@agent-deck/backend 1.4.4 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,468 +0,0 @@
1
- var DR=Object.defineProperty;var Gx=e=>{throw TypeError(e)};var LR=(e,t,n)=>t in e?DR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lo=(e,t,n)=>LR(e,typeof t!="symbol"?t+"":t,n),Kh=(e,t,n)=>t.has(e)||Gx("Cannot "+n);var z=(e,t,n)=>(Kh(e,t,"read from private field"),n?n.call(e):t.get(e)),ke=(e,t,n)=>t.has(e)?Gx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),he=(e,t,n,r)=>(Kh(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Me=(e,t,n)=>(Kh(e,t,"access private method"),n);var pu=(e,t,n,r)=>({set _(o){he(e,t,o,n)},get _(){return z(e,t,r)}});function zR(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var Od=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var f_={exports:{}},Vf={},h_={exports:{}},Ve={};/**
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 qc=Symbol.for("react.element"),FR=Symbol.for("react.portal"),UR=Symbol.for("react.fragment"),qR=Symbol.for("react.strict_mode"),VR=Symbol.for("react.profiler"),HR=Symbol.for("react.provider"),BR=Symbol.for("react.context"),WR=Symbol.for("react.forward_ref"),KR=Symbol.for("react.suspense"),ZR=Symbol.for("react.memo"),QR=Symbol.for("react.lazy"),Jx=Symbol.iterator;function GR(e){return e===null||typeof e!="object"?null:(e=Jx&&e[Jx]||e["@@iterator"],typeof e=="function"?e:null)}var p_={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m_=Object.assign,g_={};function el(e,t,n){this.props=e,this.context=t,this.refs=g_,this.updater=n||p_}el.prototype.isReactComponent={};el.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")};el.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function y_(){}y_.prototype=el.prototype;function Ry(e,t,n){this.props=e,this.context=t,this.refs=g_,this.updater=n||p_}var $y=Ry.prototype=new y_;$y.constructor=Ry;m_($y,el.prototype);$y.isPureReactComponent=!0;var Yx=Array.isArray,v_=Object.prototype.hasOwnProperty,Iy={current:null},x_={key:!0,ref:!0,__self:!0,__source:!0};function w_(e,t,n){var r,o={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)v_.call(t,r)&&!x_.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),u=0;u<a;u++)l[u]=arguments[u+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:qc,type:e,key:s,ref:i,props:o,_owner:Iy.current}}function JR(e,t){return{$$typeof:qc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ay(e){return typeof e=="object"&&e!==null&&e.$$typeof===qc}function YR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Xx=/\/+/g;function Zh(e,t){return typeof e=="object"&&e!==null&&e.key!=null?YR(""+e.key):t.toString(36)}function od(e,t,n,r,o){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case qc:case FR:i=!0}}if(i)return i=e,o=o(i),e=r===""?"."+Zh(i,0):r,Yx(o)?(n="",e!=null&&(n=e.replace(Xx,"$&/")+"/"),od(o,t,n,"",function(u){return u})):o!=null&&(Ay(o)&&(o=JR(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(Xx,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=r===""?".":r+":",Yx(e))for(var a=0;a<e.length;a++){s=e[a];var l=r+Zh(s,a);i+=od(s,t,n,l,o)}else if(l=GR(e),typeof l=="function")for(e=l.call(e),a=0;!(s=e.next()).done;)s=s.value,l=r+Zh(s,a++),i+=od(s,t,n,l,o);else if(s==="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 mu(e,t,n){if(e==null)return e;var r=[],o=0;return od(e,r,"","",function(s){return t.call(n,s,o++)}),r}function XR(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var kn={current:null},sd={transition:null},e$={ReactCurrentDispatcher:kn,ReactCurrentBatchConfig:sd,ReactCurrentOwner:Iy};function b_(){throw Error("act(...) is not supported in production builds of React.")}Ve.Children={map:mu,forEach:function(e,t,n){mu(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return mu(e,function(){t++}),t},toArray:function(e){return mu(e,function(t){return t})||[]},only:function(e){if(!Ay(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ve.Component=el;Ve.Fragment=UR;Ve.Profiler=VR;Ve.PureComponent=Ry;Ve.StrictMode=qR;Ve.Suspense=KR;Ve.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=e$;Ve.act=b_;Ve.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=m_({},e.props),o=e.key,s=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,i=Iy.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)v_.call(t,l)&&!x_.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:qc,type:e.type,key:o,ref:s,props:r,_owner:i}};Ve.createContext=function(e){return e={$$typeof:BR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:HR,_context:e},e.Consumer=e};Ve.createElement=w_;Ve.createFactory=function(e){var t=w_.bind(null,e);return t.type=e,t};Ve.createRef=function(){return{current:null}};Ve.forwardRef=function(e){return{$$typeof:WR,render:e}};Ve.isValidElement=Ay;Ve.lazy=function(e){return{$$typeof:QR,_payload:{_status:-1,_result:e},_init:XR}};Ve.memo=function(e,t){return{$$typeof:ZR,type:e,compare:t===void 0?null:t}};Ve.startTransition=function(e){var t=sd.transition;sd.transition={};try{e()}finally{sd.transition=t}};Ve.unstable_act=b_;Ve.useCallback=function(e,t){return kn.current.useCallback(e,t)};Ve.useContext=function(e){return kn.current.useContext(e)};Ve.useDebugValue=function(){};Ve.useDeferredValue=function(e){return kn.current.useDeferredValue(e)};Ve.useEffect=function(e,t){return kn.current.useEffect(e,t)};Ve.useId=function(){return kn.current.useId()};Ve.useImperativeHandle=function(e,t,n){return kn.current.useImperativeHandle(e,t,n)};Ve.useInsertionEffect=function(e,t){return kn.current.useInsertionEffect(e,t)};Ve.useLayoutEffect=function(e,t){return kn.current.useLayoutEffect(e,t)};Ve.useMemo=function(e,t){return kn.current.useMemo(e,t)};Ve.useReducer=function(e,t,n){return kn.current.useReducer(e,t,n)};Ve.useRef=function(e){return kn.current.useRef(e)};Ve.useState=function(e){return kn.current.useState(e)};Ve.useSyncExternalStore=function(e,t,n){return kn.current.useSyncExternalStore(e,t,n)};Ve.useTransition=function(){return kn.current.useTransition()};Ve.version="18.3.1";h_.exports=Ve;var b=h_.exports;const Vr=Xa(b),Oy=zR({__proto__:null,default:Vr},[b]);/**
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$=b,n$=Symbol.for("react.element"),r$=Symbol.for("react.fragment"),o$=Object.prototype.hasOwnProperty,s$=t$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i$={key:!0,ref:!0,__self:!0,__source:!0};function k_(e,t,n){var r,o={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)o$.call(t,r)&&!i$.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:n$,type:e,key:s,ref:i,props:o,_owner:s$.current}}Vf.Fragment=r$;Vf.jsx=k_;Vf.jsxs=k_;f_.exports=Vf;var c=f_.exports,__={exports:{}},Gn={},S_={exports:{}},C_={};/**
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(H,W){var N=H.length;H.push(W);e:for(;0<N;){var M=N-1>>>1,V=H[M];if(0<o(V,W))H[M]=W,H[N]=V,N=M;else break e}}function n(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var W=H[0],N=H.pop();if(N!==W){H[0]=N;e:for(var M=0,V=H.length,_=V>>>1;M<_;){var E=2*(M+1)-1,R=H[E],D=E+1,K=H[D];if(0>o(R,N))D<V&&0>o(K,R)?(H[M]=K,H[D]=N,M=D):(H[M]=R,H[E]=N,M=E);else if(D<V&&0>o(K,N))H[M]=K,H[D]=N,M=D;else break e}}return W}function o(H,W){var N=H.sortIndex-W.sortIndex;return N!==0?N:H.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,a=i.now();e.unstable_now=function(){return i.now()-a}}var l=[],u=[],d=1,f=null,p=3,h=!1,y=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(H){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=H)r(u),W.sortIndex=W.expirationTime,t(l,W);else break;W=n(u)}}function k(H){if(m=!1,w(H),!y)if(n(l)!==null)y=!0,J(C);else{var W=n(u);W!==null&&Q(k,W.startTime-H)}}function C(H,W){y=!1,m&&(m=!1,g(A),A=-1),h=!0;var N=p;try{for(w(W),f=n(l);f!==null&&(!(f.expirationTime>W)||H&&!T());){var M=f.callback;if(typeof M=="function"){f.callback=null,p=f.priorityLevel;var V=M(f.expirationTime<=W);W=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(l)&&r(l),w(W)}else r(l);f=n(l)}if(f!==null)var _=!0;else{var E=n(u);E!==null&&Q(k,E.startTime-W),_=!1}return _}finally{f=null,p=N,h=!1}}var j=!1,S=null,A=-1,P=5,$=-1;function T(){return!(e.unstable_now()-$<P)}function I(){if(S!==null){var H=e.unstable_now();$=H;var W=!0;try{W=S(!0,H)}finally{W?U():(j=!1,S=null)}}else j=!1}var U;if(typeof v=="function")U=function(){v(I)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,B=O.port2;O.port1.onmessage=I,U=function(){B.postMessage(null)}}else U=function(){x(I,0)};function J(H){S=H,j||(j=!0,U())}function Q(H,W){A=x(function(){H(e.unstable_now())},W)}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(H){H.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,J(C))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(H){switch(p){case 1:case 2:case 3:var W=3;break;default:W=p}var N=p;p=W;try{return H()}finally{p=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,W){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var N=p;p=H;try{return W()}finally{p=N}},e.unstable_scheduleCallback=function(H,W,N){var M=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?M+N:M):N=M,H){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=N+V,H={id:d++,callback:W,priorityLevel:H,startTime:N,expirationTime:V,sortIndex:-1},N>M?(H.sortIndex=N,t(u,H),n(l)===null&&H===n(u)&&(m?(g(A),A=-1):m=!0,Q(k,N-M))):(H.sortIndex=V,t(l,H),y||h||(y=!0,J(C))),H},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(H){var W=p;return function(){var N=p;p=W;try{return H.apply(this,arguments)}finally{p=N}}}})(C_);S_.exports=C_;var a$=S_.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$=b,Qn=a$;function se(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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 E_=new Set,dc={};function Ti(e,t){Da(e,t),Da(e+"Capture",t)}function Da(e,t){for(dc[e]=t,e=0;e<t.length;e++)E_.add(t[e])}var jo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pm=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]*$/,ew={},tw={};function u$(e){return pm.call(tw,e)?!0:pm.call(ew,e)?!1:c$.test(e)?tw[e]=!0:(ew[e]=!0,!1)}function d$(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function f$(e,t,n,r){if(t===null||typeof t>"u"||d$(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 _n(e,t,n,r,o,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var en={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){en[e]=new _n(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];en[t]=new _n(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){en[e]=new _n(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){en[e]=new _n(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){en[e]=new _n(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){en[e]=new _n(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){en[e]=new _n(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){en[e]=new _n(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){en[e]=new _n(e,5,!1,e.toLowerCase(),null,!1,!1)});var My=/[\-:]([a-z])/g;function Dy(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(My,Dy);en[t]=new _n(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(My,Dy);en[t]=new _n(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(My,Dy);en[t]=new _n(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){en[e]=new _n(e,1,!1,e.toLowerCase(),null,!1,!1)});en.xlinkHref=new _n("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){en[e]=new _n(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ly(e,t,n,r){var o=en.hasOwnProperty(t)?en[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(f$(t,n,o,r)&&(n=null),r||o===null?u$(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Oo=l$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,gu=Symbol.for("react.element"),Gi=Symbol.for("react.portal"),Ji=Symbol.for("react.fragment"),zy=Symbol.for("react.strict_mode"),mm=Symbol.for("react.profiler"),N_=Symbol.for("react.provider"),j_=Symbol.for("react.context"),Fy=Symbol.for("react.forward_ref"),gm=Symbol.for("react.suspense"),ym=Symbol.for("react.suspense_list"),Uy=Symbol.for("react.memo"),Zo=Symbol.for("react.lazy"),P_=Symbol.for("react.offscreen"),nw=Symbol.iterator;function gl(e){return e===null||typeof e!="object"?null:(e=nw&&e[nw]||e["@@iterator"],typeof e=="function"?e:null)}var St=Object.assign,Qh;function Il(e){if(Qh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Qh=t&&t[1]||""}return`
34
- `+Qh+e}var Gh=!1;function Jh(e,t){if(!e||Gh)return"";Gh=!0;var n=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 r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.stack.split(`
35
- `),s=r.stack.split(`
36
- `),i=o.length-1,a=s.length-1;1<=i&&0<=a&&o[i]!==s[a];)a--;for(;1<=i&&0<=a;i--,a--)if(o[i]!==s[a]){if(i!==1||a!==1)do if(i--,a--,0>a||o[i]!==s[a]){var l=`
37
- `+o[i].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=i&&0<=a);break}}}finally{Gh=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Il(e):""}function h$(e){switch(e.tag){case 5:return Il(e.type);case 16:return Il("Lazy");case 13:return Il("Suspense");case 19:return Il("SuspenseList");case 0:case 2:case 15:return e=Jh(e.type,!1),e;case 11:return e=Jh(e.type.render,!1),e;case 1:return e=Jh(e.type,!0),e;default:return""}}function vm(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 Ji:return"Fragment";case Gi:return"Portal";case mm:return"Profiler";case zy:return"StrictMode";case gm:return"Suspense";case ym:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case j_:return(e.displayName||"Context")+".Consumer";case N_:return(e._context.displayName||"Context")+".Provider";case Fy:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Uy:return t=e.displayName||null,t!==null?t:vm(e.type)||"Memo";case Zo:t=e._payload,e=e._init;try{return vm(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 vm(t);case 8:return t===zy?"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 Ss(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function T_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function m$(e){var t=T_(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yu(e){e._valueTracker||(e._valueTracker=m$(e))}function R_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=T_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Md(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 xm(e,t){var n=t.checked;return St({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function rw(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ss(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $_(e,t){t=t.checked,t!=null&&Ly(e,"checked",t,!1)}function wm(e,t){$_(e,t);var n=Ss(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?bm(e,t.type,n):t.hasOwnProperty("defaultValue")&&bm(e,t.type,Ss(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ow(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function bm(e,t,n){(t!=="number"||Md(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Al=Array.isArray;function da(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ss(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function km(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(se(91));return St({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function sw(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(se(92));if(Al(n)){if(1<n.length)throw Error(se(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ss(n)}}function I_(e,t){var n=Ss(t.value),r=Ss(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function iw(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function A_(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 _m(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?A_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var vu,O_=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(vu=vu||document.createElement("div"),vu.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=vu.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function fc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Hl={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(Hl).forEach(function(e){g$.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hl[t]=Hl[e]})});function M_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hl.hasOwnProperty(e)&&Hl[e]?(""+t).trim():t+"px"}function D_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=M_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var y$=St({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 Sm(e,t){if(t){if(y$[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(se(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(se(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(se(61))}if(t.style!=null&&typeof t.style!="object")throw Error(se(62))}}function Cm(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 Em=null;function qy(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Nm=null,fa=null,ha=null;function aw(e){if(e=Bc(e)){if(typeof Nm!="function")throw Error(se(280));var t=e.stateNode;t&&(t=Zf(t),Nm(e.stateNode,e.type,t))}}function L_(e){fa?ha?ha.push(e):ha=[e]:fa=e}function z_(){if(fa){var e=fa,t=ha;if(ha=fa=null,aw(e),t)for(e=0;e<t.length;e++)aw(t[e])}}function F_(e,t){return e(t)}function U_(){}var Yh=!1;function q_(e,t,n){if(Yh)return e(t,n);Yh=!0;try{return F_(e,t,n)}finally{Yh=!1,(fa!==null||ha!==null)&&(U_(),z_())}}function hc(e,t){var n=e.stateNode;if(n===null)return null;var r=Zf(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(se(231,t,typeof n));return n}var jm=!1;if(jo)try{var yl={};Object.defineProperty(yl,"passive",{get:function(){jm=!0}}),window.addEventListener("test",yl,yl),window.removeEventListener("test",yl,yl)}catch{jm=!1}function v$(e,t,n,r,o,s,i,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Bl=!1,Dd=null,Ld=!1,Pm=null,x$={onError:function(e){Bl=!0,Dd=e}};function w$(e,t,n,r,o,s,i,a,l){Bl=!1,Dd=null,v$.apply(x$,arguments)}function b$(e,t,n,r,o,s,i,a,l){if(w$.apply(this,arguments),Bl){if(Bl){var u=Dd;Bl=!1,Dd=null}else throw Error(se(198));Ld||(Ld=!0,Pm=u)}}function Ri(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function V_(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 lw(e){if(Ri(e)!==e)throw Error(se(188))}function k$(e){var t=e.alternate;if(!t){if(t=Ri(e),t===null)throw Error(se(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var s=o.alternate;if(s===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return lw(o),e;if(s===r)return lw(o),t;s=s.sibling}throw Error(se(188))}if(n.return!==r.return)n=o,r=s;else{for(var i=!1,a=o.child;a;){if(a===n){i=!0,n=o,r=s;break}if(a===r){i=!0,r=o,n=s;break}a=a.sibling}if(!i){for(a=s.child;a;){if(a===n){i=!0,n=s,r=o;break}if(a===r){i=!0,r=s,n=o;break}a=a.sibling}if(!i)throw Error(se(189))}}if(n.alternate!==r)throw Error(se(190))}if(n.tag!==3)throw Error(se(188));return n.stateNode.current===n?e:t}function H_(e){return e=k$(e),e!==null?B_(e):null}function B_(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=B_(e);if(t!==null)return t;e=e.sibling}return null}var W_=Qn.unstable_scheduleCallback,cw=Qn.unstable_cancelCallback,_$=Qn.unstable_shouldYield,S$=Qn.unstable_requestPaint,Tt=Qn.unstable_now,C$=Qn.unstable_getCurrentPriorityLevel,Vy=Qn.unstable_ImmediatePriority,K_=Qn.unstable_UserBlockingPriority,zd=Qn.unstable_NormalPriority,E$=Qn.unstable_LowPriority,Z_=Qn.unstable_IdlePriority,Hf=null,Xr=null;function N$(e){if(Xr&&typeof Xr.onCommitFiberRoot=="function")try{Xr.onCommitFiberRoot(Hf,e,void 0,(e.current.flags&128)===128)}catch{}}var Rr=Math.clz32?Math.clz32:T$,j$=Math.log,P$=Math.LN2;function T$(e){return e>>>=0,e===0?32:31-(j$(e)/P$|0)|0}var xu=64,wu=4194304;function Ol(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 Fd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var a=i&~o;a!==0?r=Ol(a):(s&=i,s!==0&&(r=Ol(s)))}else i=n&~o,i!==0?r=Ol(i):s!==0&&(r=Ol(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Rr(t),o=1<<n,r|=e[n],t&=~o;return r}function R$(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 $$(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-Rr(s),a=1<<i,l=o[i];l===-1?(!(a&n)||a&r)&&(o[i]=R$(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function Tm(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Q_(){var e=xu;return xu<<=1,!(xu&4194240)&&(xu=64),e}function Xh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Rr(t),e[t]=n}function I$(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Rr(n),s=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~s}}function Hy(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Rr(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var et=0;function G_(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var J_,By,Y_,X_,eS,Rm=!1,bu=[],ps=null,ms=null,gs=null,pc=new Map,mc=new Map,Xo=[],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 uw(e,t){switch(e){case"focusin":case"focusout":ps=null;break;case"dragenter":case"dragleave":ms=null;break;case"mouseover":case"mouseout":gs=null;break;case"pointerover":case"pointerout":pc.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":mc.delete(t.pointerId)}}function vl(e,t,n,r,o,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[o]},t!==null&&(t=Bc(t),t!==null&&By(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function O$(e,t,n,r,o){switch(t){case"focusin":return ps=vl(ps,e,t,n,r,o),!0;case"dragenter":return ms=vl(ms,e,t,n,r,o),!0;case"mouseover":return gs=vl(gs,e,t,n,r,o),!0;case"pointerover":var s=o.pointerId;return pc.set(s,vl(pc.get(s)||null,e,t,n,r,o)),!0;case"gotpointercapture":return s=o.pointerId,mc.set(s,vl(mc.get(s)||null,e,t,n,r,o)),!0}return!1}function tS(e){var t=Xs(e.target);if(t!==null){var n=Ri(t);if(n!==null){if(t=n.tag,t===13){if(t=V_(n),t!==null){e.blockedOn=t,eS(e.priority,function(){Y_(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function id(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=$m(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Em=r,n.target.dispatchEvent(r),Em=null}else return t=Bc(n),t!==null&&By(t),e.blockedOn=n,!1;t.shift()}return!0}function dw(e,t,n){id(e)&&n.delete(t)}function M$(){Rm=!1,ps!==null&&id(ps)&&(ps=null),ms!==null&&id(ms)&&(ms=null),gs!==null&&id(gs)&&(gs=null),pc.forEach(dw),mc.forEach(dw)}function xl(e,t){e.blockedOn===t&&(e.blockedOn=null,Rm||(Rm=!0,Qn.unstable_scheduleCallback(Qn.unstable_NormalPriority,M$)))}function gc(e){function t(o){return xl(o,e)}if(0<bu.length){xl(bu[0],e);for(var n=1;n<bu.length;n++){var r=bu[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ps!==null&&xl(ps,e),ms!==null&&xl(ms,e),gs!==null&&xl(gs,e),pc.forEach(t),mc.forEach(t),n=0;n<Xo.length;n++)r=Xo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Xo.length&&(n=Xo[0],n.blockedOn===null);)tS(n),n.blockedOn===null&&Xo.shift()}var pa=Oo.ReactCurrentBatchConfig,Ud=!0;function D$(e,t,n,r){var o=et,s=pa.transition;pa.transition=null;try{et=1,Wy(e,t,n,r)}finally{et=o,pa.transition=s}}function L$(e,t,n,r){var o=et,s=pa.transition;pa.transition=null;try{et=4,Wy(e,t,n,r)}finally{et=o,pa.transition=s}}function Wy(e,t,n,r){if(Ud){var o=$m(e,t,n,r);if(o===null)cp(e,t,r,qd,n),uw(e,r);else if(O$(o,e,t,n,r))r.stopPropagation();else if(uw(e,r),t&4&&-1<A$.indexOf(e)){for(;o!==null;){var s=Bc(o);if(s!==null&&J_(s),s=$m(e,t,n,r),s===null&&cp(e,t,r,qd,n),s===o)break;o=s}o!==null&&r.stopPropagation()}else cp(e,t,r,null,n)}}var qd=null;function $m(e,t,n,r){if(qd=null,e=qy(r),e=Xs(e),e!==null)if(t=Ri(e),t===null)e=null;else if(n=t.tag,n===13){if(e=V_(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return qd=e,null}function nS(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 Vy:return 1;case K_:return 4;case zd:case E$:return 16;case Z_:return 536870912;default:return 16}default:return 16}}var ds=null,Ky=null,ad=null;function rS(){if(ad)return ad;var e,t=Ky,n=t.length,r,o="value"in ds?ds.value:ds.textContent,s=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[s-r];r++);return ad=o.slice(e,1<r?1-r:void 0)}function ld(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 ku(){return!0}function fw(){return!1}function Jn(e){function t(n,r,o,s,i){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?ku:fw,this.isPropagationStopped=fw,this}return St(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ku)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ku)},persist:function(){},isPersistent:ku}),t}var tl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zy=Jn(tl),Hc=St({},tl,{view:0,detail:0}),z$=Jn(Hc),ep,tp,wl,Bf=St({},Hc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qy,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!==wl&&(wl&&e.type==="mousemove"?(ep=e.screenX-wl.screenX,tp=e.screenY-wl.screenY):tp=ep=0,wl=e),ep)},movementY:function(e){return"movementY"in e?e.movementY:tp}}),hw=Jn(Bf),F$=St({},Bf,{dataTransfer:0}),U$=Jn(F$),q$=St({},Hc,{relatedTarget:0}),np=Jn(q$),V$=St({},tl,{animationName:0,elapsedTime:0,pseudoElement:0}),H$=Jn(V$),B$=St({},tl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),W$=Jn(B$),K$=St({},tl,{data:0}),pw=Jn(K$),Z$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q$={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"},G$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function J$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=G$[e])?!!t[e]:!1}function Qy(){return J$}var Y$=St({},Hc,{key:function(e){if(e.key){var t=Z$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ld(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Q$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qy,charCode:function(e){return e.type==="keypress"?ld(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ld(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),X$=Jn(Y$),eI=St({},Bf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mw=Jn(eI),tI=St({},Hc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qy}),nI=Jn(tI),rI=St({},tl,{propertyName:0,elapsedTime:0,pseudoElement:0}),oI=Jn(rI),sI=St({},Bf,{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}),iI=Jn(sI),aI=[9,13,27,32],Gy=jo&&"CompositionEvent"in window,Wl=null;jo&&"documentMode"in document&&(Wl=document.documentMode);var lI=jo&&"TextEvent"in window&&!Wl,oS=jo&&(!Gy||Wl&&8<Wl&&11>=Wl),gw=" ",yw=!1;function sS(e,t){switch(e){case"keyup":return aI.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iS(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Yi=!1;function cI(e,t){switch(e){case"compositionend":return iS(t);case"keypress":return t.which!==32?null:(yw=!0,gw);case"textInput":return e=t.data,e===gw&&yw?null:e;default:return null}}function uI(e,t){if(Yi)return e==="compositionend"||!Gy&&sS(e,t)?(e=rS(),ad=Ky=ds=null,Yi=!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 oS&&t.locale!=="ko"?null:t.data;default:return null}}var dI={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 vw(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dI[e.type]:t==="textarea"}function aS(e,t,n,r){L_(r),t=Vd(t,"onChange"),0<t.length&&(n=new Zy("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Kl=null,yc=null;function fI(e){vS(e,0)}function Wf(e){var t=ta(e);if(R_(t))return e}function hI(e,t){if(e==="change")return t}var lS=!1;if(jo){var rp;if(jo){var op="oninput"in document;if(!op){var xw=document.createElement("div");xw.setAttribute("oninput","return;"),op=typeof xw.oninput=="function"}rp=op}else rp=!1;lS=rp&&(!document.documentMode||9<document.documentMode)}function ww(){Kl&&(Kl.detachEvent("onpropertychange",cS),yc=Kl=null)}function cS(e){if(e.propertyName==="value"&&Wf(yc)){var t=[];aS(t,yc,e,qy(e)),q_(fI,t)}}function pI(e,t,n){e==="focusin"?(ww(),Kl=t,yc=n,Kl.attachEvent("onpropertychange",cS)):e==="focusout"&&ww()}function mI(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Wf(yc)}function gI(e,t){if(e==="click")return Wf(t)}function yI(e,t){if(e==="input"||e==="change")return Wf(t)}function vI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ar=typeof Object.is=="function"?Object.is:vI;function vc(e,t){if(Ar(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!pm.call(t,o)||!Ar(e[o],t[o]))return!1}return!0}function bw(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kw(e,t){var n=bw(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=bw(n)}}function uS(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uS(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dS(){for(var e=window,t=Md();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Md(e.document)}return t}function Jy(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 xI(e){var t=dS(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&uS(n.ownerDocument.documentElement,n)){if(r!==null&&Jy(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=kw(n,s);var i=kw(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var wI=jo&&"documentMode"in document&&11>=document.documentMode,Xi=null,Im=null,Zl=null,Am=!1;function _w(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Am||Xi==null||Xi!==Md(r)||(r=Xi,"selectionStart"in r&&Jy(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Zl&&vc(Zl,r)||(Zl=r,r=Vd(Im,"onSelect"),0<r.length&&(t=new Zy("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Xi)))}function _u(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ea={animationend:_u("Animation","AnimationEnd"),animationiteration:_u("Animation","AnimationIteration"),animationstart:_u("Animation","AnimationStart"),transitionend:_u("Transition","TransitionEnd")},sp={},fS={};jo&&(fS=document.createElement("div").style,"AnimationEvent"in window||(delete ea.animationend.animation,delete ea.animationiteration.animation,delete ea.animationstart.animation),"TransitionEvent"in window||delete ea.transitionend.transition);function Kf(e){if(sp[e])return sp[e];if(!ea[e])return e;var t=ea[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in fS)return sp[e]=t[n];return e}var hS=Kf("animationend"),pS=Kf("animationiteration"),mS=Kf("animationstart"),gS=Kf("transitionend"),yS=new Map,Sw="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 Rs(e,t){yS.set(e,t),Ti(t,[e])}for(var ip=0;ip<Sw.length;ip++){var ap=Sw[ip],bI=ap.toLowerCase(),kI=ap[0].toUpperCase()+ap.slice(1);Rs(bI,"on"+kI)}Rs(hS,"onAnimationEnd");Rs(pS,"onAnimationIteration");Rs(mS,"onAnimationStart");Rs("dblclick","onDoubleClick");Rs("focusin","onFocus");Rs("focusout","onBlur");Rs(gS,"onTransitionEnd");Da("onMouseEnter",["mouseout","mouseover"]);Da("onMouseLeave",["mouseout","mouseover"]);Da("onPointerEnter",["pointerout","pointerover"]);Da("onPointerLeave",["pointerout","pointerover"]);Ti("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ti("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ti("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ti("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ti("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ti("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ml="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(" "),_I=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ml));function Cw(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,b$(r,t,void 0,e),e.currentTarget=null}function vS(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var i=r.length-1;0<=i;i--){var a=r[i],l=a.instance,u=a.currentTarget;if(a=a.listener,l!==s&&o.isPropagationStopped())break e;Cw(o,a,u),s=l}else for(i=0;i<r.length;i++){if(a=r[i],l=a.instance,u=a.currentTarget,a=a.listener,l!==s&&o.isPropagationStopped())break e;Cw(o,a,u),s=l}}}if(Ld)throw e=Pm,Ld=!1,Pm=null,e}function lt(e,t){var n=t[zm];n===void 0&&(n=t[zm]=new Set);var r=e+"__bubble";n.has(r)||(xS(t,e,2,!1),n.add(r))}function lp(e,t,n){var r=0;t&&(r|=4),xS(n,e,r,t)}var Su="_reactListening"+Math.random().toString(36).slice(2);function xc(e){if(!e[Su]){e[Su]=!0,E_.forEach(function(n){n!=="selectionchange"&&(_I.has(n)||lp(n,!1,e),lp(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Su]||(t[Su]=!0,lp("selectionchange",!1,t))}}function xS(e,t,n,r){switch(nS(t)){case 1:var o=D$;break;case 4:o=L$;break;default:o=Wy}n=o.bind(null,t,n,e),o=void 0,!jm||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function cp(e,t,n,r,o){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var l=i.tag;if((l===3||l===4)&&(l=i.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;i=i.return}for(;a!==null;){if(i=Xs(a),i===null)return;if(l=i.tag,l===5||l===6){r=s=i;continue e}a=a.parentNode}}r=r.return}q_(function(){var u=s,d=qy(n),f=[];e:{var p=yS.get(e);if(p!==void 0){var h=Zy,y=e;switch(e){case"keypress":if(ld(n)===0)break e;case"keydown":case"keyup":h=X$;break;case"focusin":y="focus",h=np;break;case"focusout":y="blur",h=np;break;case"beforeblur":case"afterblur":h=np;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=hw;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=U$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=nI;break;case hS:case pS:case mS:h=H$;break;case gS:h=oI;break;case"scroll":h=z$;break;case"wheel":h=iI;break;case"copy":case"cut":case"paste":h=W$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=mw}var m=(t&4)!==0,x=!m&&e==="scroll",g=m?p!==null?p+"Capture":null:p;m=[];for(var v=u,w;v!==null;){w=v;var k=w.stateNode;if(w.tag===5&&k!==null&&(w=k,g!==null&&(k=hc(v,g),k!=null&&m.push(wc(v,k,w)))),x)break;v=v.return}0<m.length&&(p=new h(p,y,null,n,d),f.push({event:p,listeners:m}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==Em&&(y=n.relatedTarget||n.fromElement)&&(Xs(y)||y[Po]))break e;if((h||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=u,y=y?Xs(y):null,y!==null&&(x=Ri(y),y!==x||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(m=hw,k="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=mw,k="onPointerLeave",g="onPointerEnter",v="pointer"),x=h==null?p:ta(h),w=y==null?p:ta(y),p=new m(k,v+"leave",h,n,d),p.target=x,p.relatedTarget=w,k=null,Xs(d)===u&&(m=new m(g,v+"enter",y,n,d),m.target=w,m.relatedTarget=x,k=m),x=k,h&&y)t:{for(m=h,g=y,v=0,w=m;w;w=Mi(w))v++;for(w=0,k=g;k;k=Mi(k))w++;for(;0<v-w;)m=Mi(m),v--;for(;0<w-v;)g=Mi(g),w--;for(;v--;){if(m===g||g!==null&&m===g.alternate)break t;m=Mi(m),g=Mi(g)}m=null}else m=null;h!==null&&Ew(f,p,h,m,!1),y!==null&&x!==null&&Ew(f,x,y,m,!0)}}e:{if(p=u?ta(u):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var C=hI;else if(vw(p))if(lS)C=yI;else{C=mI;var j=pI}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(C=gI);if(C&&(C=C(e,u))){aS(f,C,n,d);break e}j&&j(e,p,u),e==="focusout"&&(j=p._wrapperState)&&j.controlled&&p.type==="number"&&bm(p,"number",p.value)}switch(j=u?ta(u):window,e){case"focusin":(vw(j)||j.contentEditable==="true")&&(Xi=j,Im=u,Zl=null);break;case"focusout":Zl=Im=Xi=null;break;case"mousedown":Am=!0;break;case"contextmenu":case"mouseup":case"dragend":Am=!1,_w(f,n,d);break;case"selectionchange":if(wI)break;case"keydown":case"keyup":_w(f,n,d)}var S;if(Gy)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Yi?sS(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(oS&&n.locale!=="ko"&&(Yi||A!=="onCompositionStart"?A==="onCompositionEnd"&&Yi&&(S=rS()):(ds=d,Ky="value"in ds?ds.value:ds.textContent,Yi=!0)),j=Vd(u,A),0<j.length&&(A=new pw(A,e,null,n,d),f.push({event:A,listeners:j}),S?A.data=S:(S=iS(n),S!==null&&(A.data=S)))),(S=lI?cI(e,n):uI(e,n))&&(u=Vd(u,"onBeforeInput"),0<u.length&&(d=new pw("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=S))}vS(f,t)})}function wc(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Vd(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,s=o.stateNode;o.tag===5&&s!==null&&(o=s,s=hc(e,n),s!=null&&r.unshift(wc(e,s,o)),s=hc(e,t),s!=null&&r.push(wc(e,s,o))),e=e.return}return r}function Mi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Ew(e,t,n,r,o){for(var s=t._reactName,i=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,o?(l=hc(n,s),l!=null&&i.unshift(wc(n,l,a))):o||(l=hc(n,s),l!=null&&i.push(wc(n,l,a)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var SI=/\r\n?/g,CI=/\u0000|\uFFFD/g;function Nw(e){return(typeof e=="string"?e:""+e).replace(SI,`
38
- `).replace(CI,"")}function Cu(e,t,n){if(t=Nw(t),Nw(e)!==t&&n)throw Error(se(425))}function Hd(){}var Om=null,Mm=null;function Dm(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 Lm=typeof setTimeout=="function"?setTimeout:void 0,EI=typeof clearTimeout=="function"?clearTimeout:void 0,jw=typeof Promise=="function"?Promise:void 0,NI=typeof queueMicrotask=="function"?queueMicrotask:typeof jw<"u"?function(e){return jw.resolve(null).then(e).catch(jI)}:Lm;function jI(e){setTimeout(function(){throw e})}function up(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),gc(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);gc(t)}function ys(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 Pw(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var nl=Math.random().toString(36).slice(2),Kr="__reactFiber$"+nl,bc="__reactProps$"+nl,Po="__reactContainer$"+nl,zm="__reactEvents$"+nl,PI="__reactListeners$"+nl,TI="__reactHandles$"+nl;function Xs(e){var t=e[Kr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Po]||n[Kr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Pw(e);e!==null;){if(n=e[Kr])return n;e=Pw(e)}return t}e=n,n=e.parentNode}return null}function Bc(e){return e=e[Kr]||e[Po],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ta(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(se(33))}function Zf(e){return e[bc]||null}var Fm=[],na=-1;function $s(e){return{current:e}}function dt(e){0>na||(e.current=Fm[na],Fm[na]=null,na--)}function st(e,t){na++,Fm[na]=e.current,e.current=t}var Cs={},fn=$s(Cs),An=$s(!1),mi=Cs;function La(e,t){var n=e.type.contextTypes;if(!n)return Cs;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function On(e){return e=e.childContextTypes,e!=null}function Bd(){dt(An),dt(fn)}function Tw(e,t,n){if(fn.current!==Cs)throw Error(se(168));st(fn,t),st(An,n)}function wS(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(se(108,p$(e)||"Unknown",o));return St({},n,r)}function Wd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cs,mi=fn.current,st(fn,e),st(An,An.current),!0}function Rw(e,t,n){var r=e.stateNode;if(!r)throw Error(se(169));n?(e=wS(e,t,mi),r.__reactInternalMemoizedMergedChildContext=e,dt(An),dt(fn),st(fn,e)):dt(An),st(An,n)}var go=null,Qf=!1,dp=!1;function bS(e){go===null?go=[e]:go.push(e)}function RI(e){Qf=!0,bS(e)}function Is(){if(!dp&&go!==null){dp=!0;var e=0,t=et;try{var n=go;for(et=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}go=null,Qf=!1}catch(o){throw go!==null&&(go=go.slice(e+1)),W_(Vy,Is),o}finally{et=t,dp=!1}}return null}var ra=[],oa=0,Kd=null,Zd=0,sr=[],ir=0,gi=null,bo=1,ko="";function Vs(e,t){ra[oa++]=Zd,ra[oa++]=Kd,Kd=e,Zd=t}function kS(e,t,n){sr[ir++]=bo,sr[ir++]=ko,sr[ir++]=gi,gi=e;var r=bo;e=ko;var o=32-Rr(r)-1;r&=~(1<<o),n+=1;var s=32-Rr(t)+o;if(30<s){var i=o-o%5;s=(r&(1<<i)-1).toString(32),r>>=i,o-=i,bo=1<<32-Rr(t)+o|n<<o|r,ko=s+e}else bo=1<<s|n<<o|r,ko=e}function Yy(e){e.return!==null&&(Vs(e,1),kS(e,1,0))}function Xy(e){for(;e===Kd;)Kd=ra[--oa],ra[oa]=null,Zd=ra[--oa],ra[oa]=null;for(;e===gi;)gi=sr[--ir],sr[ir]=null,ko=sr[--ir],sr[ir]=null,bo=sr[--ir],sr[ir]=null}var Wn=null,Bn=null,mt=!1,Nr=null;function _S(e,t){var n=lr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function $w(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Wn=e,Bn=ys(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Wn=e,Bn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=gi!==null?{id:bo,overflow:ko}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=lr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Wn=e,Bn=null,!0):!1;default:return!1}}function Um(e){return(e.mode&1)!==0&&(e.flags&128)===0}function qm(e){if(mt){var t=Bn;if(t){var n=t;if(!$w(e,t)){if(Um(e))throw Error(se(418));t=ys(n.nextSibling);var r=Wn;t&&$w(e,t)?_S(r,n):(e.flags=e.flags&-4097|2,mt=!1,Wn=e)}}else{if(Um(e))throw Error(se(418));e.flags=e.flags&-4097|2,mt=!1,Wn=e}}}function Iw(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Wn=e}function Eu(e){if(e!==Wn)return!1;if(!mt)return Iw(e),mt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Dm(e.type,e.memoizedProps)),t&&(t=Bn)){if(Um(e))throw SS(),Error(se(418));for(;t;)_S(e,t),t=ys(t.nextSibling)}if(Iw(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(se(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Bn=ys(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Bn=null}}else Bn=Wn?ys(e.stateNode.nextSibling):null;return!0}function SS(){for(var e=Bn;e;)e=ys(e.nextSibling)}function za(){Bn=Wn=null,mt=!1}function ev(e){Nr===null?Nr=[e]:Nr.push(e)}var $I=Oo.ReactCurrentBatchConfig;function bl(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(se(309));var r=n.stateNode}if(!r)throw Error(se(147,e));var o=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var a=o.refs;i===null?delete a[s]:a[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(se(284));if(!n._owner)throw Error(se(290,e))}return e}function Nu(e,t){throw e=Object.prototype.toString.call(t),Error(se(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Aw(e){var t=e._init;return t(e._payload)}function CS(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function o(g,v){return g=bs(g,v),g.index=0,g.sibling=null,g}function s(g,v,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<v?(g.flags|=2,v):w):(g.flags|=2,v)):(g.flags|=1048576,v)}function i(g){return e&&g.alternate===null&&(g.flags|=2),g}function a(g,v,w,k){return v===null||v.tag!==6?(v=vp(w,g.mode,k),v.return=g,v):(v=o(v,w),v.return=g,v)}function l(g,v,w,k){var C=w.type;return C===Ji?d(g,v,w.props.children,k,w.key):v!==null&&(v.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Zo&&Aw(C)===v.type)?(k=o(v,w.props),k.ref=bl(g,v,w),k.return=g,k):(k=md(w.type,w.key,w.props,null,g.mode,k),k.ref=bl(g,v,w),k.return=g,k)}function u(g,v,w,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=xp(w,g.mode,k),v.return=g,v):(v=o(v,w.children||[]),v.return=g,v)}function d(g,v,w,k,C){return v===null||v.tag!==7?(v=hi(w,g.mode,k,C),v.return=g,v):(v=o(v,w),v.return=g,v)}function f(g,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=vp(""+v,g.mode,w),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case gu:return w=md(v.type,v.key,v.props,null,g.mode,w),w.ref=bl(g,null,v),w.return=g,w;case Gi:return v=xp(v,g.mode,w),v.return=g,v;case Zo:var k=v._init;return f(g,k(v._payload),w)}if(Al(v)||gl(v))return v=hi(v,g.mode,w,null),v.return=g,v;Nu(g,v)}return null}function p(g,v,w,k){var C=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return C!==null?null:a(g,v,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case gu:return w.key===C?l(g,v,w,k):null;case Gi:return w.key===C?u(g,v,w,k):null;case Zo:return C=w._init,p(g,v,C(w._payload),k)}if(Al(w)||gl(w))return C!==null?null:d(g,v,w,k,null);Nu(g,w)}return null}function h(g,v,w,k,C){if(typeof k=="string"&&k!==""||typeof k=="number")return g=g.get(w)||null,a(v,g,""+k,C);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case gu:return g=g.get(k.key===null?w:k.key)||null,l(v,g,k,C);case Gi:return g=g.get(k.key===null?w:k.key)||null,u(v,g,k,C);case Zo:var j=k._init;return h(g,v,w,j(k._payload),C)}if(Al(k)||gl(k))return g=g.get(w)||null,d(v,g,k,C,null);Nu(v,k)}return null}function y(g,v,w,k){for(var C=null,j=null,S=v,A=v=0,P=null;S!==null&&A<w.length;A++){S.index>A?(P=S,S=null):P=S.sibling;var $=p(g,S,w[A],k);if($===null){S===null&&(S=P);break}e&&S&&$.alternate===null&&t(g,S),v=s($,v,A),j===null?C=$:j.sibling=$,j=$,S=P}if(A===w.length)return n(g,S),mt&&Vs(g,A),C;if(S===null){for(;A<w.length;A++)S=f(g,w[A],k),S!==null&&(v=s(S,v,A),j===null?C=S:j.sibling=S,j=S);return mt&&Vs(g,A),C}for(S=r(g,S);A<w.length;A++)P=h(S,g,A,w[A],k),P!==null&&(e&&P.alternate!==null&&S.delete(P.key===null?A:P.key),v=s(P,v,A),j===null?C=P:j.sibling=P,j=P);return e&&S.forEach(function(T){return t(g,T)}),mt&&Vs(g,A),C}function m(g,v,w,k){var C=gl(w);if(typeof C!="function")throw Error(se(150));if(w=C.call(w),w==null)throw Error(se(151));for(var j=C=null,S=v,A=v=0,P=null,$=w.next();S!==null&&!$.done;A++,$=w.next()){S.index>A?(P=S,S=null):P=S.sibling;var T=p(g,S,$.value,k);if(T===null){S===null&&(S=P);break}e&&S&&T.alternate===null&&t(g,S),v=s(T,v,A),j===null?C=T:j.sibling=T,j=T,S=P}if($.done)return n(g,S),mt&&Vs(g,A),C;if(S===null){for(;!$.done;A++,$=w.next())$=f(g,$.value,k),$!==null&&(v=s($,v,A),j===null?C=$:j.sibling=$,j=$);return mt&&Vs(g,A),C}for(S=r(g,S);!$.done;A++,$=w.next())$=h(S,g,A,$.value,k),$!==null&&(e&&$.alternate!==null&&S.delete($.key===null?A:$.key),v=s($,v,A),j===null?C=$:j.sibling=$,j=$);return e&&S.forEach(function(I){return t(g,I)}),mt&&Vs(g,A),C}function x(g,v,w,k){if(typeof w=="object"&&w!==null&&w.type===Ji&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case gu:e:{for(var C=w.key,j=v;j!==null;){if(j.key===C){if(C=w.type,C===Ji){if(j.tag===7){n(g,j.sibling),v=o(j,w.props.children),v.return=g,g=v;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Zo&&Aw(C)===j.type){n(g,j.sibling),v=o(j,w.props),v.ref=bl(g,j,w),v.return=g,g=v;break e}n(g,j);break}else t(g,j);j=j.sibling}w.type===Ji?(v=hi(w.props.children,g.mode,k,w.key),v.return=g,g=v):(k=md(w.type,w.key,w.props,null,g.mode,k),k.ref=bl(g,v,w),k.return=g,g=k)}return i(g);case Gi:e:{for(j=w.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),v=o(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=xp(w,g.mode,k),v.return=g,g=v}return i(g);case Zo:return j=w._init,x(g,v,j(w._payload),k)}if(Al(w))return y(g,v,w,k);if(gl(w))return m(g,v,w,k);Nu(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,w),v.return=g,g=v):(n(g,v),v=vp(w,g.mode,k),v.return=g,g=v),i(g)):n(g,v)}return x}var Fa=CS(!0),ES=CS(!1),Qd=$s(null),Gd=null,sa=null,tv=null;function nv(){tv=sa=Gd=null}function rv(e){var t=Qd.current;dt(Qd),e._currentValue=t}function Vm(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ma(e,t){Gd=e,tv=sa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(In=!0),e.firstContext=null)}function ur(e){var t=e._currentValue;if(tv!==e)if(e={context:e,memoizedValue:t,next:null},sa===null){if(Gd===null)throw Error(se(308));sa=e,Gd.dependencies={lanes:0,firstContext:e}}else sa=sa.next=e;return t}var ei=null;function ov(e){ei===null?ei=[e]:ei.push(e)}function NS(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,ov(t)):(n.next=o.next,o.next=n),t.interleaved=n,To(e,r)}function To(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Qo=!1;function sv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jS(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 So(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function vs(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Qe&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,To(e,n)}return o=r.interleaved,o===null?(t.next=t,ov(r)):(t.next=o.next,o.next=t),r.interleaved=t,To(e,n)}function cd(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hy(e,n)}}function Ow(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Jd(e,t,n,r){var o=e.updateQueue;Qo=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,i===null?s=u:i.next=u,i=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==i&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(s!==null){var f=o.baseState;i=0,d=u=l=null,a=s;do{var p=a.lane,h=a.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,m=a;switch(p=t,h=n,m.tag){case 1:if(y=m.payload,typeof y=="function"){f=y.call(h,f,p);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=m.payload,p=typeof y=="function"?y.call(h,f,p):y,p==null)break e;f=St({},f,p);break e;case 2:Qo=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=o.effects,p===null?o.effects=[a]:p.push(a))}else h={eventTime:h,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=h,l=f):d=d.next=h,i|=p;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;p=a,a=p.next,p.next=null,o.lastBaseUpdate=p,o.shared.pending=null}}while(!0);if(d===null&&(l=f),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);vi|=i,e.lanes=i,e.memoizedState=f}}function Mw(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(se(191,o));o.call(r)}}}var Wc={},eo=$s(Wc),kc=$s(Wc),_c=$s(Wc);function ti(e){if(e===Wc)throw Error(se(174));return e}function iv(e,t){switch(st(_c,t),st(kc,e),st(eo,Wc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:_m(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_m(t,e)}dt(eo),st(eo,t)}function Ua(){dt(eo),dt(kc),dt(_c)}function PS(e){ti(_c.current);var t=ti(eo.current),n=_m(t,e.type);t!==n&&(st(kc,e),st(eo,n))}function av(e){kc.current===e&&(dt(eo),dt(kc))}var wt=$s(0);function Yd(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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 fp=[];function lv(){for(var e=0;e<fp.length;e++)fp[e]._workInProgressVersionPrimary=null;fp.length=0}var ud=Oo.ReactCurrentDispatcher,hp=Oo.ReactCurrentBatchConfig,yi=0,kt=null,Lt=null,Ht=null,Xd=!1,Ql=!1,Sc=0,II=0;function an(){throw Error(se(321))}function cv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ar(e[n],t[n]))return!1;return!0}function uv(e,t,n,r,o,s){if(yi=s,kt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ud.current=e===null||e.memoizedState===null?DI:LI,e=n(r,o),Ql){s=0;do{if(Ql=!1,Sc=0,25<=s)throw Error(se(301));s+=1,Ht=Lt=null,t.updateQueue=null,ud.current=zI,e=n(r,o)}while(Ql)}if(ud.current=ef,t=Lt!==null&&Lt.next!==null,yi=0,Ht=Lt=kt=null,Xd=!1,t)throw Error(se(300));return e}function dv(){var e=Sc!==0;return Sc=0,e}function Fr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?kt.memoizedState=Ht=e:Ht=Ht.next=e,Ht}function dr(){if(Lt===null){var e=kt.alternate;e=e!==null?e.memoizedState:null}else e=Lt.next;var t=Ht===null?kt.memoizedState:Ht.next;if(t!==null)Ht=t,Lt=e;else{if(e===null)throw Error(se(310));Lt=e,e={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},Ht===null?kt.memoizedState=Ht=e:Ht=Ht.next=e}return Ht}function Cc(e,t){return typeof t=="function"?t(e):t}function pp(e){var t=dr(),n=t.queue;if(n===null)throw Error(se(311));n.lastRenderedReducer=e;var r=Lt,o=r.baseQueue,s=n.pending;if(s!==null){if(o!==null){var i=o.next;o.next=s.next,s.next=i}r.baseQueue=o=s,n.pending=null}if(o!==null){s=o.next,r=r.baseState;var a=i=null,l=null,u=s;do{var d=u.lane;if((yi&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=f,i=r):l=l.next=f,kt.lanes|=d,vi|=d}u=u.next}while(u!==null&&u!==s);l===null?i=r:l.next=a,Ar(r,t.memoizedState)||(In=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do s=o.lane,kt.lanes|=s,vi|=s,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function mp(e){var t=dr(),n=t.queue;if(n===null)throw Error(se(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do s=e(s,i.action),i=i.next;while(i!==o);Ar(s,t.memoizedState)||(In=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function TS(){}function RS(e,t){var n=kt,r=dr(),o=t(),s=!Ar(r.memoizedState,o);if(s&&(r.memoizedState=o,In=!0),r=r.queue,fv(AS.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Ht!==null&&Ht.memoizedState.tag&1){if(n.flags|=2048,Ec(9,IS.bind(null,n,r,o,t),void 0,null),Bt===null)throw Error(se(349));yi&30||$S(n,t,o)}return o}function $S(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=kt.updateQueue,t===null?(t={lastEffect:null,stores:null},kt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function IS(e,t,n,r){t.value=n,t.getSnapshot=r,OS(t)&&MS(e)}function AS(e,t,n){return n(function(){OS(t)&&MS(e)})}function OS(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ar(e,n)}catch{return!0}}function MS(e){var t=To(e,1);t!==null&&$r(t,e,1,-1)}function Dw(e){var t=Fr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cc,lastRenderedState:e},t.queue=e,e=e.dispatch=MI.bind(null,kt,e),[t.memoizedState,e]}function Ec(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=kt.updateQueue,t===null?(t={lastEffect:null,stores:null},kt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function DS(){return dr().memoizedState}function dd(e,t,n,r){var o=Fr();kt.flags|=e,o.memoizedState=Ec(1|t,n,void 0,r===void 0?null:r)}function Gf(e,t,n,r){var o=dr();r=r===void 0?null:r;var s=void 0;if(Lt!==null){var i=Lt.memoizedState;if(s=i.destroy,r!==null&&cv(r,i.deps)){o.memoizedState=Ec(t,n,s,r);return}}kt.flags|=e,o.memoizedState=Ec(1|t,n,s,r)}function Lw(e,t){return dd(8390656,8,e,t)}function fv(e,t){return Gf(2048,8,e,t)}function LS(e,t){return Gf(4,2,e,t)}function zS(e,t){return Gf(4,4,e,t)}function FS(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 US(e,t,n){return n=n!=null?n.concat([e]):null,Gf(4,4,FS.bind(null,t,e),n)}function hv(){}function qS(e,t){var n=dr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function VS(e,t){var n=dr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&cv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function HS(e,t,n){return yi&21?(Ar(n,t)||(n=Q_(),kt.lanes|=n,vi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,In=!0),e.memoizedState=n)}function AI(e,t){var n=et;et=n!==0&&4>n?n:4,e(!0);var r=hp.transition;hp.transition={};try{e(!1),t()}finally{et=n,hp.transition=r}}function BS(){return dr().memoizedState}function OI(e,t,n){var r=ws(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},WS(e))KS(t,n);else if(n=NS(e,t,n,r),n!==null){var o=bn();$r(n,e,r,o),ZS(n,t,r)}}function MI(e,t,n){var r=ws(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(WS(e))KS(t,o);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,a=s(i,n);if(o.hasEagerState=!0,o.eagerState=a,Ar(a,i)){var l=t.interleaved;l===null?(o.next=o,ov(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=NS(e,t,o,r),n!==null&&(o=bn(),$r(n,e,r,o),ZS(n,t,r))}}function WS(e){var t=e.alternate;return e===kt||t!==null&&t===kt}function KS(e,t){Ql=Xd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ZS(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hy(e,n)}}var ef={readContext:ur,useCallback:an,useContext:an,useEffect:an,useImperativeHandle:an,useInsertionEffect:an,useLayoutEffect:an,useMemo:an,useReducer:an,useRef:an,useState:an,useDebugValue:an,useDeferredValue:an,useTransition:an,useMutableSource:an,useSyncExternalStore:an,useId:an,unstable_isNewReconciler:!1},DI={readContext:ur,useCallback:function(e,t){return Fr().memoizedState=[e,t===void 0?null:t],e},useContext:ur,useEffect:Lw,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,dd(4194308,4,FS.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dd(4194308,4,e,t)},useInsertionEffect:function(e,t){return dd(4,2,e,t)},useMemo:function(e,t){var n=Fr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=OI.bind(null,kt,e),[r.memoizedState,e]},useRef:function(e){var t=Fr();return e={current:e},t.memoizedState=e},useState:Dw,useDebugValue:hv,useDeferredValue:function(e){return Fr().memoizedState=e},useTransition:function(){var e=Dw(!1),t=e[0];return e=AI.bind(null,e[1]),Fr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=kt,o=Fr();if(mt){if(n===void 0)throw Error(se(407));n=n()}else{if(n=t(),Bt===null)throw Error(se(349));yi&30||$S(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,Lw(AS.bind(null,r,s,e),[e]),r.flags|=2048,Ec(9,IS.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=Fr(),t=Bt.identifierPrefix;if(mt){var n=ko,r=bo;n=(r&~(1<<32-Rr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Sc++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=II++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},LI={readContext:ur,useCallback:qS,useContext:ur,useEffect:fv,useImperativeHandle:US,useInsertionEffect:LS,useLayoutEffect:zS,useMemo:VS,useReducer:pp,useRef:DS,useState:function(){return pp(Cc)},useDebugValue:hv,useDeferredValue:function(e){var t=dr();return HS(t,Lt.memoizedState,e)},useTransition:function(){var e=pp(Cc)[0],t=dr().memoizedState;return[e,t]},useMutableSource:TS,useSyncExternalStore:RS,useId:BS,unstable_isNewReconciler:!1},zI={readContext:ur,useCallback:qS,useContext:ur,useEffect:fv,useImperativeHandle:US,useInsertionEffect:LS,useLayoutEffect:zS,useMemo:VS,useReducer:mp,useRef:DS,useState:function(){return mp(Cc)},useDebugValue:hv,useDeferredValue:function(e){var t=dr();return Lt===null?t.memoizedState=e:HS(t,Lt.memoizedState,e)},useTransition:function(){var e=mp(Cc)[0],t=dr().memoizedState;return[e,t]},useMutableSource:TS,useSyncExternalStore:RS,useId:BS,unstable_isNewReconciler:!1};function kr(e,t){if(e&&e.defaultProps){t=St({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Hm(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:St({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Jf={isMounted:function(e){return(e=e._reactInternals)?Ri(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=bn(),o=ws(e),s=So(r,o);s.payload=t,n!=null&&(s.callback=n),t=vs(e,s,o),t!==null&&($r(t,e,o,r),cd(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=bn(),o=ws(e),s=So(r,o);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=vs(e,s,o),t!==null&&($r(t,e,o,r),cd(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=bn(),r=ws(e),o=So(n,r);o.tag=2,t!=null&&(o.callback=t),t=vs(e,o,r),t!==null&&($r(t,e,r,n),cd(t,e,r))}};function zw(e,t,n,r,o,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!vc(n,r)||!vc(o,s):!0}function QS(e,t,n){var r=!1,o=Cs,s=t.contextType;return typeof s=="object"&&s!==null?s=ur(s):(o=On(t)?mi:fn.current,r=t.contextTypes,s=(r=r!=null)?La(e,o):Cs),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Jf,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s),t}function Fw(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Jf.enqueueReplaceState(t,t.state,null)}function Bm(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},sv(e);var s=t.contextType;typeof s=="object"&&s!==null?o.context=ur(s):(s=On(t)?mi:fn.current,o.context=La(e,s)),o.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Hm(e,t,s,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Jf.enqueueReplaceState(o,o.state,null),Jd(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function qa(e,t){try{var n="",r=t;do n+=h$(r),r=r.return;while(r);var o=n}catch(s){o=`
39
- Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:o,digest:null}}function gp(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Wm(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var FI=typeof WeakMap=="function"?WeakMap:Map;function GS(e,t,n){n=So(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){nf||(nf=!0,ng=r),Wm(e,t)},n}function JS(e,t,n){n=So(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Wm(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Wm(e,t),typeof r!="function"&&(xs===null?xs=new Set([this]):xs.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Uw(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new FI;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=eA.bind(null,e,t,n),t.then(e,e))}function qw(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 Vw(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=So(-1,1),t.tag=2,vs(n,t,1))),n.lanes|=1),e)}var UI=Oo.ReactCurrentOwner,In=!1;function yn(e,t,n,r){t.child=e===null?ES(t,null,n,r):Fa(t,e.child,n,r)}function Hw(e,t,n,r,o){n=n.render;var s=t.ref;return ma(t,o),r=uv(e,t,n,r,s,o),n=dv(),e!==null&&!In?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ro(e,t,o)):(mt&&n&&Yy(t),t.flags|=1,yn(e,t,r,o),t.child)}function Bw(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!bv(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,YS(e,t,s,r,o)):(e=md(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:vc,n(i,r)&&e.ref===t.ref)return Ro(e,t,o)}return t.flags|=1,e=bs(s,r),e.ref=t.ref,e.return=t,t.child=e}function YS(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(vc(s,r)&&e.ref===t.ref)if(In=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&(In=!0);else return t.lanes=e.lanes,Ro(e,t,o)}return Km(e,t,n,r,o)}function XS(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},st(aa,qn),qn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,st(aa,qn),qn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,st(aa,qn),qn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,st(aa,qn),qn|=r;return yn(e,t,o,n),t.child}function eC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Km(e,t,n,r,o){var s=On(n)?mi:fn.current;return s=La(t,s),ma(t,o),n=uv(e,t,n,r,s,o),r=dv(),e!==null&&!In?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ro(e,t,o)):(mt&&r&&Yy(t),t.flags|=1,yn(e,t,n,o),t.child)}function Ww(e,t,n,r,o){if(On(n)){var s=!0;Wd(t)}else s=!1;if(ma(t,o),t.stateNode===null)fd(e,t),QS(t,n,r),Bm(t,n,r,o),r=!0;else if(e===null){var i=t.stateNode,a=t.memoizedProps;i.props=a;var l=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=ur(u):(u=On(n)?mi:fn.current,u=La(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==r||l!==u)&&Fw(t,i,r,u),Qo=!1;var p=t.memoizedState;i.state=p,Jd(t,r,i,o),l=t.memoizedState,a!==r||p!==l||An.current||Qo?(typeof d=="function"&&(Hm(t,n,d,r),l=t.memoizedState),(a=Qo||zw(t,n,a,r,p,l,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=r,t.memoizedState=l),i.props=r,i.state=l,i.context=u,r=a):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,jS(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:kr(t.type,a),i.props=u,f=t.pendingProps,p=i.context,l=n.contextType,typeof l=="object"&&l!==null?l=ur(l):(l=On(n)?mi:fn.current,l=La(t,l));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(a!==f||p!==l)&&Fw(t,i,r,l),Qo=!1,p=t.memoizedState,i.state=p,Jd(t,r,i,o);var y=t.memoizedState;a!==f||p!==y||An.current||Qo?(typeof h=="function"&&(Hm(t,n,h,r),y=t.memoizedState),(u=Qo||zw(t,n,u,r,p,y,l)||!1)?(d||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,y,l),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,y,l)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),i.props=r,i.state=y,i.context=l,r=u):(typeof i.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Zm(e,t,n,r,s,o)}function Zm(e,t,n,r,o,s){eC(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&Rw(t,n,!1),Ro(e,t,s);r=t.stateNode,UI.current=t;var a=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Fa(t,e.child,null,s),t.child=Fa(t,null,a,s)):yn(e,t,a,s),t.memoizedState=r.state,o&&Rw(t,n,!0),t.child}function tC(e){var t=e.stateNode;t.pendingContext?Tw(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Tw(e,t.context,!1),iv(e,t.containerInfo)}function Kw(e,t,n,r,o){return za(),ev(o),t.flags|=256,yn(e,t,n,r),t.child}var Qm={dehydrated:null,treeContext:null,retryLane:0};function Gm(e){return{baseLanes:e,cachePool:null,transitions:null}}function nC(e,t,n){var r=t.pendingProps,o=wt.current,s=!1,i=(t.flags&128)!==0,a;if((a=i)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),st(wt,o&1),e===null)return qm(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=r.children,e=r.fallback,s?(r=t.mode,s=t.child,i={mode:"hidden",children:i},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=i):s=eh(i,r,0,null),e=hi(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Gm(n),t.memoizedState=Qm,e):pv(t,i));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return qI(e,t,i,r,a,o,n);if(s){s=r.fallback,i=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=bs(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?s=bs(a,s):(s=hi(s,i,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,i=e.child.memoizedState,i=i===null?Gm(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=Qm,r}return s=e.child,e=s.sibling,r=bs(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function pv(e,t){return t=eh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ju(e,t,n,r){return r!==null&&ev(r),Fa(t,e.child,null,n),e=pv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function qI(e,t,n,r,o,s,i){if(n)return t.flags&256?(t.flags&=-257,r=gp(Error(se(422))),ju(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=eh({mode:"visible",children:r.children},o,0,null),s=hi(s,o,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Fa(t,e.child,null,i),t.child.memoizedState=Gm(i),t.memoizedState=Qm,s);if(!(t.mode&1))return ju(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(se(419)),r=gp(s,r,void 0),ju(e,t,i,r)}if(a=(i&e.childLanes)!==0,In||a){if(r=Bt,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,To(e,o),$r(r,e,o,-1))}return wv(),r=gp(Error(se(421))),ju(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=tA.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,Bn=ys(o.nextSibling),Wn=t,mt=!0,Nr=null,e!==null&&(sr[ir++]=bo,sr[ir++]=ko,sr[ir++]=gi,bo=e.id,ko=e.overflow,gi=t),t=pv(t,r.children),t.flags|=4096,t)}function Zw(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Vm(e.return,t,n)}function yp(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function rC(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if(yn(e,t,r.children,n),r=wt.current,r&2)r=r&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&&Zw(e,n,t);else if(e.tag===19)Zw(e,n,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}r&=1}if(st(wt,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Yd(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),yp(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Yd(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}yp(t,!0,n,null,s);break;case"together":yp(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fd(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ro(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),vi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(se(153));if(t.child!==null){for(e=t.child,n=bs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=bs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function VI(e,t,n){switch(t.tag){case 3:tC(t),za();break;case 5:PS(t);break;case 1:On(t.type)&&Wd(t);break;case 4:iv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;st(Qd,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(st(wt,wt.current&1),t.flags|=128,null):n&t.child.childLanes?nC(e,t,n):(st(wt,wt.current&1),e=Ro(e,t,n),e!==null?e.sibling:null);st(wt,wt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rC(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),st(wt,wt.current),r)break;return null;case 22:case 23:return t.lanes=0,XS(e,t,n)}return Ro(e,t,n)}var oC,Jm,sC,iC;oC=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Jm=function(){};sC=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ti(eo.current);var s=null;switch(n){case"input":o=xm(e,o),r=xm(e,r),s=[];break;case"select":o=St({},o,{value:void 0}),r=St({},r,{value:void 0}),s=[];break;case"textarea":o=km(e,o),r=km(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Hd)}Sm(n,r);var i;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(i in a)a.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(dc.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(a=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(i in a)!a.hasOwnProperty(i)||l&&l.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in l)l.hasOwnProperty(i)&&a[i]!==l[i]&&(n||(n={}),n[i]=l[i])}else n||(s||(s=[]),s.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(dc.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&lt("scroll",e),s||a===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};iC=function(e,t,n,r){n!==r&&(t.flags|=4)};function kl(e,t){if(!mt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ln(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function HI(e,t,n){var r=t.pendingProps;switch(Xy(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ln(t),null;case 1:return On(t.type)&&Bd(),ln(t),null;case 3:return r=t.stateNode,Ua(),dt(An),dt(fn),lv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Eu(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Nr!==null&&(sg(Nr),Nr=null))),Jm(e,t),ln(t),null;case 5:av(t);var o=ti(_c.current);if(n=t.type,e!==null&&t.stateNode!=null)sC(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(se(166));return ln(t),null}if(e=ti(eo.current),Eu(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[Kr]=t,r[bc]=s,e=(t.mode&1)!==0,n){case"dialog":lt("cancel",r),lt("close",r);break;case"iframe":case"object":case"embed":lt("load",r);break;case"video":case"audio":for(o=0;o<Ml.length;o++)lt(Ml[o],r);break;case"source":lt("error",r);break;case"img":case"image":case"link":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"input":rw(r,s),lt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},lt("invalid",r);break;case"textarea":sw(r,s),lt("invalid",r)}Sm(n,s),o=null;for(var i in s)if(s.hasOwnProperty(i)){var a=s[i];i==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Cu(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Cu(r.textContent,a,e),o=["children",""+a]):dc.hasOwnProperty(i)&&a!=null&&i==="onScroll"&&lt("scroll",r)}switch(n){case"input":yu(r),ow(r,s,!0);break;case"textarea":yu(r),iw(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Hd)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=A_(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Kr]=t,e[bc]=r,oC(e,t,!1,!1),t.stateNode=e;e:{switch(i=Cm(n,r),n){case"dialog":lt("cancel",e),lt("close",e),o=r;break;case"iframe":case"object":case"embed":lt("load",e),o=r;break;case"video":case"audio":for(o=0;o<Ml.length;o++)lt(Ml[o],e);o=r;break;case"source":lt("error",e),o=r;break;case"img":case"image":case"link":lt("error",e),lt("load",e),o=r;break;case"details":lt("toggle",e),o=r;break;case"input":rw(e,r),o=xm(e,r),lt("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=St({},r,{value:void 0}),lt("invalid",e);break;case"textarea":sw(e,r),o=km(e,r),lt("invalid",e);break;default:o=r}Sm(n,o),a=o;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?D_(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&O_(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&fc(e,l):typeof l=="number"&&fc(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(dc.hasOwnProperty(s)?l!=null&&s==="onScroll"&&lt("scroll",e):l!=null&&Ly(e,s,l,i))}switch(n){case"input":yu(e),ow(e,r,!1);break;case"textarea":yu(e),iw(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ss(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?da(e,!!r.multiple,s,!1):r.defaultValue!=null&&da(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Hd)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ln(t),null;case 6:if(e&&t.stateNode!=null)iC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(se(166));if(n=ti(_c.current),ti(eo.current),Eu(t)){if(r=t.stateNode,n=t.memoizedProps,r[Kr]=t,(s=r.nodeValue!==n)&&(e=Wn,e!==null))switch(e.tag){case 3:Cu(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Cu(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Kr]=t,t.stateNode=r}return ln(t),null;case 13:if(dt(wt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(mt&&Bn!==null&&t.mode&1&&!(t.flags&128))SS(),za(),t.flags|=98560,s=!1;else if(s=Eu(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(se(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(se(317));s[Kr]=t}else za(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ln(t),s=!1}else Nr!==null&&(sg(Nr),Nr=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||wt.current&1?Ut===0&&(Ut=3):wv())),t.updateQueue!==null&&(t.flags|=4),ln(t),null);case 4:return Ua(),Jm(e,t),e===null&&xc(t.stateNode.containerInfo),ln(t),null;case 10:return rv(t.type._context),ln(t),null;case 17:return On(t.type)&&Bd(),ln(t),null;case 19:if(dt(wt),s=t.memoizedState,s===null)return ln(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)kl(s,!1);else{if(Ut!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Yd(e),i!==null){for(t.flags|=128,kl(s,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,i=s.alternate,i===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,s.type=i.type,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return st(wt,wt.current&1|2),t.child}e=e.sibling}s.tail!==null&&Tt()>Va&&(t.flags|=128,r=!0,kl(s,!1),t.lanes=4194304)}else{if(!r)if(e=Yd(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kl(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!mt)return ln(t),null}else 2*Tt()-s.renderingStartTime>Va&&n!==1073741824&&(t.flags|=128,r=!0,kl(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Tt(),t.sibling=null,n=wt.current,st(wt,r?n&1|2:n&1),t):(ln(t),null);case 22:case 23:return xv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qn&1073741824&&(ln(t),t.subtreeFlags&6&&(t.flags|=8192)):ln(t),null;case 24:return null;case 25:return null}throw Error(se(156,t.tag))}function BI(e,t){switch(Xy(t),t.tag){case 1:return On(t.type)&&Bd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ua(),dt(An),dt(fn),lv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return av(t),null;case 13:if(dt(wt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(se(340));za()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return dt(wt),null;case 4:return Ua(),null;case 10:return rv(t.type._context),null;case 22:case 23:return xv(),null;case 24:return null;default:return null}}var Pu=!1,un=!1,WI=typeof WeakSet=="function"?WeakSet:Set,ge=null;function ia(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Nt(e,t,r)}else n.current=null}function Ym(e,t,n){try{n()}catch(r){Nt(e,t,r)}}var Qw=!1;function KI(e,t){if(Om=Ud,e=dS(),Jy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,a=-1,l=-1,u=0,d=0,f=e,p=null;t:for(;;){for(var h;f!==n||o!==0&&f.nodeType!==3||(a=i+o),f!==s||r!==0&&f.nodeType!==3||(l=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===o&&(a=i),p===s&&++d===r&&(l=i),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Mm={focusedElem:e,selectionRange:n},Ud=!1,ge=t;ge!==null;)if(t=ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ge=e;else for(;ge!==null;){t=ge;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var m=y.memoizedProps,x=y.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?m:kr(t.type,m),x);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(se(163))}}catch(k){Nt(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,ge=e;break}ge=t.return}return y=Qw,Qw=!1,y}function Gl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&Ym(t,n,s)}o=o.next}while(o!==r)}}function Yf(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Xm(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function aC(e){var t=e.alternate;t!==null&&(e.alternate=null,aC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kr],delete t[bc],delete t[zm],delete t[PI],delete t[TI])),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 lC(e){return e.tag===5||e.tag===3||e.tag===4}function Gw(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lC(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 eg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Hd));else if(r!==4&&(e=e.child,e!==null))for(eg(e,t,n),e=e.sibling;e!==null;)eg(e,t,n),e=e.sibling}function tg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(tg(e,t,n),e=e.sibling;e!==null;)tg(e,t,n),e=e.sibling}var Qt=null,Er=!1;function Fo(e,t,n){for(n=n.child;n!==null;)cC(e,t,n),n=n.sibling}function cC(e,t,n){if(Xr&&typeof Xr.onCommitFiberUnmount=="function")try{Xr.onCommitFiberUnmount(Hf,n)}catch{}switch(n.tag){case 5:un||ia(n,t);case 6:var r=Qt,o=Er;Qt=null,Fo(e,t,n),Qt=r,Er=o,Qt!==null&&(Er?(e=Qt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qt.removeChild(n.stateNode));break;case 18:Qt!==null&&(Er?(e=Qt,n=n.stateNode,e.nodeType===8?up(e.parentNode,n):e.nodeType===1&&up(e,n),gc(e)):up(Qt,n.stateNode));break;case 4:r=Qt,o=Er,Qt=n.stateNode.containerInfo,Er=!0,Fo(e,t,n),Qt=r,Er=o;break;case 0:case 11:case 14:case 15:if(!un&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&Ym(n,t,i),o=o.next}while(o!==r)}Fo(e,t,n);break;case 1:if(!un&&(ia(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Nt(n,t,a)}Fo(e,t,n);break;case 21:Fo(e,t,n);break;case 22:n.mode&1?(un=(r=un)||n.memoizedState!==null,Fo(e,t,n),un=r):Fo(e,t,n);break;default:Fo(e,t,n)}}function Jw(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new WI),t.forEach(function(r){var o=nA.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function gr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var s=e,i=t,a=i;e:for(;a!==null;){switch(a.tag){case 5:Qt=a.stateNode,Er=!1;break e;case 3:Qt=a.stateNode.containerInfo,Er=!0;break e;case 4:Qt=a.stateNode.containerInfo,Er=!0;break e}a=a.return}if(Qt===null)throw Error(se(160));cC(s,i,o),Qt=null,Er=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(u){Nt(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)uC(t,e),t=t.sibling}function uC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(gr(t,e),zr(e),r&4){try{Gl(3,e,e.return),Yf(3,e)}catch(m){Nt(e,e.return,m)}try{Gl(5,e,e.return)}catch(m){Nt(e,e.return,m)}}break;case 1:gr(t,e),zr(e),r&512&&n!==null&&ia(n,n.return);break;case 5:if(gr(t,e),zr(e),r&512&&n!==null&&ia(n,n.return),e.flags&32){var o=e.stateNode;try{fc(o,"")}catch(m){Nt(e,e.return,m)}}if(r&4&&(o=e.stateNode,o!=null)){var s=e.memoizedProps,i=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&$_(o,s),Cm(a,i);var u=Cm(a,s);for(i=0;i<l.length;i+=2){var d=l[i],f=l[i+1];d==="style"?D_(o,f):d==="dangerouslySetInnerHTML"?O_(o,f):d==="children"?fc(o,f):Ly(o,d,f,u)}switch(a){case"input":wm(o,s);break;case"textarea":I_(o,s);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?da(o,!!s.multiple,h,!1):p!==!!s.multiple&&(s.defaultValue!=null?da(o,!!s.multiple,s.defaultValue,!0):da(o,!!s.multiple,s.multiple?[]:"",!1))}o[bc]=s}catch(m){Nt(e,e.return,m)}}break;case 6:if(gr(t,e),zr(e),r&4){if(e.stateNode===null)throw Error(se(162));o=e.stateNode,s=e.memoizedProps;try{o.nodeValue=s}catch(m){Nt(e,e.return,m)}}break;case 3:if(gr(t,e),zr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{gc(t.containerInfo)}catch(m){Nt(e,e.return,m)}break;case 4:gr(t,e),zr(e);break;case 13:gr(t,e),zr(e),o=e.child,o.flags&8192&&(s=o.memoizedState!==null,o.stateNode.isHidden=s,!s||o.alternate!==null&&o.alternate.memoizedState!==null||(yv=Tt())),r&4&&Jw(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(un=(u=un)||d,gr(t,e),un=u):gr(t,e),zr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ge=e,d=e.child;d!==null;){for(f=ge=d;ge!==null;){switch(p=ge,h=p.child,p.tag){case 0:case 11:case 14:case 15:Gl(4,p,p.return);break;case 1:ia(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(m){Nt(r,n,m)}}break;case 5:ia(p,p.return);break;case 22:if(p.memoizedState!==null){Xw(f);continue}}h!==null?(h.return=p,ge=h):Xw(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{o=f.stateNode,u?(s=o.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=f.stateNode,l=f.memoizedProps.style,i=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=M_("display",i))}catch(m){Nt(e,e.return,m)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(m){Nt(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:gr(t,e),zr(e),r&4&&Jw(e);break;case 21:break;default:gr(t,e),zr(e)}}function zr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(lC(n)){var r=n;break e}n=n.return}throw Error(se(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(fc(o,""),r.flags&=-33);var s=Gw(e);tg(e,s,o);break;case 3:case 4:var i=r.stateNode.containerInfo,a=Gw(e);eg(e,a,i);break;default:throw Error(se(161))}}catch(l){Nt(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ZI(e,t,n){ge=e,dC(e)}function dC(e,t,n){for(var r=(e.mode&1)!==0;ge!==null;){var o=ge,s=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||Pu;if(!i){var a=o.alternate,l=a!==null&&a.memoizedState!==null||un;a=Pu;var u=un;if(Pu=i,(un=l)&&!u)for(ge=o;ge!==null;)i=ge,l=i.child,i.tag===22&&i.memoizedState!==null?eb(o):l!==null?(l.return=i,ge=l):eb(o);for(;s!==null;)ge=s,dC(s),s=s.sibling;ge=o,Pu=a,un=u}Yw(e)}else o.subtreeFlags&8772&&s!==null?(s.return=o,ge=s):Yw(e)}}function Yw(e){for(;ge!==null;){var t=ge;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:un||Yf(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!un)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:kr(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Mw(t,s,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Mw(t,i,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.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&&gc(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(se(163))}un||t.flags&512&&Xm(t)}catch(p){Nt(t,t.return,p)}}if(t===e){ge=null;break}if(n=t.sibling,n!==null){n.return=t.return,ge=n;break}ge=t.return}}function Xw(e){for(;ge!==null;){var t=ge;if(t===e){ge=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ge=n;break}ge=t.return}}function eb(e){for(;ge!==null;){var t=ge;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Yf(4,t)}catch(l){Nt(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){Nt(t,o,l)}}var s=t.return;try{Xm(t)}catch(l){Nt(t,s,l)}break;case 5:var i=t.return;try{Xm(t)}catch(l){Nt(t,i,l)}}}catch(l){Nt(t,t.return,l)}if(t===e){ge=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ge=a;break}ge=t.return}}var QI=Math.ceil,tf=Oo.ReactCurrentDispatcher,mv=Oo.ReactCurrentOwner,cr=Oo.ReactCurrentBatchConfig,Qe=0,Bt=null,At=null,Xt=0,qn=0,aa=$s(0),Ut=0,Nc=null,vi=0,Xf=0,gv=0,Jl=null,Rn=null,yv=0,Va=1/0,mo=null,nf=!1,ng=null,xs=null,Tu=!1,fs=null,rf=0,Yl=0,rg=null,hd=-1,pd=0;function bn(){return Qe&6?Tt():hd!==-1?hd:hd=Tt()}function ws(e){return e.mode&1?Qe&2&&Xt!==0?Xt&-Xt:$I.transition!==null?(pd===0&&(pd=Q_()),pd):(e=et,e!==0||(e=window.event,e=e===void 0?16:nS(e.type)),e):1}function $r(e,t,n,r){if(50<Yl)throw Yl=0,rg=null,Error(se(185));Vc(e,n,r),(!(Qe&2)||e!==Bt)&&(e===Bt&&(!(Qe&2)&&(Xf|=n),Ut===4&&es(e,Xt)),Mn(e,r),n===1&&Qe===0&&!(t.mode&1)&&(Va=Tt()+500,Qf&&Is()))}function Mn(e,t){var n=e.callbackNode;$$(e,t);var r=Fd(e,e===Bt?Xt:0);if(r===0)n!==null&&cw(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&cw(n),t===1)e.tag===0?RI(tb.bind(null,e)):bS(tb.bind(null,e)),NI(function(){!(Qe&6)&&Is()}),n=null;else{switch(G_(r)){case 1:n=Vy;break;case 4:n=K_;break;case 16:n=zd;break;case 536870912:n=Z_;break;default:n=zd}n=xC(n,fC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function fC(e,t){if(hd=-1,pd=0,Qe&6)throw Error(se(327));var n=e.callbackNode;if(ga()&&e.callbackNode!==n)return null;var r=Fd(e,e===Bt?Xt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=of(e,r);else{t=r;var o=Qe;Qe|=2;var s=pC();(Bt!==e||Xt!==t)&&(mo=null,Va=Tt()+500,fi(e,t));do try{YI();break}catch(a){hC(e,a)}while(!0);nv(),tf.current=s,Qe=o,At!==null?t=0:(Bt=null,Xt=0,t=Ut)}if(t!==0){if(t===2&&(o=Tm(e),o!==0&&(r=o,t=og(e,o))),t===1)throw n=Nc,fi(e,0),es(e,r),Mn(e,Tt()),n;if(t===6)es(e,r);else{if(o=e.current.alternate,!(r&30)&&!GI(o)&&(t=of(e,r),t===2&&(s=Tm(e),s!==0&&(r=s,t=og(e,s))),t===1))throw n=Nc,fi(e,0),es(e,r),Mn(e,Tt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(se(345));case 2:Hs(e,Rn,mo);break;case 3:if(es(e,r),(r&130023424)===r&&(t=yv+500-Tt(),10<t)){if(Fd(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){bn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Lm(Hs.bind(null,e,Rn,mo),t);break}Hs(e,Rn,mo);break;case 4:if(es(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-Rr(r);s=1<<i,i=t[i],i>o&&(o=i),r&=~s}if(r=o,r=Tt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*QI(r/1960))-r,10<r){e.timeoutHandle=Lm(Hs.bind(null,e,Rn,mo),r);break}Hs(e,Rn,mo);break;case 5:Hs(e,Rn,mo);break;default:throw Error(se(329))}}}return Mn(e,Tt()),e.callbackNode===n?fC.bind(null,e):null}function og(e,t){var n=Jl;return e.current.memoizedState.isDehydrated&&(fi(e,t).flags|=256),e=of(e,t),e!==2&&(t=Rn,Rn=n,t!==null&&sg(t)),e}function sg(e){Rn===null?Rn=e:Rn.push.apply(Rn,e)}function GI(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],s=o.getSnapshot;o=o.value;try{if(!Ar(s(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function es(e,t){for(t&=~gv,t&=~Xf,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Rr(t),r=1<<n;e[n]=-1,t&=~r}}function tb(e){if(Qe&6)throw Error(se(327));ga();var t=Fd(e,0);if(!(t&1))return Mn(e,Tt()),null;var n=of(e,t);if(e.tag!==0&&n===2){var r=Tm(e);r!==0&&(t=r,n=og(e,r))}if(n===1)throw n=Nc,fi(e,0),es(e,t),Mn(e,Tt()),n;if(n===6)throw Error(se(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Hs(e,Rn,mo),Mn(e,Tt()),null}function vv(e,t){var n=Qe;Qe|=1;try{return e(t)}finally{Qe=n,Qe===0&&(Va=Tt()+500,Qf&&Is())}}function xi(e){fs!==null&&fs.tag===0&&!(Qe&6)&&ga();var t=Qe;Qe|=1;var n=cr.transition,r=et;try{if(cr.transition=null,et=1,e)return e()}finally{et=r,cr.transition=n,Qe=t,!(Qe&6)&&Is()}}function xv(){qn=aa.current,dt(aa)}function fi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,EI(n)),At!==null)for(n=At.return;n!==null;){var r=n;switch(Xy(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Bd();break;case 3:Ua(),dt(An),dt(fn),lv();break;case 5:av(r);break;case 4:Ua();break;case 13:dt(wt);break;case 19:dt(wt);break;case 10:rv(r.type._context);break;case 22:case 23:xv()}n=n.return}if(Bt=e,At=e=bs(e.current,null),Xt=qn=t,Ut=0,Nc=null,gv=Xf=vi=0,Rn=Jl=null,ei!==null){for(t=0;t<ei.length;t++)if(n=ei[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=o,r.next=i}n.pending=r}ei=null}return e}function hC(e,t){do{var n=At;try{if(nv(),ud.current=ef,Xd){for(var r=kt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Xd=!1}if(yi=0,Ht=Lt=kt=null,Ql=!1,Sc=0,mv.current=null,n===null||n.return===null){Ut=1,Nc=t,At=null;break}e:{var s=e,i=n.return,a=n,l=t;if(t=Xt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,d=a,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=qw(i);if(h!==null){h.flags&=-257,Vw(h,i,a,s,t),h.mode&1&&Uw(s,u,t),t=h,l=u;var y=t.updateQueue;if(y===null){var m=new Set;m.add(l),t.updateQueue=m}else y.add(l);break e}else{if(!(t&1)){Uw(s,u,t),wv();break e}l=Error(se(426))}}else if(mt&&a.mode&1){var x=qw(i);if(x!==null){!(x.flags&65536)&&(x.flags|=256),Vw(x,i,a,s,t),ev(qa(l,a));break e}}s=l=qa(l,a),Ut!==4&&(Ut=2),Jl===null?Jl=[s]:Jl.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var g=GS(s,l,t);Ow(s,g);break e;case 1:a=l;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(xs===null||!xs.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var k=JS(s,a,t);Ow(s,k);break e}}s=s.return}while(s!==null)}gC(n)}catch(C){t=C,At===n&&n!==null&&(At=n=n.return);continue}break}while(!0)}function pC(){var e=tf.current;return tf.current=ef,e===null?ef:e}function wv(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Bt===null||!(vi&268435455)&&!(Xf&268435455)||es(Bt,Xt)}function of(e,t){var n=Qe;Qe|=2;var r=pC();(Bt!==e||Xt!==t)&&(mo=null,fi(e,t));do try{JI();break}catch(o){hC(e,o)}while(!0);if(nv(),Qe=n,tf.current=r,At!==null)throw Error(se(261));return Bt=null,Xt=0,Ut}function JI(){for(;At!==null;)mC(At)}function YI(){for(;At!==null&&!_$();)mC(At)}function mC(e){var t=vC(e.alternate,e,qn);e.memoizedProps=e.pendingProps,t===null?gC(e):At=t,mv.current=null}function gC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=BI(n,t),n!==null){n.flags&=32767,At=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ut=6,At=null;return}}else if(n=HI(n,t,qn),n!==null){At=n;return}if(t=t.sibling,t!==null){At=t;return}At=t=e}while(t!==null);Ut===0&&(Ut=5)}function Hs(e,t,n){var r=et,o=cr.transition;try{cr.transition=null,et=1,XI(e,t,n,r)}finally{cr.transition=o,et=r}return null}function XI(e,t,n,r){do ga();while(fs!==null);if(Qe&6)throw Error(se(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(se(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(I$(e,s),e===Bt&&(At=Bt=null,Xt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Tu||(Tu=!0,xC(zd,function(){return ga(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=cr.transition,cr.transition=null;var i=et;et=1;var a=Qe;Qe|=4,mv.current=null,KI(e,n),uC(n,e),xI(Mm),Ud=!!Om,Mm=Om=null,e.current=n,ZI(n),S$(),Qe=a,et=i,cr.transition=s}else e.current=n;if(Tu&&(Tu=!1,fs=e,rf=o),s=e.pendingLanes,s===0&&(xs=null),N$(n.stateNode),Mn(e,Tt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(nf)throw nf=!1,e=ng,ng=null,e;return rf&1&&e.tag!==0&&ga(),s=e.pendingLanes,s&1?e===rg?Yl++:(Yl=0,rg=e):Yl=0,Is(),null}function ga(){if(fs!==null){var e=G_(rf),t=cr.transition,n=et;try{if(cr.transition=null,et=16>e?16:e,fs===null)var r=!1;else{if(e=fs,fs=null,rf=0,Qe&6)throw Error(se(331));var o=Qe;for(Qe|=4,ge=e.current;ge!==null;){var s=ge,i=s.child;if(ge.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(ge=u;ge!==null;){var d=ge;switch(d.tag){case 0:case 11:case 15:Gl(8,d,s)}var f=d.child;if(f!==null)f.return=d,ge=f;else for(;ge!==null;){d=ge;var p=d.sibling,h=d.return;if(aC(d),d===u){ge=null;break}if(p!==null){p.return=h,ge=p;break}ge=h}}}var y=s.alternate;if(y!==null){var m=y.child;if(m!==null){y.child=null;do{var x=m.sibling;m.sibling=null,m=x}while(m!==null)}}ge=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,ge=i;else e:for(;ge!==null;){if(s=ge,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Gl(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,ge=g;break e}ge=s.return}}var v=e.current;for(ge=v;ge!==null;){i=ge;var w=i.child;if(i.subtreeFlags&2064&&w!==null)w.return=i,ge=w;else e:for(i=v;ge!==null;){if(a=ge,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:Yf(9,a)}}catch(C){Nt(a,a.return,C)}if(a===i){ge=null;break e}var k=a.sibling;if(k!==null){k.return=a.return,ge=k;break e}ge=a.return}}if(Qe=o,Is(),Xr&&typeof Xr.onPostCommitFiberRoot=="function")try{Xr.onPostCommitFiberRoot(Hf,e)}catch{}r=!0}return r}finally{et=n,cr.transition=t}}return!1}function nb(e,t,n){t=qa(n,t),t=GS(e,t,1),e=vs(e,t,1),t=bn(),e!==null&&(Vc(e,1,t),Mn(e,t))}function Nt(e,t,n){if(e.tag===3)nb(e,e,n);else for(;t!==null;){if(t.tag===3){nb(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(xs===null||!xs.has(r))){e=qa(n,e),e=JS(t,e,1),t=vs(t,e,1),e=bn(),t!==null&&(Vc(t,1,e),Mn(t,e));break}}t=t.return}}function eA(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=bn(),e.pingedLanes|=e.suspendedLanes&n,Bt===e&&(Xt&n)===n&&(Ut===4||Ut===3&&(Xt&130023424)===Xt&&500>Tt()-yv?fi(e,0):gv|=n),Mn(e,t)}function yC(e,t){t===0&&(e.mode&1?(t=wu,wu<<=1,!(wu&130023424)&&(wu=4194304)):t=1);var n=bn();e=To(e,t),e!==null&&(Vc(e,t,n),Mn(e,n))}function tA(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),yC(e,n)}function nA(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(se(314))}r!==null&&r.delete(t),yC(e,n)}var vC;vC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||An.current)In=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return In=!1,VI(e,t,n);In=!!(e.flags&131072)}else In=!1,mt&&t.flags&1048576&&kS(t,Zd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;fd(e,t),e=t.pendingProps;var o=La(t,fn.current);ma(t,n),o=uv(null,t,r,e,o,n);var s=dv();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,On(r)?(s=!0,Wd(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,sv(t),o.updater=Jf,t.stateNode=o,o._reactInternals=t,Bm(t,r,e,n),t=Zm(null,t,r,!0,s,n)):(t.tag=0,mt&&s&&Yy(t),yn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(fd(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=oA(r),e=kr(r,e),o){case 0:t=Km(null,t,r,e,n);break e;case 1:t=Ww(null,t,r,e,n);break e;case 11:t=Hw(null,t,r,e,n);break e;case 14:t=Bw(null,t,r,kr(r.type,e),n);break e}throw Error(se(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kr(r,o),Km(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kr(r,o),Ww(e,t,r,o,n);case 3:e:{if(tC(t),e===null)throw Error(se(387));r=t.pendingProps,s=t.memoizedState,o=s.element,jS(e,t),Jd(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){o=qa(Error(se(423)),t),t=Kw(e,t,r,n,o);break e}else if(r!==o){o=qa(Error(se(424)),t),t=Kw(e,t,r,n,o);break e}else for(Bn=ys(t.stateNode.containerInfo.firstChild),Wn=t,mt=!0,Nr=null,n=ES(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(za(),r===o){t=Ro(e,t,n);break e}yn(e,t,r,n)}t=t.child}return t;case 5:return PS(t),e===null&&qm(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Dm(r,o)?i=null:s!==null&&Dm(r,s)&&(t.flags|=32),eC(e,t),yn(e,t,i,n),t.child;case 6:return e===null&&qm(t),null;case 13:return nC(e,t,n);case 4:return iv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Fa(t,null,r,n):yn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kr(r,o),Hw(e,t,r,o,n);case 7:return yn(e,t,t.pendingProps,n),t.child;case 8:return yn(e,t,t.pendingProps.children,n),t.child;case 12:return yn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,st(Qd,r._currentValue),r._currentValue=i,s!==null)if(Ar(s.value,i)){if(s.children===o.children&&!An.current){t=Ro(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){i=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=So(-1,n&-n),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Vm(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(se(341));i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Vm(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}yn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,ma(t,n),o=ur(o),r=r(o),t.flags|=1,yn(e,t,r,n),t.child;case 14:return r=t.type,o=kr(r,t.pendingProps),o=kr(r.type,o),Bw(e,t,r,o,n);case 15:return YS(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:kr(r,o),fd(e,t),t.tag=1,On(r)?(e=!0,Wd(t)):e=!1,ma(t,n),QS(t,r,o),Bm(t,r,o,n),Zm(null,t,r,!0,e,n);case 19:return rC(e,t,n);case 22:return XS(e,t,n)}throw Error(se(156,t.tag))};function xC(e,t){return W_(e,t)}function rA(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lr(e,t,n,r){return new rA(e,t,n,r)}function bv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function oA(e){if(typeof e=="function")return bv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Fy)return 11;if(e===Uy)return 14}return 2}function bs(e,t){var n=e.alternate;return n===null?(n=lr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function md(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")bv(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Ji:return hi(n.children,o,s,t);case zy:i=8,o|=8;break;case mm:return e=lr(12,n,t,o|2),e.elementType=mm,e.lanes=s,e;case gm:return e=lr(13,n,t,o),e.elementType=gm,e.lanes=s,e;case ym:return e=lr(19,n,t,o),e.elementType=ym,e.lanes=s,e;case P_:return eh(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N_:i=10;break e;case j_:i=9;break e;case Fy:i=11;break e;case Uy:i=14;break e;case Zo:i=16,r=null;break e}throw Error(se(130,e==null?e:typeof e,""))}return t=lr(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function hi(e,t,n,r){return e=lr(7,e,r,t),e.lanes=n,e}function eh(e,t,n,r){return e=lr(22,e,r,t),e.elementType=P_,e.lanes=n,e.stateNode={isHidden:!1},e}function vp(e,t,n){return e=lr(6,e,null,t),e.lanes=n,e}function xp(e,t,n){return t=lr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sA(e,t,n,r,o){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=Xh(0),this.expirationTimes=Xh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xh(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function kv(e,t,n,r,o,s,i,a,l){return e=new sA(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=lr(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},sv(s),e}function iA(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Gi,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function wC(e){if(!e)return Cs;e=e._reactInternals;e:{if(Ri(e)!==e||e.tag!==1)throw Error(se(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(On(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(se(171))}if(e.tag===1){var n=e.type;if(On(n))return wS(e,n,t)}return t}function bC(e,t,n,r,o,s,i,a,l){return e=kv(n,r,!0,e,o,s,i,a,l),e.context=wC(null),n=e.current,r=bn(),o=ws(n),s=So(r,o),s.callback=t??null,vs(n,s,o),e.current.lanes=o,Vc(e,o,r),Mn(e,r),e}function th(e,t,n,r){var o=t.current,s=bn(),i=ws(o);return n=wC(n),t.context===null?t.context=n:t.pendingContext=n,t=So(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=vs(o,t,i),e!==null&&($r(e,o,i,s),cd(e,o,i)),i}function sf(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 rb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function _v(e,t){rb(e,t),(e=e.alternate)&&rb(e,t)}function aA(){return null}var kC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Sv(e){this._internalRoot=e}nh.prototype.render=Sv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(se(409));th(e,t,null,null)};nh.prototype.unmount=Sv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;xi(function(){th(null,e,null,null)}),t[Po]=null}};function nh(e){this._internalRoot=e}nh.prototype.unstable_scheduleHydration=function(e){if(e){var t=X_();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Xo.length&&t!==0&&t<Xo[n].priority;n++);Xo.splice(n,0,e),n===0&&tS(e)}};function Cv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function rh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function ob(){}function lA(e,t,n,r,o){if(o){if(typeof r=="function"){var s=r;r=function(){var u=sf(i);s.call(u)}}var i=bC(t,r,e,0,null,!1,!1,"",ob);return e._reactRootContainer=i,e[Po]=i.current,xc(e.nodeType===8?e.parentNode:e),xi(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var u=sf(l);a.call(u)}}var l=kv(e,0,!1,null,null,!1,!1,"",ob);return e._reactRootContainer=l,e[Po]=l.current,xc(e.nodeType===8?e.parentNode:e),xi(function(){th(t,l,n,r)}),l}function oh(e,t,n,r,o){var s=n._reactRootContainer;if(s){var i=s;if(typeof o=="function"){var a=o;o=function(){var l=sf(i);a.call(l)}}th(t,i,e,o)}else i=lA(n,t,e,o,r);return sf(i)}J_=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ol(t.pendingLanes);n!==0&&(Hy(t,n|1),Mn(t,Tt()),!(Qe&6)&&(Va=Tt()+500,Is()))}break;case 13:xi(function(){var r=To(e,1);if(r!==null){var o=bn();$r(r,e,1,o)}}),_v(e,1)}};By=function(e){if(e.tag===13){var t=To(e,134217728);if(t!==null){var n=bn();$r(t,e,134217728,n)}_v(e,134217728)}};Y_=function(e){if(e.tag===13){var t=ws(e),n=To(e,t);if(n!==null){var r=bn();$r(n,e,t,r)}_v(e,t)}};X_=function(){return et};eS=function(e,t){var n=et;try{return et=e,t()}finally{et=n}};Nm=function(e,t,n){switch(t){case"input":if(wm(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Zf(r);if(!o)throw Error(se(90));R_(r),wm(r,o)}}}break;case"textarea":I_(e,n);break;case"select":t=n.value,t!=null&&da(e,!!n.multiple,t,!1)}};F_=vv;U_=xi;var cA={usingClientEntryPoint:!1,Events:[Bc,ta,Zf,L_,z_,vv]},_l={findFiberByHostInstance:Xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},uA={bundleType:_l.bundleType,version:_l.version,rendererPackageName:_l.rendererPackageName,rendererConfig:_l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Oo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=H_(e),e===null?null:e.stateNode},findFiberByHostInstance:_l.findFiberByHostInstance||aA,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 Ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ru.isDisabled&&Ru.supportsFiber)try{Hf=Ru.inject(uA),Xr=Ru}catch{}}Gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=cA;Gn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cv(t))throw Error(se(200));return iA(e,t,null,n)};Gn.createRoot=function(e,t){if(!Cv(e))throw Error(se(299));var n=!1,r="",o=kC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=kv(e,1,!1,null,null,n,!1,r,o),e[Po]=t.current,xc(e.nodeType===8?e.parentNode:e),new Sv(t)};Gn.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(se(188)):(e=Object.keys(e).join(","),Error(se(268,e)));return e=H_(t),e=e===null?null:e.stateNode,e};Gn.flushSync=function(e){return xi(e)};Gn.hydrate=function(e,t,n){if(!rh(t))throw Error(se(200));return oh(null,e,t,!0,n)};Gn.hydrateRoot=function(e,t,n){if(!Cv(e))throw Error(se(405));var r=n!=null&&n.hydratedSources||null,o=!1,s="",i=kC;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=bC(t,null,e,1,n??null,o,!1,s,i),e[Po]=t.current,xc(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new nh(t)};Gn.render=function(e,t,n){if(!rh(t))throw Error(se(200));return oh(null,e,t,!1,n)};Gn.unmountComponentAtNode=function(e){if(!rh(e))throw Error(se(40));return e._reactRootContainer?(xi(function(){oh(null,null,e,!1,function(){e._reactRootContainer=null,e[Po]=null})}),!0):!1};Gn.unstable_batchedUpdates=vv;Gn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!rh(n))throw Error(se(200));if(e==null||e._reactInternals===void 0)throw Error(se(38));return oh(e,t,n,!1,r)};Gn.version="18.3.1-next-f1338f8080-20240426";function _C(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_C)}catch(e){console.error(e)}}_C(),__.exports=Gn;var $i=__.exports;const dA=Xa($i);var SC,sb=$i;SC=sb.createRoot,sb.hydrateRoot;function fA(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,o,s,i=[],a="",l=e.split("/");for(l[0]||l.shift();o=l.shift();)n=o[0],n==="*"?(i.push(n),a+=o[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(r=o.indexOf("?",1),s=o.indexOf(".",1),i.push(o.substring(1,~r?r:~s?s:o.length)),a+=~r&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(a+=(~r?"?":"")+"\\"+o.substring(s))):a+="/"+o;return{keys:i,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}var CC={exports:{}},EC={};/**
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 Ha=b;function hA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pA=typeof Object.is=="function"?Object.is:hA,mA=Ha.useState,gA=Ha.useEffect,yA=Ha.useLayoutEffect,vA=Ha.useDebugValue;function xA(e,t){var n=t(),r=mA({inst:{value:n,getSnapshot:t}}),o=r[0].inst,s=r[1];return yA(function(){o.value=n,o.getSnapshot=t,wp(o)&&s({inst:o})},[e,n,t]),gA(function(){return wp(o)&&s({inst:o}),e(function(){wp(o)&&s({inst:o})})},[e]),vA(n),n}function wp(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!pA(e,n)}catch{return!0}}function wA(e,t){return t()}var bA=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?wA:xA;EC.useSyncExternalStore=Ha.useSyncExternalStore!==void 0?Ha.useSyncExternalStore:bA;CC.exports=EC;var kA=CC.exports;const _A=Oy.useInsertionEffect,SA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",CA=SA?b.useLayoutEffect:b.useEffect,EA=_A||CA,NC=e=>{const t=b.useRef([e,(...n)=>t[0](...n)]).current;return EA(()=>{t[0]=e}),t[1]},NA="popstate",Ev="pushState",Nv="replaceState",jA="hashchange",ib=[NA,Ev,Nv,jA],PA=e=>{for(const t of ib)addEventListener(t,e);return()=>{for(const t of ib)removeEventListener(t,e)}},jC=(e,t)=>kA.useSyncExternalStore(PA,e,t),TA=()=>location.search,RA=({ssrSearch:e=""}={})=>jC(TA,()=>e),ab=()=>location.pathname,$A=({ssrPath:e}={})=>jC(ab,e?()=>e:ab),IA=(e,{replace:t=!1,state:n=null}={})=>history[t?Nv:Ev](n,"",e),AA=(e={})=>[$A(e),IA],lb=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[lb]>"u"){for(const e of[Ev,Nv]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,lb,{value:!0})}const OA=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",PC=(e="")=>e==="/"?"":e,MA=(e,t)=>e[0]==="~"?e.slice(1):PC(t)+e,DA=(e="",t)=>OA(cb(PC(e)),cb(t)),cb=e=>{try{return decodeURI(e)}catch{return e}},TC={hook:AA,searchHook:RA,parser:fA,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},RC=b.createContext(TC),Kc=()=>b.useContext(RC),$C={},IC=b.createContext($C),LA=()=>b.useContext(IC),sh=e=>{const[t,n]=e.hook(e);return[DA(e.base,t),NC((r,o)=>n(MA(r,e.base),o))]},zA=()=>sh(Kc()),AC=(e,t,n,r)=>{const{pattern:o,keys:s}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",r),i=o.exec(n)||[],[a,...l]=i;return a!==void 0?[!0,(()=>{const u=s!==!1?Object.fromEntries(s.map((f,p)=>[f,l[p]])):i.groups;let d={...l};return u&&Object.assign(d,u),d})(),...r?[a]:[]]:[!1,null]},FA=({children:e,...t})=>{var d,f;const n=Kc(),r=t.hook?TC:n;let o=r;const[s,i]=((d=t.ssrPath)==null?void 0:d.split("?"))??[];i&&(t.ssrSearch=i,t.ssrPath=s),t.hrefs=t.hrefs??((f=t.hook)==null?void 0:f.hrefs);let a=b.useRef({}),l=a.current,u=l;for(let p in r){const h=p==="base"?r[p]+(t[p]||""):t[p]||r[p];l===u&&h!==u[p]&&(a.current=u={...u}),u[p]=h,(h!==r[p]||h!==o[p])&&(o=u)}return b.createElement(RC.Provider,{value:o,children:e})},ub=({children:e,component:t},n)=>t?b.createElement(t,{params:n}):typeof e=="function"?e(n):e,UA=e=>{let t=b.useRef($C);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([r,o])=>o!==n[r])?e:n},Sl=({path:e,nest:t,match:n,...r})=>{const o=Kc(),[s]=sh(o),[i,a,l]=n??AC(o.parser,e,s,t),u=UA({...LA(),...a});if(!i)return null;const d=l?b.createElement(FA,{base:l},ub(r,u)):ub(r,u);return b.createElement(IC.Provider,{value:u,children:d})},OC=b.forwardRef((e,t)=>{const n=Kc(),[r,o]=sh(n),{to:s="",href:i=s,onClick:a,asChild:l,children:u,className:d,replace:f,state:p,...h}=e,y=NC(x=>{x.ctrlKey||x.metaKey||x.altKey||x.shiftKey||x.button!==0||(a==null||a(x),x.defaultPrevented||(x.preventDefault(),o(i,e)))}),m=n.hrefs(i[0]==="~"?i.slice(1):n.base+i,n);return l&&b.isValidElement(u)?b.cloneElement(u,{onClick:y,href:m}):b.createElement("a",{...h,onClick:y,href:m,className:d!=null&&d.call?d(r===i):d,children:u,ref:t})}),MC=e=>Array.isArray(e)?e.flatMap(t=>MC(t&&t.type===b.Fragment?t.props.children:t)):[e],qA=({children:e,location:t})=>{const n=Kc(),[r]=sh(n);for(const o of MC(e)){let s=0;if(b.isValidElement(o)&&(s=AC(n.parser,o.props.path,t||r,o.props.nest))[0])return b.cloneElement(o,{match:s})}return null};var rl=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(){}},wi=typeof window>"u"||"Deno"in globalThis;function xn(){}function VA(e,t){return typeof e=="function"?e(t):e}function ig(e){return typeof e=="number"&&e>=0&&e!==1/0}function DC(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ks(e,t){return typeof e=="function"?e(t):e}function or(e,t){return typeof e=="function"?e(t):e}function db(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:i,stale:a}=e;if(i){if(r){if(t.queryHash!==jv(i,t.options))return!1}else if(!jc(t.queryKey,i))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||s&&!s(t))}function fb(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(bi(t.options.mutationKey)!==bi(s))return!1}else if(!jc(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function jv(e,t){return((t==null?void 0:t.queryKeyHashFn)||bi)(e)}function bi(e){return JSON.stringify(e,(t,n)=>ag(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function jc(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>jc(e[n],t[n])):!1}function LC(e,t){if(e===t)return e;const n=hb(e)&&hb(t);if(n||ag(e)&&ag(t)){const r=n?e:Object.keys(e),o=r.length,s=n?t:Object.keys(t),i=s.length,a=n?[]:{},l=new Set(r);let u=0;for(let d=0;d<i;d++){const f=n?d:s[d];(!n&&l.has(f)||n)&&e[f]===void 0&&t[f]===void 0?(a[f]=void 0,u++):(a[f]=LC(e[f],t[f]),a[f]===e[f]&&e[f]!==void 0&&u++)}return o===i&&u===o?e:a}return t}function af(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function hb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ag(e){if(!pb(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!pb(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function pb(e){return Object.prototype.toString.call(e)==="[object Object]"}function HA(e){return new Promise(t=>{setTimeout(t,e)})}function lg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?LC(e,t):t}function BA(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function WA(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Pv=Symbol();function zC(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Pv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function FC(e,t){return typeof e=="function"?e(...t):!!e}var oi,ns,Sa,n_,KA=(n_=class extends rl{constructor(){super();ke(this,oi);ke(this,ns);ke(this,Sa);he(this,Sa,t=>{if(!wi&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){z(this,ns)||this.setEventListener(z(this,Sa))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,ns))==null||t.call(this),he(this,ns,void 0))}setEventListener(t){var n;he(this,Sa,t),(n=z(this,ns))==null||n.call(this),he(this,ns,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){z(this,oi)!==t&&(he(this,oi,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof z(this,oi)=="boolean"?z(this,oi):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},oi=new WeakMap,ns=new WeakMap,Sa=new WeakMap,n_),Tv=new KA,Ca,rs,Ea,r_,ZA=(r_=class extends rl{constructor(){super();ke(this,Ca,!0);ke(this,rs);ke(this,Ea);he(this,Ea,t=>{if(!wi&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){z(this,rs)||this.setEventListener(z(this,Ea))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,rs))==null||t.call(this),he(this,rs,void 0))}setEventListener(t){var n;he(this,Ea,t),(n=z(this,rs))==null||n.call(this),he(this,rs,t(this.setOnline.bind(this)))}setOnline(t){z(this,Ca)!==t&&(he(this,Ca,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return z(this,Ca)}},Ca=new WeakMap,rs=new WeakMap,Ea=new WeakMap,r_),lf=new ZA;function cg(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function QA(e){return Math.min(1e3*2**e,3e4)}function UC(e){return(e??"online")==="online"?lf.isOnline():!0}var qC=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function VC(e){let t=!1,n=0,r;const o=cg(),s=()=>o.status!=="pending",i=m=>{var x;s()||(p(new qC(m)),(x=e.abort)==null||x.call(e))},a=()=>{t=!0},l=()=>{t=!1},u=()=>Tv.isFocused()&&(e.networkMode==="always"||lf.isOnline())&&e.canRun(),d=()=>UC(e.networkMode)&&e.canRun(),f=m=>{s()||(r==null||r(),o.resolve(m))},p=m=>{s()||(r==null||r(),o.reject(m))},h=()=>new Promise(m=>{var x;r=g=>{(s()||u())&&m(g)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;r=void 0,s()||(m=e.onContinue)==null||m.call(e)}),y=()=>{if(s())return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(g){m=Promise.reject(g)}Promise.resolve(m).then(f).catch(g=>{var j;if(s())return;const v=e.retry??(wi?0:3),w=e.retryDelay??QA,k=typeof w=="function"?w(n,g):w,C=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,g);if(t||!C){p(g);return}n++,(j=e.onFail)==null||j.call(e,n,g),HA(k).then(()=>u()?void 0:h()).then(()=>{t?p(g):y()})})};return{promise:o,status:()=>o.status,cancel:i,continue:()=>(r==null||r(),o),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?y():h().then(y),o)}}var GA=e=>setTimeout(e,0);function JA(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=GA;const s=a=>{t?e.push(a):o(()=>{n(a)})},i=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||i()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var Ft=JA(),si,o_,HC=(o_=class{constructor(){ke(this,si)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ig(this.gcTime)&&he(this,si,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wi?1/0:5*60*1e3))}clearGcTimeout(){z(this,si)&&(clearTimeout(z(this,si)),he(this,si,void 0))}},si=new WeakMap,o_),Na,ja,nr,ii,Vt,Lc,ai,Sr,ho,s_,YA=(s_=class extends HC{constructor(t){super();ke(this,Sr);ke(this,Na);ke(this,ja);ke(this,nr);ke(this,ii);ke(this,Vt);ke(this,Lc);ke(this,ai);he(this,ai,!1),he(this,Lc,t.defaultOptions),this.setOptions(t.options),this.observers=[],he(this,ii,t.client),he(this,nr,z(this,ii).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,he(this,Na,XA(this.options)),this.state=t.state??z(this,Na),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=z(this,Vt))==null?void 0:t.promise}setOptions(t){this.options={...z(this,Lc),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&z(this,nr).remove(this)}setData(t,n){const r=lg(this.state.data,t,this.options);return Me(this,Sr,ho).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Me(this,Sr,ho).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=z(this,Vt))==null?void 0:r.promise;return(o=z(this,Vt))==null||o.cancel(t),n?n.then(xn).catch(xn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(z(this,Na))}isActive(){return this.observers.some(t=>or(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ks(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:!DC(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,Vt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,Vt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),z(this,nr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(z(this,Vt)&&(z(this,ai)?z(this,Vt).cancel({revert:!0}):z(this,Vt).cancelRetry()),this.scheduleGc()),z(this,nr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Me(this,Sr,ho).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,d,f,p,h,y,m,x,g,v,w;if(this.state.fetchStatus!=="idle"&&((l=z(this,Vt))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(z(this,Vt))return z(this,Vt).continueRetry(),z(this,Vt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(C=>C.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,o=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(he(this,ai,!0),r.signal)})},s=()=>{const k=zC(this.options,n),j=(()=>{const S={client:z(this,ii),queryKey:this.queryKey,meta:this.meta};return o(S),S})();return he(this,ai,!1),this.options.persister?this.options.persister(k,j,this):k(j)},a=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:z(this,ii),state:this.state,fetchFn:s};return o(k),k})();(u=this.options.behavior)==null||u.onFetch(a,this),he(this,ja,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Me(this,Sr,ho).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),he(this,Vt,VC({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(k,C)=>{Me(this,Sr,ho).call(this,{type:"failed",failureCount:k,error:C})},onPause:()=>{Me(this,Sr,ho).call(this,{type:"pause"})},onContinue:()=>{Me(this,Sr,ho).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const k=await z(this,Vt).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(h=(p=z(this,nr).config).onSuccess)==null||h.call(p,k,this),(m=(y=z(this,nr).config).onSettled)==null||m.call(y,k,this.state.error,this),k}catch(k){if(k instanceof qC){if(k.silent)return z(this,Vt).promise;if(k.revert){if(this.setState({...z(this,ja),fetchStatus:"idle"}),this.state.data===void 0)throw k;return this.state.data}}throw Me(this,Sr,ho).call(this,{type:"error",error:k}),(g=(x=z(this,nr).config).onError)==null||g.call(x,k,this),(w=(v=z(this,nr).config).onSettled)==null||w.call(v,this.state.data,k,this),k}finally{this.scheduleGc()}}},Na=new WeakMap,ja=new WeakMap,nr=new WeakMap,ii=new WeakMap,Vt=new WeakMap,Lc=new WeakMap,ai=new WeakMap,Sr=new WeakSet,ho=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...BC(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return he(this,ja,t.manual?o:void 0),o;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ft.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),z(this,nr).notify({query:this,type:"updated",action:t})})},s_);function BC(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:UC(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function XA(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Hr,i_,eO=(i_=class extends rl{constructor(t={}){super();ke(this,Hr);this.config=t,he(this,Hr,new Map)}build(t,n,r){const o=n.queryKey,s=n.queryHash??jv(o,n);let i=this.get(s);return i||(i=new YA({client:t,queryKey:o,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(i)),i}add(t){z(this,Hr).has(t.queryHash)||(z(this,Hr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=z(this,Hr).get(t.queryHash);n&&(t.destroy(),n===t&&z(this,Hr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ft.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return z(this,Hr).get(t)}getAll(){return[...z(this,Hr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>db(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>db(t,r)):n}notify(t){Ft.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ft.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ft.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Hr=new WeakMap,i_),Br,mn,li,Wr,Wo,a_,tO=(a_=class extends HC{constructor(t){super();ke(this,Wr);ke(this,Br);ke(this,mn);ke(this,li);this.mutationId=t.mutationId,he(this,mn,t.mutationCache),he(this,Br,[]),this.state=t.state||WC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){z(this,Br).includes(t)||(z(this,Br).push(t),this.clearGcTimeout(),z(this,mn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){he(this,Br,z(this,Br).filter(n=>n!==t)),this.scheduleGc(),z(this,mn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){z(this,Br).length||(this.state.status==="pending"?this.scheduleGc():z(this,mn).remove(this))}continue(){var t;return((t=z(this,li))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,i,a,l,u,d,f,p,h,y,m,x,g,v,w,k,C,j,S,A;const n=()=>{Me(this,Wr,Wo).call(this,{type:"continue"})};he(this,li,VC({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,$)=>{Me(this,Wr,Wo).call(this,{type:"failed",failureCount:P,error:$})},onPause:()=>{Me(this,Wr,Wo).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>z(this,mn).canRun(this)}));const r=this.state.status==="pending",o=!z(this,li).canStart();try{if(r)n();else{Me(this,Wr,Wo).call(this,{type:"pending",variables:t,isPaused:o}),await((i=(s=z(this,mn).config).onMutate)==null?void 0:i.call(s,t,this));const $=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,t));$!==this.state.context&&Me(this,Wr,Wo).call(this,{type:"pending",context:$,variables:t,isPaused:o})}const P=await z(this,li).start();return await((d=(u=z(this,mn).config).onSuccess)==null?void 0:d.call(u,P,t,this.state.context,this)),await((p=(f=this.options).onSuccess)==null?void 0:p.call(f,P,t,this.state.context)),await((y=(h=z(this,mn).config).onSettled)==null?void 0:y.call(h,P,null,this.state.variables,this.state.context,this)),await((x=(m=this.options).onSettled)==null?void 0:x.call(m,P,null,t,this.state.context)),Me(this,Wr,Wo).call(this,{type:"success",data:P}),P}catch(P){try{throw await((v=(g=z(this,mn).config).onError)==null?void 0:v.call(g,P,t,this.state.context,this)),await((k=(w=this.options).onError)==null?void 0:k.call(w,P,t,this.state.context)),await((j=(C=z(this,mn).config).onSettled)==null?void 0:j.call(C,void 0,P,this.state.variables,this.state.context,this)),await((A=(S=this.options).onSettled)==null?void 0:A.call(S,void 0,P,t,this.state.context)),P}finally{Me(this,Wr,Wo).call(this,{type:"error",error:P})}}finally{z(this,mn).runNext(this)}}},Br=new WeakMap,mn=new WeakMap,li=new WeakMap,Wr=new WeakSet,Wo=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ft.batch(()=>{z(this,Br).forEach(r=>{r.onMutationUpdate(t)}),z(this,mn).notify({mutation:this,type:"updated",action:t})})},a_);function WC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var yo,Cr,zc,l_,nO=(l_=class extends rl{constructor(t={}){super();ke(this,yo);ke(this,Cr);ke(this,zc);this.config=t,he(this,yo,new Set),he(this,Cr,new Map),he(this,zc,0)}build(t,n,r){const o=new tO({mutationCache:this,mutationId:++pu(this,zc)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){z(this,yo).add(t);const n=$u(t);if(typeof n=="string"){const r=z(this,Cr).get(n);r?r.push(t):z(this,Cr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(z(this,yo).delete(t)){const n=$u(t);if(typeof n=="string"){const r=z(this,Cr).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&z(this,Cr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=$u(t);if(typeof n=="string"){const r=z(this,Cr).get(n),o=r==null?void 0:r.find(s=>s.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=$u(t);if(typeof n=="string"){const o=(r=z(this,Cr).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ft.batch(()=>{z(this,yo).forEach(t=>{this.notify({type:"removed",mutation:t})}),z(this,yo).clear(),z(this,Cr).clear()})}getAll(){return Array.from(z(this,yo))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>fb(n,r))}findAll(t={}){return this.getAll().filter(n=>fb(t,n))}notify(t){Ft.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ft.batch(()=>Promise.all(t.map(n=>n.continue().catch(xn))))}},yo=new WeakMap,Cr=new WeakMap,zc=new WeakMap,l_);function $u(e){var t;return(t=e.options.scope)==null?void 0:t.id}function mb(e){return{onFetch:(t,n)=>{var d,f,p,h,y;const r=t.options,o=(p=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((h=t.state.data)==null?void 0:h.pages)||[],i=((y=t.state.data)==null?void 0:y.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},g=zC(t.options,t.fetchOptions),v=async(w,k,C)=>{if(m)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const S=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:k,direction:C?"backward":"forward",meta:t.options.meta};return x(T),T})(),A=await g(S),{maxPages:P}=t.options,$=C?WA:BA;return{pages:$(w.pages,A,P),pageParams:$(w.pageParams,k,P)}};if(o&&s.length){const w=o==="backward",k=w?rO:gb,C={pages:s,pageParams:i},j=k(r,C);a=await v(C,j,w)}else{const w=e??s.length;do{const k=l===0?i[0]??r.initialPageParam:gb(r,a);if(l>0&&k==null)break;a=await v(a,k),l++}while(l<w)}return a};t.options.persister?t.fetchFn=()=>{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function gb(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rO(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Et,os,ss,Pa,Ta,is,Ra,$a,c_,oO=(c_=class{constructor(e={}){ke(this,Et);ke(this,os);ke(this,ss);ke(this,Pa);ke(this,Ta);ke(this,is);ke(this,Ra);ke(this,$a);he(this,Et,e.queryCache||new eO),he(this,os,e.mutationCache||new nO),he(this,ss,e.defaultOptions||{}),he(this,Pa,new Map),he(this,Ta,new Map),he(this,is,0)}mount(){pu(this,is)._++,z(this,is)===1&&(he(this,Ra,Tv.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,Et).onFocus())})),he(this,$a,lf.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,Et).onOnline())})))}unmount(){var e,t;pu(this,is)._--,z(this,is)===0&&((e=z(this,Ra))==null||e.call(this),he(this,Ra,void 0),(t=z(this,$a))==null||t.call(this),he(this,$a,void 0))}isFetching(e){return z(this,Et).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return z(this,os).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,Et).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=z(this,Et).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ks(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return z(this,Et).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=z(this,Et).get(r.queryHash),s=o==null?void 0:o.state.data,i=VA(t,s);if(i!==void 0)return z(this,Et).build(this,r).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Ft.batch(()=>z(this,Et).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,Et).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=z(this,Et);Ft.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=z(this,Et);return Ft.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ft.batch(()=>z(this,Et).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(xn).catch(xn)}invalidateQueries(e,t={}){return Ft.batch(()=>(z(this,Et).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ft.batch(()=>z(this,Et).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(xn)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(xn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=z(this,Et).build(this,t);return n.isStaleByTime(ks(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xn).catch(xn)}fetchInfiniteQuery(e){return e.behavior=mb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xn).catch(xn)}ensureInfiniteQueryData(e){return e.behavior=mb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return lf.isOnline()?z(this,os).resumePausedMutations():Promise.resolve()}getQueryCache(){return z(this,Et)}getMutationCache(){return z(this,os)}getDefaultOptions(){return z(this,ss)}setDefaultOptions(e){he(this,ss,e)}setQueryDefaults(e,t){z(this,Pa).set(bi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...z(this,Pa).values()],n={};return t.forEach(r=>{jc(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){z(this,Ta).set(bi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...z(this,Ta).values()],n={};return t.forEach(r=>{jc(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...z(this,ss).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=jv(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===Pv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...z(this,ss).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){z(this,Et).clear(),z(this,os).clear()}},Et=new WeakMap,os=new WeakMap,ss=new WeakMap,Pa=new WeakMap,Ta=new WeakMap,is=new WeakMap,Ra=new WeakMap,$a=new WeakMap,c_),En,Be,Fc,gn,ci,Ia,vo,as,Uc,Aa,Oa,ui,di,ls,Ma,Je,Dl,ug,dg,fg,hg,pg,mg,gg,KC,u_,sO=(u_=class extends rl{constructor(t,n){super();ke(this,Je);ke(this,En);ke(this,Be);ke(this,Fc);ke(this,gn);ke(this,ci);ke(this,Ia);ke(this,vo);ke(this,as);ke(this,Uc);ke(this,Aa);ke(this,Oa);ke(this,ui);ke(this,di);ke(this,ls);ke(this,Ma,new Set);this.options=n,he(this,En,t),he(this,as,null),he(this,vo,cg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(z(this,Be).addObserver(this),yb(z(this,Be),this.options)?Me(this,Je,Dl).call(this):this.updateResult(),Me(this,Je,hg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return yg(z(this,Be),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return yg(z(this,Be),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Me(this,Je,pg).call(this),Me(this,Je,mg).call(this),z(this,Be).removeObserver(this)}setOptions(t){const n=this.options,r=z(this,Be);if(this.options=z(this,En).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof or(this.options.enabled,z(this,Be))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Me(this,Je,gg).call(this),z(this,Be).setOptions(this.options),n._defaulted&&!af(this.options,n)&&z(this,En).getQueryCache().notify({type:"observerOptionsUpdated",query:z(this,Be),observer:this});const o=this.hasListeners();o&&vb(z(this,Be),r,this.options,n)&&Me(this,Je,Dl).call(this),this.updateResult(),o&&(z(this,Be)!==r||or(this.options.enabled,z(this,Be))!==or(n.enabled,z(this,Be))||ks(this.options.staleTime,z(this,Be))!==ks(n.staleTime,z(this,Be)))&&Me(this,Je,ug).call(this);const s=Me(this,Je,dg).call(this);o&&(z(this,Be)!==r||or(this.options.enabled,z(this,Be))!==or(n.enabled,z(this,Be))||s!==z(this,ls))&&Me(this,Je,fg).call(this,s)}getOptimisticResult(t){const n=z(this,En).getQueryCache().build(z(this,En),t),r=this.createResult(n,t);return aO(this,r)&&(he(this,gn,r),he(this,Ia,this.options),he(this,ci,z(this,Be).state)),r}getCurrentResult(){return z(this,gn)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&!this.options.experimental_prefetchInRender&&z(this,vo).status==="pending"&&z(this,vo).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,o))})}trackProp(t){z(this,Ma).add(t)}getCurrentQuery(){return z(this,Be)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=z(this,En).defaultQueryOptions(t),r=z(this,En).getQueryCache().build(z(this,En),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Me(this,Je,Dl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),z(this,gn)))}createResult(t,n){var P;const r=z(this,Be),o=this.options,s=z(this,gn),i=z(this,ci),a=z(this,Ia),u=t!==r?t.state:z(this,Fc),{state:d}=t;let f={...d},p=!1,h;if(n._optimisticResults){const $=this.hasListeners(),T=!$&&yb(t,n),I=$&&vb(t,r,n,o);(T||I)&&(f={...f,...BC(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:y,errorUpdatedAt:m,status:x}=f;h=f.data;let g=!1;if(n.placeholderData!==void 0&&h===void 0&&x==="pending"){let $;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?($=s.data,g=!0):$=typeof n.placeholderData=="function"?n.placeholderData((P=z(this,Oa))==null?void 0:P.state.data,z(this,Oa)):n.placeholderData,$!==void 0&&(x="success",h=lg(s==null?void 0:s.data,$,n),p=!0)}if(n.select&&h!==void 0&&!g)if(s&&h===(i==null?void 0:i.data)&&n.select===z(this,Uc))h=z(this,Aa);else try{he(this,Uc,n.select),h=n.select(h),h=lg(s==null?void 0:s.data,h,n),he(this,Aa,h),he(this,as,null)}catch($){he(this,as,$)}z(this,as)&&(y=z(this,as),h=z(this,Aa),m=Date.now(),x="error");const v=f.fetchStatus==="fetching",w=x==="pending",k=x==="error",C=w&&v,j=h!==void 0,A={status:x,fetchStatus:f.fetchStatus,isPending:w,isSuccess:x==="success",isError:k,isInitialLoading:C,isLoading:C,data:h,dataUpdatedAt:f.dataUpdatedAt,error:y,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:v,isRefetching:v&&!w,isLoadingError:k&&!j,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:k&&j,isStale:Rv(t,n),refetch:this.refetch,promise:z(this,vo),isEnabled:or(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=U=>{A.status==="error"?U.reject(A.error):A.data!==void 0&&U.resolve(A.data)},T=()=>{const U=he(this,vo,A.promise=cg());$(U)},I=z(this,vo);switch(I.status){case"pending":t.queryHash===r.queryHash&&$(I);break;case"fulfilled":(A.status==="error"||A.data!==I.value)&&T();break;case"rejected":(A.status!=="error"||A.error!==I.reason)&&T();break}}return A}updateResult(){const t=z(this,gn),n=this.createResult(z(this,Be),this.options);if(he(this,ci,z(this,Be).state),he(this,Ia,this.options),z(this,ci).data!==void 0&&he(this,Oa,z(this,Be)),af(n,t))return;he(this,gn,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,s=typeof o=="function"?o():o;if(s==="all"||!s&&!z(this,Ma).size)return!0;const i=new Set(s??z(this,Ma));return this.options.throwOnError&&i.add("error"),Object.keys(z(this,gn)).some(a=>{const l=a;return z(this,gn)[l]!==t[l]&&i.has(l)})};Me(this,Je,KC).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Me(this,Je,hg).call(this)}},En=new WeakMap,Be=new WeakMap,Fc=new WeakMap,gn=new WeakMap,ci=new WeakMap,Ia=new WeakMap,vo=new WeakMap,as=new WeakMap,Uc=new WeakMap,Aa=new WeakMap,Oa=new WeakMap,ui=new WeakMap,di=new WeakMap,ls=new WeakMap,Ma=new WeakMap,Je=new WeakSet,Dl=function(t){Me(this,Je,gg).call(this);let n=z(this,Be).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(xn)),n},ug=function(){Me(this,Je,pg).call(this);const t=ks(this.options.staleTime,z(this,Be));if(wi||z(this,gn).isStale||!ig(t))return;const r=DC(z(this,gn).dataUpdatedAt,t)+1;he(this,ui,setTimeout(()=>{z(this,gn).isStale||this.updateResult()},r))},dg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(z(this,Be)):this.options.refetchInterval)??!1},fg=function(t){Me(this,Je,mg).call(this),he(this,ls,t),!(wi||or(this.options.enabled,z(this,Be))===!1||!ig(z(this,ls))||z(this,ls)===0)&&he(this,di,setInterval(()=>{(this.options.refetchIntervalInBackground||Tv.isFocused())&&Me(this,Je,Dl).call(this)},z(this,ls)))},hg=function(){Me(this,Je,ug).call(this),Me(this,Je,fg).call(this,Me(this,Je,dg).call(this))},pg=function(){z(this,ui)&&(clearTimeout(z(this,ui)),he(this,ui,void 0))},mg=function(){z(this,di)&&(clearInterval(z(this,di)),he(this,di,void 0))},gg=function(){const t=z(this,En).getQueryCache().build(z(this,En),this.options);if(t===z(this,Be))return;const n=z(this,Be);he(this,Be,t),he(this,Fc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},KC=function(t){Ft.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(z(this,gn))}),z(this,En).getQueryCache().notify({query:z(this,Be),type:"observerResultsUpdated"})})},u_);function iO(e,t){return or(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function yb(e,t){return iO(e,t)||e.state.data!==void 0&&yg(e,t,t.refetchOnMount)}function yg(e,t,n){if(or(t.enabled,e)!==!1&&ks(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Rv(e,t)}return!1}function vb(e,t,n,r){return(e!==t||or(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Rv(e,n)}function Rv(e,t){return or(t.enabled,e)!==!1&&e.isStaleByTime(ks(t.staleTime,e))}function aO(e,t){return!af(e.getCurrentResult(),t)}var cs,us,Nn,xo,No,gd,vg,d_,lO=(d_=class extends rl{constructor(n,r){super();ke(this,No);ke(this,cs);ke(this,us);ke(this,Nn);ke(this,xo);he(this,cs,n),this.setOptions(r),this.bindMethods(),Me(this,No,gd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=z(this,cs).defaultMutationOptions(n),af(this.options,r)||z(this,cs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:z(this,Nn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&bi(r.mutationKey)!==bi(this.options.mutationKey)?this.reset():((o=z(this,Nn))==null?void 0:o.state.status)==="pending"&&z(this,Nn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=z(this,Nn))==null||n.removeObserver(this)}onMutationUpdate(n){Me(this,No,gd).call(this),Me(this,No,vg).call(this,n)}getCurrentResult(){return z(this,us)}reset(){var n;(n=z(this,Nn))==null||n.removeObserver(this),he(this,Nn,void 0),Me(this,No,gd).call(this),Me(this,No,vg).call(this)}mutate(n,r){var o;return he(this,xo,r),(o=z(this,Nn))==null||o.removeObserver(this),he(this,Nn,z(this,cs).getMutationCache().build(z(this,cs),this.options)),z(this,Nn).addObserver(this),z(this,Nn).execute(n)}},cs=new WeakMap,us=new WeakMap,Nn=new WeakMap,xo=new WeakMap,No=new WeakSet,gd=function(){var r;const n=((r=z(this,Nn))==null?void 0:r.state)??WC();he(this,us,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},vg=function(n){Ft.batch(()=>{var r,o,s,i,a,l,u,d;if(z(this,xo)&&this.hasListeners()){const f=z(this,us).variables,p=z(this,us).context;(n==null?void 0:n.type)==="success"?((o=(r=z(this,xo)).onSuccess)==null||o.call(r,n.data,f,p),(i=(s=z(this,xo)).onSettled)==null||i.call(s,n.data,null,f,p)):(n==null?void 0:n.type)==="error"&&((l=(a=z(this,xo)).onError)==null||l.call(a,n.error,f,p),(d=(u=z(this,xo)).onSettled)==null||d.call(u,void 0,n.error,f,p))}this.listeners.forEach(f=>{f(z(this,us))})})},d_),ZC=b.createContext(void 0),nn=e=>{const t=b.useContext(ZC);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cO=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(ZC.Provider,{value:e,children:t})),QC=b.createContext(!1),uO=()=>b.useContext(QC);QC.Provider;function dO(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fO=b.createContext(dO()),hO=()=>b.useContext(fO),pO=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},mO=e=>{b.useEffect(()=>{e.clearReset()},[e])},gO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||FC(n,[e.error,r])),yO=e=>{if(e.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...r)=>t(n(...r)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},vO=(e,t)=>e.isLoading&&e.isFetching&&!t,xO=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,xb=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function wO(e,t,n){var f,p,h,y,m;const r=uO(),o=hO(),s=nn(),i=s.defaultQueryOptions(e);(p=(f=s.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||p.call(f,i),i._optimisticResults=r?"isRestoring":"optimistic",yO(i),pO(i,o),mO(o);const a=!s.getQueryCache().get(i.queryHash),[l]=b.useState(()=>new t(s,i)),u=l.getOptimisticResult(i),d=!r&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(x=>{const g=d?l.subscribe(Ft.batchCalls(x)):xn;return l.updateResult(),g},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(i)},[i,l]),xO(i,u))throw xb(i,l,o);if(gO({result:u,errorResetBoundary:o,throwOnError:i.throwOnError,query:s.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((y=(h=s.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,i,u),i.experimental_prefetchInRender&&!wi&&vO(u,r)){const x=a?xb(i,l,o):(m=s.getQueryCache().get(i.queryHash))==null?void 0:m.promise;x==null||x.catch(xn).finally(()=>{l.updateResult()})}return i.notifyOnChangeProps?u:l.trackResult(u)}function It(e,t){return wO(e,sO)}function gt(e,t){const n=nn(),[r]=b.useState(()=>new lO(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const o=b.useSyncExternalStore(b.useCallback(i=>r.subscribe(Ft.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=b.useCallback((i,a)=>{r.mutate(i,a).catch(xn)},[r]);if(o.error&&FC(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}const bO="x-agent-deck-client",kO="dashboard",GC={[bO]:kO};async function JC(e){if(e.ok)return;let t=e.statusText;try{const n=await e.text();try{const r=JSON.parse(n);t=r.error||r.message||t}catch{n.trim()&&(t=`${e.status}: ${n}`)}}catch(n){console.warn("Response body parsing failed:",n)}throw new Error(t)}async function Ne(e,t,n){const r=await fetch(t,{method:e,headers:{...GC,...n?{"Content-Type":"application/json"}:{}},body:n?JSON.stringify(n):void 0});return await JC(r),r}const _O=({on401:e})=>async({queryKey:t})=>{const n=t.join("/"),r=await fetch(n,{headers:GC});return await JC(r),await r.json()},SO=new oO({defaultOptions:{queries:{queryFn:_O({on401:"throw"}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:10*60*1e3,retry:!1},mutations:{retry:!1}}}),CO=1,EO=1e6;let bp=0;function NO(){return bp=(bp+1)%Number.MAX_SAFE_INTEGER,bp.toString()}const kp=new Map,wb=e=>{if(kp.has(e))return;const t=setTimeout(()=>{kp.delete(e),Xl({type:"REMOVE_TOAST",toastId:e})},EO);kp.set(e,t)},jO=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,CO)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?wb(n):e.toasts.forEach(r=>{wb(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},yd=[];let vd={toasts:[]};function Xl(e){vd=jO(vd,e),yd.forEach(t=>{t(vd)})}function PO({...e}){const t=NO(),n=o=>Xl({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>Xl({type:"DISMISS_TOAST",toastId:t});return Xl({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Wt(){const[e,t]=b.useState(vd);return b.useEffect(()=>(yd.push(t),()=>{const n=yd.indexOf(t);n>-1&&yd.splice(n,1)}),[e]),{...e,toast:PO,dismiss:n=>Xl({type:"DISMISS_TOAST",toastId:n})}}function be(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function bb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function YC(...e){return t=>{let n=!1;const r=e.map(o=>{const s=bb(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():bb(e[o],null)}}}}function Ye(...e){return b.useCallback(YC(...e),e)}function TO(e,t){const n=b.createContext(t),r=s=>{const{children:i,...a}=s,l=b.useMemo(()=>a,Object.values(a));return c.jsx(n.Provider,{value:l,children:i})};r.displayName=e+"Provider";function o(s){const i=b.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function ro(e,t=[]){let n=[];function r(s,i){const a=b.createContext(i),l=n.length;n=[...n,i];const u=f=>{var g;const{scope:p,children:h,...y}=f,m=((g=p==null?void 0:p[e])==null?void 0:g[l])||a,x=b.useMemo(()=>y,Object.values(y));return c.jsx(m.Provider,{value:x,children:h})};u.displayName=s+"Provider";function d(f,p){var m;const h=((m=p==null?void 0:p[e])==null?void 0:m[l])||a,y=b.useContext(h);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>b.createContext(i));return function(a){const l=(a==null?void 0:a[e])||s;return b.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,RO(o,...t)]}function RO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:l,scopeName:u})=>{const f=l(s)[`__scope${u}`];return{...a,...f}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function ki(e){const t=IO(e),n=b.forwardRef((r,o)=>{const{children:s,...i}=r,a=b.Children.toArray(s),l=a.find(OO);if(l){const u=l.props.children,d=a.map(f=>f===l?b.Children.count(u)>1?b.Children.only(null):b.isValidElement(u)?u.props.children:null:f);return c.jsx(t,{...i,ref:o,children:b.isValidElement(u)?b.cloneElement(u,void 0,d):null})}return c.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var $O=ki("Slot");function IO(e){const t=b.forwardRef((n,r)=>{const{children:o,...s}=n;if(b.isValidElement(o)){const i=DO(o),a=MO(s,o.props);return o.type!==b.Fragment&&(a.ref=r?YC(r,i):i),b.cloneElement(o,a)}return b.Children.count(o)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var XC=Symbol("radix.slottable");function AO(e){const t=({children:n})=>c.jsx(c.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=XC,t}function OO(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===XC}function MO(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const l=s(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function DO(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function $v(e){const t=e+"CollectionProvider",[n,r]=ro(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:g}=m,v=Vr.useRef(null),w=Vr.useRef(new Map).current;return c.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:g})};i.displayName=t;const a=e+"CollectionSlot",l=ki(a),u=Vr.forwardRef((m,x)=>{const{scope:g,children:v}=m,w=s(a,g),k=Ye(x,w.collectionRef);return c.jsx(l,{ref:k,children:v})});u.displayName=a;const d=e+"CollectionItemSlot",f="data-radix-collection-item",p=ki(d),h=Vr.forwardRef((m,x)=>{const{scope:g,children:v,...w}=m,k=Vr.useRef(null),C=Ye(x,k),j=s(d,g);return Vr.useEffect(()=>(j.itemMap.set(k,{ref:k,...w}),()=>void j.itemMap.delete(k))),c.jsx(p,{[f]:"",ref:C,children:v})});h.displayName=d;function y(m){const x=s(e+"CollectionConsumer",m);return Vr.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((j,S)=>w.indexOf(j.ref.current)-w.indexOf(S.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},y,r]}var LO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Te=LO.reduce((e,t)=>{const n=ki(`Primitive.${t}`),r=b.forwardRef((o,s)=>{const{asChild:i,...a}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function eE(e,t){e&&$i.flushSync(()=>e.dispatchEvent(t))}function fr(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function zO(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e);b.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var FO="DismissableLayer",xg="dismissableLayer.update",UO="dismissableLayer.pointerDownOutside",qO="dismissableLayer.focusOutside",kb,tE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ol=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...l}=e,u=b.useContext(tE),[d,f]=b.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=b.useState({}),y=Ye(t,S=>f(S)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(x),v=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,k=v>=g,C=HO(S=>{const A=S.target,P=[...u.branches].some($=>$.contains(A));!k||P||(o==null||o(S),i==null||i(S),S.defaultPrevented||a==null||a())},p),j=BO(S=>{const A=S.target;[...u.branches].some($=>$.contains(A))||(s==null||s(S),i==null||i(S),S.defaultPrevented||a==null||a())},p);return zO(S=>{v===u.layers.size-1&&(r==null||r(S),!S.defaultPrevented&&a&&(S.preventDefault(),a()))},p),b.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(kb=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),_b(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=kb)}},[d,p,n,u]),b.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),_b())},[d,u]),b.useEffect(()=>{const S=()=>h({});return document.addEventListener(xg,S),()=>document.removeEventListener(xg,S)},[]),c.jsx(Te.div,{...l,ref:y,style:{pointerEvents:w?k?"auto":"none":void 0,...e.style},onFocusCapture:be(e.onFocusCapture,j.onFocusCapture),onBlurCapture:be(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:be(e.onPointerDownCapture,C.onPointerDownCapture)})});ol.displayName=FO;var VO="DismissableLayerBranch",nE=b.forwardRef((e,t)=>{const n=b.useContext(tE),r=b.useRef(null),o=Ye(t,r);return b.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),c.jsx(Te.div,{...e,ref:o})});nE.displayName=VO;function HO(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e),r=b.useRef(!1),o=b.useRef(()=>{});return b.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){rE(UO,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function BO(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e),r=b.useRef(!1);return b.useEffect(()=>{const o=s=>{s.target&&!r.current&&rE(qO,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function _b(){const e=new CustomEvent(xg);document.dispatchEvent(e)}function rE(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?eE(o,s):o.dispatchEvent(s)}var WO=ol,KO=nE,tn=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},ZO="Portal",Zc=b.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=b.useState(!1);tn(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?dA.createPortal(c.jsx(Te.div,{...r,ref:t}),i):null});Zc.displayName=ZO;function QO(e,t){return b.useReducer((n,r)=>t[n][r]??n,e)}var oo=e=>{const{present:t,children:n}=e,r=GO(t),o=typeof n=="function"?n({present:r.isPresent}):b.Children.only(n),s=Ye(r.ref,JO(o));return typeof n=="function"||r.isPresent?b.cloneElement(o,{ref:s}):null};oo.displayName="Presence";function GO(e){const[t,n]=b.useState(),r=b.useRef(null),o=b.useRef(e),s=b.useRef("none"),i=e?"mounted":"unmounted",[a,l]=QO(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const u=Iu(r.current);s.current=a==="mounted"?u:"none"},[a]),tn(()=>{const u=r.current,d=o.current;if(d!==e){const p=s.current,h=Iu(u);e?l("MOUNT"):h==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),tn(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const m=Iu(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&m&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=h=>{h.target===t&&(s.current=Iu(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:b.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Iu(e){return(e==null?void 0:e.animationName)||"none"}function JO(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var YO=Oy[" useInsertionEffect ".trim().toString()]||tn;function Es({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=XO({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const d=b.useRef(e!==void 0);b.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} 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,r])}const u=b.useCallback(d=>{var f;if(a){const p=eM(d)?d(e):d;p!==e&&((f=i.current)==null||f.call(i,p))}else s(d)},[a,e,s,i]);return[l,u]}function XO({defaultProp:e,onChange:t}){const[n,r]=b.useState(e),o=b.useRef(n),s=b.useRef(t);return YO(()=>{s.current=t},[t]),b.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function eM(e){return typeof e=="function"}var oE=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"}),tM="VisuallyHidden",ih=b.forwardRef((e,t)=>c.jsx(Te.span,{...e,ref:t,style:{...oE,...e.style}}));ih.displayName=tM;var nM=ih,Iv="ToastProvider",[Av,rM,oM]=$v("Toast"),[sE,BX]=ro("Toast",[oM]),[sM,ah]=sE(Iv),iE=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,l]=b.useState(null),[u,d]=b.useState(0),f=b.useRef(!1),p=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Iv}\`. Expected non-empty \`string\`.`),c.jsx(Av.Provider,{scope:t,children:c.jsx(sM,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:b.useCallback(()=>d(h=>h+1),[]),onToastRemove:b.useCallback(()=>d(h=>h-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:p,children:i})})};iE.displayName=Iv;var aE="ToastViewport",iM=["F8"],wg="toast.viewportPause",bg="toast.viewportResume",lE=b.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=iM,label:o="Notifications ({hotkey})",...s}=e,i=ah(aE,n),a=rM(n),l=b.useRef(null),u=b.useRef(null),d=b.useRef(null),f=b.useRef(null),p=Ye(t,f,i.onViewportChange),h=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=i.toastCount>0;b.useEffect(()=>{const x=g=>{var w;r.length!==0&&r.every(k=>g[k]||g.code===k)&&((w=f.current)==null||w.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),b.useEffect(()=>{const x=l.current,g=f.current;if(y&&x&&g){const v=()=>{if(!i.isClosePausedRef.current){const j=new CustomEvent(wg);g.dispatchEvent(j),i.isClosePausedRef.current=!0}},w=()=>{if(i.isClosePausedRef.current){const j=new CustomEvent(bg);g.dispatchEvent(j),i.isClosePausedRef.current=!1}},k=j=>{!x.contains(j.relatedTarget)&&w()},C=()=>{x.contains(document.activeElement)||w()};return x.addEventListener("focusin",v),x.addEventListener("focusout",k),x.addEventListener("pointermove",v),x.addEventListener("pointerleave",C),window.addEventListener("blur",v),window.addEventListener("focus",w),()=>{x.removeEventListener("focusin",v),x.removeEventListener("focusout",k),x.removeEventListener("pointermove",v),x.removeEventListener("pointerleave",C),window.removeEventListener("blur",v),window.removeEventListener("focus",w)}}},[y,i.isClosePausedRef]);const m=b.useCallback(({tabbingDirection:x})=>{const v=a().map(w=>{const k=w.ref.current,C=[k,...xM(k)];return x==="forwards"?C:C.reverse()});return(x==="forwards"?v.reverse():v).flat()},[a]);return b.useEffect(()=>{const x=f.current;if(x){const g=v=>{var C,j,S;const w=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!w){const A=document.activeElement,P=v.shiftKey;if(v.target===x&&P){(C=u.current)==null||C.focus();return}const I=m({tabbingDirection:P?"backwards":"forwards"}),U=I.findIndex(O=>O===A);_p(I.slice(U+1))?v.preventDefault():P?(j=u.current)==null||j.focus():(S=d.current)==null||S.focus()}};return x.addEventListener("keydown",g),()=>x.removeEventListener("keydown",g)}},[a,m]),c.jsxs(KO,{ref:l,role:"region","aria-label":o.replace("{hotkey}",h),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&c.jsx(kg,{ref:u,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"forwards"});_p(x)}}),c.jsx(Av.Slot,{scope:n,children:c.jsx(Te.ol,{tabIndex:-1,...s,ref:p})}),y&&c.jsx(kg,{ref:d,onFocusFromOutsideViewport:()=>{const x=m({tabbingDirection:"backwards"});_p(x)}})]})});lE.displayName=aE;var cE="ToastFocusProxy",kg=b.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=ah(cE,n);return c.jsx(ih,{tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var u;const a=i.relatedTarget;!((u=s.viewport)!=null&&u.contains(a))&&r()}})});kg.displayName=cE;var Qc="Toast",aM="toast.swipeStart",lM="toast.swipeMove",cM="toast.swipeCancel",uM="toast.swipeEnd",uE=b.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a,l]=Es({prop:r,defaultProp:o??!0,onChange:s,caller:Qc});return c.jsx(oo,{present:n||a,children:c.jsx(hM,{open:a,...i,ref:t,onClose:()=>l(!1),onPause:fr(e.onPause),onResume:fr(e.onResume),onSwipeStart:be(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:be(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:be(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:be(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`),l(!1)})})})});uE.displayName=Qc;var[dM,fM]=sE(Qc,{onClose(){}}),hM=b.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:p,onSwipeEnd:h,...y}=e,m=ah(Qc,n),[x,g]=b.useState(null),v=Ye(t,O=>g(O)),w=b.useRef(null),k=b.useRef(null),C=o||m.duration,j=b.useRef(0),S=b.useRef(C),A=b.useRef(0),{onToastAdd:P,onToastRemove:$}=m,T=fr(()=>{var B;(x==null?void 0:x.contains(document.activeElement))&&((B=m.viewport)==null||B.focus()),i()}),I=b.useCallback(O=>{!O||O===1/0||(window.clearTimeout(A.current),j.current=new Date().getTime(),A.current=window.setTimeout(T,O))},[T]);b.useEffect(()=>{const O=m.viewport;if(O){const B=()=>{I(S.current),u==null||u()},J=()=>{const Q=new Date().getTime()-j.current;S.current=S.current-Q,window.clearTimeout(A.current),l==null||l()};return O.addEventListener(wg,J),O.addEventListener(bg,B),()=>{O.removeEventListener(wg,J),O.removeEventListener(bg,B)}}},[m.viewport,C,l,u,I]),b.useEffect(()=>{s&&!m.isClosePausedRef.current&&I(C)},[s,C,m.isClosePausedRef,I]),b.useEffect(()=>(P(),()=>$()),[P,$]);const U=b.useMemo(()=>x?yE(x):null,[x]);return m.viewport?c.jsxs(c.Fragment,{children:[U&&c.jsx(pM,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:U}),c.jsx(dM,{scope:n,onClose:T,children:$i.createPortal(c.jsx(Av.ItemSlot,{scope:n,children:c.jsx(WO,{asChild:!0,onEscapeKeyDown:be(a,()=>{m.isFocusedToastEscapeKeyDownRef.current||T(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:c.jsx(Te.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":m.swipeDirection,...y,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:be(e.onKeyDown,O=>{O.key==="Escape"&&(a==null||a(O.nativeEvent),O.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,T()))}),onPointerDown:be(e.onPointerDown,O=>{O.button===0&&(w.current={x:O.clientX,y:O.clientY})}),onPointerMove:be(e.onPointerMove,O=>{if(!w.current)return;const B=O.clientX-w.current.x,J=O.clientY-w.current.y,Q=!!k.current,H=["left","right"].includes(m.swipeDirection),W=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,N=H?W(0,B):0,M=H?0:W(0,J),V=O.pointerType==="touch"?10:2,_={x:N,y:M},E={originalEvent:O,delta:_};Q?(k.current=_,Au(lM,f,E,{discrete:!1})):Sb(_,m.swipeDirection,V)?(k.current=_,Au(aM,d,E,{discrete:!1}),O.target.setPointerCapture(O.pointerId)):(Math.abs(B)>V||Math.abs(J)>V)&&(w.current=null)}),onPointerUp:be(e.onPointerUp,O=>{const B=k.current,J=O.target;if(J.hasPointerCapture(O.pointerId)&&J.releasePointerCapture(O.pointerId),k.current=null,w.current=null,B){const Q=O.currentTarget,H={originalEvent:O,delta:B};Sb(B,m.swipeDirection,m.swipeThreshold)?Au(uM,h,H,{discrete:!0}):Au(cM,p,H,{discrete:!0}),Q.addEventListener("click",W=>W.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),pM=e=>{const{__scopeToast:t,children:n,...r}=e,o=ah(Qc,t),[s,i]=b.useState(!1),[a,l]=b.useState(!1);return yM(()=>i(!0)),b.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:c.jsx(Zc,{asChild:!0,children:c.jsx(ih,{...r,children:s&&c.jsxs(c.Fragment,{children:[o.label," ",n]})})})},mM="ToastTitle",dE=b.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(Te.div,{...r,ref:t})});dE.displayName=mM;var gM="ToastDescription",fE=b.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return c.jsx(Te.div,{...r,ref:t})});fE.displayName=gM;var hE="ToastAction",pE=b.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?c.jsx(gE,{altText:n,asChild:!0,children:c.jsx(Ov,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${hE}\`. Expected non-empty \`string\`.`),null)});pE.displayName=hE;var mE="ToastClose",Ov=b.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=fM(mE,n);return c.jsx(gE,{asChild:!0,children:c.jsx(Te.button,{type:"button",...r,ref:t,onClick:be(e.onClick,o.onClose)})})});Ov.displayName=mE;var gE=b.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return c.jsx(Te.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function yE(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),vM(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...yE(r))}}),t}function Au(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?eE(o,s):o.dispatchEvent(s)}var Sb=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function yM(e=()=>{}){const t=fr(e);tn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function vM(e){return e.nodeType===e.ELEMENT_NODE}function xM(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function _p(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var wM=iE,vE=lE,xE=uE,wE=dE,bE=fE,kE=pE,_E=Ov;function SE(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=SE(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function CE(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=SE(e))&&(r&&(r+=" "),r+=t);return r}const Cb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Eb=CE,lh=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Eb(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],f=s==null?void 0:s[u];if(d===null)return null;const p=Cb(d)||Cb(f);return o[u][p]}),a=n&&Object.entries(n).reduce((u,d)=>{let[f,p]=d;return p===void 0||(u[f]=p),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:p,...h}=d;return Object.entries(h).every(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...u,f,p]:u},[]);return Eb(e,i,l,n==null?void 0:n.class,n==null?void 0:n.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 bM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),EE=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).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 kM={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 _M=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},l)=>b.createElement("svg",{ref:l,...kM,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:EE("lucide",o),...a},[...i.map(([u,d])=>b.createElement(u,d)),...Array.isArray(s)?s:[s]]));/**
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 Fe=(e,t)=>{const n=b.forwardRef(({className:r,...o},s)=>b.createElement(_M,{ref:s,iconNode:t,className:EE(`lucide-${bM(e)}`,r),...o}));return n.displayName=`${e}`,n};/**
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 SM=Fe("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 CM=Fe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
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 NE=Fe("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"}]]);/**
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 Mv=Fe("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"}]]);/**
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 EM=Fe("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"}]]);/**
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 Sp=Fe("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"}]]);/**
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 jE=Fe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 ch=Fe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 NM=Fe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
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 jM=Fe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 PM=Fe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 PE=Fe("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"}]]);/**
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 _g=Fe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
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 Nb=Fe("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"}]]);/**
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 TM=Fe("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"}]]);/**
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 TE=Fe("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"}]]);/**
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 jb=Fe("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"}]]);/**
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 RE=Fe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
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 _o=Fe("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"}]]);/**
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 RM=Fe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
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 $M=Fe("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/**
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 Sg=Fe("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"}]]);/**
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 Ou=Fe("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"}]]);/**
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 cf=Fe("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"}]]);/**
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 IM=Fe("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"}]]);/**
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 Pb=Fe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 AM=Fe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 ni=Fe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 OM=Fe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
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 $E=Fe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 uf=Fe("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"}]]);/**
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 MM=Fe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 uh=Fe("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"}]]);/**
234
- * @license lucide-react v0.453.0 - ISC
235
- *
236
- * This source code is licensed under the ISC license.
237
- * See the LICENSE file in the root directory of this source tree.
238
- */const jr=Fe("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"}]]);/**
239
- * @license lucide-react v0.453.0 - ISC
240
- *
241
- * This source code is licensed under the ISC license.
242
- * See the LICENSE file in the root directory of this source tree.
243
- */const DM=Fe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
244
- * @license lucide-react v0.453.0 - ISC
245
- *
246
- * This source code is licensed under the ISC license.
247
- * See the LICENSE file in the root directory of this source tree.
248
- */const LM=Fe("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"}]]);/**
249
- * @license lucide-react v0.453.0 - ISC
250
- *
251
- * This source code is licensed under the ISC license.
252
- * See the LICENSE file in the root directory of this source tree.
253
- */const Dv=Fe("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"}]]);/**
254
- * @license lucide-react v0.453.0 - ISC
255
- *
256
- * This source code is licensed under the ISC license.
257
- * See the LICENSE file in the root directory of this source tree.
258
- */const df=Fe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Lv="-",zM=e=>{const t=UM(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Lv);return a[0]===""&&a.length!==1&&a.shift(),IE(a,t)||FM(i)},getConflictingClassGroupIds:(i,a)=>{const l=n[i]||[];return a&&r[i]?[...l,...r[i]]:l}}},IE=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?IE(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Lv);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},Tb=/^\[(.+)\]$/,FM=e=>{if(Tb.test(e)){const t=Tb.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},UM=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return VM(Object.entries(e.classGroups),n).forEach(([s,i])=>{Cg(i,r,s,t)}),r},Cg=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Rb(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(qM(o)){Cg(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Cg(i,Rb(t,s),n,r)})})},Rb=(e,t)=>{let n=e;return t.split(Lv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},qM=e=>e.isThemeGetter,VM=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,HM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},AE="!",BM=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const l=[];let u=0,d=0,f;for(let x=0;x<a.length;x++){let g=a[x];if(u===0){if(g===o&&(r||a.slice(x,x+s)===t)){l.push(a.slice(d,x)),d=x+s;continue}if(g==="/"){f=x;continue}}g==="["?u++:g==="]"&&u--}const p=l.length===0?a:a.substring(d),h=p.startsWith(AE),y=h?p.substring(1):p,m=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:y,maybePostfixModifierPosition:m}};return n?a=>n({className:a,parseClassName:i}):i},WM=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},KM=e=>({cache:HM(e.cacheSize),parseClassName:BM(e),...zM(e)}),ZM=/\s+/,QM=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(ZM);let a="";for(let l=i.length-1;l>=0;l-=1){const u=i[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:h}=n(u);let y=!!h,m=r(y?p.substring(0,h):p);if(!m){if(!y){a=u+(a.length>0?" "+a:a);continue}if(m=r(p),!m){a=u+(a.length>0?" "+a:a);continue}y=!1}const x=WM(d).join(":"),g=f?x+AE:x,v=g+m;if(s.includes(v))continue;s.push(v);const w=o(m,y);for(let k=0;k<w.length;++k){const C=w[k];s.push(g+C)}a=u+(a.length>0?" "+a:a)}return a};function GM(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=OE(t))&&(r&&(r+=" "),r+=n);return r}const OE=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=OE(e[r]))&&(n&&(n+=" "),n+=t);return n};function JM(e,...t){let n,r,o,s=i;function i(l){const u=t.reduce((d,f)=>f(d),e());return n=KM(u),r=n.cache.get,o=n.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const d=QM(l,n);return o(l,d),d}return function(){return s(GM.apply(null,arguments))}}const at=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},ME=/^\[(?:([a-z-]+):)?(.+)\]$/i,YM=/^\d+\/\d+$/,XM=new Set(["px","full","screen"]),e4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,t4=/\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$/,n4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,r4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,o4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,co=e=>ya(e)||XM.has(e)||YM.test(e),Uo=e=>sl(e,"length",f4),ya=e=>!!e&&!Number.isNaN(Number(e)),Cp=e=>sl(e,"number",ya),Cl=e=>!!e&&Number.isInteger(Number(e)),s4=e=>e.endsWith("%")&&ya(e.slice(0,-1)),Ae=e=>ME.test(e),qo=e=>e4.test(e),i4=new Set(["length","size","percentage"]),a4=e=>sl(e,i4,DE),l4=e=>sl(e,"position",DE),c4=new Set(["image","url"]),u4=e=>sl(e,c4,p4),d4=e=>sl(e,"",h4),El=()=>!0,sl=(e,t,n)=>{const r=ME.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},f4=e=>t4.test(e)&&!n4.test(e),DE=()=>!1,h4=e=>r4.test(e),p4=e=>o4.test(e),m4=()=>{const e=at("colors"),t=at("spacing"),n=at("blur"),r=at("brightness"),o=at("borderColor"),s=at("borderRadius"),i=at("borderSpacing"),a=at("borderWidth"),l=at("contrast"),u=at("grayscale"),d=at("hueRotate"),f=at("invert"),p=at("gap"),h=at("gradientColorStops"),y=at("gradientColorStopPositions"),m=at("inset"),x=at("margin"),g=at("opacity"),v=at("padding"),w=at("saturate"),k=at("scale"),C=at("sepia"),j=at("skew"),S=at("space"),A=at("translate"),P=()=>["auto","contain","none"],$=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",Ae,t],I=()=>[Ae,t],U=()=>["",co,Uo],O=()=>["auto",ya,Ae],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],J=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",Ae],N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[ya,Ae];return{cacheSize:500,separator:":",theme:{colors:[El],spacing:[co,Uo],blur:["none","",qo,Ae],brightness:M(),borderColor:[e],borderRadius:["none","","full",qo,Ae],borderSpacing:I(),borderWidth:U(),contrast:M(),grayscale:W(),hueRotate:M(),invert:W(),gap:I(),gradientColorStops:[e],gradientColorStopPositions:[s4,Uo],inset:T(),margin:T(),opacity:M(),padding:I(),saturate:M(),scale:M(),sepia:W(),skew:M(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",Ae]}],container:["container"],columns:[{columns:[qo]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"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(),Ae]}],overflow:[{overflow:$()}],"overflow-x":[{"overflow-x":$()}],"overflow-y":[{"overflow-y":$()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],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",Cl,Ae]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ae]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Cl,Ae]}],"grid-cols":[{"grid-cols":[El]}],"col-start-end":[{col:["auto",{span:["full",Cl,Ae]},Ae]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[El]}],"row-start-end":[{row:["auto",{span:[Cl,Ae]},Ae]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ae]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ae]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ae,t]}],"min-w":[{"min-w":[Ae,t,"min","max","fit"]}],"max-w":[{"max-w":[Ae,t,"none","full","min","max","fit","prose",{screen:[qo]},qo]}],h:[{h:[Ae,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ae,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ae,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ae,t,"auto","min","max","fit"]}],"font-size":[{text:["base",qo,Uo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Cp]}],"font-family":[{font:[El]}],"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",Ae]}],"line-clamp":[{"line-clamp":["none",ya,Cp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",co,Ae]}],"list-image":[{"list-image":["none",Ae]}],"list-style-type":[{list:["none","disc","decimal",Ae]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[g]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[g]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",co,Uo]}],"underline-offset":[{"underline-offset":["auto",co,Ae]}],"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:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae]}],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",Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[g]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),l4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",a4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},u4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"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":[g]}],"border-style":[{border:[...J(),"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":[g]}],"divide-style":[{divide:J()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...J()]}],"outline-offset":[{"outline-offset":[co,Ae]}],"outline-w":[{outline:[co,Uo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[g]}],"ring-offset-w":[{"ring-offset":[co,Uo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",qo,d4]}],"shadow-color":[{shadow:[El]}],opacity:[{opacity:[g]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",qo,Ae]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[g]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"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",Ae]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",Ae]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ae]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Cl,Ae]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ae]}],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",Ae]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",Ae]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[co,Uo,Cp]}],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"]}}},g4=JM(m4);function je(...e){return g4(CE(e))}const y4=wM,LE=b.forwardRef(({className:e,...t},n)=>c.jsx(vE,{ref:n,className:je("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}));LE.displayName=vE.displayName;const v4=lh("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"}}),zE=b.forwardRef(({className:e,variant:t,...n},r)=>c.jsx(xE,{ref:r,className:je(v4({variant:t}),e),...n}));zE.displayName=xE.displayName;const x4=b.forwardRef(({className:e,...t},n)=>c.jsx(kE,{ref:n,className:je("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}));x4.displayName=kE.displayName;const FE=b.forwardRef(({className:e,...t},n)=>c.jsx(_E,{ref:n,className:je("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:c.jsx(df,{className:"h-4 w-4"})}));FE.displayName=_E.displayName;const UE=b.forwardRef(({className:e,...t},n)=>c.jsx(wE,{ref:n,className:je("text-sm font-semibold",e),...t}));UE.displayName=wE.displayName;const qE=b.forwardRef(({className:e,...t},n)=>c.jsx(bE,{ref:n,className:je("text-sm opacity-90",e),...t}));qE.displayName=bE.displayName;function w4(){const{toasts:e}=Wt();return c.jsxs(y4,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return c.jsxs(zE,{...s,children:[c.jsxs("div",{className:"grid gap-1",children:[n&&c.jsx(UE,{children:n}),r&&c.jsx(qE,{children:r})]}),o,c.jsx(FE,{})]},t)}),c.jsx(LE,{})]})}var b4=Oy[" useId ".trim().toString()]||(()=>{}),k4=0;function Co(e){const[t,n]=b.useState(b4());return tn(()=>{n(r=>r??String(k4++))},[e]),t?`radix-${t}`:""}const _4=["top","right","bottom","left"],Ns=Math.min,Vn=Math.max,ff=Math.round,Mu=Math.floor,to=e=>({x:e,y:e}),S4={left:"right",right:"left",bottom:"top",top:"bottom"},C4={start:"end",end:"start"};function Eg(e,t,n){return Vn(e,Ns(t,n))}function $o(e,t){return typeof e=="function"?e(t):e}function Io(e){return e.split("-")[0]}function il(e){return e.split("-")[1]}function zv(e){return e==="x"?"y":"x"}function Fv(e){return e==="y"?"height":"width"}const E4=new Set(["top","bottom"]);function Jr(e){return E4.has(Io(e))?"y":"x"}function Uv(e){return zv(Jr(e))}function N4(e,t,n){n===void 0&&(n=!1);const r=il(e),o=Uv(e),s=Fv(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=hf(i)),[i,hf(i)]}function j4(e){const t=hf(e);return[Ng(e),t,Ng(t)]}function Ng(e){return e.replace(/start|end/g,t=>C4[t])}const $b=["left","right"],Ib=["right","left"],P4=["top","bottom"],T4=["bottom","top"];function R4(e,t,n){switch(e){case"top":case"bottom":return n?t?Ib:$b:t?$b:Ib;case"left":case"right":return t?P4:T4;default:return[]}}function $4(e,t,n,r){const o=il(e);let s=R4(Io(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ng)))),s}function hf(e){return e.replace(/left|right|bottom|top/g,t=>S4[t])}function I4(e){return{top:0,right:0,bottom:0,left:0,...e}}function VE(e){return typeof e!="number"?I4(e):{top:e,right:e,bottom:e,left:e}}function pf(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ab(e,t,n){let{reference:r,floating:o}=e;const s=Jr(t),i=Uv(t),a=Fv(i),l=Io(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(il(t)){case"start":h[i]-=p*(n&&u?-1:1);break;case"end":h[i]+=p*(n&&u?-1:1);break}return h}const A4=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Ab(u,r,l),p=r,h={},y=0;for(let m=0;m<a.length;m++){const{name:x,fn:g}=a[m],{x:v,y:w,data:k,reset:C}=await g({x:d,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:u,platform:i,elements:{reference:e,floating:t}});d=v??d,f=w??f,h={...h,[x]:{...h[x],...k}},C&&y<=50&&(y++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:f}=Ab(u,p,l)),m=-1)}return{x:d,y:f,placement:p,strategy:o,middlewareData:h}};async function Pc(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=$o(t,e),y=VE(h),x=a[p?f==="floating"?"reference":"floating":f],g=pf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:l})),v=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),k=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},C=pf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:l}):v);return{top:(g.top-C.top+y.top)/k.y,bottom:(C.bottom-g.bottom+y.bottom)/k.y,left:(g.left-C.left+y.left)/k.x,right:(C.right-g.right+y.right)/k.x}}const O4=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=$o(e,t)||{};if(u==null)return{};const f=VE(d),p={x:n,y:r},h=Uv(o),y=Fv(h),m=await i.getDimensions(u),x=h==="y",g=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",k=s.reference[y]+s.reference[h]-p[h]-s.floating[y],C=p[h]-s.reference[h],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let S=j?j[w]:0;(!S||!await(i.isElement==null?void 0:i.isElement(j)))&&(S=a.floating[w]||s.floating[y]);const A=k/2-C/2,P=S/2-m[y]/2-1,$=Ns(f[g],P),T=Ns(f[v],P),I=$,U=S-m[y]-T,O=S/2-m[y]/2+A,B=Eg(I,O,U),J=!l.arrow&&il(o)!=null&&O!==B&&s.reference[y]/2-(O<I?$:T)-m[y]/2<0,Q=J?O<I?O-I:O-U:0;return{[h]:p[h]+Q,data:{[h]:B,centerOffset:O-B-Q,...J&&{alignmentOffset:Q}},reset:J}}}),M4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...x}=$o(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=Io(o),v=Jr(a),w=Io(a)===a,k=await(l.isRTL==null?void 0:l.isRTL(u.floating)),C=p||(w||!m?[hf(a)]:j4(a)),j=y!=="none";!p&&j&&C.push(...$4(a,m,y,k));const S=[a,...C],A=await Pc(t,x),P=[];let $=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&P.push(A[g]),f){const O=N4(o,i,k);P.push(A[O[0]],A[O[1]])}if($=[...$,{placement:o,overflows:P}],!P.every(O=>O<=0)){var T,I;const O=(((T=s.flip)==null?void 0:T.index)||0)+1,B=S[O];if(B&&(!(f==="alignment"?v!==Jr(B):!1)||$.every(H=>Jr(H.placement)===v?H.overflows[0]>0:!0)))return{data:{index:O,overflows:$},reset:{placement:B}};let J=(I=$.filter(Q=>Q.overflows[0]<=0).sort((Q,H)=>Q.overflows[1]-H.overflows[1])[0])==null?void 0:I.placement;if(!J)switch(h){case"bestFit":{var U;const Q=(U=$.filter(H=>{if(j){const W=Jr(H.placement);return W===v||W==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(W=>W>0).reduce((W,N)=>W+N,0)]).sort((H,W)=>H[1]-W[1])[0])==null?void 0:U[0];Q&&(J=Q);break}case"initialPlacement":J=a;break}if(o!==J)return{reset:{placement:J}}}return{}}}};function Ob(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Mb(e){return _4.some(t=>e[t]>=0)}const D4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=$o(e,t);switch(r){case"referenceHidden":{const s=await Pc(t,{...o,elementContext:"reference"}),i=Ob(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Mb(i)}}}case"escaped":{const s=await Pc(t,{...o,altBoundary:!0}),i=Ob(s,n.floating);return{data:{escapedOffsets:i,escaped:Mb(i)}}}default:return{}}}}},HE=new Set(["left","top"]);async function L4(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Io(n),a=il(n),l=Jr(n)==="y",u=HE.has(i)?-1:1,d=s&&l?-1:1,f=$o(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof y=="number"&&(h=a==="end"?y*-1:y),l?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const z4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,l=await L4(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:s+l.y,data:{...l,placement:i}}}}},F4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:x=>{let{x:g,y:v}=x;return{x:g,y:v}}},...l}=$o(e,t),u={x:n,y:r},d=await Pc(t,l),f=Jr(Io(o)),p=zv(f);let h=u[p],y=u[f];if(s){const x=p==="y"?"top":"left",g=p==="y"?"bottom":"right",v=h+d[x],w=h-d[g];h=Eg(v,h,w)}if(i){const x=f==="y"?"top":"left",g=f==="y"?"bottom":"right",v=y+d[x],w=y-d[g];y=Eg(v,y,w)}const m=a.fn({...t,[p]:h,[f]:y});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[p]:s,[f]:i}}}}}},U4=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=$o(e,t),d={x:n,y:r},f=Jr(o),p=zv(f);let h=d[p],y=d[f];const m=$o(a,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=p==="y"?"height":"width",k=s.reference[p]-s.floating[w]+x.mainAxis,C=s.reference[p]+s.reference[w]-x.mainAxis;h<k?h=k:h>C&&(h=C)}if(u){var g,v;const w=p==="y"?"width":"height",k=HE.has(Io(o)),C=s.reference[f]-s.floating[w]+(k&&((g=i.offset)==null?void 0:g[f])||0)+(k?0:x.crossAxis),j=s.reference[f]+s.reference[w]+(k?0:((v=i.offset)==null?void 0:v[f])||0)-(k?x.crossAxis:0);y<C?y=C:y>j&&(y=j)}return{[p]:h,[f]:y}}}},q4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:l=()=>{},...u}=$o(e,t),d=await Pc(t,u),f=Io(o),p=il(o),h=Jr(o)==="y",{width:y,height:m}=s.floating;let x,g;f==="top"||f==="bottom"?(x=f,g=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(g=f,x=p==="end"?"top":"bottom");const v=m-d.top-d.bottom,w=y-d.left-d.right,k=Ns(m-d[x],v),C=Ns(y-d[g],w),j=!t.middlewareData.shift;let S=k,A=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(S=v),j&&!p){const $=Vn(d.left,0),T=Vn(d.right,0),I=Vn(d.top,0),U=Vn(d.bottom,0);h?A=y-2*($!==0||T!==0?$+T:Vn(d.left,d.right)):S=m-2*(I!==0||U!==0?I+U:Vn(d.top,d.bottom))}await l({...t,availableWidth:A,availableHeight:S});const P=await i.getDimensions(a.floating);return y!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function dh(){return typeof window<"u"}function al(e){return BE(e)?(e.nodeName||"").toLowerCase():"#document"}function Kn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function so(e){var t;return(t=(BE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function BE(e){return dh()?e instanceof Node||e instanceof Kn(e).Node:!1}function Or(e){return dh()?e instanceof Element||e instanceof Kn(e).Element:!1}function no(e){return dh()?e instanceof HTMLElement||e instanceof Kn(e).HTMLElement:!1}function Db(e){return!dh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Kn(e).ShadowRoot}const V4=new Set(["inline","contents"]);function Gc(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Mr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!V4.has(o)}const H4=new Set(["table","td","th"]);function B4(e){return H4.has(al(e))}const W4=[":popover-open",":modal"];function fh(e){return W4.some(t=>{try{return e.matches(t)}catch{return!1}})}const K4=["transform","translate","scale","rotate","perspective"],Z4=["transform","translate","scale","rotate","perspective","filter"],Q4=["paint","layout","strict","content"];function qv(e){const t=Vv(),n=Or(e)?Mr(e):e;return K4.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Z4.some(r=>(n.willChange||"").includes(r))||Q4.some(r=>(n.contain||"").includes(r))}function G4(e){let t=js(e);for(;no(t)&&!Ba(t);){if(qv(t))return t;if(fh(t))return null;t=js(t)}return null}function Vv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const J4=new Set(["html","body","#document"]);function Ba(e){return J4.has(al(e))}function Mr(e){return Kn(e).getComputedStyle(e)}function hh(e){return Or(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function js(e){if(al(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Db(e)&&e.host||so(e);return Db(t)?t.host:t}function WE(e){const t=js(e);return Ba(t)?e.ownerDocument?e.ownerDocument.body:e.body:no(t)&&Gc(t)?t:WE(t)}function Tc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=WE(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Kn(o);if(s){const a=jg(i);return t.concat(i,i.visualViewport||[],Gc(o)?o:[],a&&n?Tc(a):[])}return t.concat(o,Tc(o,[],n))}function jg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function KE(e){const t=Mr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=no(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=ff(n)!==s||ff(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Hv(e){return Or(e)?e:e.contextElement}function va(e){const t=Hv(e);if(!no(t))return to(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=KE(t);let i=(s?ff(n.width):n.width)/r,a=(s?ff(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Y4=to(0);function ZE(e){const t=Kn(e);return!Vv()||!t.visualViewport?Y4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function X4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Kn(e)?!1:t}function _i(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Hv(e);let i=to(1);t&&(r?Or(r)&&(i=va(r)):i=va(e));const a=X4(s,n,r)?ZE(s):to(0);let l=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const p=Kn(s),h=r&&Or(r)?Kn(r):r;let y=p,m=jg(y);for(;m&&r&&h!==y;){const x=va(m),g=m.getBoundingClientRect(),v=Mr(m),w=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*x.x,k=g.top+(m.clientTop+parseFloat(v.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=w,u+=k,y=Kn(m),m=jg(y)}}return pf({width:d,height:f,x:l,y:u})}function ph(e,t){const n=hh(e).scrollLeft;return t?t.left+n:_i(so(e)).left+n}function QE(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ph(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function eD(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=so(r),a=t?fh(t.floating):!1;if(r===i||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=to(1);const d=to(0),f=no(r);if((f||!f&&!s)&&((al(r)!=="body"||Gc(i))&&(l=hh(r)),no(r))){const h=_i(r);u=va(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=i&&!f&&!s?QE(i,l):to(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function tD(e){return Array.from(e.getClientRects())}function nD(e){const t=so(e),n=hh(e),r=e.ownerDocument.body,o=Vn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Vn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ph(e);const a=-n.scrollTop;return Mr(r).direction==="rtl"&&(i+=Vn(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Lb=25;function rD(e,t){const n=Kn(e),r=so(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,l=0;if(o){s=o.width,i=o.height;const d=Vv();(!d||d&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const u=ph(r);if(u<=0){const d=r.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=Lb&&(s-=y)}else u<=Lb&&(s+=u);return{width:s,height:i,x:a,y:l}}const oD=new Set(["absolute","fixed"]);function sD(e,t){const n=_i(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=no(e)?va(e):to(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,l=o*s.x,u=r*s.y;return{width:i,height:a,x:l,y:u}}function zb(e,t,n){let r;if(t==="viewport")r=rD(e,n);else if(t==="document")r=nD(so(e));else if(Or(t))r=sD(t,n);else{const o=ZE(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return pf(r)}function GE(e,t){const n=js(e);return n===t||!Or(n)||Ba(n)?!1:Mr(n).position==="fixed"||GE(n,t)}function iD(e,t){const n=t.get(e);if(n)return n;let r=Tc(e,[],!1).filter(a=>Or(a)&&al(a)!=="body"),o=null;const s=Mr(e).position==="fixed";let i=s?js(e):e;for(;Or(i)&&!Ba(i);){const a=Mr(i),l=qv(i);!l&&a.position==="fixed"&&(o=null),(s?!l&&!o:!l&&a.position==="static"&&!!o&&oD.has(o.position)||Gc(i)&&!l&&GE(e,i))?r=r.filter(d=>d!==i):o=a,i=js(i)}return t.set(e,r),r}function aD(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?fh(t)?[]:iD(t,this._c):[].concat(n),r],a=i[0],l=i.reduce((u,d)=>{const f=zb(t,d,o);return u.top=Vn(f.top,u.top),u.right=Ns(f.right,u.right),u.bottom=Ns(f.bottom,u.bottom),u.left=Vn(f.left,u.left),u},zb(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function lD(e){const{width:t,height:n}=KE(e);return{width:t,height:n}}function cD(e,t,n){const r=no(t),o=so(t),s=n==="fixed",i=_i(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=to(0);function u(){l.x=ph(o)}if(r||!r&&!s)if((al(t)!=="body"||Gc(o))&&(a=hh(t)),r){const h=_i(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?QE(o,a):to(0),f=i.left+a.scrollLeft-l.x-d.x,p=i.top+a.scrollTop-l.y-d.y;return{x:f,y:p,width:i.width,height:i.height}}function Ep(e){return Mr(e).position==="static"}function Fb(e,t){if(!no(e)||Mr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return so(e)===n&&(n=n.ownerDocument.body),n}function JE(e,t){const n=Kn(e);if(fh(e))return n;if(!no(e)){let o=js(e);for(;o&&!Ba(o);){if(Or(o)&&!Ep(o))return o;o=js(o)}return n}let r=Fb(e,t);for(;r&&B4(r)&&Ep(r);)r=Fb(r,t);return r&&Ba(r)&&Ep(r)&&!qv(r)?n:r||G4(e)||n}const uD=async function(e){const t=this.getOffsetParent||JE,n=this.getDimensions,r=await n(e.floating);return{reference:cD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function dD(e){return Mr(e).direction==="rtl"}const fD={convertOffsetParentRelativeRectToViewportRelativeRect:eD,getDocumentElement:so,getClippingRect:aD,getOffsetParent:JE,getElementRects:uD,getClientRects:tD,getDimensions:lD,getScale:va,isElement:Or,isRTL:dD};function YE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hD(e,t){let n=null,r;const o=so(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(a||t(),!p||!h)return;const y=Mu(f),m=Mu(o.clientWidth-(d+p)),x=Mu(o.clientHeight-(f+h)),g=Mu(d),w={rootMargin:-y+"px "+-m+"px "+-x+"px "+-g+"px",threshold:Vn(0,Ns(1,l))||1};let k=!0;function C(j){const S=j[0].intersectionRatio;if(S!==l){if(!k)return i();S?i(!1,S):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S===1&&!YE(u,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(C,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),s}function pD(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Hv(e),d=o||s?[...u?Tc(u):[],...Tc(t)]:[];d.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const f=u&&a?hD(u,n):null;let p=-1,h=null;i&&(h=new ResizeObserver(g=>{let[v]=g;v&&v.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),u&&!l&&h.observe(u),h.observe(t));let y,m=l?_i(e):null;l&&x();function x(){const g=_i(e);m&&!YE(m,g)&&n(),m=g,y=requestAnimationFrame(x)}return n(),()=>{var g;d.forEach(v=>{o&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,l&&cancelAnimationFrame(y)}}const mD=z4,gD=F4,yD=M4,vD=q4,xD=D4,Ub=O4,wD=U4,bD=(e,t,n)=>{const r=new Map,o={platform:fD,...n},s={...o.platform,_c:r};return A4(e,t,{...o,platform:s})};var kD=typeof document<"u",_D=function(){},xd=kD?b.useLayoutEffect:_D;function mf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!mf(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!mf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function XE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qb(e,t){const n=XE(e);return Math.round(t*n)/n}function Np(e){const t=b.useRef(e);return xd(()=>{t.current=e}),t}function SD(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[d,f]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=b.useState(r);mf(p,r)||h(r);const[y,m]=b.useState(null),[x,g]=b.useState(null),v=b.useCallback(H=>{H!==j.current&&(j.current=H,m(H))},[]),w=b.useCallback(H=>{H!==S.current&&(S.current=H,g(H))},[]),k=s||y,C=i||x,j=b.useRef(null),S=b.useRef(null),A=b.useRef(d),P=l!=null,$=Np(l),T=Np(o),I=Np(u),U=b.useCallback(()=>{if(!j.current||!S.current)return;const H={placement:t,strategy:n,middleware:p};T.current&&(H.platform=T.current),bD(j.current,S.current,H).then(W=>{const N={...W,isPositioned:I.current!==!1};O.current&&!mf(A.current,N)&&(A.current=N,$i.flushSync(()=>{f(N)}))})},[p,t,n,T,I]);xd(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(H=>({...H,isPositioned:!1})))},[u]);const O=b.useRef(!1);xd(()=>(O.current=!0,()=>{O.current=!1}),[]),xd(()=>{if(k&&(j.current=k),C&&(S.current=C),k&&C){if($.current)return $.current(k,C,U);U()}},[k,C,U,$,P]);const B=b.useMemo(()=>({reference:j,floating:S,setReference:v,setFloating:w}),[v,w]),J=b.useMemo(()=>({reference:k,floating:C}),[k,C]),Q=b.useMemo(()=>{const H={position:n,left:0,top:0};if(!J.floating)return H;const W=qb(J.floating,d.x),N=qb(J.floating,d.y);return a?{...H,transform:"translate("+W+"px, "+N+"px)",...XE(J.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:N}},[n,a,J.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:U,refs:B,elements:J,floatingStyles:Q}),[d,U,B,J,Q])}const CD=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ub({element:r.current,padding:o}).fn(n):{}:r?Ub({element:r,padding:o}).fn(n):{}}}},ED=(e,t)=>({...mD(e),options:[e,t]}),ND=(e,t)=>({...gD(e),options:[e,t]}),jD=(e,t)=>({...wD(e),options:[e,t]}),PD=(e,t)=>({...yD(e),options:[e,t]}),TD=(e,t)=>({...vD(e),options:[e,t]}),RD=(e,t)=>({...xD(e),options:[e,t]}),$D=(e,t)=>({...CD(e),options:[e,t]});var ID="Arrow",eN=b.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return c.jsx(Te.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:c.jsx("polygon",{points:"0,0 30,0 15,10"})})});eN.displayName=ID;var AD=eN;function tN(e){const[t,n]=b.useState(void 0);return tn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Bv="Popper",[nN,ll]=ro(Bv),[OD,rN]=nN(Bv),oN=e=>{const{__scopePopper:t,children:n}=e,[r,o]=b.useState(null);return c.jsx(OD,{scope:t,anchor:r,onAnchorChange:o,children:n})};oN.displayName=Bv;var sN="PopperAnchor",iN=b.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=rN(sN,n),i=b.useRef(null),a=Ye(t,i),l=b.useRef(null);return b.useEffect(()=>{const u=l.current;l.current=(r==null?void 0:r.current)||i.current,u!==l.current&&s.onAnchorChange(l.current)}),r?null:c.jsx(Te.div,{...o,ref:a})});iN.displayName=sN;var Wv="PopperContent",[MD,DD]=nN(Wv),aN=b.forwardRef((e,t)=>{var K,X,pe,ce,L,q;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:y,...m}=e,x=rN(Wv,n),[g,v]=b.useState(null),w=Ye(t,Y=>v(Y)),[k,C]=b.useState(null),j=tN(k),S=(j==null?void 0:j.width)??0,A=(j==null?void 0:j.height)??0,P=r+(s!=="center"?"-"+s:""),$=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],I=T.length>0,U={padding:$,boundary:T.filter(zD),altBoundary:I},{refs:O,floatingStyles:B,placement:J,isPositioned:Q,middlewareData:H}=SD({strategy:"fixed",placement:P,whileElementsMounted:(...Y)=>pD(...Y,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[ED({mainAxis:o+A,alignmentAxis:i}),l&&ND({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?jD():void 0,...U}),l&&PD({...U}),TD({...U,apply:({elements:Y,rects:ne,availableWidth:Z,availableHeight:re})=>{const{width:oe,height:Re}=ne.reference,le=Y.floating.style;le.setProperty("--radix-popper-available-width",`${Z}px`),le.setProperty("--radix-popper-available-height",`${re}px`),le.setProperty("--radix-popper-anchor-width",`${oe}px`),le.setProperty("--radix-popper-anchor-height",`${Re}px`)}}),k&&$D({element:k,padding:a}),FD({arrowWidth:S,arrowHeight:A}),p&&RD({strategy:"referenceHidden",...U})]}),[W,N]=uN(J),M=fr(y);tn(()=>{Q&&(M==null||M())},[Q,M]);const V=(K=H.arrow)==null?void 0:K.x,_=(X=H.arrow)==null?void 0:X.y,E=((pe=H.arrow)==null?void 0:pe.centerOffset)!==0,[R,D]=b.useState();return tn(()=>{g&&D(window.getComputedStyle(g).zIndex)},[g]),c.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:Q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ce=H.transformOrigin)==null?void 0:ce.x,(L=H.transformOrigin)==null?void 0:L.y].join(" "),...((q=H.hide)==null?void 0:q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:c.jsx(MD,{scope:n,placedSide:W,onArrowChange:C,arrowX:V,arrowY:_,shouldHideArrow:E,children:c.jsx(Te.div,{"data-side":W,"data-align":N,...m,ref:w,style:{...m.style,animation:Q?void 0:"none"}})})})});aN.displayName=Wv;var lN="PopperArrow",LD={top:"bottom",right:"left",bottom:"top",left:"right"},cN=b.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=DD(lN,r),i=LD[s.placedSide];return c.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:c.jsx(AD,{...o,ref:n,style:{...o.style,display:"block"}})})});cN.displayName=lN;function zD(e){return e!==null}var FD=e=>({name:"transformOrigin",options:e,fn(t){var x,g,v;const{placement:n,rects:r,middlewareData:o}=t,i=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=i?0:e.arrowWidth,l=i?0:e.arrowHeight,[u,d]=uN(n),f={start:"0%",center:"50%",end:"100%"}[d],p=(((g=o.arrow)==null?void 0:g.x)??0)+a/2,h=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let y="",m="";return u==="bottom"?(y=i?f:`${p}px`,m=`${-l}px`):u==="top"?(y=i?f:`${p}px`,m=`${r.floating.height+l}px`):u==="right"?(y=`${-l}px`,m=i?f:`${h}px`):u==="left"&&(y=`${r.floating.width+l}px`,m=i?f:`${h}px`),{data:{x:y,y:m}}}});function uN(e){const[t,n="center"]=e.split("-");return[t,n]}var dN=oN,mh=iN,Kv=aN,Zv=cN,[gh,WX]=ro("Tooltip",[ll]),Qv=ll(),fN="TooltipProvider",UD=700,Vb="tooltip.open",[qD,hN]=gh(fN),pN=e=>{const{__scopeTooltip:t,delayDuration:n=UD,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=b.useRef(!0),a=b.useRef(!1),l=b.useRef(0);return b.useEffect(()=>{const u=l.current;return()=>window.clearTimeout(u)},[]),c.jsx(qD,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:b.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};pN.displayName=fN;var mN="Tooltip",[KX,yh]=gh(mN),Pg="TooltipTrigger",VD=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=yh(Pg,n),s=hN(Pg,n),i=Qv(n),a=b.useRef(null),l=Ye(t,a,o.onTriggerChange),u=b.useRef(!1),d=b.useRef(!1),f=b.useCallback(()=>u.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),c.jsx(mh,{asChild:!0,...i,children:c.jsx(Te.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:be(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:be(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:be(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:be(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:be(e.onBlur,o.onClose),onClick:be(e.onClick,o.onClose)})})});VD.displayName=Pg;var HD="TooltipPortal",[ZX,BD]=gh(HD,{forceMount:void 0}),Wa="TooltipContent",gN=b.forwardRef((e,t)=>{const n=BD(Wa,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=yh(Wa,e.__scopeTooltip);return c.jsx(oo,{present:r||i.open,children:i.disableHoverableContent?c.jsx(yN,{side:o,...s,ref:t}):c.jsx(WD,{side:o,...s,ref:t})})}),WD=b.forwardRef((e,t)=>{const n=yh(Wa,e.__scopeTooltip),r=hN(Wa,e.__scopeTooltip),o=b.useRef(null),s=Ye(t,o),[i,a]=b.useState(null),{trigger:l,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,p=b.useCallback(()=>{a(null),f(!1)},[f]),h=b.useCallback((y,m)=>{const x=y.currentTarget,g={x:y.clientX,y:y.clientY},v=JD(g,x.getBoundingClientRect()),w=YD(g,v),k=XD(m.getBoundingClientRect()),C=tL([...w,...k]);a(C),f(!0)},[f]);return b.useEffect(()=>()=>p(),[p]),b.useEffect(()=>{if(l&&d){const y=x=>h(x,d),m=x=>h(x,l);return l.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[l,d,h,p]),b.useEffect(()=>{if(i){const y=m=>{const x=m.target,g={x:m.clientX,y:m.clientY},v=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),w=!eL(g,i);v?p():w&&(p(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[l,d,i,u,p]),c.jsx(yN,{...e,ref:s})}),[KD,ZD]=gh(mN,{isInside:!1}),QD=AO("TooltipContent"),yN=b.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,l=yh(Wa,n),u=Qv(n),{onClose:d}=l;return b.useEffect(()=>(document.addEventListener(Vb,d),()=>document.removeEventListener(Vb,d)),[d]),b.useEffect(()=>{if(l.trigger){const f=p=>{const h=p.target;h!=null&&h.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),c.jsx(ol,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:c.jsxs(Kv,{"data-state":l.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:[c.jsx(QD,{children:r}),c.jsx(KD,{scope:n,isInside:!0,children:c.jsx(nM,{id:l.contentId,role:"tooltip",children:o||r})})]})})});gN.displayName=Wa;var vN="TooltipArrow",GD=b.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Qv(n);return ZD(vN,n).isInside?null:c.jsx(Zv,{...o,...r,ref:t})});GD.displayName=vN;function JD(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function YD(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function XD(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function eL(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],l=t[i],u=a.x,d=a.y,f=l.x,p=l.y;d>r!=p>r&&n<(f-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function tL(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),nL(t)}function nL(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var rL=pN,xN=gN;const oL=rL,sL=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>c.jsx(xN,{ref:r,sideOffset:t,className:je("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),...n}));sL.displayName=xN.displayName;const iL={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 aL(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))}:iL}const vn="#92E4DD",Pn="#F9386D",_r="#FFFFFF",Zr="bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900";function Ur(e){return vn}function Qr(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}const lL=lh("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:{gold:"bg-[#C4B643] text-[#0A0A07] hover:bg-[#D4C760] border border-[#C4B643] font-medium",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"}}),fe=b.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?$O:"button";return c.jsx(i,{className:je(lL({variant:t,size:n,className:e})),ref:s,...o})});fe.displayName="Button";function xa({warnings:e}){if(!(e!=null&&e.length))return null;const t=e.find(r=>r.severity==="error")??e[0],n=t.severity==="error";return c.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 ${n?"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(r=>r.message).join(" · "),"data-testid":"card-warning-badge",children:[c.jsx(jr,{className:"h-2.5 w-2.5 shrink-0"}),c.jsx("span",{className:"max-w-[72px] truncate",children:t.message})]})}const Hb="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 cL(e){return e.iconUrl?e.iconUrl:null}function wN({service:e}){const t=Ur(),n=cL(e),[r,o]=b.useState(!1);return n&&!r?c.jsx("img",{src:n,alt:"",className:"w-7 h-7 object-contain rounded-sm",draggable:!1,onError:()=>o(!0)}):c.jsx("div",{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${Hb}) no-repeat center / contain`,mask:`url(${Hb}) 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 Jv(){return c.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 uL({service:e,onDragStart:t,onDragEnd:n,isInActiveDeck:r,onCardClick:o,isInCollection:s=!1,onMouseEnter:i,onMouseLeave:a,activeDeck:l,warnings:u}){const d=nn(),{toast:f}=Wt(),p=Ur(),h=gt({mutationFn:async()=>{if(!l)throw new Error("No active deck found");return Ne("POST",`/api/decks/${l.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:g=>{f({title:"Failed to add service",description:g.message,variant:"destructive"})}}),y=gt({mutationFn:async()=>Ne("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:g=>{f({title:"Failed to delete service",description:g.message,variant:"destructive"})}}),m=g=>{g.stopPropagation(),h.mutate()},x=g=>{g.stopPropagation(),window.confirm(`Are you sure you want to delete ${e.name}? This action cannot be undone.`)&&y.mutate()};return c.jsx("div",{className:"relative group cursor-pointer",draggable:!r,onDragStart:g=>t(g,e),onDragEnd:n,onClick:()=>o==null?void 0:o(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:c.jsxs("div",{className:`
259
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
260
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
261
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
262
- relative overflow-hidden
263
- ${Gv(r)}
264
- ${s?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
265
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(xa,{warnings:u}),r&&c.jsx(Jv,{}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:p},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:p},children:e.type==="mcp"?"RM":e.type==="local-mcp"?"LM":"A"})}),c.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:c.jsx(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:x,title:`Delete ${e.name}`,children:c.jsx(uh,{className:"w-3 h-3"})})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:p},children:c.jsx(wN,{service:e})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-service-name-${e.id}`,style:{color:p},children:e.name}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:p,borderColor:p},children:e.type==="mcp"?"Remote MCP":e.type==="local-mcp"?"Local MCP":"A2A"})]}),c.jsx("div",{className:"absolute bottom-6 inset-x-1",children:c.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:p,borderColor:p},onClick:m,disabled:r||h.isPending,"data-testid":`button-add-to-deck-${e.id}`,children:r?"IN DECK":"ADD"})}),c.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 dL=b.memo(uL);function fL(e){return e.iconUrl?e.iconUrl:null}function bN({credential:e,color:t}){const n=fL(e);return n?c.jsx("img",{src:n,alt:"",className:"h-7 w-7 object-contain rounded-sm",draggable:!1}):c.jsx(Sg,{className:"h-7 w-7",strokeWidth:2.25,style:{color:t}})}function hL({credential:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:o,onDragEnd:s,onMouseEnter:i,onMouseLeave:a,onCardClick:l,warnings:u}){const d=nn(),{toast:f}=Wt(),p=Pn,h=gt({mutationFn:async()=>{if(!n)throw new Error("No active deck found");return Ne("POST",`/api/decks/${n.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"})}}),y=gt({mutationFn:async()=>Ne("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 c.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!o,onDragStart:o?m=>o(m,e):void 0,onDragEnd:s,onClick:()=>l==null?void 0:l(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:c.jsxs("div",{className:`
266
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
267
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
268
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
269
- relative overflow-hidden
270
- ${Gv(t)}
271
- ${r?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
272
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(xa,{warnings:u}),t&&c.jsx(Jv,{}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"AK"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"AK"})}),c.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:c.jsx(fe,{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?`)&&y.mutate()},title:`Remove ${e.label}`,children:c.jsx(uh,{className:"w-3 h-3"})})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:p},children:c.jsx(bN,{credential:e,color:p})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2","data-testid":`text-credential-name-${e.id}`,style:{color:p},children:e.label}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:p,borderColor:p},children:e.hasSecret?"API Key":"Missing key"})]}),c.jsx("div",{className:"absolute bottom-6 inset-x-1",children:c.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:p,borderColor:p},onClick:m=>{m.stopPropagation(),h.mutate()},disabled:t||h.isPending||!n,"data-testid":`button-add-to-deck-${e.id}`,children:t?"IN DECK":"ADD"})}),c.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 pL=b.memo(hL);function mL({playbook:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:o,onDragEnd:s,onMouseEnter:i,onMouseLeave:a,onCardClick:l,warnings:u}){const d=nn(),{toast:f}=Wt(),p=_r,h=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,y=gt({mutationFn:async()=>{if(!n)throw new Error("No deck selected");return Ne("POST",`/api/decks/${n.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:x=>{f({title:"Failed to add playbook",description:x.message,variant:"destructive"})}}),m=gt({mutationFn:async()=>Ne("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:x=>{f({title:"Failed to delete playbook",description:x.message,variant:"destructive"})}});return c.jsx("div",{className:"relative group cursor-pointer",draggable:!t&&!!o,onDragStart:o?x=>o(x,e):void 0,onDragEnd:s,onClick:()=>l==null?void 0:l(e),"data-testid":`card-${e.id}`,onMouseEnter:i,onMouseLeave:a,children:c.jsxs("div",{className:`
273
- w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3
274
- transform transition-all duration-300 shadow-lg hover:shadow-2xl
275
- bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900
276
- relative overflow-hidden
277
- ${Gv(t)}
278
- ${r?"hover:scale-110 hover:rotate-0":"hover:scale-105"}
279
- `,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[c.jsx(xa,{warnings:u}),t&&c.jsx(Jv,{}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"PB"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:p},children:"PB"})}),c.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 z-10",children:c.jsx(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:x=>{x.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&m.mutate()},title:`Delete ${e.title}`,children:c.jsx(uh,{className:"w-3 h-3"})})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:p},children:c.jsx(Mv,{className:"h-7 w-7",strokeWidth:2.25})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:p},children:e.title}),c.jsxs("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:p,borderColor:p},children:["Playbook",h>0?` · ${h} deps`:""]})]}),c.jsx("div",{className:"absolute bottom-6 inset-x-1",children:c.jsx(fe,{size:"sm",className:"w-full text-[8px] px-1 py-1 h-5 bg-black/20 hover:bg-black/40 border",style:{color:p,borderColor:p},onClick:x=>{x.stopPropagation(),y.mutate()},disabled:t||y.isPending||!n,children:t?"IN DECK":"ADD"})}),c.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 gL=b.memo(mL),Rc=128,kN=192,Ka=48,yL=10,gf=12,Du=64,Lu=4,Bb=14,_N=12,SN=1.08;function vL(e=_N,t=SN){const n=e*Math.PI/180,r=Rc*Math.sin(n)+kN*Math.cos(n);return Math.ceil(r*t)+8}const Tg=vL();function CN(e,t=Ka){return e===0?0:Rc+Math.max(0,e-1)*(Rc-t)}function xL(e=yL,t=Ka,n=gf){return CN(e,t)+2*n}function wL(e,t=Ka){return CN(e,t)+2*gf}const bL=xL();function kL(e,t,n,r=_N){const o=t+n/2,s=n/2;if(s<=0)return 0;const i=(e-o)/s;return Math.max(-r,Math.min(r,i*r))}function _L(e){return{flexShrink:0,marginLeft:e===0?0:`-${Ka}px`}}function SL(e,t,n){return n===e?999999:t-e}function CL({cardCount:e,children:t}){const n=b.useRef(null),r=b.useRef([]),o=b.useRef(0),s=b.useRef(void 0),[i,a]=b.useState(!1),[l,u]=b.useState(!1),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[y,m]=b.useState(!1),x=b.useRef(!1),g=b.useRef(!1),[v,w]=b.useState(null),k=b.useRef(null);k.current=v;const C=b.useCallback(()=>{const T=n.current;if(!T)return;const I=T.getBoundingClientRect(),U=k.current;r.current.forEach((O,B)=>{if(!O)return;const J=O.getBoundingClientRect(),Q=J.left+J.width/2,H=U===B?0:kL(Q,I.left,I.width),W=U===B?SN:1;O.style.transform=`rotate(${H}deg) scale(${W})`,O.style.transformOrigin="center center",O.style.zIndex=String(SL(B,e,U))})},[e]),j=b.useCallback(T=>{const I=n.current;if(!I)return;const U=Rc-Ka;I.scrollBy({left:T==="left"?-U:U,behavior:"smooth"})},[]),S=b.useCallback(()=>{const T=n.current;if(!T)return;const U=wL(e,Ka)>T.clientWidth+2;a(U),u(U&&T.scrollLeft>4),f(U&&T.scrollLeft+T.clientWidth<T.scrollWidth-4),C()},[e,C]);b.useLayoutEffect(()=>{const T=n.current;if(!T)return;S();const I=new ResizeObserver(S);return I.observe(T),T.addEventListener("scroll",S,{passive:!0}),()=>{I.disconnect(),T.removeEventListener("scroll",S)}},[e,S]),b.useEffect(()=>{const T=()=>{const I=n.current,U=o.current;if(I&&U!==0){I.scrollLeft+=U,C();const J=I.scrollLeft>4,Q=I.scrollLeft+I.clientWidth<I.scrollWidth-4;u(J),f(Q)}const O=U<0,B=U>0;O!==x.current&&(x.current=O,h(O)),B!==g.current&&(g.current=B,m(B)),s.current=requestAnimationFrame(T)};return s.current=requestAnimationFrame(T),()=>{s.current!==void 0&&cancelAnimationFrame(s.current)}},[C]);const A=T=>{const I=n.current;if(!I||!i){o.current=0;return}const U=I.getBoundingClientRect(),O=T.clientX-U.left;if(O<Du&&l){const B=1-O/Du;o.current=-(Lu+B*(Bb-Lu))}else if(O>U.width-Du&&d){const B=1-(U.width-O)/Du;o.current=Lu+B*(Bb-Lu)}else o.current=0;C()},P=()=>{o.current=0,x.current=!1,g.current=!1,h(!1),m(!1)};if(b.useLayoutEffect(()=>{r.current.length=e,C()},[e,v,C]),e===0)return c.jsx(c.Fragment,{children:t});const $=(T,I)=>`absolute ${T==="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 ${I?"scale-110":"scale-100"}`;return c.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:A,onMouseLeave:P,children:[i&&l&&c.jsx("button",{type:"button",className:$("left",p),"aria-label":"Scroll deck left","data-testid":"deck-scroll-left",onClick:()=>j("left"),children:c.jsx(NM,{className:"h-6 w-6",strokeWidth:2.5})}),i&&d&&c.jsx("button",{type:"button",className:$("right",y),"aria-label":"Scroll deck right","data-testid":"deck-scroll-right",onClick:()=>j("right"),children:c.jsx(jM,{className:"h-6 w-6",strokeWidth:2.5})}),c.jsx("div",{ref:n,className:"max-w-full overflow-x-auto overflow-y-visible [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{width:bL,maxWidth:"100%"},children:c.jsx("div",{className:"flex items-center justify-start isolate group/fan",style:{minHeight:Tg,paddingLeft:gf,paddingRight:gf},children:b.Children.map(t,(T,I)=>c.jsx("div",{ref:U=>{r.current[I]=U},className:"relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform",style:{..._L(I),minHeight:Tg},onMouseEnter:()=>w(I),onMouseLeave:()=>w(null),children:T},T&&typeof T=="object"&&"key"in T?T.key:I))})})]})}const Xe=b.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{type:t,className:je("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:r,...n}));Xe.displayName="Input";function EL({deck:e,services:t,credentials:n=[],playbooks:r=[],collectionWarnings:o,onDrop:s,onDragStart:i,onCredentialDragStart:a,onPlaybookDragStart:l,onDragEnd:u,onCardClick:d,onPlaybookClick:f,onCredentialClick:p}){const[h,y]=b.useState(!1),[m,x]=b.useState(e.name),g=b.useRef(null),v=nn(),{toast:w}=Wt();b.useEffect(()=>{x(e.name),y(!1)},[e.id,e.name]),b.useEffect(()=>{var P,$;h&&((P=g.current)==null||P.focus(),($=g.current)==null||$.select())},[h]);const k=gt({mutationFn:async P=>(await Ne("PUT",`/api/decks/${e.id}`,{name:P})).json(),onSuccess:P=>{if(!P.success)throw new Error(P.error||"Rename failed");v.invalidateQueries({queryKey:["/api/decks"]}),y(!1)},onError:P=>{x(e.name),y(!1),w({title:"Could not rename deck",description:P.message,variant:"destructive"})}}),C=()=>{const P=m.trim();if(!P||P===e.name){x(e.name),y(!1);return}k.mutate(P)},j=P=>{P.preventDefault(),s(P)},S=P=>{P.preventDefault()},A=t.length+n.length+r.length;return c.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[c.jsxs("h3",{className:"mb-4 flex min-w-0 shrink-0 items-center text-lg font-bold",children:[c.jsx("i",{className:"fas fa-layer-group mr-2 text-blue-400"}),"Deck",h?c.jsx(Xe,{ref:g,value:m,disabled:k.isPending,onChange:P=>x(P.target.value),onBlur:C,onKeyDown:P=>{P.key==="Enter"?(P.preventDefault(),C()):P.key==="Escape"&&(P.preventDefault(),x(e.name),y(!1))},className:"ml-2 h-7 max-w-[12rem] border-white/20 bg-white/10 px-2 text-sm font-normal text-white sm:max-w-[16rem]","data-testid":"input-deck-name","aria-label":"Deck name"}):c.jsx("button",{type:"button",className:"ml-2 min-w-0 truncate text-left text-sm font-normal text-gray-400 hover:text-white hover:underline",title:"Click to rename",onClick:()=>y(!0),"data-testid":"button-rename-deck",children:e.name}),c.jsxs("span",{className:"ml-2 shrink-0 text-sm font-normal text-gray-400",children:["(",A," cards)"]})]}),c.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:j,onDragOver:S,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:c.jsx("div",{className:"relative flex min-h-0 flex-1 items-center justify-center overflow-hidden min-w-0",children:A===0?c.jsx("div",{className:"flex items-center justify-center",style:{minHeight:Tg},children:c.jsx("div",{className:"flex items-center justify-center rounded-lg border-2 border-dashed border-gray-500 opacity-50 transition-opacity hover:opacity-75",style:{width:Rc,height:kN},"data-testid":"deck-empty-placeholder",children:c.jsx(ni,{className:"h-8 w-8 text-gray-500"})})}):c.jsxs(CL,{cardCount:A,children:[n.map((P,$)=>c.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:Pn,boxShadow:`0 0 20px ${Pn}20`},draggable:!0,onDragStart:T=>a(T,P,!0),onDragEnd:u,onClick:()=>p==null?void 0:p(P),"data-testid":`deck-card-${P.id}`,children:[c.jsx(xa,{warnings:o==null?void 0:o.credentialWarnings.get(P.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:Pn},children:"AK"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:Pn},children:"AK"})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:Pn},children:c.jsx(bN,{credential:P,color:Pn})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Pn},children:P.label}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Pn,borderColor:Pn},children:P.hasSecret?"API Key":"Missing key"})]})]},P.id)),r.map((P,$)=>c.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:_r,boxShadow:`0 0 20px ${_r}20`},draggable:!0,onDragStart:T=>l(T,P,!0),onDragEnd:u,onClick:()=>f==null?void 0:f(P),"data-testid":`deck-card-${P.id}`,children:[c.jsx(xa,{warnings:o==null?void 0:o.playbookWarnings.get(P.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:_r},children:"PB"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:_r},children:"PB"})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:_r},children:c.jsx(Mv,{className:"h-7 w-7",strokeWidth:2.25})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:_r},children:P.title}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:_r,borderColor:_r},children:"Playbook"})]})]},P.id)),t.map(P=>c.jsxs("div",{className:"w-32 h-48 aspect-[2/3] rounded-lg border-2 p-3 transition-shadow duration-500 shadow-lg hover:shadow-2xl bg-gradient-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer",style:{borderColor:Ur(),boxShadow:`0 0 20px ${Ur()}20`},draggable:!0,onDragStart:$=>i($,P,!0),onDragEnd:u,onClick:()=>d==null?void 0:d(P),"data-testid":`deck-card-${P.id}`,children:[c.jsx(xa,{warnings:o==null?void 0:o.serviceWarnings.get(P.id)}),c.jsx("div",{className:"absolute top-1 left-1 text-xs font-bold",children:c.jsx("div",{className:"leading-none",style:{color:Ur()},children:P.type==="mcp"?"RM":P.type==="local-mcp"?"LM":"A"})}),c.jsx("div",{className:"absolute bottom-1 right-1 text-xs font-bold rotate-180",children:c.jsx("div",{className:"leading-none",style:{color:Ur()},children:P.type==="mcp"?"RM":P.type==="local-mcp"?"LM":"A"})}),c.jsxs("div",{className:"absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"mb-2",style:{color:Ur()},children:c.jsx(wN,{service:P})}),c.jsx("h3",{className:"font-bold text-xs mb-1 line-clamp-2",style:{color:Ur()},children:P.name}),c.jsx("div",{className:"text-[8px] px-1 py-0.5 rounded border opacity-70",style:{color:Ur(),borderColor:Ur()},children:P.type==="mcp"?"Remote MCP":P.type==="local-mcp"?"Local MCP":"A2A"})]})]},P.id))]})})})]})}var jp=0;function Yv(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Wb()),document.body.insertAdjacentElement("beforeend",e[1]??Wb()),jp++,()=>{jp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jp--}},[])}function Wb(){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 Pp="focusScope.autoFocusOnMount",Tp="focusScope.autoFocusOnUnmount",Kb={bubbles:!1,cancelable:!0},NL="FocusScope",vh=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,l]=b.useState(null),u=fr(o),d=fr(s),f=b.useRef(null),p=Ye(t,m=>l(m)),h=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let m=function(w){if(h.paused||!a)return;const k=w.target;a.contains(k)?f.current=k:Ko(f.current,{select:!0})},x=function(w){if(h.paused||!a)return;const k=w.relatedTarget;k!==null&&(a.contains(k)||Ko(f.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&Ko(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(g);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[r,a,h.paused]),b.useEffect(()=>{if(a){Qb.add(h);const m=document.activeElement;if(!a.contains(m)){const g=new CustomEvent(Pp,Kb);a.addEventListener(Pp,u),a.dispatchEvent(g),g.defaultPrevented||(jL(IL(EN(a)),{select:!0}),document.activeElement===m&&Ko(a))}return()=>{a.removeEventListener(Pp,u),setTimeout(()=>{const g=new CustomEvent(Tp,Kb);a.addEventListener(Tp,d),a.dispatchEvent(g),g.defaultPrevented||Ko(m??document.body,{select:!0}),a.removeEventListener(Tp,d),Qb.remove(h)},0)}}},[a,u,d,h]);const y=b.useCallback(m=>{if(!n&&!r||h.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(x&&g){const v=m.currentTarget,[w,k]=PL(v);w&&k?!m.shiftKey&&g===k?(m.preventDefault(),n&&Ko(w,{select:!0})):m.shiftKey&&g===w&&(m.preventDefault(),n&&Ko(k,{select:!0})):g===v&&m.preventDefault()}},[n,r,h.paused]);return c.jsx(Te.div,{tabIndex:-1,...i,ref:p,onKeyDown:y})});vh.displayName=NL;function jL(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ko(r,{select:t}),document.activeElement!==n)return}function PL(e){const t=EN(e),n=Zb(t,e),r=Zb(t.reverse(),e);return[n,r]}function EN(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Zb(e,t){for(const n of e)if(!TL(n,{upTo:t}))return n}function TL(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 RL(e){return e instanceof HTMLInputElement&&"select"in e}function Ko(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&RL(e)&&t&&e.select()}}var Qb=$L();function $L(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Gb(e,t),e.unshift(t)},remove(t){var n;e=Gb(e,t),(n=e[0])==null||n.resume()}}}function Gb(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function IL(e){return e.filter(t=>t.tagName!=="A")}var AL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Di=new WeakMap,zu=new WeakMap,Fu={},Rp=0,NN=function(e){return e&&(e.host||NN(e.parentNode))},OL=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=NN(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ML=function(e,t,n,r){var o=OL(t,Array.isArray(e)?e:[e]);Fu[n]||(Fu[n]=new WeakMap);var s=Fu[n],i=[],a=new Set,l=new Set(o),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(a.has(p))d(p);else try{var h=p.getAttribute(r),y=h!==null&&h!=="false",m=(Di.get(p)||0)+1,x=(s.get(p)||0)+1;Di.set(p,m),s.set(p,x),i.push(p),m===1&&y&&zu.set(p,!0),x===1&&p.setAttribute(n,"true"),y||p.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",p,g)}})};return d(t),a.clear(),Rp++,function(){i.forEach(function(f){var p=Di.get(f)-1,h=s.get(f)-1;Di.set(f,p),s.set(f,h),p||(zu.has(f)||f.removeAttribute(r),zu.delete(f)),h||f.removeAttribute(n)}),Rp--,Rp||(Di=new WeakMap,Di=new WeakMap,zu=new WeakMap,Fu={})}},Xv=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=AL(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),ML(r,o,n,"aria-hidden")):function(){return null}},Gr=function(){return Gr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Gr.apply(this,arguments)};function jN(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function DL(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var wd="right-scroll-bar-position",bd="width-before-scroll-bar",LL="with-scroll-bars-hidden",zL="--removed-body-scroll-bar-size";function $p(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function FL(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var UL=typeof window<"u"?b.useLayoutEffect:b.useEffect,Jb=new WeakMap;function qL(e,t){var n=FL(null,function(r){return e.forEach(function(o){return $p(o,r)})});return UL(function(){var r=Jb.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||$p(a,null)}),s.forEach(function(a){o.has(a)||$p(a,i)})}Jb.set(n,e)},[e]),n}function VL(e){return e}function HL(e,t){t===void 0&&(t=VL);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var l=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(l)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function BL(e){e===void 0&&(e={});var t=HL(null);return t.options=Gr({async:!0,ssr:!1},e),t}var PN=function(e){var t=e.sideCar,n=jN(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return b.createElement(r,Gr({},n))};PN.isSideCarExport=!0;function WL(e,t){return e.useMedium(t),PN}var TN=BL(),Ip=function(){},xh=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:Ip,onWheelCapture:Ip,onTouchMoveCapture:Ip}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,l=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,y=e.noIsolation,m=e.inert,x=e.allowPinchZoom,g=e.as,v=g===void 0?"div":g,w=e.gapMode,k=jN(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,j=qL([n,t]),S=Gr(Gr({},k),o);return b.createElement(b.Fragment,null,d&&b.createElement(C,{sideCar:TN,removeScrollBar:u,shards:f,noRelative:h,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:w}),i?b.cloneElement(b.Children.only(a),Gr(Gr({},S),{ref:j})):b.createElement(v,Gr({},S,{className:l,ref:j}),a))});xh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};xh.classNames={fullWidth:bd,zeroRight:wd};var KL=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function ZL(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=KL();return t&&e.setAttribute("nonce",t),e}function QL(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function GL(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var JL=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ZL())&&(QL(t,n),GL(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},YL=function(){var e=JL();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},RN=function(){var e=YL(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},XL={left:0,top:0,right:0,gap:0},Ap=function(e){return parseInt(e||"",10)||0},ez=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ap(n),Ap(r),Ap(o)]},tz=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return XL;var t=ez(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},nz=RN(),wa="data-scroll-locked",rz=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
280
- .`.concat(LL,` {
281
- overflow: hidden `).concat(r,`;
282
- padding-right: `).concat(a,"px ").concat(r,`;
283
- }
284
- body[`).concat(wa,`] {
285
- overflow: hidden `).concat(r,`;
286
- overscroll-behavior: contain;
287
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
288
- padding-left: `.concat(o,`px;
289
- padding-top: `).concat(s,`px;
290
- padding-right: `).concat(i,`px;
291
- margin-left:0;
292
- margin-top:0;
293
- margin-right: `).concat(a,"px ").concat(r,`;
294
- `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
295
- }
296
-
297
- .`).concat(wd,` {
298
- right: `).concat(a,"px ").concat(r,`;
299
- }
300
-
301
- .`).concat(bd,` {
302
- margin-right: `).concat(a,"px ").concat(r,`;
303
- }
304
-
305
- .`).concat(wd," .").concat(wd,` {
306
- right: 0 `).concat(r,`;
307
- }
308
-
309
- .`).concat(bd," .").concat(bd,` {
310
- margin-right: 0 `).concat(r,`;
311
- }
312
-
313
- body[`).concat(wa,`] {
314
- `).concat(zL,": ").concat(a,`px;
315
- }
316
- `)},Yb=function(){var e=parseInt(document.body.getAttribute(wa)||"0",10);return isFinite(e)?e:0},oz=function(){b.useEffect(function(){return document.body.setAttribute(wa,(Yb()+1).toString()),function(){var e=Yb()-1;e<=0?document.body.removeAttribute(wa):document.body.setAttribute(wa,e.toString())}},[])},sz=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;oz();var s=b.useMemo(function(){return tz(o)},[o]);return b.createElement(nz,{styles:rz(s,!t,o,n?"":"!important")})},Rg=!1;if(typeof window<"u")try{var Uu=Object.defineProperty({},"passive",{get:function(){return Rg=!0,!0}});window.addEventListener("test",Uu,Uu),window.removeEventListener("test",Uu,Uu)}catch{Rg=!1}var Li=Rg?{passive:!1}:!1,iz=function(e){return e.tagName==="TEXTAREA"},$N=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!iz(e)&&n[t]==="visible")},az=function(e){return $N(e,"overflowY")},lz=function(e){return $N(e,"overflowX")},Xb=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=IN(e,r);if(o){var s=AN(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cz=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},uz=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},IN=function(e,t){return e==="v"?az(t):lz(t)},AN=function(e,t){return e==="v"?cz(t):uz(t)},dz=function(e,t){return e==="h"&&t==="rtl"?-1:1},fz=function(e,t,n,r,o){var s=dz(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,l=t.contains(a),u=!1,d=i>0,f=0,p=0;do{if(!a)break;var h=AN(e,a),y=h[0],m=h[1],x=h[2],g=m-x-s*y;(y||g)&&IN(e,a)&&(f+=g,p+=y);var v=a.parentNode;a=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(u=!0),u},qu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ek=function(e){return[e.deltaX,e.deltaY]},tk=function(e){return e&&"current"in e?e.current:e},hz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},pz=function(e){return`
317
- .block-interactivity-`.concat(e,` {pointer-events: none;}
318
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
319
- `)},mz=0,zi=[];function gz(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),o=b.useState(mz++)[0],s=b.useState(RN)[0],i=b.useRef(e);b.useEffect(function(){i.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=DL([e.lockRef.current],(e.shards||[]).map(tk),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=b.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var g=qu(m),v=n.current,w="deltaX"in m?m.deltaX:v[0]-g[0],k="deltaY"in m?m.deltaY:v[1]-g[1],C,j=m.target,S=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in m&&S==="h"&&j.type==="range")return!1;var A=Xb(S,j);if(!A)return!0;if(A?C=S:(C=S==="v"?"h":"v",A=Xb(S,j)),!A)return!1;if(!r.current&&"changedTouches"in m&&(w||k)&&(r.current=C),!C)return!0;var P=r.current||C;return fz(P,x,m,P==="h"?w:k)},[]),l=b.useCallback(function(m){var x=m;if(!(!zi.length||zi[zi.length-1]!==s)){var g="deltaY"in x?ek(x):qu(x),v=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&hz(C.delta,g)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var w=(i.current.shards||[]).map(tk).filter(Boolean).filter(function(C){return C.contains(x.target)}),k=w.length>0?a(x,w[0]):!i.current.noIsolation;k&&x.cancelable&&x.preventDefault()}}},[]),u=b.useCallback(function(m,x,g,v){var w={name:m,delta:x,target:g,should:v,shadowParent:yz(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),d=b.useCallback(function(m){n.current=qu(m),r.current=void 0},[]),f=b.useCallback(function(m){u(m.type,ek(m),m.target,a(m,e.lockRef.current))},[]),p=b.useCallback(function(m){u(m.type,qu(m),m.target,a(m,e.lockRef.current))},[]);b.useEffect(function(){return zi.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Li),document.addEventListener("touchmove",l,Li),document.addEventListener("touchstart",d,Li),function(){zi=zi.filter(function(m){return m!==s}),document.removeEventListener("wheel",l,Li),document.removeEventListener("touchmove",l,Li),document.removeEventListener("touchstart",d,Li)}},[]);var h=e.removeScrollBar,y=e.inert;return b.createElement(b.Fragment,null,y?b.createElement(s,{styles:pz(o)}):null,h?b.createElement(sz,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function yz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vz=WL(TN,gz);var wh=b.forwardRef(function(e,t){return b.createElement(xh,Gr({},e,{ref:t,sideCar:vz}))});wh.classNames=xh.classNames;var bh="Popover",[ON,QX]=ro(bh,[ll]),Jc=ll(),[xz,As]=ON(bh),MN=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,a=Jc(t),l=b.useRef(null),[u,d]=b.useState(!1),[f,p]=Es({prop:r,defaultProp:o??!1,onChange:s,caller:bh});return c.jsx(dN,{...a,children:c.jsx(xz,{scope:t,contentId:Co(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(h=>!h),[p]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:i,children:n})})};MN.displayName=bh;var DN="PopoverAnchor",wz=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=As(DN,n),s=Jc(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:a}=o;return b.useEffect(()=>(i(),()=>a()),[i,a]),c.jsx(mh,{...s,...r,ref:t})});wz.displayName=DN;var LN="PopoverTrigger",zN=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=As(LN,n),s=Jc(n),i=Ye(t,o.triggerRef),a=c.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":HN(o.open),...r,ref:i,onClick:be(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:c.jsx(mh,{asChild:!0,...s,children:a})});zN.displayName=LN;var e0="PopoverPortal",[bz,kz]=ON(e0,{forceMount:void 0}),FN=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=As(e0,t);return c.jsx(bz,{scope:t,forceMount:n,children:c.jsx(oo,{present:n||s.open,children:c.jsx(Zc,{asChild:!0,container:o,children:r})})})};FN.displayName=e0;var Za="PopoverContent",UN=b.forwardRef((e,t)=>{const n=kz(Za,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=As(Za,e.__scopePopover);return c.jsx(oo,{present:r||s.open,children:s.modal?c.jsx(Sz,{...o,ref:t}):c.jsx(Cz,{...o,ref:t})})});UN.displayName=Za;var _z=ki("PopoverContent.RemoveScroll"),Sz=b.forwardRef((e,t)=>{const n=As(Za,e.__scopePopover),r=b.useRef(null),o=Ye(t,r),s=b.useRef(!1);return b.useEffect(()=>{const i=r.current;if(i)return Xv(i)},[]),c.jsx(wh,{as:_z,allowPinchZoom:!0,children:c.jsx(qN,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:be(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:be(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:be(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Cz=b.forwardRef((e,t)=>{const n=As(Za,e.__scopePopover),r=b.useRef(!1),o=b.useRef(!1);return c.jsx(qN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),qN=b.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,...f}=e,p=As(Za,n),h=Jc(n);return Yv(),c.jsx(vh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:c.jsx(ol,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>p.onOpenChange(!1),children:c.jsx(Kv,{"data-state":HN(p.open),role:"dialog",id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),VN="PopoverClose",Ez=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=As(VN,n);return c.jsx(Te.button,{type:"button",...r,ref:t,onClick:be(e.onClick,()=>o.onOpenChange(!1))})});Ez.displayName=VN;var Nz="PopoverArrow",jz=b.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Jc(n);return c.jsx(Zv,{...o,...r,ref:t})});jz.displayName=Nz;function HN(e){return e?"open":"closed"}var Pz=MN,Tz=zN,Rz=FN,BN=UN;const $z=Pz,Iz=Tz,WN=b.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>c.jsx(Rz,{children:c.jsx(BN,{ref:o,align:t,sideOffset:n,className:je("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",e),...r})}));WN.displayName=BN.displayName;function Az(e,t){const n=new Date(e).getTime();if(Number.isNaN(n))return"";const r=Math.max(0,Math.floor((t.getTime()-n)/1e3));if(r<60)return`${r}s`;const o=Math.floor(r/60);if(o<60)return`${o}m`;const s=Math.floor(o/60);return s<24?`${s}h`:`${Math.floor(s/24)}d`}function Oz(e,t=24){return e.length>t?`${e.slice(0,t-1)}…`:e}function Mz(e){const t=e.replace(/\/+$/,""),n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function Dz(e){const t=new Map;for(const n of e)t.set(n.deckId,(t.get(n.deckId)??0)+1);return t}function Lz(e,t){const n=e>0?`${e} cards`:"Empty";if(t<=0)return n;const r=t===1?"1 session":`${t} sessions`;return`${n}, ${r}`}const zz=3e3;function Fz({highlightDeckId:e}){const{data:t}=It({queryKey:["/api/scope/bindings"],refetchInterval:zz}),n=(t==null?void 0:t.data)??[],r=b.useMemo(()=>new Date,[t]),o=b.useMemo(()=>{const i=new Map;for(const a of n){const l=i.get(a.workspaceRoot)??[];l.push(a),i.set(a.workspaceRoot,l)}return[...i.entries()].sort(([a],[l])=>a.localeCompare(l)).map(([a,l])=>({workspaceRoot:a,rows:[...l].sort((u,d)=>u.lastActivityAt<d.lastActivityAt?1:-1)}))},[n]);if(n.length===0)return null;const s=e?n.filter(i=>i.deckId===e).length:0;return c.jsxs($z,{children:[c.jsx(Iz,{asChild:!0,children:c.jsxs(fe,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 border-white/20 bg-black/30 px-2 text-xs text-gray-200 hover:bg-white/10 hover:text-white","data-testid":"live-session-badges-trigger",title:"Live MCP session binds — click for badges",children:[c.jsx(OM,{className:"mr-1 h-3 w-3",style:{color:vn},"aria-hidden":!0}),c.jsxs("span",{className:"font-mono",children:["⌘",n.length]}),s>0&&s<n.length?c.jsxs("span",{className:"ml-1 text-gray-400",children:["(",s," here)"]}):null]})}),c.jsxs(WN,{align:"end",className:"w-80 border-white/10 bg-gray-950/95 p-0 text-gray-100","data-testid":"live-session-badges-panel",children:[c.jsxs("div",{className:"border-b border-white/10 px-3 py-2",children:[c.jsx("p",{className:"text-sm font-semibold",style:{color:vn},children:"Live sessions"}),c.jsxs("p",{className:"text-xs text-gray-400",children:["Match ",c.jsx("span",{className:"font-mono",children:"⌘badge"})," to the chat opener"]})]}),c.jsx("div",{className:"max-h-64 overflow-y-auto p-2",children:o.map(({workspaceRoot:i,rows:a})=>c.jsxs("div",{className:"mb-2 last:mb-0",children:[c.jsxs("p",{className:"px-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500",children:[Mz(i),"/"]}),c.jsx("ul",{className:"space-y-1",children:a.map(l=>{const u=l.clientName??"agent",d=Az(l.lastActivityAt,r),f=d?`${u} · ${d}`:u,p=e===l.deckId;return c.jsxs("li",{className:je("rounded-md px-2 py-1.5 font-mono text-xs",p?"bg-[#92E4DD]/10 ring-1 ring-[#92E4DD]/40":"bg-white/5"),"data-testid":`live-session-row-${l.badge}`,children:[c.jsx("span",{className:"text-gray-100",children:Oz(l.deckName)})," ",c.jsxs("span",{style:{color:vn},children:["⌘",l.badge]}),c.jsx("span",{className:"mt-0.5 block font-sans text-[10px] text-gray-400",children:f})]},l.badge)})})]},i))})]})]})}var kh="Dialog",[KN,GX]=ro(kh),[Uz,Dr]=KN(kh),ZN=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=b.useRef(null),l=b.useRef(null),[u,d]=Es({prop:r,defaultProp:o??!1,onChange:s,caller:kh});return c.jsx(Uz,{scope:t,triggerRef:a,contentRef:l,contentId:Co(),titleId:Co(),descriptionId:Co(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};ZN.displayName=kh;var QN="DialogTrigger",qz=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Dr(QN,n),s=Ye(t,o.triggerRef);return c.jsx(Te.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":r0(o.open),...r,ref:s,onClick:be(e.onClick,o.onOpenToggle)})});qz.displayName=QN;var t0="DialogPortal",[Vz,GN]=KN(t0,{forceMount:void 0}),JN=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Dr(t0,t);return c.jsx(Vz,{scope:t,forceMount:n,children:b.Children.map(r,i=>c.jsx(oo,{present:n||s.open,children:c.jsx(Zc,{asChild:!0,container:o,children:i})}))})};JN.displayName=t0;var yf="DialogOverlay",YN=b.forwardRef((e,t)=>{const n=GN(yf,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Dr(yf,e.__scopeDialog);return s.modal?c.jsx(oo,{present:r||s.open,children:c.jsx(Bz,{...o,ref:t})}):null});YN.displayName=yf;var Hz=ki("DialogOverlay.RemoveScroll"),Bz=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Dr(yf,n);return c.jsx(wh,{as:Hz,allowPinchZoom:!0,shards:[o.contentRef],children:c.jsx(Te.div,{"data-state":r0(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Si="DialogContent",XN=b.forwardRef((e,t)=>{const n=GN(Si,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Dr(Si,e.__scopeDialog);return c.jsx(oo,{present:r||s.open,children:s.modal?c.jsx(Wz,{...o,ref:t}):c.jsx(Kz,{...o,ref:t})})});XN.displayName=Si;var Wz=b.forwardRef((e,t)=>{const n=Dr(Si,e.__scopeDialog),r=b.useRef(null),o=Ye(t,n.contentRef,r);return b.useEffect(()=>{const s=r.current;if(s)return Xv(s)},[]),c.jsx(ej,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:be(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:be(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:be(e.onFocusOutside,s=>s.preventDefault())})}),Kz=b.forwardRef((e,t)=>{const n=Dr(Si,e.__scopeDialog),r=b.useRef(!1),o=b.useRef(!1);return c.jsx(ej,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,a;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),ej=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=Dr(Si,n),l=b.useRef(null),u=Ye(t,l);return Yv(),c.jsxs(c.Fragment,{children:[c.jsx(vh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:c.jsx(ol,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":r0(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(Zz,{titleId:a.titleId}),c.jsx(Gz,{contentRef:l,descriptionId:a.descriptionId})]})]})}),n0="DialogTitle",tj=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Dr(n0,n);return c.jsx(Te.h2,{id:o.titleId,...r,ref:t})});tj.displayName=n0;var nj="DialogDescription",rj=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Dr(nj,n);return c.jsx(Te.p,{id:o.descriptionId,...r,ref:t})});rj.displayName=nj;var oj="DialogClose",sj=b.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Dr(oj,n);return c.jsx(Te.button,{type:"button",...r,ref:t,onClick:be(e.onClick,()=>o.onOpenChange(!1))})});sj.displayName=oj;function r0(e){return e?"open":"closed"}var ij="DialogTitleWarning",[JX,aj]=TO(ij,{contentName:Si,titleName:n0,docsSlug:"dialog"}),Zz=({titleId:e})=>{const t=aj(ij),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
320
-
321
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
322
-
323
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Qz="DialogDescriptionWarning",Gz=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${aj(Qz).contentName}}.`;return b.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Jz=ZN,Yz=JN,lj=YN,cj=XN,uj=tj,dj=rj,Xz=sj;const Os=Jz,eF=Yz,fj=b.forwardRef(({className:e,...t},n)=>c.jsx(lj,{ref:n,className:je("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}));fj.displayName=lj.displayName;const Mo=b.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(eF,{children:[c.jsx(fj,{}),c.jsxs(cj,{ref:r,className:je("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),...n,children:[t,c.jsxs(Xz,{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:[c.jsx(df,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Mo.displayName=cj.displayName;const Do=({className:e,...t})=>c.jsx("div",{className:je("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Do.displayName="DialogHeader";const Lo=b.forwardRef(({className:e,...t},n)=>c.jsx(uj,{ref:n,className:je("text-lg font-semibold leading-none tracking-tight",e),...t}));Lo.displayName=uj.displayName;const Ii=b.forwardRef(({className:e,...t},n)=>c.jsx(dj,{ref:n,className:je("text-sm text-muted-foreground",e),...t}));Ii.displayName=dj.displayName;const wo=b.forwardRef(({className:e,...t},n)=>c.jsx("textarea",{className:je("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:n,...t}));wo.displayName="Textarea";var tF="Label",hj=b.forwardRef((e,t)=>c.jsx(Te.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));hj.displayName=tF;var pj=hj;const nF=lh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=b.forwardRef(({className:e,...t},n)=>c.jsx(pj,{ref:n,className:je(nF(),e),...t}));We.displayName=pj.displayName;var rF=b.createContext(void 0);function o0(e){const t=b.useContext(rF);return e||t||"ltr"}var Op="rovingFocusGroup.onEntryFocus",oF={bubbles:!1,cancelable:!0},Yc="RovingFocusGroup",[$g,mj,sF]=$v(Yc),[iF,gj]=ro(Yc,[sF]),[aF,lF]=iF(Yc),yj=b.forwardRef((e,t)=>c.jsx($g.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx($g.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(cF,{...e,ref:t})})}));yj.displayName=Yc;var cF=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,p=b.useRef(null),h=Ye(t,p),y=o0(s),[m,x]=Es({prop:i,defaultProp:a??null,onChange:l,caller:Yc}),[g,v]=b.useState(!1),w=fr(u),k=mj(n),C=b.useRef(!1),[j,S]=b.useState(0);return b.useEffect(()=>{const A=p.current;if(A)return A.addEventListener(Op,w),()=>A.removeEventListener(Op,w)},[w]),c.jsx(aF,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:m,onItemFocus:b.useCallback(A=>x(A),[x]),onItemShiftTab:b.useCallback(()=>v(!0),[]),onFocusableItemAdd:b.useCallback(()=>S(A=>A+1),[]),onFocusableItemRemove:b.useCallback(()=>S(A=>A-1),[]),children:c.jsx(Te.div,{tabIndex:g||j===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:be(e.onMouseDown,()=>{C.current=!0}),onFocus:be(e.onFocus,A=>{const P=!C.current;if(A.target===A.currentTarget&&P&&!g){const $=new CustomEvent(Op,oF);if(A.currentTarget.dispatchEvent($),!$.defaultPrevented){const T=k().filter(J=>J.focusable),I=T.find(J=>J.active),U=T.find(J=>J.id===m),B=[I,U,...T].filter(Boolean).map(J=>J.ref.current);wj(B,d)}}C.current=!1}),onBlur:be(e.onBlur,()=>v(!1))})})}),vj="RovingFocusGroupItem",xj=b.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,l=Co(),u=s||l,d=lF(vj,n),f=d.currentTabStopId===u,p=mj(n),{onFocusableItemAdd:h,onFocusableItemRemove:y,currentTabStopId:m}=d;return b.useEffect(()=>{if(r)return h(),()=>y()},[r,h,y]),c.jsx($g.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:c.jsx(Te.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:be(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:be(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:be(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=fF(x,d.orientation,d.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let w=p().filter(k=>k.focusable).map(k=>k.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const k=w.indexOf(x.currentTarget);w=d.loop?hF(w,k+1):w.slice(k+1)}setTimeout(()=>wj(w))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:m!=null}):i})})});xj.displayName=vj;var uF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function fF(e,t,n){const r=dF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return uF[r]}function wj(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function hF(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pF=yj,mF=xj,_h="Tabs",[gF,YX]=ro(_h,[gj]),bj=gj(),[yF,s0]=gF(_h),kj=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=o0(a),[f,p]=Es({prop:r,onChange:o,defaultProp:s??"",caller:_h});return c.jsx(yF,{scope:n,baseId:Co(),value:f,onValueChange:p,orientation:i,dir:d,activationMode:l,children:c.jsx(Te.div,{dir:d,"data-orientation":i,...u,ref:t})})});kj.displayName=_h;var _j="TabsList",Sj=b.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=s0(_j,n),i=bj(n);return c.jsx(pF,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:c.jsx(Te.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Sj.displayName=_j;var Cj="TabsTrigger",Ej=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=s0(Cj,n),a=bj(n),l=Pj(i.baseId,r),u=Tj(i.baseId,r),d=r===i.value;return c.jsx(mF,{asChild:!0,...a,focusable:!o,active:d,children:c.jsx(Te.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...s,ref:t,onMouseDown:be(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:be(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:be(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});Ej.displayName=Cj;var Nj="TabsContent",jj=b.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=s0(Nj,n),l=Pj(a.baseId,r),u=Tj(a.baseId,r),d=r===a.value,f=b.useRef(d);return b.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),c.jsx(oo,{present:o||d,children:({present:p})=>c.jsx(Te.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&s})})});jj.displayName=Nj;function Pj(e,t){return`${e}-trigger-${t}`}function Tj(e,t){return`${e}-content-${t}`}var vF=kj,Rj=Sj,$j=Ej,Ij=jj;const xF=vF,Aj=b.forwardRef(({className:e,...t},n)=>c.jsx(Rj,{ref:n,className:je("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Aj.displayName=Rj.displayName;const Ig=b.forwardRef(({className:e,...t},n)=>c.jsx($j,{ref:n,className:je("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}));Ig.displayName=$j.displayName;const Ag=b.forwardRef(({className:e,...t},n)=>c.jsx(Ij,{ref:n,className:je("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ag.displayName=Ij.displayName;function ec(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Oj(e){return ec(e)&&typeof e.command=="string"}function Mp(e){return!ec(e)||Object.keys(e).length===0?!1:Object.values(e).every(Oj)}function wF(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,"").replace(/\n?```\s*$/,"").trim():t}function bF(e){if(!ec(e))throw new Error("Configuration must be a JSON object");if(ec(e.config)&&Mp(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Mp(e.mcpServers))return{mcpServers:e.mcpServers};if(ec(e)&&typeof e.command=="string"){const t=typeof e.name=="string"&&e.name.trim()?e.name.trim():"local-server",{name:n,...r}=e;if(!Oj(r))throw new Error("Missing or invalid command");return{mcpServers:{[t]:r}}}if(Mp(e))return{mcpServers:e};throw new Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
324
- {
325
- "mcpServers": {
326
- "google-drive": {
327
- "command": "npx",
328
- "args": ["-y", "@piotr-agier/google-drive-mcp"]
329
- }
330
- }
331
- }`)}function kF(e){let t;try{t=JSON.parse(wF(e))}catch(n){throw new Error(`Failed to parse JSON: ${n instanceof Error?n.message:"Unknown error"}`)}return bF(t)}function _F({type:e,open:t,onOpenChange:n}){const[r,o]=b.useState("remote"),[s,i]=b.useState("json"),[a,l]=b.useState(`{
332
- "mcpServers": {
333
- "memory": {
334
- "command": "npx",
335
- "args": ["-y", "@modelcontextprotocol/server-memory"],
336
- "env": {
337
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
338
- }
339
- }
340
- }
341
- }`),[u,d]=b.useState(null),[f,p]=b.useState(null),[h,y]=b.useState(null),[m,x]=b.useState({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:vn}),[g,v]=b.useState(`{
342
-
343
- }`),[w,k]=b.useState(null),[C,j]=b.useState({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:vn}),[S,A]=b.useState({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:vn}),P=nn(),{toast:$}=Wt(),T=()=>{try{p(null);const E=kF(a),R=Object.entries(E.mcpServers);if(R.length===0)throw new Error("No MCP servers found in configuration");if(R.length>1)throw new Error("Multiple servers not supported. Please configure one server at a time.");const[D,K]=R[0],{command:X,args:pe,env:ce,description:L}=K;if(!X||typeof X!="string")throw new Error("Missing or invalid command");if(!pe||!Array.isArray(pe))throw new Error("Missing or invalid args array");const q={name:D,command:X,args:pe.map(String),env:ce&&typeof ce=="object"?ce:void 0,description:L&&typeof L=="string"?L:void 0};d(q),i("review"),j({name:q.name,type:"local-mcp",command:q.command,args:q.args,env:q.env||{},description:q.description||"",cardColor:vn}),I(D)}catch(E){p(E instanceof Error?E.message:"Failed to parse JSON"),d(null)}},I=async E=>{try{const K=((await Ne("GET","/api/services")).data||[]).find(X=>X.name===E);y(K?E:null)}catch(R){console.error("Failed to check name conflict:",R)}},U=async E=>{await I(E)},O=gt({mutationFn:async E=>{if(e==="mcp"&&r==="local"){const R={mcpServers:{[E.name]:{command:E.command,args:E.args.filter(D=>D.trim()!==""),...Object.keys(E.env).length>0&&{env:E.env}}}};return console.log("Importing local MCP server:",R),Ne("POST","/api/local-mcp/import",{config:JSON.stringify(R)})}else{const R={name:E.name,type:e,url:e==="mcp"?E.url:E.manifest_url,description:E.description,cardColor:E.cardColor,...E.headers_enabled&&{headers:E.headers}};return console.log("Sending service data:",R),Ne("POST","/api/services",R)}},onSuccess:()=>{P.invalidateQueries({queryKey:["/api/services"]}),P.invalidateQueries({queryKey:["/api/collection/warnings"]}),$({title:"Service registered successfully!",description:`${(e==="mcp"?r==="remote"?m:C:S).name} has been added to your collection.`}),J()},onError:E=>{var R;console.error("Registration failed:",E),console.error("Error details:",{message:E==null?void 0:E.message,name:E==null?void 0:E.name,stack:E==null?void 0:E.stack,toString:E==null?void 0:E.toString(),constructor:(R=E==null?void 0:E.constructor)==null?void 0:R.name}),$({title:"Registration failed",description:(E==null?void 0:E.message)||"Failed to register service. Please try again.",variant:"destructive"})}}),B=async()=>{if(e==="mcp"&&r==="local"){if(s==="json")T();else if(s==="review"){if(await U(C.name),h){$({title:"Name Conflict",description:`A service with the name "${C.name}" already exists. Please choose a different name.`,variant:"destructive"});return}O.mutate(C)}}else{const E=e==="mcp"?r==="remote"?m:C:S;if(await U(E.name),h){$({title:"Name Conflict",description:`A service with the name "${E.name}" already exists. Please choose a different name.`,variant:"destructive"});return}if(e==="mcp"&&r==="remote"&&m.headers_enabled){const R=W();if(R===null)return;O.mutate({...m,headers:R});return}O.mutate(E)}},J=()=>{i("json"),l(`{
344
- "mcpServers": {
345
- "memory": {
346
- "command": "npx",
347
- "args": ["-y", "@modelcontextprotocol/server-memory"],
348
- "env": {
349
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
350
- }
351
- }
352
- }
353
- }`),d(null),p(null),y(null),x({name:"",type:"mcp",url:"http://localhost:8000/mcp",description:"",headers_enabled:!1,headers:{},cardColor:vn}),v(`{
354
-
355
- }`),k(null),j({name:"",type:"local-mcp",command:"",args:[""],env:{},description:"",cardColor:vn}),A({name:"",type:"a2a",manifest_url:"http://localhost:8001/.well-known/a2a/manifest.json",description:"",cardColor:vn}),n(!1)},Q=(E,R)=>{x(D=>({...D,[E]:R}))},H=E=>{Q("headers_enabled",E),E&&g.trim()===`{
356
-
357
- }`&&v(`{
358
- "Authorization": "Bearer "
359
- }`),E||k(null)},W=()=>{const E=g.trim();if(!E||E==="{}")return{};try{const R=JSON.parse(E);if(typeof R!="object"||R===null||Array.isArray(R))return k('Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})'),null;for(const[D,K]of Object.entries(R))if(typeof K!="string")return k(`Header "${D}" must be a string value`),null;return k(null),R}catch{return k("Invalid JSON — fix syntax before registering"),null}},N=(E,R)=>{j(D=>({...D,[E]:R}))},M=(E,R)=>{A(D=>({...D,[E]:R}))},V=()=>{if(e==="mcp"&&r==="local"){if(s==="json")return"Parse Configuration";if(s==="review")return h?"Register Anyway":"Register Service"}return"Register Service"},_=()=>{var E,R;if(e==="mcp"&&r==="local"){if(s==="json")return!a.trim();if(s==="review")return!C.name.trim()||!C.command.trim()}else{const D=e==="mcp"?r==="remote"?m:C:S;return!D.name.trim()||e==="mcp"&&r==="remote"&&!((E=D.url)!=null&&E.trim())||e==="a2a"&&!((R=D.manifest_url)!=null&&R.trim())}return!1};return c.jsx(Os,{open:t,onOpenChange:n,children:c.jsxs(Mo,{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:[c.jsxs(Do,{children:[c.jsxs(Lo,{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"?c.jsx(uf,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}):c.jsx(EM,{className:"w-6 h-6 mr-3",style:{color:"#92E4DD"}}),"Register ",e==="mcp"?"MCP Server":"A2A Agent"]}),c.jsx(Ii,{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"?c.jsxs(xF,{value:r,onValueChange:E=>o(E),className:"w-full",children:[c.jsxs(Aj,{className:"grid w-full grid-cols-2 bg-white/10 border border-white/20",children:[c.jsxs(Ig,{value:"remote",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[c.jsx(uf,{className:"w-4 h-4 mr-2"}),"Remote MCP"]}),c.jsxs(Ig,{value:"local",className:"data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400",children:[c.jsx(MM,{className:"w-4 h-4 mr-2"}),"Local MCP"]})]}),c.jsxs(Ag,{value:"remote",className:"space-y-4 mt-4",children:[c.jsxs("div",{children:[c.jsx(We,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),c.jsx(Xe,{id:"name",placeholder:"e.g., Database Tools",value:m.name,onChange:E=>{Q("name",E.target.value),E.target.value.trim()?U(E.target.value):y(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),h&&c.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[c.jsx(jr,{className:"w-4 h-4"}),c.jsx("span",{children:"A service with this name already exists"})]})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"MCP URL"}),c.jsx(Xe,{id:"url",type:"url",placeholder:"http://localhost:8080/mcp or https://mcp.notion.com/mcp",value:m.url,onChange:E=>Q("url",E.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-mcp-url"}),c.jsxs("div",{className:"mt-1 text-xs text-gray-400",children:[c.jsx("p",{children:"Supported formats:"}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsxs("li",{children:["HTTP MCP: ",c.jsx("code",{children:"http://localhost:8080/mcp"})]}),c.jsxs("li",{children:["SSE MCP: ",c.jsx("code",{children:"https://be.omnimcp.ai/api/v1/mcp/.../sse"})]}),c.jsxs("li",{children:["Notion MCP: ",c.jsx("code",{children:"https://mcp.notion.com/mcp"})]})]})]})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(wo,{id:"description",placeholder:"Brief description of capabilities...",value:m.description,onChange:E=>Q("description",E.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),c.jsxs(Ag,{value:"local",className:"space-y-4 mt-4",children:[s==="json"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(We,{htmlFor:"local-json",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Local MCP Configuration (JSON)"}),c.jsx(wo,{id:"local-json",placeholder:`{
360
- "mcpServers": {
361
- "memory": {
362
- "command": "npx",
363
- "args": ["-y", "@modelcontextprotocol/server-memory"]
364
- }
365
- }
366
- }`,value:a,onChange:E=>l(E.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"}),c.jsxs("div",{className:"mt-2 text-xs text-gray-400",children:[c.jsx("p",{children:"Enter your local MCP server configuration in JSON format."}),c.jsx("p",{children:"Example:"}),c.jsx("pre",{className:"bg-white/10 p-2 rounded-md text-xs text-gray-300",children:`{
367
- "mcpServers": {
368
- "memory": {
369
- "command": "npx",
370
- "args": ["-y", "@modelcontextprotocol/server-memory"],
371
- "env": {
372
- "MEMORY_FILE_PATH": "/path/to/custom/memory.json"
373
- }
374
- }
375
- }
376
- }`})]})]}),c.jsxs(fe,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:T,disabled:!a.trim()||a.trim().length<10,"data-testid":"button-parse-json",children:[c.jsx(_g,{className:"w-4 h-4 mr-2",style:{color:"#0A0A07"}}),"Parse Configuration"]})]}),s==="review"&&c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(We,{htmlFor:"local-name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Server Name"}),c.jsx(Xe,{id:"local-name",placeholder:"e.g., Memory Server",value:C.name,onChange:E=>{N("name",E.target.value),E.target.value.trim()?U(E.target.value):y(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-local-service-name"}),h&&c.jsxs("div",{className:"mt-2 text-xs text-red-400 flex items-center",children:[c.jsx(jr,{className:"w-4 h-4 mr-1"}),'A service with the name "',h,'" already exists.']})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"command",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Command"}),c.jsx(Xe,{id:"command",placeholder:"e.g., npx, python, node",value:C.command,onChange:E=>N("command",E.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-command"}),c.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"The command to execute (e.g., npx, python, node)"})]}),c.jsxs("div",{children:[c.jsx(We,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Arguments"}),C.args.map((E,R)=>c.jsxs("div",{className:"flex gap-2 mb-2",children:[c.jsx(Xe,{placeholder:`Argument ${R+1}`,value:E,onChange:D=>{const K=[...C.args];K[R]=D.target.value,N("args",K)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-arg-${R}`}),R===C.args.length-1&&c.jsx(fe,{type:"button",size:"sm",onClick:()=>N("args",[...C.args,""]),className:"bg-white/20 hover:bg-white/30 text-white",children:c.jsx(ni,{className:"w-4 h-4"})}),C.args.length>1&&c.jsx(fe,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const D=C.args.filter((K,X)=>X!==R);N("args",D)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:c.jsx(df,{className:"w-4 h-4"})})]},R)),c.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Command arguments (e.g., -y, @modelcontextprotocol/server-memory)"})]}),c.jsxs("div",{children:[c.jsx(We,{className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Environment Variables"}),Object.entries(C.env).length===0?c.jsx("div",{className:"text-gray-400 text-sm italic",children:"No environment variables configured"}):c.jsx("div",{className:"space-y-2",children:Object.entries(C.env).map(([E,R],D)=>c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Xe,{placeholder:"Variable name",value:E,onChange:K=>{const X={...C.env};delete X[E],X[K.target.value]=R,N("env",X)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-key-${D}`}),c.jsx(Xe,{placeholder:"Value",value:R,onChange:K=>{const X={...C.env};X[E]=K.target.value,N("env",X)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400","data-testid":`input-env-value-${D}`}),c.jsx(fe,{type:"button",size:"sm",variant:"destructive",onClick:()=>{const K={...C.env};delete K[E],N("env",K)},className:"bg-red-500/80 hover:bg-red-500 text-white",children:c.jsx(df,{className:"w-4 h-4"})})]},D))}),c.jsxs(fe,{type:"button",size:"sm",onClick:()=>{const E={...C.env};E[""]="",N("env",E)},className:"mt-2 bg-white/20 hover:bg-white/30 text-white",children:[c.jsx(ni,{className:"w-4 h-4 mr-2"}),"Add Environment Variable"]}),c.jsx("div",{className:"mt-1 text-xs text-gray-400",children:"Environment variables for the MCP server process"})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"local-description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(wo,{id:"local-description",placeholder:"Brief description of capabilities...",value:C.description,onChange:E=>N("description",E.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-local-description"})]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx(fe,{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"}),c.jsxs(fe,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Zr}`,style:Qr(vn),onClick:B,disabled:_(),"data-testid":"button-register",children:[c.jsx(ni,{className:"w-4 h-4 mr-2"}),O.isPending?"Registering...":V()]})]})]}),s==="complete"&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx(_g,{className:"w-16 h-16 text-green-500 mx-auto mb-4"}),c.jsx("h3",{className:"text-xl font-bold mb-2",style:{color:"#92E4DD"},children:"Local MCP Registered!"}),c.jsx("p",{className:"text-gray-400 mb-4",children:"Your local MCP server has been successfully registered."}),c.jsx(fe,{type:"button",className:"flex-1 border",style:{background:"linear-gradient(135deg, #C4B643, #D4C760)",borderColor:"#C4B643",color:"#0A0A07"},onClick:J,"data-testid":"button-close",children:"Close"})]})]})]}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(We,{htmlFor:"name",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Agent Name"}),c.jsx(Xe,{id:"name",placeholder:"e.g., Code Assistant",value:S.name,onChange:E=>{M("name",E.target.value),E.target.value.trim()?U(E.target.value):y(null)},className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-service-name"}),h&&c.jsxs("div",{className:"flex items-center gap-2 mt-1 text-red-400 text-sm",children:[c.jsx(jr,{className:"w-4 h-4"}),c.jsx("span",{children:"A service with this name already exists"})]})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"manifest_url",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Manifest URL"}),c.jsx(Xe,{id:"manifest_url",type:"url",placeholder:"http://localhost:8001/.well-known/a2a/manifest.json",value:S.manifest_url,onChange:E=>M("manifest_url",E.target.value),className:"bg-white/10 border-white/20 text-white placeholder-gray-400",required:!0,"data-testid":"input-manifest-url"})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"description",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"Description"}),c.jsx(wo,{id:"description",placeholder:"Brief description of capabilities...",value:S.description,onChange:E=>M("description",E.target.value),rows:3,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none","data-testid":"textarea-description"})]})]}),e==="mcp"&&r==="remote"&&c.jsxs("div",{className:"space-y-4 border border-white/10 rounded-lg p-4",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx("input",{type:"checkbox",id:"headers_enabled",checked:m.headers_enabled,onChange:E=>H(E.target.checked),className:"rounded border-white/20 bg-white/10"}),c.jsx(We,{htmlFor:"headers_enabled",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"🔐 Authentication Required"})]}),c.jsx("div",{className:"text-xs text-gray-400",children:c.jsx("p",{children:"Enable this if your MCP server requires authentication (API keys, tokens, etc.)."})}),m.headers_enabled&&c.jsxs("div",{className:"space-y-3 pl-6",children:[c.jsxs("div",{className:"text-xs text-gray-400 mb-2",children:[c.jsx("p",{children:"Configure HTTP headers for authentication. Common examples:"}),c.jsxs("ul",{className:"list-disc list-inside ml-2 mt-1 space-y-1",children:[c.jsxs("li",{children:[c.jsx("code",{children:"Authorization: Bearer YOUR_TOKEN"})," - For API tokens"]}),c.jsxs("li",{children:[c.jsx("code",{children:"X-API-Key: YOUR_API_KEY"})," - For API keys"]}),c.jsxs("li",{children:[c.jsx("code",{children:"X-Custom-Header: value"})," - For custom headers"]})]})]}),c.jsxs("div",{children:[c.jsx(We,{htmlFor:"headers",className:"text-sm font-semibold",style:{color:"#92E4DD"},children:"HTTP Headers (JSON)"}),c.jsx(wo,{id:"headers",placeholder:`{
377
- "Authorization": "Bearer YOUR_TOKEN_HERE",
378
- "X-API-Key": "YOUR_API_KEY_HERE"
379
- }`,value:g,onChange:E=>{v(E.target.value),w&&k(null)},onBlur:()=>{g.trim()&&W()},rows:6,className:"bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs","data-testid":"textarea-headers"}),w&&c.jsxs("p",{className:"text-red-400 text-xs mt-1 flex items-center gap-1",children:[c.jsx(jr,{className:"w-3 h-3 shrink-0"}),w]}),c.jsx("div",{className:"text-xs text-gray-400 mt-1",children:c.jsx("p",{children:"Enter headers as JSON. Keys are header names, values are header values."})})]})]})]}),f&&c.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[c.jsx(jr,{className:"w-4 h-4 mr-1"}),f]}),h&&c.jsxs("div",{className:"text-red-400 text-sm mt-2",children:[c.jsx(jr,{className:"w-4 h-4 mr-1"}),'A service with the name "',h,'" already exists. You can register it anyway, but it might overwrite the existing one.']}),c.jsxs("div",{className:"flex space-x-3 pt-4",children:[c.jsx(fe,{type:"button",variant:"secondary",className:"flex-1 border text-white",style:{background:"#ad095e",borderColor:"#ad095e"},onClick:J,"data-testid":"button-cancel",children:"Cancel"}),!(e==="mcp"&&r==="local")&&c.jsxs(fe,{type:"button",variant:"ghost",className:`flex-1 border-2 hover:opacity-90 ${Zr}`,style:Qr(vn),disabled:O.isPending||_(),"data-testid":"button-register",onClick:B,children:[c.jsx(ni,{className:"w-4 h-4 mr-2"}),O.isPending?"Registering...":"Register Service"]})]})]})})}async function Mj(e){return(await(await Ne("POST","/api/export",{scope:e.scope??"collection",...e.deckId?{deckId:e.deckId}:{}})).json()).data}async function SF(e){return(await(await Ne("POST","/api/import",e)).json()).data}function Dj(e,t){const n=new Blob([`${JSON.stringify(e,null,2)}
380
- `],{type:"application/json"}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r,o.download=t,o.click(),URL.revokeObjectURL(r)}function CF(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"deck"}function nk(e){const{services:t,playbooks:n,decks:r}=e.counts;return`Decks +${r.created} / skipped ${r.reused}. Services +${t.created} / skipped ${t.reused}. Playbooks +${n.created} / skipped ${n.reused}.`}function EF({decks:e,editingDeckId:t,onSelectDeck:n,isLoading:r}){const[o,s]=b.useState(!1),[i,a]=b.useState(""),l=nn(),{toast:u}=Wt(),{data:d}=It({queryKey:["/api/scope/bindings"],refetchInterval:3e3}),f=b.useMemo(()=>Dz((d==null?void 0:d.data)??[]),[d]),p=gt({mutationFn:async k=>Ne("POST","/api/decks",{name:k,isActive:!1}),onSuccess:async(k,C)=>{var S;const j=await k.json();l.invalidateQueries({queryKey:["/api/decks"]}),(S=j.data)!=null&&S.id&&n(j.data.id),u({title:"Deck created",description:`${C} has been created successfully.`}),s(!1),a("")},onError:k=>{u({title:"Failed to create deck",description:k.message,variant:"destructive"})}}),h=gt({mutationFn:async k=>{const C=await Mj({scope:"deck",deckId:k.id});return Dj(C,`${CF(k.name)}.agent-deck.json`),C},onSuccess:(k,C)=>{u({title:"Deck exported",description:`${C.name}: ${k.services.length} services, ${k.playbooks.length} playbooks`})},onError:k=>{u({title:"Export failed",description:k.message,variant:"destructive"})}}),y=(k,C)=>{k.stopPropagation(),h.mutate(C)},m=gt({mutationFn:async k=>Ne("DELETE",`/api/decks/${k}`,{}),onSuccess:()=>{l.invalidateQueries({queryKey:["/api/decks"]}),u({title:"Deck deleted",description:"Your deck has been deleted successfully."})},onError:k=>{k.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:k.message,variant:"destructive"})}}),x=async(k,C)=>{k.stopPropagation();try{await navigator.clipboard.writeText(C.id),u({title:"Copied deck id",description:"Use with bind_workspace({ workspaceRoot, deckId }) in your agent."})}catch(j){u({title:"Failed to copy deck id",description:j instanceof Error?j.message:"Unknown error",variant:"destructive"})}},g=(k,C)=>{k.stopPropagation(),window.confirm("Are you sure you want to delete this deck? This action cannot be undone.")&&m.mutate(C)},v=k=>{k.preventDefault();const C=i.trim();C&&p.mutate(C)},w=k=>{var C,j,S;return(((C=k.services)==null?void 0:C.length)??0)+(((j=k.credentials)==null?void 0:j.length)??0)+(((S=k.playbooks)==null?void 0:S.length)??0)};return r?c.jsx("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl border border-white/10 p-6 shadow-2xl",children:c.jsxs("div",{className:"animate-pulse space-y-4",children:[c.jsx("div",{className:"h-6 bg-white/10 rounded"}),c.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((k,C)=>c.jsx("div",{className:"h-16 bg-white/5 rounded-lg"},C))})]})}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"h-full flex flex-col","data-testid":"deck-management-panel",children:[c.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[c.jsx(cf,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),c.jsx("span",{style:{color:"#92E4DD"},children:"My Decks"})]}),c.jsx("div",{className:"mb-3",children:c.jsxs(fe,{onClick:()=>s(!0),className:"w-full border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"create-deck-button",children:[c.jsx(ni,{className:"w-3 h-3 mr-2"}),"Add Deck"]})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx("div",{className:"space-y-2",children:e.map(k=>{const C=k.id===t,j=w(k),S=f.get(k.id)??0,A=Lz(j,S);return c.jsxs("div",{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${C?"bg-gradient-to-r from-yellow-500/20 to-yellow-600/20 border-2 border-yellow-500/40 hover:border-yellow-400/60":"bg-white/5 border border-white/10 hover:border-white/20"}`,onClick:()=>n(k.id),"data-testid":`deck-item-${k.id}`,children:[c.jsxs("div",{className:"absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200",children:[c.jsx(fe,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:P=>y(P,k),title:"Export this deck","data-testid":`export-deck-${k.id}`,children:c.jsx(RE,{className:"w-2 h-2"})}),c.jsx(fe,{size:"sm",variant:"secondary",className:"h-5 w-5 p-0",onClick:P=>x(P,k),title:"Copy deck id for bind_workspace",children:c.jsx(TE,{className:"w-2 h-2"})}),c.jsx(fe,{size:"sm",variant:"destructive",className:"h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400",onClick:P=>g(P,k.id),title:"Delete deck",children:c.jsx(uh,{className:"w-2 h-2"})})]}),c.jsxs("div",{children:[c.jsx("h3",{className:`font-semibold text-sm pr-16 ${C?"text-yellow-300":"text-white"}`,children:k.name}),c.jsx("p",{className:"text-xs text-gray-400 select-none pointer-events-none",children:A})]})]},k.id)})})})]}),c.jsx(Os,{open:o,onOpenChange:s,children:c.jsxs(Mo,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsx(Do,{children:c.jsxs(Lo,{className:"flex items-center text-xl font-bold",children:[c.jsx(cf,{className:"mr-2 h-5 w-5",style:{color:"#92E4DD"}}),"Create New Deck"]})}),c.jsxs("form",{onSubmit:v,className:"space-y-4","data-testid":"form-create-deck",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"deckName",children:"Deck Name"}),c.jsx(Xe,{id:"deckName",placeholder:"e.g., Hiring stack",value:i,onChange:k=>a(k.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#A8C4C0]/60",required:!0,"data-testid":"input-deck-name"})]}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx(fe,{type:"button",variant:"outline",className:"flex-1 rounded-full border-white/20 text-[#E8F6F4] hover:bg-white/10",onClick:()=>s(!1),"data-testid":"button-cancel-create",children:"Cancel"}),c.jsx(fe,{type:"submit",className:"flex-1 rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},disabled:p.isPending,"data-testid":"button-submit-create",children:p.isPending?"Creating…":"Create Deck"})]})]})]})})]})}function NF({open:e,onOpenChange:t}){const[n,r]=b.useState(""),[o,s]=b.useState(""),i=nn(),{toast:a}=Wt(),l=gt({mutationFn:async()=>Ne("POST","/api/credentials",{label:n.trim(),value:o}),onSuccess:()=>{i.invalidateQueries({queryKey:["/api/credentials/vault"]}),i.invalidateQueries({queryKey:["/api/decks"]}),a({title:"API key saved",description:`${n.trim()} is stored securely. Your agent can use it from the active deck.`}),t(!1),r(""),s("")},onError:d=>{a({title:"Could not save API key",description:d.message,variant:"destructive"})}}),u=n.trim().length>0&&o.trim().length>0;return c.jsx(Os,{open:e,onOpenChange:t,children:c.jsxs(Mo,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Do,{children:[c.jsx(Lo,{className:"text-[#E8F6F4]",children:"Register API key"}),c.jsx(Ii,{className:"text-[#A8C4C0]",children:"Name the service and paste the key. Agent Deck handles the rest — stored in your vault, never shown again."})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"credential-name",className:"text-[#CFEAE6]",children:"Service name"}),c.jsx(Xe,{id:"credential-name",placeholder:"OpenAI, Linear, Slack…",value:n,onChange:d=>r(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"credential-value",className:"text-[#CFEAE6]",children:"API key"}),c.jsx(Xe,{id:"credential-value",type:"password",placeholder:"Paste key from the service dashboard",value:o,onChange:d=>s(d.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Zr}`,style:Qr(Pn),onClick:()=>l.mutate(),disabled:!u||l.isPending,children:"Save to vault"})]})]})})}function jF({open:e,onOpenChange:t}){const[n,r]=b.useState(""),[o,s]=b.useState(""),[i,a]=b.useState(""),[l,u]=b.useState(""),[d,f]=b.useState(""),[p,h]=b.useState([]),[y,m]=b.useState([]),x=nn(),{toast:g}=Wt(),{data:v}=It({queryKey:["/api/credentials/vault"],enabled:e}),{data:w}=It({queryKey:["/api/services"],enabled:e}),k=(v==null?void 0:v.data)??[],C=(w==null?void 0:w.data)??[],j=gt({mutationFn:async()=>Ne("POST","/api/playbooks",{title:n.trim(),body:o,triggers:i.split(",").map(P=>P.trim()).filter(Boolean),dependsOnCredentialIds:p,dependsOnServiceIds:y,exec:l.trim()||void 0,skill:d.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{x.invalidateQueries({queryKey:["/api/playbooks/vault"]}),g({title:"Playbook saved",description:`${n.trim()} is in your collection.`}),t(!1),r(""),s(""),a(""),u(""),f(""),h([]),m([])},onError:P=>{g({title:"Could not save playbook",description:P.message,variant:"destructive"})}}),S=(P,$,T)=>{T(P.includes($)?P.filter(I=>I!==$):[...P,$])},A=n.trim().length>0&&o.trim().length>0;return c.jsx(Os,{open:e,onOpenChange:t,children:c.jsxs(Mo,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Do,{children:[c.jsx(Lo,{children:"Register Playbook"}),c.jsxs(Ii,{className:"text-[#A8C4C0]",children:["Prefer"," ",c.jsx("span",{className:"font-mono text-xs",children:"register_playbook"})," /"," ",c.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."]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"playbook-title",children:"Title"}),c.jsx(Xe,{id:"playbook-title",placeholder:"Hiring inbox, Ashby API guide…",value:n,onChange:P=>r(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"playbook-triggers",children:"Triggers (comma-separated)"}),c.jsx(Xe,{id:"playbook-triggers",placeholder:"check inbox, review applicants",value:i,onChange:P=>a(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"playbook-body",children:"Instructions (markdown)"}),c.jsx(wo,{id:"playbook-body",rows:8,placeholder:`# Steps
381
- 1. …
382
- 2. …`,value:o,onChange:P=>s(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-sm"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{children:"Extra API key deps (optional)"}),c.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),c.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:k.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No API keys registered yet."}):k.map(P=>c.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:p.includes(P.id),onChange:()=>S(p,P.id,h)}),P.label]},P.id))})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{children:"Extra MCP deps (optional)"}),c.jsx("p",{className:"text-xs text-gray-500",children:"Merged with auto-detected refs from content."}),c.jsx("div",{className:"max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1",children:C.length===0?c.jsx("p",{className:"text-xs text-gray-500",children:"No MCP services registered yet."}):C.map(P=>c.jsxs("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:y.includes(P.id),onChange:()=>S(y,P.id,m)}),P.name]},P.id))})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"playbook-exec",children:"Suggested exec (optional)"}),c.jsx(Xe,{id:"playbook-exec",placeholder:"agent-deck exec --connections … -- uv run …",value:l,onChange:P=>u(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"playbook-skill",children:"Skill path hint (optional)"}),c.jsx(Xe,{id:"playbook-skill",placeholder:".cursor/skills/…/SKILL.md",value:d,onChange:P=>f(P.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs"})]}),c.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Zr}`,style:Qr(_r),onClick:()=>j.mutate(),disabled:!A||j.isPending,children:"Save to collection"})]})]})})}async function Xc(e){const t=await e.json();if(!t.success)throw new Error(t.error??"Request failed");return t.data}function rk(e){return e.length===0?null:e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} and ${e.length-3} more`}async function Lj(e){const t=`?status=${encodeURIComponent(e)}`,n=await Ne("GET",`/api/playbook-patches${t}`);return Xc(n)}async function PF(e){const t=await Ne("GET",`/api/playbook-patches/${e}/preview`);return Xc(t)}async function TF(e){const t=await Ne("POST",`/api/playbook-patches/${e}/accept`);return Xc(t)}async function RF(e,t){const n=await Ne("POST",`/api/playbook-patches/${e}/reject`,{reason:t});return Xc(n)}async function $F(e){const t=await Ne("GET",`/api/playbooks/${e}/events/count`);return Xc(t)}function IF({playbookId:e,open:t,onOpenChange:n}){const{data:r,isLoading:o}=It({queryKey:e?[`/api/playbooks/${e}`]:["playbook-detail-disabled"],enabled:t&&!!e}),{data:s}=It({queryKey:[`/api/playbooks/${e}/events/count`],queryFn:()=>$F(e),enabled:t&&!!e}),i=r==null?void 0:r.data,a=((i==null?void 0:i.dependencies.missingCredentialIds.length)??0)+((i==null?void 0:i.dependencies.missingServiceIds.length)??0);return c.jsx(Os,{open:t,onOpenChange:n,children:c.jsxs(Mo,{className:"sm:max-w-6xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Do,{children:[c.jsx(Lo,{children:(i==null?void 0:i.title)??"Playbook"}),c.jsx(Ii,{className:"text-[#A8C4C0]",children:(i==null?void 0:i.id)??e})]}),o||!i?c.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):c.jsxs("div",{className:"space-y-4 text-sm",children:[c.jsxs("p",{className:"rounded-md border border-white/10 bg-white/5 px-3 py-2 text-[#A8C4C0]",children:["Agent corrections file as"," ",c.jsx("span",{className:"font-mono text-xs",children:"propose_playbook_patch"})," proposals — review in the queue. Direct"," ",c.jsx("span",{className:"font-mono text-xs",children:"update_playbook"})," is for explicit edits only."]}),typeof s=="number"&&c.jsxs("p",{className:"text-xs text-gray-500",children:["Fetched ",s," time",s===1?"":"s"," (undertriggering signal)"]}),i.triggers.length>0&&c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Triggers"}),c.jsx("p",{className:"text-gray-300",children:i.triggers.join(", ")})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Dependencies"}),i.dependencies.credentials.length===0&&i.dependencies.services.length===0&&a===0?c.jsx("p",{className:"text-gray-400",children:"None declared."}):c.jsxs("ul",{className:"space-y-1 text-gray-300",children:[i.dependencies.credentials.map(l=>c.jsxs("li",{children:["API key: ",l.label]},l.id)),i.dependencies.services.map(l=>c.jsxs("li",{children:["MCP: ",l.label]},l.id)),i.dependencies.missingCredentialIds.map(l=>c.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[c.jsx(jr,{className:"w-3 h-3"})," Missing API key: ",l]},l)),i.dependencies.missingServiceIds.map(l=>c.jsxs("li",{className:"text-amber-300 flex items-center gap-1",children:[c.jsx(jr,{className:"w-3 h-3"})," Missing MCP: ",l]},l))]})]}),i.exec&&c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Suggested exec"}),c.jsx("pre",{className:"rounded bg-black/40 p-2 text-xs overflow-x-auto",children:i.exec})]}),i.skill&&c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Skill hint"}),c.jsx("p",{className:"font-mono text-xs text-gray-300",children:i.skill})]}),c.jsxs("div",{children:[c.jsx("h4",{className:"font-semibold text-amber-200 mb-1",children:"Instructions"}),c.jsx("div",{className:"rounded bg-black/30 p-3 whitespace-pre-wrap text-gray-200",children:i.body})]})]})]})})}function AF({credentialId:e,open:t,onOpenChange:n}){const r=nn(),{toast:o}=Wt(),[s,i]=b.useState(""),[a,l]=b.useState(""),[u,d]=b.useState(""),{data:f,isLoading:p}=It({queryKey:e?[`/api/credentials/${e}`]:["credential-detail-disabled"],enabled:t&&!!e}),h=f==null?void 0:f.data;b.useEffect(()=>{h&&(i(h.label),l(h.docsUrl??""),d(""))},[h==null?void 0:h.id,h==null?void 0:h.label,h==null?void 0:h.docsUrl]);const y=gt({mutationFn:async()=>{if(!e)throw new Error("No credential selected");const x=s.trim();if(!x)throw new Error("Name is required");const g=a.trim();if(g)try{new URL(g)}catch{throw new Error("Documentation link must be a valid URL")}await Ne("PUT",`/api/credentials/${e}`,{label:x,docsUrl:g}),u.trim()&&await Ne("POST",`/api/credentials/${e}/rotate`,{value:u.trim()})},onSuccess:()=>{r.invalidateQueries({queryKey:["/api/credentials/vault"]}),e&&r.invalidateQueries({queryKey:[`/api/credentials/${e}`]}),r.invalidateQueries({queryKey:["/api/collection/warnings"]}),r.invalidateQueries({queryKey:["/api/decks"]}),o({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(""),n(!1)},onError:x=>{o({title:"Could not save API key",description:x.message,variant:"destructive"})}}),m=s.trim().length>0&&(s.trim()!==(h==null?void 0:h.label)||a.trim()!==((h==null?void 0:h.docsUrl)??"")||u.trim().length>0);return c.jsx(Os,{open:t,onOpenChange:n,children:c.jsxs(Mo,{className:"sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Do,{children:[c.jsx(Lo,{className:"text-[#E8F6F4]",children:(h==null?void 0:h.label)??"API key"}),c.jsx(Ii,{className:"font-mono text-xs text-[#A8C4C0]",children:(h==null?void 0:h.id)??e})]}),p||!h?c.jsx("p",{className:"text-sm text-gray-400",children:"Loading…"}):c.jsxs("div",{className:"space-y-4",children:[!h.hasSecret&&c.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:[c.jsx(jr,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.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."})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"credential-detail-name",className:"text-[#CFEAE6]",children:"Name"}),c.jsx(Xe,{id:"credential-detail-name",value:s,onChange:x=>i(x.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"credential-detail-key",className:"text-[#CFEAE6]",children:h.hasSecret?"Rotate API key":"API key"}),c.jsx(Xe,{id:"credential-detail-key",type:"password",placeholder:h.hasSecret?"Leave blank to keep current key":"Paste key from the service dashboard",value:u,onChange:x=>d(x.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),h.hasSecret&&c.jsx("p",{className:"text-xs text-[#6B8581]",children:"Stored securely in Keychain. Enter a new value only when rotating."})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"credential-detail-docs",className:"text-[#CFEAE6]",children:"Documentation link"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Xe,{id:"credential-detail-docs",type:"url",placeholder:"https://…",value:a,onChange:x=>l(x.target.value),className:"border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]"}),a.trim()&&c.jsx(fe,{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:c.jsx(_o,{className:"h-4 w-4"})})]})]}),c.jsx(fe,{variant:"ghost",className:`w-full border-2 hover:opacity-90 ${Zr}`,style:Qr(Pn),onClick:()=>y.mutate(),disabled:!m||y.isPending,children:y.isPending?"Saving…":"Save changes"})]})]})})}const OF=lh("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 Un({className:e,variant:t,...n}){return c.jsx("div",{className:je(OF({variant:t}),e),...n})}function zj(e){const t=b.useRef({value:e,previous:e});return b.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Sh="Checkbox",[MF,XX]=ro(Sh),[DF,i0]=MF(Sh);function LF(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:s,form:i,name:a,onCheckedChange:l,required:u,value:d="on",internal_do_not_use_render:f}=e,[p,h]=Es({prop:n,defaultProp:o??!1,onChange:l,caller:Sh}),[y,m]=b.useState(null),[x,g]=b.useState(null),v=b.useRef(!1),w=y?!!i||!!y.closest("form"):!0,k={checked:p,disabled:s,setChecked:h,control:y,setControl:m,name:a,form:i,value:d,hasConsumerStoppedPropagationRef:v,required:u,defaultChecked:_s(o)?!1:o,isFormControl:w,bubbleInput:x,setBubbleInput:g};return c.jsx(DF,{scope:t,...k,children:zF(f)?f(k):r})}var Fj="CheckboxTrigger",Uj=b.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:s,value:i,disabled:a,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:h,bubbleInput:y}=i0(Fj,e),m=Ye(o,d),x=b.useRef(l);return b.useEffect(()=>{const g=s==null?void 0:s.form;if(g){const v=()=>f(x.current);return g.addEventListener("reset",v),()=>g.removeEventListener("reset",v)}},[s,f]),c.jsx(Te.button,{type:"button",role:"checkbox","aria-checked":_s(l)?"mixed":l,"aria-required":u,"data-state":Wj(l),"data-disabled":a?"":void 0,disabled:a,value:i,...r,ref:m,onKeyDown:be(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:be(n,g=>{f(v=>_s(v)?!0:!v),y&&h&&(p.current=g.isPropagationStopped(),p.current||g.stopPropagation())})})});Uj.displayName=Fj;var a0=b.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:l,onCheckedChange:u,form:d,...f}=e;return c.jsx(LF,{__scopeCheckbox:n,checked:o,defaultChecked:s,disabled:a,required:i,onCheckedChange:u,name:r,form:d,value:l,internal_do_not_use_render:({isFormControl:p})=>c.jsxs(c.Fragment,{children:[c.jsx(Uj,{...f,ref:t,__scopeCheckbox:n}),p&&c.jsx(Bj,{__scopeCheckbox:n})]})})});a0.displayName=Sh;var qj="CheckboxIndicator",Vj=b.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=i0(qj,n);return c.jsx(oo,{present:r||_s(s.checked)||s.checked===!0,children:c.jsx(Te.span,{"data-state":Wj(s.checked),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Vj.displayName=qj;var Hj="CheckboxBubbleInput",Bj=b.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:s,defaultChecked:i,required:a,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:h}=i0(Hj,e),y=Ye(n,h),m=zj(s),x=tN(r);b.useEffect(()=>{const v=p;if(!v)return;const w=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(w,"checked").set,j=!o.current;if(m!==s&&C){const S=new Event("click",{bubbles:j});v.indeterminate=_s(s),C.call(v,_s(s)?!1:s),v.dispatchEvent(S)}},[p,m,s,o]);const g=b.useRef(_s(s)?!1:s);return c.jsx(Te.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:a,disabled:l,name:u,value:d,form:f,...t,tabIndex:-1,ref:y,style:{...t.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Bj.displayName=Hj;function zF(e){return typeof e=="function"}function _s(e){return e==="indeterminate"}function Wj(e){return _s(e)?"indeterminate":e?"checked":"unchecked"}const Kj=b.forwardRef(({className:e,...t},n)=>c.jsx(a0,{ref:n,className:je("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:c.jsx(Vj,{className:je("flex items-center justify-center text-current"),children:c.jsx(jE,{className:"h-4 w-4"})})}));Kj.displayName=a0.displayName;const Zj=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:n,className:je("w-full caption-bottom text-sm",e),...t})}));Zj.displayName="Table";const Qj=b.forwardRef(({className:e,...t},n)=>c.jsx("thead",{ref:n,className:je("[&_tr]:border-b",e),...t}));Qj.displayName="TableHeader";const Gj=b.forwardRef(({className:e,...t},n)=>c.jsx("tbody",{ref:n,className:je("[&_tr:last-child]:border-0",e),...t}));Gj.displayName="TableBody";const FF=b.forwardRef(({className:e,...t},n)=>c.jsx("tfoot",{ref:n,className:je("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));FF.displayName="TableFooter";const Vi=b.forwardRef(({className:e,...t},n)=>c.jsx("tr",{ref:n,className:je("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Vi.displayName="TableRow";const kd=b.forwardRef(({className:e,...t},n)=>c.jsx("th",{ref:n,className:je("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));kd.displayName="TableHead";const Bs=b.forwardRef(({className:e,...t},n)=>c.jsx("td",{ref:n,className:je("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Bs.displayName="TableCell";const UF=b.forwardRef(({className:e,...t},n)=>c.jsx("caption",{ref:n,className:je("mt-4 text-sm text-muted-foreground",e),...t}));UF.displayName="TableCaption";function qF(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const VF=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HF=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,BF={};function ok(e,t){return(BF.jsx?HF:VF).test(e)}const WF=/[ \t\n\f\r]/g;function KF(e){return typeof e=="object"?e.type==="text"?sk(e.value):!1:sk(e)}function sk(e){return e.replace(WF,"")===""}class eu{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}eu.prototype.normal={};eu.prototype.property={};eu.prototype.space=void 0;function Jj(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new eu(n,r,t)}function Og(e){return e.toLowerCase()}class Dn{constructor(t,n){this.attribute=n,this.property=t}}Dn.prototype.attribute="";Dn.prototype.booleanish=!1;Dn.prototype.boolean=!1;Dn.prototype.commaOrSpaceSeparated=!1;Dn.prototype.commaSeparated=!1;Dn.prototype.defined=!1;Dn.prototype.mustUseProperty=!1;Dn.prototype.number=!1;Dn.prototype.overloadedBoolean=!1;Dn.prototype.property="";Dn.prototype.spaceSeparated=!1;Dn.prototype.space=void 0;let ZF=0;const Pe=Ai(),$t=Ai(),Mg=Ai(),ie=Ai(),nt=Ai(),pi=Ai(),Fn=Ai();function Ai(){return 2**++ZF}const Dg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:$t,commaOrSpaceSeparated:Fn,commaSeparated:pi,number:ie,overloadedBoolean:Mg,spaceSeparated:nt},Symbol.toStringTag,{value:"Module"})),Dp=Object.keys(Dg);class l0 extends Dn{constructor(t,n,r,o){let s=-1;if(super(t,n),ik(this,"space",o),typeof r=="number")for(;++s<Dp.length;){const i=Dp[s];ik(this,Dp[s],(r&Dg[i])===Dg[i])}}}l0.prototype.defined=!0;function ik(e,t,n){n&&(e[t]=n)}function cl(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new l0(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Og(r)]=r,n[Og(s.attribute)]=r}return new eu(t,n,e.space)}const Yj=cl({properties:{ariaActiveDescendant:null,ariaAtomic:$t,ariaAutoComplete:null,ariaBusy:$t,ariaChecked:$t,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:nt,ariaCurrent:null,ariaDescribedBy:nt,ariaDetails:null,ariaDisabled:$t,ariaDropEffect:nt,ariaErrorMessage:null,ariaExpanded:$t,ariaFlowTo:nt,ariaGrabbed:$t,ariaHasPopup:null,ariaHidden:$t,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:nt,ariaLevel:ie,ariaLive:null,ariaModal:$t,ariaMultiLine:$t,ariaMultiSelectable:$t,ariaOrientation:null,ariaOwns:nt,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:$t,ariaReadOnly:$t,ariaRelevant:null,ariaRequired:$t,ariaRoleDescription:nt,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:$t,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Xj(e,t){return t in e?e[t]:t}function eP(e,t){return Xj(e,t.toLowerCase())}const QF=cl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:pi,acceptCharset:nt,accessKey:nt,action:null,allow:null,allowFullScreen:Pe,allowPaymentRequest:Pe,allowUserMedia:Pe,alpha:Pe,alt:null,as:null,async:Pe,autoCapitalize:null,autoComplete:nt,autoFocus:Pe,autoPlay:Pe,blocking:nt,capture:null,charSet:null,checked:Pe,cite:null,className:nt,closedBy:null,colorSpace:null,cols:ie,colSpan:ie,command:null,commandFor:null,content:null,contentEditable:$t,controls:Pe,controlsList:nt,coords:ie|pi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pe,defer:Pe,dir:null,dirName:null,disabled:Pe,download:Mg,draggable:$t,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pe,formTarget:null,headers:nt,height:ie,hidden:Mg,high:ie,href:null,hrefLang:null,htmlFor:nt,httpEquiv:nt,id:null,imageSizes:null,imageSrcSet:null,inert:Pe,inputMode:null,integrity:null,is:null,isMap:Pe,itemId:null,itemProp:nt,itemRef:nt,itemScope:Pe,itemType:nt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pe,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:Pe,muted:Pe,name:null,nonce:null,noModule:Pe,noValidate:Pe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Pe,optimum:ie,pattern:null,ping:nt,placeholder:null,playsInline:Pe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pe,referrerPolicy:null,rel:nt,required:Pe,reversed:Pe,rows:ie,rowSpan:ie,sandbox:nt,scope:null,scoped:Pe,seamless:Pe,selected:Pe,shadowRootClonable:Pe,shadowRootCustomElementRegistry:Pe,shadowRootDelegatesFocus:Pe,shadowRootMode:null,shadowRootSerializable:Pe,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:$t,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:Pe,useMap:null,value:$t,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:nt,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pe,declare:Pe,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:Pe,noHref:Pe,noShade:Pe,noWrap:Pe,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:$t,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Pe,disablePictureInPicture:Pe,disableRemotePlayback:Pe,exportParts:pi,part:nt,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:eP}),GF=cl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Fn,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:nt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:Pe,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:pi,g2:pi,glyphName:pi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:Fn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:nt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fn,rev:Fn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fn,requiredFeatures:Fn,requiredFonts:Fn,requiredFormats:Fn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:Fn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fn,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Xj}),tP=cl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),nP=cl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:eP}),rP=cl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JF={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},YF=/[A-Z]/g,ak=/-[a-z]/g,XF=/^data[-\w.:]+$/i;function e3(e,t){const n=Og(t);let r=t,o=Dn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&XF.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(ak,n3);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!ak.test(s)){let i=s.replace(YF,t3);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=l0}return new o(r,t)}function t3(e){return"-"+e.toLowerCase()}function n3(e){return e.charAt(1).toUpperCase()}const r3=Jj([Yj,QF,tP,nP,rP],"html"),c0=Jj([Yj,GF,tP,nP,rP],"svg");function o3(e){return e.join(" ").trim()}var u0={},lk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,s3=/\n/g,i3=/^\s*/,a3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l3=/^:\s*/,c3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u3=/^[;\s]*/,d3=/^\s+|\s+$/g,f3=`
383
- `,ck="/",uk="*",Qs="",h3="comment",p3="declaration";function m3(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(y){var m=y.match(s3);m&&(n+=m.length);var x=y.lastIndexOf(f3);r=~x?y.length-x:r+y.length}function s(){var y={line:n,column:r};return function(m){return m.position=new i(y),u(),m}}function i(y){this.start=y,this.end={line:n,column:r},this.source=t.source}i.prototype.content=e;function a(y){var m=new Error(t.source+":"+n+":"+r+": "+y);if(m.reason=y,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(y){var m=y.exec(e);if(m){var x=m[0];return o(x),e=e.slice(x.length),m}}function u(){l(i3)}function d(y){var m;for(y=y||[];m=f();)m!==!1&&y.push(m);return y}function f(){var y=s();if(!(ck!=e.charAt(0)||uk!=e.charAt(1))){for(var m=2;Qs!=e.charAt(m)&&(uk!=e.charAt(m)||ck!=e.charAt(m+1));)++m;if(m+=2,Qs===e.charAt(m-1))return a("End of comment missing");var x=e.slice(2,m-2);return r+=2,o(x),e=e.slice(m),r+=2,y({type:h3,comment:x})}}function p(){var y=s(),m=l(a3);if(m){if(f(),!l(l3))return a("property missing ':'");var x=l(c3),g=y({type:p3,property:dk(m[0].replace(lk,Qs)),value:x?dk(x[0].replace(lk,Qs)):Qs});return l(u3),g}}function h(){var y=[];d(y);for(var m;m=p();)m!==!1&&(y.push(m),d(y));return y}return u(),h()}function dk(e){return e?e.replace(d3,Qs):Qs}var g3=m3,y3=Od&&Od.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(u0,"__esModule",{value:!0});u0.default=x3;const v3=y3(g3);function x3(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,v3.default)(e),o=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:i,value:a}=s;o?t(i,a,s):a&&(n=n||{},n[i]=a)}),n}var Ch={};Object.defineProperty(Ch,"__esModule",{value:!0});Ch.camelCase=void 0;var w3=/^--[a-zA-Z0-9_-]+$/,b3=/-([a-z])/g,k3=/^[^-]+$/,_3=/^-(webkit|moz|ms|o|khtml)-/,S3=/^-(ms)-/,C3=function(e){return!e||k3.test(e)||w3.test(e)},E3=function(e,t){return t.toUpperCase()},fk=function(e,t){return"".concat(t,"-")},N3=function(e,t){return t===void 0&&(t={}),C3(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(S3,fk):e=e.replace(_3,fk),e.replace(b3,E3))};Ch.camelCase=N3;var j3=Od&&Od.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},P3=j3(u0),T3=Ch;function Lg(e,t){var n={};return!e||typeof e!="string"||(0,P3.default)(e,function(r,o){r&&o&&(n[(0,T3.camelCase)(r,t)]=o)}),n}Lg.default=Lg;var R3=Lg;const $3=Xa(R3),oP=sP("end"),d0=sP("start");function sP(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function I3(e){const t=d0(e),n=oP(e);if(t&&n)return{start:t,end:n}}function tc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?hk(e.position):"start"in e||"end"in e?hk(e):"line"in e||"column"in e?zg(e):""}function zg(e){return pk(e&&e.line)+":"+pk(e&&e.column)}function hk(e){return zg(e&&e.start)+"-"+zg(e&&e.end)}function pk(e){return e&&typeof e=="number"?e:1}class hn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=tc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}hn.prototype.file="";hn.prototype.name="";hn.prototype.reason="";hn.prototype.message="";hn.prototype.stack="";hn.prototype.column=void 0;hn.prototype.line=void 0;hn.prototype.ancestors=void 0;hn.prototype.cause=void 0;hn.prototype.fatal=void 0;hn.prototype.place=void 0;hn.prototype.ruleId=void 0;hn.prototype.source=void 0;const f0={}.hasOwnProperty,A3=new Map,O3=/[A-Z]/g,M3=new Set(["table","tbody","thead","tfoot","tr"]),D3=new Set(["td","th"]),iP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function L3(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=W3(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=B3(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?c0:r3,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=aP(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function aP(e,t,n){if(t.type==="element")return z3(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return F3(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return q3(e,t,n);if(t.type==="mdxjsEsm")return U3(e,t);if(t.type==="root")return V3(e,t,n);if(t.type==="text")return H3(e,t)}function z3(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=c0,e.schema=o),e.ancestors.push(t);const s=cP(e,t.tagName,!1),i=K3(e,t);let a=p0(e,t);return M3.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!KF(l):!0})),lP(e,i,s,t),h0(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function F3(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}$c(e,t.position)}function U3(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);$c(e,t.position)}function q3(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=c0,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:cP(e,t.name,!0),i=Z3(e,t),a=p0(e,t);return lP(e,i,s,t),h0(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function V3(e,t,n){const r={};return h0(r,p0(e,t)),e.create(t,e.Fragment,r,n)}function H3(e,t){return t.value}function lP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function h0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function B3(e,t,n){return r;function r(o,s,i,a){const u=Array.isArray(i.children)?n:t;return a?u(s,i,a):u(s,i)}}function W3(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),l=d0(r);return t(o,s,i,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function K3(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&f0.call(t.properties,o)){const s=Q3(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&D3.has(t.tagName)?r=a:n[i]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Z3(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else $c(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else $c(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function p0(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:A3;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=o.get(l)||0;i=l+"-"+u,o.set(l,u+1)}}const a=aP(e,s,i);a!==void 0&&n.push(a)}return n}function Q3(e,t,n){const r=e3(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?qF(n):o3(n)),r.property==="style"){let o=typeof n=="object"?n:G3(e,String(n));return e.stylePropertyNameCase==="css"&&(o=J3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?JF[r.property]||r.property:r.attribute,n]}}function G3(e,t){try{return $3(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new hn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=iP+"#cannot-parse-style-attribute",o}}function cP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const a=ok(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=i}else r=ok(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return f0.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);$c(e)}function $c(e,t){const n=new hn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=iP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function J3(e){const t={};let n;for(n in e)f0.call(e,n)&&(t[Y3(n)]=e[n]);return t}function Y3(e){let t=e.replace(O3,X3);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function X3(e){return"-"+e.toLowerCase()}const Lp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},e5={};function m0(e,t){const n=e5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return uP(e,r,o)}function uP(e,t,n){if(t5(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return mk(e.children,t,n)}return Array.isArray(e)?mk(e,t,n):""}function mk(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=uP(e[o],t,n);return r.join("")}function t5(e){return!!(e&&typeof e=="object")}const gk=document.createElement("i");function g0(e){const t="&"+e+";";gk.innerHTML=t;const n=gk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Zn(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function ar(e,t){return e.length>0?(Zn(e,e.length,0,t),e):t}const yk={}.hasOwnProperty;function dP(e){const t={};let n=-1;for(;++n<e.length;)n5(t,e[n]);return t}function n5(e,t){let n;for(n in t){const o=(yk.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){yk.call(o,i)||(o[i]=[]);const a=s[i];r5(o[i],Array.isArray(a)?a:a?[a]:[])}}}function r5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Zn(e,0,0,r)}function fP(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const wn=Ms(/[A-Za-z]/),dn=Ms(/[\dA-Za-z]/),o5=Ms(/[#-'*+\--9=?A-Z^-~]/);function vf(e){return e!==null&&(e<32||e===127)}const Fg=Ms(/\d/),s5=Ms(/[\dA-Fa-f]/),i5=Ms(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function ot(e){return e!==null&&(e<0||e===32)}function qe(e){return e===-2||e===-1||e===32}const Eh=Ms(new RegExp("\\p{P}|\\p{S}","u")),Ci=Ms(/\s/);function Ms(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ul(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&dn(e.charCodeAt(n+1))&&dn(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Ze(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(l){return qe(l)?(e.enter(n),a(l)):t(l)}function a(l){return qe(l)&&s++<o?(e.consume(l),a):(e.exit(n),t(l))}}const a5={tokenize:l5};function l5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ze(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const c5={tokenize:u5},vk={tokenize:d5};function u5(e){const t=this,n=[];let r=0,o,s,i;return a;function a(w){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const k=t.events.length;let C=k,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}g(r);let S=k;for(;S<t.events.length;)t.events[S][1].end={...j},S++;return Zn(t.events,C+1,0,t.events.slice(k)),t.events.length=S,u(w)}return a(w)}function u(w){if(r===n.length){if(!o)return p(w);if(o.currentConstruct&&o.currentConstruct.concrete)return y(w);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(vk,d,f)(w)}function d(w){return o&&v(),g(r),p(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,y(w)}function p(w){return t.containerState={},e.attempt(vk,h,y)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function y(w){if(w===null){o&&v(),g(0),e.consume(w);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(w)}function m(w){if(w===null){x(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return _e(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),m)}function x(w,k){const C=t.sliceStream(w);if(k&&C.push(null),w.previous=s,s&&(s.next=w),s=w,o.defineSkip(w.start),o.write(C),t.parser.lazy[w.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<i&&(!o.events[j][1].end||o.events[j][1].end.offset>i))return;const S=t.events.length;let A=S,P,$;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(P){$=t.events[A][1].end;break}P=!0}for(g(r),j=S;j<t.events.length;)t.events[j][1].end={...$},j++;Zn(t.events,A+1,0,t.events.slice(S)),t.events.length=j}}function g(w){let k=n.length;for(;k-- >w;){const C=n[k];t.containerState=C[1],C[0].exit.call(t,e)}n.length=w}function v(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function d5(e,t,n){return Ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Qa(e){if(e===null||ot(e)||Ci(e))return 1;if(Eh(e))return 2}function Nh(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Ug={name:"attention",resolveAll:f5,tokenize:h5};function f5(e,t){let n=-1,r,o,s,i,a,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},p={...e[n][1].start};xk(f,-l),xk(p,l),i={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:l>1?"strong":"emphasis",start:{...i.start},end:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ar(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ar(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=ar(u,Nh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ar(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ar(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Zn(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function h5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Qa(r);let s;return i;function i(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const u=e.exit("attentionSequence"),d=Qa(l),f=!d||d===2&&o||n.includes(l),p=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?f:f&&(o||!p)),u._close=!!(s===42?p:p&&(d||!f)),t(l)}}function xk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const p5={name:"autolink",tokenize:m5};function m5(e,t,n){let r=0;return o;function o(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return wn(h)?(e.consume(h),i):h===64?n(h):u(h)}function i(h){return h===43||h===45||h===46||dn(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||dn(h))&&r++<32?(e.consume(h),a):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||vf(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):o5(h)?(e.consume(h),u):n(h)}function d(h){return dn(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||dn(h))&&r++<63){const y=h===45?p:f;return e.consume(h),y}return n(h)}}const tu={partial:!0,tokenize:g5};function g5(e,t,n){return r;function r(s){return qe(s)?Ze(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||_e(s)?t(s):n(s)}}const hP={continuation:{tokenize:v5},exit:x5,name:"blockQuote",tokenize:y5};function y5(e,t,n){const r=this;return o;function o(i){if(i===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return qe(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function v5(e,t,n){const r=this;return o;function o(i){return qe(i)?Ze(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(hP,t,n)(i)}}function x5(e){e.exit("blockQuote")}const pP={name:"characterEscape",tokenize:w5};function w5(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return i5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const mP={name:"characterReference",tokenize:b5};function b5(e,t,n){const r=this;let o=0,s,i;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=dn,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=s5,d):(e.enter("characterReferenceValue"),s=7,i=Fg,d(f))}function d(f){if(f===59&&o){const p=e.exit("characterReferenceValue");return i===dn&&!g0(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(f)&&o++<s?(e.consume(f),d):n(f)}}const wk={partial:!0,tokenize:_5},bk={concrete:!0,name:"codeFenced",tokenize:k5};function k5(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,a;return l;function l(j){return u(j)}function u(j){const S=r.events[r.events.length-1];return s=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,a=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===a?(i++,e.consume(j),d):i<3?n(j):(e.exit("codeFencedFenceSequence"),qe(j)?Ze(e,f,"whitespace")(j):f(j))}function f(j){return j===null||_e(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(wk,m,k)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||_e(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):qe(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ze(e,h,"whitespace")(j)):j===96&&j===a?n(j):(e.consume(j),p)}function h(j){return j===null||_e(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||_e(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===a?n(j):(e.consume(j),y)}function m(j){return e.attempt(o,k,x)(j)}function x(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),g}function g(j){return s>0&&qe(j)?Ze(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||_e(j)?e.check(wk,m,k)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||_e(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),w)}function k(j){return e.exit("codeFenced"),t(j)}function C(j,S,A){let P=0;return $;function $(B){return j.enter("lineEnding"),j.consume(B),j.exit("lineEnding"),T}function T(B){return j.enter("codeFencedFence"),qe(B)?Ze(j,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):I(B)}function I(B){return B===a?(j.enter("codeFencedFenceSequence"),U(B)):A(B)}function U(B){return B===a?(P++,j.consume(B),U):P>=i?(j.exit("codeFencedFenceSequence"),qe(B)?Ze(j,O,"whitespace")(B):O(B)):A(B)}function O(B){return B===null||_e(B)?(j.exit("codeFencedFence"),S(B)):A(B)}}}function _5(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const zp={name:"codeIndented",tokenize:C5},S5={partial:!0,tokenize:E5};function C5(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Ze(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?l(u):_e(u)?e.attempt(S5,i,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||_e(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function E5(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):_e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):Ze(e,s,"linePrefix",5)(i)}function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):_e(i)?o(i):n(i)}}const N5={name:"codeText",previous:P5,resolve:j5,tokenize:T5};function j5(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function P5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function T5(e,t,n){let r=0,o,s;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(s=e.enter("codeTextSequence"),o=0,d(f)):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||_e(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(s.type="codeTextData",u(f))}}class R5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Nl(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Nl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Nl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Nl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Nl(this.left,n.reverse())}}}function Nl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gP(e){const t={};let n=-1,r,o,s,i,a,l,u;const d=new R5(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,$5(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},a=d.slice(o,n),a.unshift(r),d.splice(o,n-o+1,a))}}return Zn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function $5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,l=[],u={};let d,f,p=-1,h=n,y=0,m=0;const x=[m];for(;h;){for(;e.get(++o)[1]!==h;);s.push(o),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&i.defineSkip(h.start),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),h._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,x.push(m),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(i.events=[],h?(h._tokenizer=void 0,h.previous=void 0):x.pop(),p=x.length;p--;){const g=a.slice(x[p],x[p+1]),v=s.pop();l.push([v,v+g.length-1]),e.splice(v,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[y+l[p][0]]=y+l[p][1],y+=l[p][1]-l[p][0]-1;return u}const I5={resolve:O5,tokenize:M5},A5={partial:!0,tokenize:D5};function O5(e){return gP(e),e}function M5(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):_e(a)?e.check(A5,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function D5(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ze(e,s,"linePrefix")}function s(i){if(i===null||_e(i))return n(i);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function yP(e,t,n,r,o,s,i,a,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(g),e.exit(s),p):g===null||g===32||g===41||vf(g)?n(g):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(g))}function p(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(a),p(g)):g===null||g===60||_e(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function m(g){return!d&&(g===null||g===41||ot(g))?(e.exit("chunkString"),e.exit(a),e.exit(i),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,m):g===41?(e.consume(g),d--,m):g===null||g===32||g===40||vf(g)?n(g):(e.consume(g),g===92?x:m)}function x(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function vP(e,t,n,r,o,s){const i=this;let a=0,l;return u;function u(h){return e.enter(r),e.enter(o),e.consume(h),e.exit(o),e.enter(s),d}function d(h){return a>999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):h===93?(e.exit(s),e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||_e(h)||a++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!qe(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,f):f(h)}}function xP(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,l):n(p)}function l(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),l(i)):p===null?n(p):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===i||p===null||_e(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===i||p===92?(e.consume(p),d):d(p)}}function nc(e,t){let n;return r;function r(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):qe(o)?Ze(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const L5={name:"definition",tokenize:F5},z5={partial:!0,tokenize:U5};function F5(e,t,n){const r=this;let o;return s;function s(h){return e.enter("definition"),i(h)}function i(h){return vP.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return o=Ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ot(h)?nc(e,u)(h):u(h)}function u(h){return yP(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(z5,f,f)(h)}function f(h){return qe(h)?Ze(e,p,"whitespace")(h):p(h)}function p(h){return h===null||_e(h)?(e.exit("definition"),r.parser.defined.push(o),t(h)):n(h)}}function U5(e,t,n){return r;function r(a){return ot(a)?nc(e,o)(a):n(a)}function o(a){return xP(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return qe(a)?Ze(e,i,"whitespace")(a):i(a)}function i(a){return a===null||_e(a)?t(a):n(a)}}const q5={name:"hardBreakEscape",tokenize:V5};function V5(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const H5={name:"headingAtx",resolve:B5,tokenize:W5};function B5(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Zn(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function W5(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||ot(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||_e(d)?(e.exit("atxHeading"),t(d)):qe(d)?Ze(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||ot(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const K5=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],kk=["pre","script","style","textarea"],Z5={concrete:!0,name:"htmlFlow",resolveTo:J5,tokenize:Y5},Q5={partial:!0,tokenize:eU},G5={partial:!0,tokenize:X5};function J5(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Y5(e,t,n){const r=this;let o,s,i,a,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),f}function f(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),s=!0,m):_===63?(e.consume(_),o=3,r.interrupt?t:N):wn(_)?(e.consume(_),i=String.fromCharCode(_),x):n(_)}function p(_){return _===45?(e.consume(_),o=2,h):_===91?(e.consume(_),o=5,a=0,y):wn(_)?(e.consume(_),o=4,r.interrupt?t:N):n(_)}function h(_){return _===45?(e.consume(_),r.interrupt?t:N):n(_)}function y(_){const E="CDATA[";return _===E.charCodeAt(a++)?(e.consume(_),a===E.length?r.interrupt?t:I:y):n(_)}function m(_){return wn(_)?(e.consume(_),i=String.fromCharCode(_),x):n(_)}function x(_){if(_===null||_===47||_===62||ot(_)){const E=_===47,R=i.toLowerCase();return!E&&!s&&kk.includes(R)?(o=1,r.interrupt?t(_):I(_)):K5.includes(i.toLowerCase())?(o=6,E?(e.consume(_),g):r.interrupt?t(_):I(_)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):s?v(_):w(_))}return _===45||dn(_)?(e.consume(_),i+=String.fromCharCode(_),x):n(_)}function g(_){return _===62?(e.consume(_),r.interrupt?t:I):n(_)}function v(_){return qe(_)?(e.consume(_),v):$(_)}function w(_){return _===47?(e.consume(_),$):_===58||_===95||wn(_)?(e.consume(_),k):qe(_)?(e.consume(_),w):$(_)}function k(_){return _===45||_===46||_===58||_===95||dn(_)?(e.consume(_),k):C(_)}function C(_){return _===61?(e.consume(_),j):qe(_)?(e.consume(_),C):w(_)}function j(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,S):qe(_)?(e.consume(_),j):A(_)}function S(_){return _===l?(e.consume(_),l=null,P):_===null||_e(_)?n(_):(e.consume(_),S)}function A(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ot(_)?C(_):(e.consume(_),A)}function P(_){return _===47||_===62||qe(_)?w(_):n(_)}function $(_){return _===62?(e.consume(_),T):n(_)}function T(_){return _===null||_e(_)?I(_):qe(_)?(e.consume(_),T):n(_)}function I(_){return _===45&&o===2?(e.consume(_),J):_===60&&o===1?(e.consume(_),Q):_===62&&o===4?(e.consume(_),M):_===63&&o===3?(e.consume(_),N):_===93&&o===5?(e.consume(_),W):_e(_)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Q5,V,U)(_)):_===null||_e(_)?(e.exit("htmlFlowData"),U(_)):(e.consume(_),I)}function U(_){return e.check(G5,O,V)(_)}function O(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),B}function B(_){return _===null||_e(_)?U(_):(e.enter("htmlFlowData"),I(_))}function J(_){return _===45?(e.consume(_),N):I(_)}function Q(_){return _===47?(e.consume(_),i="",H):I(_)}function H(_){if(_===62){const E=i.toLowerCase();return kk.includes(E)?(e.consume(_),M):I(_)}return wn(_)&&i.length<8?(e.consume(_),i+=String.fromCharCode(_),H):I(_)}function W(_){return _===93?(e.consume(_),N):I(_)}function N(_){return _===62?(e.consume(_),M):_===45&&o===2?(e.consume(_),N):I(_)}function M(_){return _===null||_e(_)?(e.exit("htmlFlowData"),V(_)):(e.consume(_),M)}function V(_){return e.exit("htmlFlow"),t(_)}}function X5(e,t,n){const r=this;return o;function o(i){return _e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function eU(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(tu,t,n)}}const tU={name:"htmlText",tokenize:nU};function nU(e,t,n){const r=this;let o,s,i;return a;function a(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),u):N===47?(e.consume(N),C):N===63?(e.consume(N),w):wn(N)?(e.consume(N),A):n(N)}function u(N){return N===45?(e.consume(N),d):N===91?(e.consume(N),s=0,y):wn(N)?(e.consume(N),v):n(N)}function d(N){return N===45?(e.consume(N),h):n(N)}function f(N){return N===null?n(N):N===45?(e.consume(N),p):_e(N)?(i=f,Q(N)):(e.consume(N),f)}function p(N){return N===45?(e.consume(N),h):f(N)}function h(N){return N===62?J(N):N===45?p(N):f(N)}function y(N){const M="CDATA[";return N===M.charCodeAt(s++)?(e.consume(N),s===M.length?m:y):n(N)}function m(N){return N===null?n(N):N===93?(e.consume(N),x):_e(N)?(i=m,Q(N)):(e.consume(N),m)}function x(N){return N===93?(e.consume(N),g):m(N)}function g(N){return N===62?J(N):N===93?(e.consume(N),g):m(N)}function v(N){return N===null||N===62?J(N):_e(N)?(i=v,Q(N)):(e.consume(N),v)}function w(N){return N===null?n(N):N===63?(e.consume(N),k):_e(N)?(i=w,Q(N)):(e.consume(N),w)}function k(N){return N===62?J(N):w(N)}function C(N){return wn(N)?(e.consume(N),j):n(N)}function j(N){return N===45||dn(N)?(e.consume(N),j):S(N)}function S(N){return _e(N)?(i=S,Q(N)):qe(N)?(e.consume(N),S):J(N)}function A(N){return N===45||dn(N)?(e.consume(N),A):N===47||N===62||ot(N)?P(N):n(N)}function P(N){return N===47?(e.consume(N),J):N===58||N===95||wn(N)?(e.consume(N),$):_e(N)?(i=P,Q(N)):qe(N)?(e.consume(N),P):J(N)}function $(N){return N===45||N===46||N===58||N===95||dn(N)?(e.consume(N),$):T(N)}function T(N){return N===61?(e.consume(N),I):_e(N)?(i=T,Q(N)):qe(N)?(e.consume(N),T):P(N)}function I(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),o=N,U):_e(N)?(i=I,Q(N)):qe(N)?(e.consume(N),I):(e.consume(N),O)}function U(N){return N===o?(e.consume(N),o=void 0,B):N===null?n(N):_e(N)?(i=U,Q(N)):(e.consume(N),U)}function O(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||ot(N)?P(N):(e.consume(N),O)}function B(N){return N===47||N===62||ot(N)?P(N):n(N)}function J(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function Q(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),H}function H(N){return qe(N)?Ze(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):W(N)}function W(N){return e.enter("htmlTextData"),i(N)}}const y0={name:"labelEnd",resolveAll:iU,resolveTo:aU,tokenize:lU},rU={tokenize:cU},oU={tokenize:uU},sU={tokenize:dU};function iU(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Zn(e,0,e.length,n),e}function aU(e,t){let n=e.length,r=0,o,s,i,a;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=ar(a,e.slice(s+1,s+r+3)),a=ar(a,[["enter",d,t]]),a=ar(a,Nh(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=ar(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=ar(a,e.slice(i+1)),a=ar(a,[["exit",l,t]]),Zn(e,s,e.length,a),e}function lU(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return a;function a(p){return s?s._inactive?f(p):(i=r.parser.defined.includes(Ir(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(rU,d,i?d:f)(p):p===91?e.attempt(oU,d,i?u:f)(p):i?d(p):f(p)}function u(p){return e.attempt(sU,d,f)(p)}function d(p){return t(p)}function f(p){return s._balanced=!0,n(p)}}function cU(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return ot(f)?nc(e,s)(f):s(f)}function s(f){return f===41?d(f):yP(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return ot(f)?nc(e,l)(f):d(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?xP(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ot(f)?nc(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function uU(e,t,n){const r=this;return o;function o(a){return vP.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function dU(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const fU={name:"labelStartImage",resolveAll:y0.resolveAll,tokenize:hU};function hU(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const pU={name:"labelStartLink",resolveAll:y0.resolveAll,tokenize:mU};function mU(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const Fp={name:"lineEnding",tokenize:gU};function gU(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ze(e,t,"linePrefix")}}const _d={name:"thematicBreak",tokenize:yU};function yU(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===o?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),qe(u)?Ze(e,a,"whitespace")(u):a(u))}}const Cn={continuation:{tokenize:bU},exit:_U,name:"list",tokenize:wU},vU={partial:!0,tokenize:SU},xU={partial:!0,tokenize:kU};function wU(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return a;function a(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Fg(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(_d,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return Fg(h)&&++i<10?(e.consume(h),l):(!r.interrupt||i<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(tu,r.interrupt?n:d,e.attempt(vU,p,f))}function d(h){return r.containerState.initialBlankLine=!0,s++,p(h)}function f(h){return qe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function bU(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(tu,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ze(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!qe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xU,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ze(e,e.attempt(Cn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function kU(e,t,n){const r=this;return Ze(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function _U(e){e.exit(this.containerState.type)}function SU(e,t,n){const r=this;return Ze(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!qe(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const _k={name:"setextUnderline",resolveTo:CU,tokenize:EU};function CU(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function EU(e,t,n){const r=this;let o;return s;function s(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),qe(u)?Ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const NU={tokenize:jU};function jU(e){const t=this,n=e.attempt(tu,r,e.attempt(this.parser.constructs.flowInitial,o,Ze(e,e.attempt(this.parser.constructs.flow,o,e.attempt(I5,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const PU={resolveAll:bP()},TU=wP("string"),RU=wP("text");function wP(e){return{resolveAll:bP(e==="text"?$U:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=o[d];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function bP(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function $U(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,i=-1,a=0,l;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)l=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const IU={42:Cn,43:Cn,45:Cn,48:Cn,49:Cn,50:Cn,51:Cn,52:Cn,53:Cn,54:Cn,55:Cn,56:Cn,57:Cn,62:hP},AU={91:L5},OU={[-2]:zp,[-1]:zp,32:zp},MU={35:H5,42:_d,45:[_k,_d],60:Z5,61:_k,95:_d,96:bk,126:bk},DU={38:mP,92:pP},LU={[-5]:Fp,[-4]:Fp,[-3]:Fp,33:fU,38:mP,42:Ug,60:[p5,tU],91:pU,92:[q5,pP],93:y0,95:Ug,96:N5},zU={null:[Ug,PU]},FU={null:[42,95]},UU={null:[]},qU=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:FU,contentInitial:AU,disable:UU,document:IU,flow:MU,flowInitial:OU,insideSpan:zU,string:DU,text:LU},Symbol.toStringTag,{value:"Module"}));function VU(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},s=[];let i=[],a=[];const l={attempt:S(C),check:S(j),consume:v,enter:w,exit:k,interrupt:S(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let d=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function f(T){return i=ar(i,T),x(),i[i.length-1]!==null?[]:(A(t,0),u.events=Nh(s,u.events,u),u.events)}function p(T,I){return BU(h(T),I)}function h(T){return HU(i,T)}function y(){const{_bufferIndex:T,_index:I,line:U,column:O,offset:B}=r;return{_bufferIndex:T,_index:I,line:U,column:O,offset:B}}function m(T){o[T.line]=T.column,$()}function x(){let T;for(;r._index<i.length;){const I=i[r._index];if(typeof I=="string")for(T=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===T&&r._bufferIndex<I.length;)g(I.charCodeAt(r._bufferIndex));else g(I)}}function g(T){d=d(T)}function v(T){_e(T)?(r.line++,r.column=1,r.offset+=T===-3?2:1,$()):T!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=T}function w(T,I){const U=I||{};return U.type=T,U.start=y(),u.events.push(["enter",U,u]),a.push(U),U}function k(T){const I=a.pop();return I.end=y(),u.events.push(["exit",I,u]),I}function C(T,I){A(T,I.from)}function j(T,I){I.restore()}function S(T,I){return U;function U(O,B,J){let Q,H,W,N;return Array.isArray(O)?V(O):"tokenize"in O?V([O]):M(O);function M(D){return K;function K(X){const pe=X!==null&&D[X],ce=X!==null&&D.null,L=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(ce)?ce:ce?[ce]:[]];return V(L)(X)}}function V(D){return Q=D,H=0,D.length===0?J:_(D[H])}function _(D){return K;function K(X){return N=P(),W=D,D.partial||(u.currentConstruct=D),D.name&&u.parser.constructs.disable.null.includes(D.name)?R():D.tokenize.call(I?Object.assign(Object.create(u),I):u,l,E,R)(X)}}function E(D){return T(W,N),B}function R(D){return N.restore(),++H<Q.length?_(Q[H]):J}}}function A(T,I){T.resolveAll&&!s.includes(T)&&s.push(T),T.resolve&&Zn(u.events,I,u.events.length-I,T.resolve(u.events.slice(I),u)),T.resolveTo&&(u.events=T.resolveTo(u.events,u))}function P(){const T=y(),I=u.previous,U=u.currentConstruct,O=u.events.length,B=Array.from(a);return{from:O,restore:J};function J(){r=T,u.previous=I,u.currentConstruct=U,u.events.length=O,a=B,$()}}function $(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function HU(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function BU(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
384
- `;break}case-3:{i=`\r
385
- `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function WU(e){const r={constructs:dP([qU,...(e||{}).extensions||[]]),content:o(a5),defined:[],document:o(c5),flow:o(NU),lazy:{},string:o(TU),text:o(RU)};return r;function o(s){return i;function i(a){return VU(r,s,a)}}}function KU(e){for(;!gP(e););return e}const Sk=/[\0\t\n\r]/g;function ZU(){let e=1,t="",n=!0,r;return o;function o(s,i,a){const l=[];let u,d,f,p,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),f=0,t="",n&&(s.charCodeAt(0)===65279&&f++,n=void 0);f<s.length;){if(Sk.lastIndex=f,u=Sk.exec(s),p=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(p),!u){t=s.slice(f);break}if(h===10&&f===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<p&&(l.push(s.slice(f,p)),e+=p-f),h){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const QU=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GU(e){return e.replace(QU,JU)}function JU(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return fP(n.slice(s?2:1),s?16:10)}return g0(n)||e}const kP={}.hasOwnProperty;function YU(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XU(n)(KU(WU(n).document().write(ZU()(e,t,!0))))}function XU(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(le),autolinkProtocol:P,autolinkEmail:P,atxHeading:s(Z),blockQuote:s(ce),characterEscape:P,characterReference:P,codeFenced:s(L),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(L,i),codeText:s(q,i),codeTextData:P,data:P,codeFlowValue:P,definition:s(Y),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(ne),hardBreakEscape:s(re),hardBreakTrailing:s(re),htmlFlow:s(oe,i),htmlFlowData:P,htmlText:s(oe,i),htmlTextData:P,image:s(Re),label:i,link:s(le),listItem:s(Se),listItemValue:p,listOrdered:s(Ce,f),listUnordered:s(Ce),paragraph:s(tt),reference:_,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(Z),strong:s(Ke),thematicBreak:s(zn)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:pe,autolinkProtocol:X,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:D,characterReference:K,codeFenced:l(x),codeFencedFence:m,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:$,codeIndented:l(g),codeText:l(B),codeTextData:$,data:$,definition:l(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(U),htmlFlowData:$,htmlText:l(O),htmlTextData:$,image:l(Q),label:W,labelText:H,lineEnding:T,link:l(J),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:E,resourceDestinationString:N,resourceTitleString:M,resource:V,setextHeading:l(A),setextHeadingLineSequence:S,setextHeadingText:j,strong:l(),thematicBreak:l()}};_P(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(G){let ae={type:"root",children:[]};const we={stack:[ae],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},Ie=[];let He=-1;for(;++He<G.length;)if(G[He][1].type==="listOrdered"||G[He][1].type==="listUnordered")if(G[He][0]==="enter")Ie.push(He);else{const sn=Ie.pop();He=o(G,sn,He)}for(He=-1;++He<G.length;){const sn=t[G[He][0]];kP.call(sn,G[He][1].type)&&sn[G[He][1].type].call(Object.assign({sliceSerialize:G[He][2].sliceSerialize},we),G[He][1])}if(we.tokenStack.length>0){const sn=we.tokenStack[we.tokenStack.length-1];(sn[1]||Ck).call(we,void 0,sn[0])}for(ae.position={start:Vo(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:Vo(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},He=-1;++He<t.transforms.length;)ae=t.transforms[He](ae)||ae;return ae}function o(G,ae,we){let Ie=ae-1,He=-1,sn=!1,er,Sn,Lr,mr;for(;++Ie<=we;){const Ot=G[Ie];switch(Ot[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ot[0]==="enter"?He++:He--,mr=void 0;break}case"lineEndingBlank":{Ot[0]==="enter"&&(er&&!mr&&!He&&!Lr&&(Lr=Ie),mr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mr=void 0}if(!He&&Ot[0]==="enter"&&Ot[1].type==="listItemPrefix"||He===-1&&Ot[0]==="exit"&&(Ot[1].type==="listUnordered"||Ot[1].type==="listOrdered")){if(er){let tr=Ie;for(Sn=void 0;tr--;){const Mt=G[tr];if(Mt[1].type==="lineEnding"||Mt[1].type==="lineEndingBlank"){if(Mt[0]==="exit")continue;Sn&&(G[Sn][1].type="lineEndingBlank",sn=!0),Mt[1].type="lineEnding",Sn=tr}else if(!(Mt[1].type==="linePrefix"||Mt[1].type==="blockQuotePrefix"||Mt[1].type==="blockQuotePrefixWhitespace"||Mt[1].type==="blockQuoteMarker"||Mt[1].type==="listItemIndent"))break}Lr&&(!Sn||Lr<Sn)&&(er._spread=!0),er.end=Object.assign({},Sn?G[Sn][1].start:Ot[1].end),G.splice(Sn||Ie,0,["exit",er,Ot[2]]),Ie++,we++}if(Ot[1].type==="listItemPrefix"){const tr={type:"listItem",_spread:!1,start:Object.assign({},Ot[1].start),end:void 0};er=tr,G.splice(Ie,0,["enter",tr,Ot[2]]),Ie++,we++,Lr=void 0,mr=!0}}}return G[ae][1]._spread=sn,we}function s(G,ae){return we;function we(Ie){a.call(this,G(Ie),Ie),ae&&ae.call(this,Ie)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(G,ae,we){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([ae,we||void 0]),G.position={start:Vo(ae.start),end:void 0}}function l(G){return ae;function ae(we){G&&G.call(this,we),u.call(this,we)}}function u(G,ae){const we=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==G.type&&(ae?ae.call(this,G,Ie[0]):(Ie[1]||Ck).call(this,G,Ie[0]));else throw new Error("Cannot close `"+G.type+"` ("+tc({start:G.start,end:G.end})+"): it’s not open");we.position.end=Vo(G.end)}function d(){return m0(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(G){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function h(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=G}function y(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=G}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.value=G.replace(/(\r?\n|\r)$/g,"")}function v(G){const ae=this.resume(),we=this.stack[this.stack.length-1];we.label=ae,we.identifier=Ir(this.sliceSerialize(G)).toLowerCase()}function w(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.title=G}function k(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.url=G}function C(G){const ae=this.stack[this.stack.length-1];if(!ae.depth){const we=this.sliceSerialize(G).length;ae.depth=we}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function S(G){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function P(G){const we=this.stack[this.stack.length-1].children;let Ie=we[we.length-1];(!Ie||Ie.type!=="text")&&(Ie=pn(),Ie.position={start:Vo(G.start),end:void 0},we.push(Ie)),this.stack.push(Ie)}function $(G){const ae=this.stack.pop();ae.value+=this.sliceSerialize(G),ae.position.end=Vo(G.end)}function T(G){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=ae.children[ae.children.length-1];we.position.end=Vo(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(P.call(this,G),$.call(this,G))}function I(){this.data.atHardBreak=!0}function U(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.value=G}function O(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.value=G}function B(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.value=G}function J(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=ae,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function Q(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=ae,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function H(G){const ae=this.sliceSerialize(G),we=this.stack[this.stack.length-2];we.label=GU(ae),we.identifier=Ir(ae).toLowerCase()}function W(){const G=this.stack[this.stack.length-1],ae=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Ie=G.children;we.children=Ie}else we.alt=ae}function N(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.url=G}function M(){const G=this.resume(),ae=this.stack[this.stack.length-1];ae.title=G}function V(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function E(G){const ae=this.resume(),we=this.stack[this.stack.length-1];we.label=ae,we.identifier=Ir(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function R(G){this.data.characterReferenceType=G.type}function D(G){const ae=this.sliceSerialize(G),we=this.data.characterReferenceType;let Ie;we?(Ie=fP(ae,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=g0(ae);const He=this.stack[this.stack.length-1];He.value+=Ie}function K(G){const ae=this.stack.pop();ae.position.end=Vo(G.end)}function X(G){$.call(this,G);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(G)}function pe(G){$.call(this,G);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(G)}function ce(){return{type:"blockquote",children:[]}}function L(){return{type:"code",lang:null,meta:null,value:""}}function q(){return{type:"inlineCode",value:""}}function Y(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ne(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function re(){return{type:"break"}}function oe(){return{type:"html",value:""}}function Re(){return{type:"image",title:null,url:"",alt:null}}function le(){return{type:"link",title:null,url:"",children:[]}}function Ce(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function Se(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Ke(){return{type:"strong",children:[]}}function pn(){return{type:"text",value:""}}function zn(){return{type:"thematicBreak"}}}function Vo(e){return{line:e.line,column:e.column,offset:e.offset}}function _P(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?_P(e,r):e9(e,r)}}function e9(e,t){let n;for(n in t)if(kP.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Ck(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+tc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+tc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+tc({start:t.start,end:t.end})+") is still open")}function t9(e){const t=this;t.parser=n;function n(r){return YU(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function n9(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function r9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
386
- `}]}function o9(e,t){const n=t.value?t.value+`
387
- `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function s9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function i9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function a9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=ul(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function l9(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function SP(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&i.type==="text"?i.value+=r:o.push({type:"text",value:r}),o}function u9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return SP(e,t);const o={src:ul(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function d9(e,t){const n={src:ul(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function f9(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function h9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return SP(e,t);const o={href:ul(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function p9(e,t){const n={href:ul(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function m9(e,t,n){const r=e.all(t),o=n?g9(n):CP(t),s={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(o||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
388
- `}),d.type==="element"&&d.tagName==="p"&&!o?i.push(...d.children):i.push(d)}const l=r[r.length-1];l&&(o||l.type!=="element"||l.tagName!=="p")&&i.push({type:"text",value:`
389
- `});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function g9(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=CP(n[r])}return t}function CP(e){const t=e.spread;return t??e.children.length>1}function y9(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const i=r[o];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function v9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function w9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function b9(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),o.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=d0(t.children[1]),l=oP(t.children[t.children.length-1]);a&&l&&(i.position={start:a,end:l}),o.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function k9(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,a=i?i.length:t.children.length;let l=-1;const u=[];for(;++l<a;){const f=t.children[l],p={},h=i?i[l]:void 0;h&&(p.align=h);let y={type:"element",tagName:s,properties:p,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function _9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ek=9,Nk=32;function S9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(jk(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(jk(t.slice(o),o>0,!1)),s.join("")}function jk(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===Ek||s===Nk;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===Ek||s===Nk;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function C9(e,t){const n={type:"text",value:S9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function E9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const N9={blockquote:n9,break:r9,code:o9,delete:s9,emphasis:i9,footnoteReference:a9,heading:l9,html:c9,imageReference:u9,image:d9,inlineCode:f9,linkReference:h9,link:p9,listItem:m9,list:y9,paragraph:v9,root:x9,strong:w9,table:b9,tableCell:_9,tableRow:k9,text:C9,thematicBreak:E9,toml:Vu,yaml:Vu,definition:Vu,footnoteDefinition:Vu};function Vu(){}const EP=-1,jh=0,rc=1,xf=2,v0=3,x0=4,w0=5,b0=6,NP=7,jP=8,Pk=typeof self=="object"?self:globalThis,j9=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,i]=t[o];switch(s){case jh:case EP:return n(i,o);case rc:{const a=n([],o);for(const l of i)a.push(r(l));return a}case xf:{const a=n({},o);for(const[l,u]of i)a[r(l)]=r(u);return a}case v0:return n(new Date(i),o);case x0:{const{source:a,flags:l}=i;return n(new RegExp(a,l),o)}case w0:{const a=n(new Map,o);for(const[l,u]of i)a.set(r(l),r(u));return a}case b0:{const a=n(new Set,o);for(const l of i)a.add(r(l));return a}case NP:{const{name:a,message:l}=i;return n(new Pk[a](l),o)}case jP:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:a}=new Uint8Array(i);return n(new DataView(a),i)}}return n(new Pk[s](i),o)};return r},Tk=e=>j9(new Map,e)(0),Fi="",{toString:P9}={},{keys:T9}=Object,jl=e=>{const t=typeof e;if(t!=="object"||!e)return[jh,t];const n=P9.call(e).slice(8,-1);switch(n){case"Array":return[rc,Fi];case"Object":return[xf,Fi];case"Date":return[v0,Fi];case"RegExp":return[x0,Fi];case"Map":return[w0,Fi];case"Set":return[b0,Fi];case"DataView":return[rc,n]}return n.includes("Array")?[rc,n]:n.includes("Error")?[NP,n]:[xf,n]},Hu=([e,t])=>e===jh&&(t==="function"||t==="symbol"),R9=(e,t,n,r)=>{const o=(i,a)=>{const l=r.push(i)-1;return n.set(a,l),l},s=i=>{if(n.has(i))return n.get(i);let[a,l]=jl(i);switch(a){case jh:{let d=i;switch(l){case"bigint":a=jP,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return o([EP],i)}return o([a,d],i)}case rc:{if(l){let p=i;return l==="DataView"?p=new Uint8Array(i.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(i)),o([l,[...p]],i)}const d=[],f=o([a,d],i);for(const p of i)d.push(s(p));return f}case xf:{if(l)switch(l){case"BigInt":return o([l,i.toString()],i);case"Boolean":case"Number":case"String":return o([l,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const d=[],f=o([a,d],i);for(const p of T9(i))(e||!Hu(jl(i[p])))&&d.push([s(p),s(i[p])]);return f}case v0:return o([a,i.toISOString()],i);case x0:{const{source:d,flags:f}=i;return o([a,{source:d,flags:f}],i)}case w0:{const d=[],f=o([a,d],i);for(const[p,h]of i)(e||!(Hu(jl(p))||Hu(jl(h))))&&d.push([s(p),s(h)]);return f}case b0:{const d=[],f=o([a,d],i);for(const p of i)(e||!Hu(jl(p)))&&d.push(s(p));return f}}const{message:u}=i;return o([a,{name:l,message:u}],i)};return s},Rk=(e,{json:t,lossy:n}={})=>{const r=[];return R9(!(t||n),!!t,new Map,r)(e),r},wf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Tk(Rk(e,t)):structuredClone(e):(e,t)=>Tk(Rk(e,t));function $9(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function I9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function A9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||$9,r=e.options.footnoteBackLabel||I9,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),p=ul(f.toLowerCase());let h=0;const y=[],m=e.footnoteCounts.get(f);for(;m!==void 0&&++h<=m;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,h);typeof v=="string"&&(v={type:"text",value:v}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...y)}else d.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,g),a.push(g)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...wf(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
390
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
391
- `}]}}const Ph=function(e){if(e==null)return L9;if(typeof e=="function")return Th(e);if(typeof e=="object")return Array.isArray(e)?O9(e):M9(e);if(typeof e=="string")return D9(e);throw new Error("Expected function, string, or object as test")};function O9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ph(e[n]);return Th(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function M9(e){const t=e;return Th(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function D9(e){return Th(t);function t(n){return n&&n.type===e}}function Th(e){return t;function t(n,r,o){return!!(z9(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function L9(){return!0}function z9(e){return e!==null&&typeof e=="object"&&"type"in e}const PP=[],F9=!0,qg=!1,U9="skip";function TP(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Ph(o),i=r?-1:1;a(e,void 0,[])();function a(l,u,d){const f=l&&typeof l=="object"?l:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=PP,y,m,x;if((!t||s(l,u,d[d.length-1]||void 0))&&(h=q9(n(l,d)),h[0]===qg))return h;if("children"in l&&l.children){const g=l;if(g.children&&h[0]!==U9)for(m=(r?g.children.length:-1)+i,x=d.concat(g);m>-1&&m<g.children.length;){const v=g.children[m];if(y=a(v,m,x)(),y[0]===qg)return y;m=typeof y[1]=="number"?y[1]:m+i}}return h}}}function q9(e){return Array.isArray(e)?e:typeof e=="number"?[F9,e]:e==null?PP:[e]}function k0(e,t,n,r){let o,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,o=n):(s=t,i=n,o=r),TP(e,s,a,o);function a(l,u){const d=u[u.length-1],f=d?d.children.indexOf(l):void 0;return i(l,f,d)}}const Vg={}.hasOwnProperty,V9={};function H9(e,t){const n=t||V9,r=new Map,o=new Map,s=new Map,i={...N9,...n.handlers},a={all:u,applyData:W9,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:l,options:n,patch:B9,wrap:Z9};return k0(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:o,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),a;function l(d,f){const p=d.type,h=a.handlers[p];if(Vg.call(a.handlers,p)&&h)return h(a,d,f);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:m,...x}=d,g=wf(x);return g.children=a.all(d),g}return wf(d)}return(a.options.unknownHandler||K9)(a,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let h=-1;for(;++h<p.length;){const y=a.one(p[h],d);if(y){if(h&&p[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=$k(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=$k(m.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function B9(e,t){e.position&&(t.position=I3(e))}function W9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,wf(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function K9(e,t){const n=t.data||{},r="value"in t&&!(Vg.call(n,"hProperties")||Vg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
392
- `});++r<e.length;)r&&n.push({type:"text",value:`
393
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
394
- `}),n}function $k(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Ik(e,t){const n=H9(e,t),r=n.one(e,void 0),o=A9(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
395
- `},o),s}function Q9(e,t){return e&&"run"in e?async function(n,r){const o=Ik(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Ik(n,{file:r,...e||t})}}function Ak(e){if(e)throw e}var Sd=Object.prototype.hasOwnProperty,RP=Object.prototype.toString,Ok=Object.defineProperty,Mk=Object.getOwnPropertyDescriptor,Dk=function(t){return typeof Array.isArray=="function"?Array.isArray(t):RP.call(t)==="[object Array]"},Lk=function(t){if(!t||RP.call(t)!=="[object Object]")return!1;var n=Sd.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Sd.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||Sd.call(t,o)},zk=function(t,n){Ok&&n.name==="__proto__"?Ok(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Fk=function(t,n){if(n==="__proto__")if(Sd.call(t,n)){if(Mk)return Mk(t,n).value}else return;return t[n]},G9=function e(){var t,n,r,o,s,i,a=arguments[0],l=1,u=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=Fk(a,n),o=Fk(t,n),a!==o&&(d&&o&&(Lk(o)||(s=Dk(o)))?(s?(s=!1,i=r&&Dk(r)?r:[]):i=r&&Lk(r)?r:{},zk(a,{name:n,newValue:e(d,i,o)})):typeof o<"u"&&zk(a,{name:n,newValue:o}));return a};const Up=Xa(G9);function Hg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function J9(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);a(null,...o);function a(l,...u){const d=e[++s];let f=-1;if(l){i(l);return}for(;++f<o.length;)(u[f]===null||u[f]===void 0)&&(u[f]=o[f]);o=u,d?Y9(d,a)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Y9(e,t){let n;return r;function r(...i){const a=e.length>i.length;let l;a&&i.push(o);try{l=e.apply(this,i)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,o):l instanceof Error?o(l):s(l))}function o(i,...a){n||(n=!0,t(i,...a))}function s(i){o(null,i)}}const qr={basename:X9,dirname:e6,extname:t6,join:n6,sep:"/"};function X9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');nu(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function e6(e){if(nu(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function t6(e){nu(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const a=e.codePointAt(t);if(a===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),a===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function n6(...e){let t=-1,n;for(;++t<e.length;)nu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":r6(n)}function r6(e){nu(e);const t=e.codePointAt(0)===47;let n=o6(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function o6(e,t){let n="",r=0,o=-1,s=0,i=-1,a,l;for(;++i<=e.length;){if(i<e.length)a=e.codePointAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else a===46&&s>-1?s++:s=-1}return n}function nu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const s6={cwd:i6};function i6(){return"/"}function Bg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function a6(e){if(typeof e=="string")e=new URL(e);else if(!Bg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return l6(e)}function l6(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const qp=["history","path","basename","stem","extname","dirname"];class $P{constructor(t){let n;t?Bg(t)?n={path:t}:typeof t=="string"||c6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":s6.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qp.length;){const s=qp[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)qp.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?qr.basename(this.path):void 0}set basename(t){Hp(t,"basename"),Vp(t,"basename"),this.path=qr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qr.dirname(this.path):void 0}set dirname(t){Uk(this.basename,"dirname"),this.path=qr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qr.extname(this.path):void 0}set extname(t){if(Vp(t,"extname"),Uk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=qr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bg(t)&&(t=a6(t)),Hp(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qr.basename(this.path,this.extname):void 0}set stem(t){Hp(t,"stem"),Vp(t,"stem"),this.path=qr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new hn(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Vp(e,t){if(e&&e.includes(qr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qr.sep+"`")}function Hp(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Uk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function c6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const u6=function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},d6={}.hasOwnProperty;class _0 extends u6{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=J9()}copy(){const t=new _0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Up(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Kp("data",this.frozen),this.namespace[t]=n,this):d6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Kp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Bu(t),r=this.parser||this.Parser;return Bp("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Bp("process",this.parser||this.Parser),Wp("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=Bu(t),l=r.parse(a);r.run(l,a,function(d,f,p){if(d||!f||!p)return u(d);const h=f,y=r.stringify(h,p);p6(y)?p.value=y:p.result=y,u(d,p)});function u(d,f){d||!f?i(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Bp("processSync",this.parser||this.Parser),Wp("processSync",this.compiler||this.Compiler),this.process(t,o),Vk("processSync","process",n),r;function o(s,i){n=!0,Ak(s),r=i}}run(t,n,r){qk(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,a){const l=Bu(n);o.run(t,l,u);function u(d,f,p){const h=f||t;d?a(d):i?i(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Vk("runSync","run",r),o;function s(i,a){Ak(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=Bu(n),o=this.compiler||this.Compiler;return Wp("stringify",o),qk(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Kp("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;l(d,f)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(o.settings=Up(!0,o.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...y]=d;const m=r[p][1];Hg(m)&&Hg(h)&&(h=Up(!0,m,h)),r[p]=[u,h,...y]}}}}const f6=new _0().freeze();function Bp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Wp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Kp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function qk(e){if(!Hg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Vk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Bu(e){return h6(e)?e:new $P(e)}function h6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function p6(e){return typeof e=="string"||m6(e)}function m6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const g6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hk=[],Bk={allowDangerousHtml:!0},y6=/^(https?|ircs?|mailto|xmpp)$/i,v6=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function x6(e){const t=w6(e),n=b6(e);return k6(t.runSync(t.parse(n),n),e)}function w6(e){const t=e.rehypePlugins||Hk,n=e.remarkPlugins||Hk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Bk}:Bk;return f6().use(t9).use(n).use(Q9,r).use(t)}function b6(e){const t=e.children||"",n=new $P;return typeof t=="string"&&(n.value=t),n}function k6(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||_6;for(const d of v6)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+g6+d.id,void 0);return k0(e,u),L3(e,{Fragment:c.Fragment,components:o,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function u(d,f,p){if(d.type==="raw"&&p&&typeof f=="number")return i?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in Lp)if(Object.hasOwn(Lp,h)&&Object.hasOwn(d.properties,h)){const y=d.properties[h],m=Lp[h];(m===null||m.includes(d.tagName))&&(d.properties[h]=l(String(y||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(d,f,p)),h&&p&&typeof f=="number")return a&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function _6(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||y6.test(e.slice(0,t))?e:""}function Wk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}function S6(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function C6(e,t,n){const o=Ph((n||{}).ignore||[]),s=E6(t);let i=-1;for(;++i<s.length;)TP(e,"text",a);function a(u,d){let f=-1,p;for(;++f<d.length;){const h=d[f],y=p?p.children:void 0;if(o(h,y?y.indexOf(h):void 0,p))return;p=h}if(p)return l(u,d)}function l(u,d){const f=d[d.length-1],p=s[i][0],h=s[i][1];let y=0;const x=f.children.indexOf(u);let g=!1,v=[];p.lastIndex=0;let w=p.exec(u.value);for(;w;){const k=w.index,C={index:w.index,input:w.input,stack:[...d,u]};let j=h(...w,C);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?p.lastIndex=k+1:(y!==k&&v.push({type:"text",value:u.value.slice(y,k)}),Array.isArray(j)?v.push(...j):j&&v.push(j),y=k+w[0].length,g=!0),!p.global)break;w=p.exec(u.value)}return g?(y<u.value.length&&v.push({type:"text",value:u.value.slice(y)}),f.children.splice(x,1,...v)):v=[u],x+v.length}}function E6(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const o=n[r];t.push([N6(o[0]),j6(o[1])])}return t}function N6(e){return typeof e=="string"?new RegExp(S6(e),"g"):e}function j6(e){return typeof e=="function"?e:function(){return e}}const Zp="phrasing",Qp=["autolink","link","image","label"];function P6(){return{transforms:[M6],enter:{literalAutolink:R6,literalAutolinkEmail:Gp,literalAutolinkHttp:Gp,literalAutolinkWww:Gp},exit:{literalAutolink:O6,literalAutolinkEmail:A6,literalAutolinkHttp:$6,literalAutolinkWww:I6}}}function T6(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Zp,notInConstruct:Qp},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Zp,notInConstruct:Qp},{character:":",before:"[ps]",after:"\\/",inConstruct:Zp,notInConstruct:Qp}]}}function R6(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Gp(e){this.config.enter.autolinkProtocol.call(this,e)}function $6(e){this.config.exit.autolinkProtocol.call(this,e)}function I6(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function A6(e){this.config.exit.autolinkEmail.call(this,e)}function O6(e){this.exit(e)}function M6(e){C6(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,D6],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),L6]],{ignore:["link","linkReference"]})}function D6(e,t,n,r,o){let s="";if(!IP(o)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!z6(n)))return!1;const i=F6(n+r);if(!i[0])return!1;const a={type:"link",title:null,url:s+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[a,{type:"text",value:i[1]}]:a}function L6(e,t,n,r){return!IP(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function z6(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function F6(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=Wk(e,"(");let s=Wk(e,")");for(;r!==-1&&o>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function IP(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ci(n)||Eh(n))&&(!t||n!==47)}AP.peek=Q6;function U6(){this.buffer()}function q6(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function V6(){this.buffer()}function H6(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function B6(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),n.label=t}function W6(e){this.exit(e)}function K6(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ir(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Z6(e){this.exit(e)}function Q6(){return"["}function AP(e,t,n,r){const o=n.createTracker(r);let s=o.move("[^");const i=n.enter("footnoteReference"),a=n.enter("reference");return s+=o.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),i(),s+=o.move("]"),s}function G6(){return{enter:{gfmFootnoteCallString:U6,gfmFootnoteCall:q6,gfmFootnoteDefinitionLabelString:V6,gfmFootnoteDefinition:H6},exit:{gfmFootnoteCallString:B6,gfmFootnoteCall:W6,gfmFootnoteDefinitionLabelString:K6,gfmFootnoteDefinition:Z6}}}function J6(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:AP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,s,i){const a=s.createTracker(i);let l=a.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),d(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
396
- `:" ")+s.indentLines(s.containerFlow(r,a.current()),t?OP:Y6))),u(),l}}function Y6(e,t,n){return t===0?e:OP(e,t,n)}function OP(e,t,n){return(n?"":" ")+e}const X6=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];MP.peek=o8;function e8(){return{canContainEols:["delete"],enter:{strikethrough:n8},exit:{strikethrough:r8}}}function t8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:X6}],handlers:{delete:MP}}}function n8(e){this.enter({type:"delete",children:[]},e)}function r8(e){this.exit(e)}function MP(e,t,n,r){const o=n.createTracker(r),s=n.enter("strikethrough");let i=o.move("~~");return i+=n.containerPhrasing(e,{...o.current(),before:i,after:"~"}),i+=o.move("~~"),s(),i}function o8(){return"~"}function s8(e){return e.length}function i8(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||s8,s=[],i=[],a=[],l=[];let u=0,d=-1;for(;++d<e.length;){const m=[],x=[];let g=-1;for(e[d].length>u&&(u=e[d].length);++g<e[d].length;){const v=a8(e[d][g]);if(n.alignDelimiters!==!1){const w=o(v);x[g]=w,(l[g]===void 0||w>l[g])&&(l[g]=w)}m.push(v)}i[d]=m,a[d]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<u;)s[f]=Kk(r[f]);else{const m=Kk(r);for(;++f<u;)s[f]=m}f=-1;const p=[],h=[];for(;++f<u;){const m=s[f];let x="",g="";m===99?(x=":",g=":"):m===108?x=":":m===114&&(g=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[f]-x.length-g.length);const w=x+"-".repeat(v)+g;n.alignDelimiters!==!1&&(v=x.length+v+g.length,v>l[f]&&(l[f]=v),h[f]=v),p[f]=w}i.splice(1,0,p),a.splice(1,0,h),d=-1;const y=[];for(;++d<i.length;){const m=i[d],x=a[d];f=-1;const g=[];for(;++f<u;){const v=m[f]||"";let w="",k="";if(n.alignDelimiters!==!1){const C=l[f]-(x[f]||0),j=s[f];j===114?w=" ".repeat(C):j===99?C%2?(w=" ".repeat(C/2+.5),k=" ".repeat(C/2-.5)):(w=" ".repeat(C/2),k=w):k=" ".repeat(C)}n.delimiterStart!==!1&&!f&&g.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&g.push(" "),n.alignDelimiters!==!1&&g.push(w),g.push(v),n.alignDelimiters!==!1&&g.push(k),n.padding!==!1&&g.push(" "),(n.delimiterEnd!==!1||f!==u-1)&&g.push("|")}y.push(n.delimiterEnd===!1?g.join("").replace(/ +$/,""):g.join(""))}return y.join(`
397
- `)}function a8(e){return e==null?"":String(e)}function Kk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function l8(e,t,n,r){const o=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const i=n.indentLines(n.containerFlow(e,s.current()),c8);return o(),i}function c8(e,t,n){return">"+(n?"":" ")+e}function u8(e,t){return Zk(e,t.inConstruct,!0)&&!Zk(e,t.notInConstruct,!1)}function Zk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Qk(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
398
- `&&u8(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
399
- `}function d8(e,t){const n=String(e);let r=n.indexOf(t),o=r,s=0,i=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++s>i&&(i=s):s=1,o=r+t.length,r=n.indexOf(t,o);return i}function f8(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function h8(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function p8(e,t,n,r){const o=h8(n),s=e.value||"",i=o==="`"?"GraveAccent":"Tilde";if(f8(e,n)){const f=n.enter("codeIndented"),p=n.indentLines(s,m8);return f(),p}const a=n.createTracker(r),l=o.repeat(Math.max(d8(s,o)+1,3)),u=n.enter("codeFenced");let d=a.move(l);if(e.lang){const f=n.enter(`codeFencedLang${i}`);d+=a.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...a.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${i}`);d+=a.move(" "),d+=a.move(n.safe(e.meta,{before:d,after:`
400
- `,encode:["`"],...a.current()})),f()}return d+=a.move(`
401
- `),s&&(d+=a.move(s+`
402
- `)),d+=a.move(l),u(),d}function m8(e,t,n){return(n?"":" ")+e}function S0(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function g8(e,t,n,r){const o=S0(n),s=o==='"'?"Quote":"Apostrophe",i=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
403
- `,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+o),u+=l.move(n.safe(e.title,{before:u,after:o,...l.current()})),u+=l.move(o),a()),i(),u}function y8(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ic(e){return"&#x"+e.toString(16).toUpperCase()+";"}function bf(e,t,n){const r=Qa(e),o=Qa(t);return r===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}DP.peek=v8;function DP(e,t,n,r){const o=y8(n),s=n.enter("emphasis"),i=n.createTracker(r),a=i.move(o);let l=i.move(n.containerPhrasing(e,{after:o,before:a,...i.current()}));const u=l.charCodeAt(0),d=bf(r.before.charCodeAt(r.before.length-1),u,o);d.inside&&(l=Ic(u)+l.slice(1));const f=l.charCodeAt(l.length-1),p=bf(r.after.charCodeAt(0),f,o);p.inside&&(l=l.slice(0,-1)+Ic(f));const h=i.move(o);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+l+h}function v8(e,t,n){return n.options.emphasis||"*"}function x8(e,t){let n=!1;return k0(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,qg}),!!((!e.depth||e.depth<3)&&m0(e)&&(t.options.setext||n))}function w8(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(x8(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),p=n.containerPhrasing(e,{...s.current(),before:`
404
- `,after:`
405
- `});return f(),d(),p+`
406
- `+(o===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
407
- `))+1))}const i="#".repeat(o),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(i+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
408
- `,...s.current()});return/^[\t ]/.test(u)&&(u=Ic(u.charCodeAt(0))+u.slice(1)),u=u?i+" "+u:i,n.options.closeAtx&&(u+=" "+i),l(),a(),u}LP.peek=b8;function LP(e){return e.value||""}function b8(){return"<"}zP.peek=k8;function zP(e,t,n,r){const o=S0(n),s=o==='"'?"Quote":"Apostrophe",i=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+o),u+=l.move(n.safe(e.title,{before:u,after:o,...l.current()})),u+=l.move(o),a()),u+=l.move(")"),i(),u}function k8(){return"!"}FP.peek=_8;function FP(e,t,n,r){const o=e.referenceType,s=n.enter("imageReference");let i=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),i();const d=n.stack;n.stack=[],i=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return i(),n.stack=d,s(),o==="full"||!u||u!==f?l+=a.move(f+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function _8(){return"!"}UP.peek=S8;function UP(e,t,n){let r=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const i=n.unsafe[s],a=n.compilePattern(i);let l;if(i.atBreak)for(;l=a.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return o+r+o}function S8(){return"`"}function qP(e,t){const n=m0(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}VP.peek=C8;function VP(e,t,n,r){const o=S0(n),s=o==='"'?"Quote":"Apostrophe",i=n.createTracker(r);let a,l;if(qP(e,n)){const d=n.stack;n.stack=[],a=n.enter("autolink");let f=i.move("<");return f+=i.move(n.containerPhrasing(e,{before:f,after:">",...i.current()})),f+=i.move(">"),a(),n.stack=d,f}a=n.enter("link"),l=n.enter("label");let u=i.move("[");return u+=i.move(n.containerPhrasing(e,{before:u,after:"](",...i.current()})),u+=i.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=i.move("<"),u+=i.move(n.safe(e.url,{before:u,after:">",...i.current()})),u+=i.move(">")):(l=n.enter("destinationRaw"),u+=i.move(n.safe(e.url,{before:u,after:e.title?" ":")",...i.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=i.move(" "+o),u+=i.move(n.safe(e.title,{before:u,after:o,...i.current()})),u+=i.move(o),l()),u+=i.move(")"),a(),u}function C8(e,t,n){return qP(e,n)?"<":"["}HP.peek=E8;function HP(e,t,n,r){const o=e.referenceType,s=n.enter("linkReference");let i=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),i();const d=n.stack;n.stack=[],i=n.enter("reference");const f=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return i(),n.stack=d,s(),o==="full"||!u||u!==f?l+=a.move(f+"]"):o==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function E8(){return"["}function C0(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function N8(e){const t=C0(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function j8(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function BP(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function P8(e,t,n,r){const o=n.enter("list"),s=n.bulletCurrent;let i=e.ordered?j8(n):C0(n);const a=e.ordered?i==="."?")":".":N8(n);let l=t&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((i==="*"||i==="-")&&d&&(!d.children||!d.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),BP(n)===i&&d){let f=-1;for(;++f<e.children.length;){const p=e.children[f];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(i=a),n.bulletCurrent=i;const u=n.containerFlow(e,r);return n.bulletLastUsed=i,n.bulletCurrent=s,o(),u}function T8(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function R8(e,t,n,r){const o=T8(n);let s=n.bulletCurrent||C0(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let i=s.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(i=Math.ceil(i/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(i-s.length)),a.shift(i);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),d);return l(),u;function d(f,p,h){return p?(h?"":" ".repeat(i))+f:(h?s:s+" ".repeat(i-s.length))+f}}function $8(e,t,n,r){const o=n.enter("paragraph"),s=n.enter("phrasing"),i=n.containerPhrasing(e,r);return s(),o(),i}const I8=Ph(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function A8(e,t,n,r){return(e.children.some(function(i){return I8(i)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function O8(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}WP.peek=M8;function WP(e,t,n,r){const o=O8(n),s=n.enter("strong"),i=n.createTracker(r),a=i.move(o+o);let l=i.move(n.containerPhrasing(e,{after:o,before:a,...i.current()}));const u=l.charCodeAt(0),d=bf(r.before.charCodeAt(r.before.length-1),u,o);d.inside&&(l=Ic(u)+l.slice(1));const f=l.charCodeAt(l.length-1),p=bf(r.after.charCodeAt(0),f,o);p.inside&&(l=l.slice(0,-1)+Ic(f));const h=i.move(o+o);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:d.outside},a+l+h}function M8(e,t,n){return n.options.strong||"*"}function D8(e,t,n,r){return n.safe(e.value,r)}function L8(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function z8(e,t,n){const r=(BP(n)+(n.options.ruleSpaces?" ":"")).repeat(L8(n));return n.options.ruleSpaces?r.slice(0,-1):r}const KP={blockquote:l8,break:Qk,code:p8,definition:g8,emphasis:DP,hardBreak:Qk,heading:w8,html:LP,image:zP,imageReference:FP,inlineCode:UP,link:VP,linkReference:HP,list:P8,listItem:R8,paragraph:$8,root:A8,strong:WP,text:D8,thematicBreak:z8};function F8(){return{enter:{table:U8,tableData:Gk,tableHeader:Gk,tableRow:V8},exit:{codeText:H8,table:q8,tableData:Jp,tableHeader:Jp,tableRow:Jp}}}function U8(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function q8(e){this.exit(e),this.data.inTable=void 0}function V8(e){this.enter({type:"tableRow",children:[]},e)}function Jp(e){this.exit(e)}function Gk(e){this.enter({type:"tableCell",children:[]},e)}function H8(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,B8));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function B8(e,t){return t==="|"?t:e}function W8(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
409
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:i,tableCell:l,tableRow:a}};function i(h,y,m,x){return u(d(h,m,x),h.align)}function a(h,y,m,x){const g=f(h,m,x),v=u([g]);return v.slice(0,v.indexOf(`
410
- `))}function l(h,y,m,x){const g=m.enter("tableCell"),v=m.enter("phrasing"),w=m.containerPhrasing(h,{...x,before:s,after:s});return v(),g(),w}function u(h,y){return i8(h,{align:y,alignDelimiters:r,padding:n,stringLength:o})}function d(h,y,m){const x=h.children;let g=-1;const v=[],w=y.enter("table");for(;++g<x.length;)v[g]=f(x[g],y,m);return w(),v}function f(h,y,m){const x=h.children;let g=-1;const v=[],w=y.enter("tableRow");for(;++g<x.length;)v[g]=l(x[g],h,y,m);return w(),v}function p(h,y,m){let x=KP.inlineCode(h,y,m);return m.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function K8(){return{exit:{taskListCheckValueChecked:Jk,taskListCheckValueUnchecked:Jk,paragraph:Q8}}}function Z8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:G8}}}function Jk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Q8(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let s=-1,i;for(;++s<o.length;){const a=o[s];if(a.type==="paragraph"){i=a;break}}i===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function G8(e,t,n,r){const o=e.children[0],s=typeof e.checked=="boolean"&&o&&o.type==="paragraph",i="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(i);let l=KP.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(d){return d+i}}function J8(){return[P6(),G6(),e8(),F8(),K8()]}function Y8(e){return{extensions:[T6(),J6(e),t8(),W8(e),Z8()]}}const X8={tokenize:sq,partial:!0},ZP={tokenize:iq,partial:!0},QP={tokenize:aq,partial:!0},GP={tokenize:lq,partial:!0},eq={tokenize:cq,partial:!0},JP={name:"wwwAutolink",tokenize:rq,previous:XP},YP={name:"protocolAutolink",tokenize:oq,previous:eT},zo={name:"emailAutolink",tokenize:nq,previous:tT},io={};function tq(){return{text:io}}let zs=48;for(;zs<123;)io[zs]=zo,zs++,zs===58?zs=65:zs===91&&(zs=97);io[43]=zo;io[45]=zo;io[46]=zo;io[95]=zo;io[72]=[zo,YP];io[104]=[zo,YP];io[87]=[zo,JP];io[119]=[zo,JP];function nq(e,t,n){const r=this;let o,s;return i;function i(f){return!Wg(f)||!tT.call(r,r.previous)||E0(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(f))}function a(f){return Wg(f)?(e.consume(f),a):f===64?(e.consume(f),l):n(f)}function l(f){return f===46?e.check(eq,d,u)(f):f===45||f===95||dn(f)?(s=!0,e.consume(f),l):d(f)}function u(f){return e.consume(f),o=!0,l}function d(f){return s&&o&&wn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function rq(e,t,n){const r=this;return o;function o(i){return i!==87&&i!==119||!XP.call(r,r.previous)||E0(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(X8,e.attempt(ZP,e.attempt(QP,s),n),n)(i))}function s(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}}function oq(e,t,n){const r=this;let o="",s=!1;return i;function i(f){return(f===72||f===104)&&eT.call(r,r.previous)&&!E0(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(f),e.consume(f),a):n(f)}function a(f){if(wn(f)&&o.length<5)return o+=String.fromCodePoint(f),e.consume(f),a;if(f===58){const p=o.toLowerCase();if(p==="http"||p==="https")return e.consume(f),l}return n(f)}function l(f){return f===47?(e.consume(f),s?u:(s=!0,l)):n(f)}function u(f){return f===null||vf(f)||ot(f)||Ci(f)||Eh(f)?n(f):e.attempt(ZP,e.attempt(QP,d),n)(f)}function d(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function sq(e,t,n){let r=0;return o;function o(i){return(i===87||i===119)&&r<3?(r++,e.consume(i),o):i===46&&r===3?(e.consume(i),s):n(i)}function s(i){return i===null?n(i):t(i)}}function iq(e,t,n){let r,o,s;return i;function i(u){return u===46||u===95?e.check(GP,l,a)(u):u===null||ot(u)||Ci(u)||u!==45&&Eh(u)?l(u):(s=!0,e.consume(u),i)}function a(u){return u===95?r=!0:(o=r,r=void 0),e.consume(u),i}function l(u){return o||r||!s?n(u):t(u)}}function aq(e,t){let n=0,r=0;return o;function o(i){return i===40?(n++,e.consume(i),o):i===41&&r<n?s(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(GP,t,s)(i):i===null||ot(i)||Ci(i)?t(i):(e.consume(i),o)}function s(i){return i===41&&r++,e.consume(i),o}}function lq(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),o):a===60||a===null||ot(a)||Ci(a)?t(a):n(a)}function o(a){return a===null||a===40||a===91||ot(a)||Ci(a)?t(a):r(a)}function s(a){return wn(a)?i(a):n(a)}function i(a){return a===59?(e.consume(a),r):wn(a)?(e.consume(a),i):n(a)}}function cq(e,t,n){return r;function r(s){return e.consume(s),o}function o(s){return dn(s)?n(s):t(s)}}function XP(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ot(e)}function eT(e){return!wn(e)}function tT(e){return!(e===47||Wg(e))}function Wg(e){return e===43||e===45||e===46||e===95||dn(e)}function E0(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const uq={tokenize:vq,partial:!0};function dq(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mq,continuation:{tokenize:gq},exit:yq}},text:{91:{name:"gfmFootnoteCall",tokenize:pq},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:fq,resolveTo:hq}}}}function fq(e,t,n){const r=this;let o=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;o--;){const l=r.events[o][1];if(l.type==="labelImage"){i=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!i||!i._balanced)return n(l);const u=Ir(r.sliceSerialize({start:i.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function hq(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function pq(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,i;return a;function a(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(s>999||f===93&&!i||f===null||f===91||ot(f))return n(f);if(f===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return o.includes(Ir(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ot(f)||(i=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function mq(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,i=0,a;return l;function l(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(y)}function d(y){if(i>999||y===93&&!a||y===null||y===91||ot(y))return n(y);if(y===93){e.exit("chunkString");const m=e.exit("gfmFootnoteDefinitionLabelString");return s=Ir(r.sliceSerialize(m)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return ot(y)||(a=!0),i++,e.consume(y),y===92?f:d}function f(y){return y===91||y===92||y===93?(e.consume(y),i++,d):d(y)}function p(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),o.includes(s)||o.push(s),Ze(e,h,"gfmFootnoteDefinitionWhitespace")):n(y)}function h(y){return t(y)}}function gq(e,t,n){return e.check(tu,t,e.attempt(uq,t,n))}function yq(e){e.exit("gfmFootnoteDefinition")}function vq(e,t,n){const r=this;return Ze(e,o,"gfmFootnoteDefinitionIndent",5);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(s):n(s)}}function xq(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(i,a){let l=-1;for(;++l<i.length;)if(i[l][0]==="enter"&&i[l][1].type==="strikethroughSequenceTemporary"&&i[l][1]._close){let u=l;for(;u--;)if(i[u][0]==="exit"&&i[u][1].type==="strikethroughSequenceTemporary"&&i[u][1]._open&&i[l][1].end.offset-i[l][1].start.offset===i[u][1].end.offset-i[u][1].start.offset){i[l][1].type="strikethroughSequence",i[u][1].type="strikethroughSequence";const d={type:"strikethrough",start:Object.assign({},i[u][1].start),end:Object.assign({},i[l][1].end)},f={type:"strikethroughText",start:Object.assign({},i[u][1].end),end:Object.assign({},i[l][1].start)},p=[["enter",d,a],["enter",i[u][1],a],["exit",i[u][1],a],["enter",f,a]],h=a.parser.constructs.insideSpan.null;h&&Zn(p,p.length,0,Nh(h,i.slice(u+1,l),a)),Zn(p,p.length,0,[["exit",f,a],["enter",i[l][1],a],["exit",i[l][1],a],["exit",d,a]]),Zn(i,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<i.length;)i[l][1].type==="strikethroughSequenceTemporary"&&(i[l][1].type="data");return i}function s(i,a,l){const u=this.previous,d=this.events;let f=0;return p;function p(y){return u===126&&d[d.length-1][1].type!=="characterEscape"?l(y):(i.enter("strikethroughSequenceTemporary"),h(y))}function h(y){const m=Qa(u);if(y===126)return f>1?l(y):(i.consume(y),f++,h);if(f<2&&!n)return l(y);const x=i.exit("strikethroughSequenceTemporary"),g=Qa(y);return x._open=!g||g===2&&!!m,x._close=!m||m===2&&!!g,a(y)}}}class wq{constructor(){this.map=[]}add(t,n,r){bq(this,t,n,r)}consume(t){if(this.map.sort(function(s,i){return s[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const s of o)t.push(s);o=r.pop()}this.map.length=0}}function bq(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function kq(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function _q(){return{flow:{null:{name:"table",tokenize:Sq,resolveAll:Cq}}}}function Sq(e,t,n){const r=this;let o=0,s=0,i;return a;function a($){let T=r.events.length-1;for(;T>-1;){const O=r.events[T][1].type;if(O==="lineEnding"||O==="linePrefix")T--;else break}const I=T>-1?r.events[T][1].type:null,U=I==="tableHead"||I==="tableRow"?j:l;return U===j&&r.parser.lazy[r.now().line]?n($):U($)}function l($){return e.enter("tableHead"),e.enter("tableRow"),u($)}function u($){return $===124||(i=!0,s+=1),d($)}function d($){return $===null?n($):_e($)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),h):n($):qe($)?Ze(e,d,"whitespace")($):(s+=1,i&&(i=!1,o+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),i=!0,d):(e.enter("data"),f($)))}function f($){return $===null||$===124||ot($)?(e.exit("data"),d($)):(e.consume($),$===92?p:f)}function p($){return $===92||$===124?(e.consume($),f):f($)}function h($){return r.interrupt=!1,r.parser.lazy[r.now().line]?n($):(e.enter("tableDelimiterRow"),i=!1,qe($)?Ze(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):y($))}function y($){return $===45||$===58?x($):$===124?(i=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),m):C($)}function m($){return qe($)?Ze(e,x,"whitespace")($):x($)}function x($){return $===58?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),g):$===45?(s+=1,g($)):$===null||_e($)?k($):C($)}function g($){return $===45?(e.enter("tableDelimiterFiller"),v($)):C($)}function v($){return $===45?(e.consume($),v):$===58?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w($))}function w($){return qe($)?Ze(e,k,"whitespace")($):k($)}function k($){return $===124?y($):$===null||_e($)?!i||o!==s?C($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t($)):C($)}function C($){return n($)}function j($){return e.enter("tableRow"),S($)}function S($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),S):$===null||_e($)?(e.exit("tableRow"),t($)):qe($)?Ze(e,S,"whitespace")($):(e.enter("data"),A($))}function A($){return $===null||$===124||ot($)?(e.exit("data"),S($)):(e.consume($),$===92?P:A)}function P($){return $===92||$===124?(e.consume($),A):A($)}}function Cq(e,t){let n=-1,r=!0,o=0,s=[0,0,0,0],i=[0,0,0,0],a=!1,l=0,u,d,f;const p=new wq;for(;++n<e.length;){const h=e[n],y=h[1];h[0]==="enter"?y.type==="tableHead"?(a=!1,l!==0&&(Yk(p,t,l,u,d),d=void 0,l=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",u,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,f=void 0,s=[0,0,0,0],i=[0,n+1,0,0],a&&(a=!1,d={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",d,t]])),o=y.type==="tableDelimiterRow"?2:d?3:1):o&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,i[2]===0&&(s[1]!==0&&(i[0]=i[1],f=Wu(p,t,s,o,void 0,f),s=[0,0,0,0]),i[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(i[0]=i[1],f=Wu(p,t,s,o,void 0,f)),s=i,i=[s[1],n,0,0])):y.type==="tableHead"?(a=!0,l=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(l=n,s[1]!==0?(i[0]=i[1],f=Wu(p,t,s,o,n,f)):i[1]!==0&&(f=Wu(p,t,i,o,n,f)),o=0):o&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(i[3]=n)}for(l!==0&&Yk(p,t,l,u,d),p.consume(t.events),n=-1;++n<t.events.length;){const h=t.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=kq(t.events,n))}return e}function Wu(e,t,n,r,o,s){const i=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Hi(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=Hi(t.events,n[1]);if(s={type:i,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Hi(t.events,n[2]),d=Hi(t.events,n[3]),f={type:a,start:Object.assign({},u),end:Object.assign({},d)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const p=t.events[n[2]],h=t.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const y=n[2]+1,m=n[3]-n[2]-1;e.add(y,m,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return o!==void 0&&(s.end=Object.assign({},Hi(t.events,o)),e.add(o,0,[["exit",s,t]]),s=void 0),s}function Yk(e,t,n,r,o){const s=[],i=Hi(t.events,n);o&&(o.end=Object.assign({},i),s.push(["exit",o,t])),r.end=Object.assign({},i),s.push(["exit",r,t]),e.add(n+1,0,s)}function Hi(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Eq={name:"tasklistCheck",tokenize:jq};function Nq(){return{text:{91:Eq}}}function jq(e,t,n){const r=this;return o;function o(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return ot(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),i):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),i):n(l)}function i(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return _e(l)?t(l):qe(l)?e.check({tokenize:Pq},t,n)(l):n(l)}}function Pq(e,t,n){return Ze(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function Tq(e){return dP([tq(),dq(),xq(e),_q(),Nq()])}const Rq={};function $q(e){const t=this,n=e||Rq,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),i=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(Tq(n)),s.push(J8()),i.push(Y8(n))}const kf=180;function Iq(e){return e.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#+\s+/gm,"").replace(/\s+/g," ").trim()}function Aq(e,t){var o;if(t!=null&&t.trim())return t.trim();const n=((o=e.split(/\n\n+/)[0])==null?void 0:o.replace(/\n/g," "))??e,r=Iq(n);return r.length<=kf?r:`${r.slice(0,kf-1).trimEnd()}…`}function Oq(e,t){return t!=null&&t.trim()&&e.length>kf?!0:e.length>kf||/\n/.test(e)}function Mq({description:e,title:t,expanded:n,onToggle:r}){const o=Aq(e,t),s=Oq(e,t);return e?s?c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"line-clamp-3 text-sm leading-relaxed",children:o}),c.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-xs text-[#92E4DD] hover:text-white",children:[c.jsx(ch,{className:`h-3.5 w-3.5 transition-transform ${n?"rotate-180":""}`}),n?"Hide full description":"Show full description"]})]}):c.jsx("span",{children:o}):c.jsx("span",{className:"text-gray-500",children:"—"})}function Dq({description:e}){return c.jsx("div",{className:"max-h-64 overflow-auto rounded border border-white/10 bg-[#0F0F0C] p-3",children:c.jsx("div",{className:"prose prose-sm prose-invert max-w-none prose-headings:text-gray-100 prose-p:text-gray-300 prose-li:text-gray-300 prose-strong:text-gray-100 prose-code:text-[#92E4DD] prose-code:before:content-none prose-code:after:content-none",children:c.jsx(x6,{remarkPlugins:[$q],children:e})})})}function Lq(){const[e,t]=b.useState(null);return{expandedDescription:e,toggleDescription:r=>{t(o=>o===r?null:r)}}}function Yp(e){return new Set(e.filter(t=>t.enabled===!1).map(t=>t.name))}function zq({serviceId:e,tools:t,isLoading:n}){const[r,o]=b.useState(""),[s,i]=b.useState(null),{expandedDescription:a,toggleDescription:l}=Lq(),[u,d]=b.useState(()=>Yp(t)),f=nn(),{toast:p}=Wt(),h=b.useMemo(()=>t.map(k=>`${k.name}:${k.enabled===!1?"0":"1"}`).sort().join("\0"),[t]);b.useEffect(()=>{d(Yp(t))},[e,h]);const y=gt({mutationFn:async k=>{await Ne("PUT",`/api/services/${e}/tool-settings`,{disabledTools:k})},onSuccess:()=>{f.invalidateQueries({queryKey:["/api/services",e,"tools"]}),f.invalidateQueries({queryKey:["/api/services"]})},onError:k=>{p({title:"Could not save tool settings",description:k.message,variant:"destructive"}),d(Yp(t))}}),m=k=>{d(k),y.mutate([...k])},x=(k,C)=>{const j=new Set(u);C?j.delete(k):j.add(k),m(j)},g=k=>{if(k){m(new Set);return}m(new Set(t.map(C=>C.name)))},v=b.useMemo(()=>{const k=r.trim().toLowerCase();return k?t.filter(C=>{var j;return C.name.toLowerCase().includes(k)||(((j=C.title)==null?void 0:j.toLowerCase().includes(k))??!1)||C.description.toLowerCase().includes(k)}):t},[t,r]),w=t.length-u.size;return n?c.jsx("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:c.jsx("p",{className:"text-sm text-gray-400",children:"Loading tools…"})}):t.length===0?null:c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[c.jsx(Dv,{className:"w-5 h-5 mr-2"}),"Tools",c.jsxs("span",{className:"ml-2 text-sm font-normal text-gray-400",children:[w," of ",t.length," enabled"]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(fe,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>g(!0),disabled:u.size===0||y.isPending,children:"Enable all"}),c.jsx(fe,{type:"button",size:"sm",variant:"ghost",className:"h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10",onClick:()=>g(!1),disabled:w===0||y.isPending,children:"Disable all"})]})]}),c.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."}),c.jsxs("div",{className:"relative mb-3",children:[c.jsx($E,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500"}),c.jsx(Xe,{value:r,onChange:k=>o(k.target.value),placeholder:"Search tools…",className:"border-white/15 bg-[#0F0F0C] pl-9 text-[#E8F6F4] placeholder:text-[#6B8581]"})]}),c.jsx("div",{className:"rounded-md border border-white/10 overflow-hidden",children:c.jsxs(Zj,{children:[c.jsx(Qj,{children:c.jsxs(Vi,{className:"border-white/10 hover:bg-transparent",children:[c.jsx(kd,{className:"w-[72px] text-center text-[#A8C4C0]",children:"Enabled"}),c.jsx(kd,{className:"w-[220px] text-[#A8C4C0]",children:"Tool"}),c.jsx(kd,{className:"text-[#A8C4C0]",children:"Description"})]})}),c.jsx(Gj,{children:v.length===0?c.jsx(Vi,{className:"border-white/10 hover:bg-transparent",children:c.jsx(Bs,{colSpan:3,className:"py-8 text-center text-sm text-gray-400",children:"No tools match your search."})}):v.map(k=>{const C=!u.has(k.name),j=s===k.name,S=a===k.name,A=k.inputSchema&&Object.keys(k.inputSchema).length>0;return c.jsxs(b.Fragment,{children:[c.jsxs(Vi,{className:`border-white/10 ${C?"hover:bg-white/5":"opacity-60 hover:bg-white/5"}`,children:[c.jsx(Bs,{className:"text-center",children:c.jsx("div",{className:"flex justify-center",children:c.jsx(Kj,{checked:C,onCheckedChange:P=>x(k.name,P===!0),disabled:y.isPending,"aria-label":`${C?"Disable":"Enable"} ${k.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]"})})}),c.jsx(Bs,{children:A?c.jsxs("button",{type:"button",onClick:()=>i(j?null:k.name),className:"flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white",children:[c.jsx(ch,{className:`h-4 w-4 shrink-0 transition-transform ${j?"rotate-180":""}`}),k.name]}):c.jsx("span",{className:"font-mono text-sm text-[#92E4DD]",children:k.name})}),c.jsx(Bs,{className:"max-w-0 text-sm text-gray-300",children:c.jsx(Mq,{description:k.description,title:k.title,expanded:S,onToggle:()=>l(k.name)})})]}),S&&c.jsx(Vi,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:c.jsx(Bs,{colSpan:3,className:"py-3",children:c.jsx(Dq,{description:k.description})})}),A&&j&&c.jsx(Vi,{className:"border-white/10 bg-black/30 hover:bg-black/30",children:c.jsx(Bs,{colSpan:3,className:"py-3",children:c.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(k.inputSchema,null,2)})})})]},k.name)})})]})})]})}function Xp({items:e,className:t}){return e.length===0?null:c.jsx("ol",{className:`list-decimal list-inside space-y-1 text-xs ${t??""}`,children:e.map((n,r)=>c.jsx("li",{children:n},`${r}-${n.slice(0,24)}`))})}function Xk({serviceId:e,onConnected:t}){const{toast:n}=Wt(),[r,o]=b.useState(""),[s,i]=b.useState(""),[a,l]=b.useState(!1),[u,d]=b.useState(!1),[f,p]=b.useState(!1),{data:h,isLoading:y}=It({queryKey:["/api/oauth",e,"setup"],queryFn:async()=>{const C=await Ne("GET",`/api/oauth/${e}/setup`),j=await C.json();if(!C.ok||!j.success)throw new Error(j.error||"Failed to load OAuth setup");return j.data},enabled:!!e}),m=h==null?void 0:h.guide,x=!!(h!=null&&h.hasSavedCredentials),g=()=>{if(!u||(m==null?void 0:m.setupMode)!=="manual")return;const C={};return r.trim()&&(C.clientId=r.trim()),s.trim()&&(C.clientSecret=s.trim()),C},v=async(C,j)=>{try{await navigator.clipboard.writeText(j),n({title:"Copied",description:`${C} copied to clipboard.`})}catch{n({title:"Copy failed",description:"Select and copy manually.",variant:"destructive"})}};b.useEffect(()=>{(m==null?void 0:m.setupMode)==="manual"?d(!0):d(!1),p(!x)},[m==null?void 0:m.setupMode,x]),b.useEffect(()=>{h!=null&&h.savedOAuthClientId&&!r&&o(h.savedOAuthClientId)},[h==null?void 0:h.savedOAuthClientId,r]);const w=async C=>{var j,S,A;l(!0);try{const P=await Ne("POST",`/api/oauth/${e}/connect`,C??{}),$=await P.json();if(!P.ok||!$.success){((j=$.data)!=null&&j.needsCredentials||((S=$.data)==null?void 0:S.setupMode)==="manual")&&d(!0),n({title:"OAuth setup",description:$.error||"Could not start OAuth flow.",variant:"destructive"});return}(A=$.data)!=null&&A.authorizationUrl&&(window.open($.data.authorizationUrl,"_blank"),n({title:"Continue in browser",description:"Complete sign-in in the new tab, then return here."}),t==null||t())}catch(P){n({title:"OAuth setup failed",description:P instanceof Error?P.message:"Unknown error",variant:"destructive"})}finally{l(!1)}};if(y)return c.jsx("p",{className:"text-sm text-orange-200",children:"Loading setup guide…"});if(!m)return null;if(m.setupMode==="unavailable")return c.jsxs("div",{className:"space-y-3 text-sm text-orange-100",children:[c.jsx("p",{children:m.unavailableReason}),m.docsUrl&&c.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),"Provider docs"]})]});const k=m.setupMode==="dynamic"||m.setupMode==="managed"||m.setupMode==="manual";return c.jsxs("div",{className:"space-y-4 text-sm text-orange-100",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-medium text-orange-200",children:m.title}),m.summary&&c.jsx("p",{className:"mt-1 text-xs text-orange-100/90",children:m.summary}),k&&c.jsxs("p",{className:"mt-2 text-xs text-orange-100/80",children:["Redirect URI:"," ",c.jsx("code",{className:"text-orange-50",children:m.redirectUri})]}),m.easierAlternative&&c.jsx("p",{className:"mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2",children:m.easierAlternative})]}),x&&m.setupMode==="manual"&&c.jsxs("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3 text-xs text-green-100",children:[c.jsx("p",{className:"font-medium text-green-200",children:"OAuth credentials saved"}),c.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&&!x&&c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"Before you start"}),c.jsx("ul",{className:"list-disc list-inside space-y-1 text-xs text-orange-100/90",children:m.prerequisites.map(C=>c.jsx("li",{children:C},C))})]}),(m.manifestJson||m.createAppUrl||k)&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[m.manifestJson&&c.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void v("App manifest",m.manifestJson),children:[c.jsx(TM,{className:"w-4 h-4 mr-1"}),"Copy manifest"]}),k&&c.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>void v("Redirect URI",m.redirectUri),children:[c.jsx(TE,{className:"w-4 h-4 mr-1"}),"Copy redirect URI"]}),m.createAppUrl&&c.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.createAppUrl,"_blank"),children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),m.createAppLabel??"Open app creator"]})]}),m.steps.length>0&&c.jsx("div",{children:x&&m.setupMode==="manual"?c.jsxs("details",{className:"rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[c.jsx("summary",{className:"cursor-pointer text-xs font-medium text-orange-200",children:"First-time Slack app setup"}),c.jsx("div",{className:"mt-2",children:c.jsx(Xp,{items:m.steps})})]}):c.jsxs(c.Fragment,{children:[m.setupMode==="informational"?c.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"What to do"}):null,c.jsx(Xp,{items:m.steps})]})}),m.tokenAlternative&&c.jsxs("p",{className:"text-xs text-orange-100/80 border-l-2 border-orange-500/30 pl-2",children:[c.jsx("span",{className:"font-medium text-orange-200",children:"Alternative: "}),m.tokenAlternative]}),u&&m.setupMode==="manual"&&c.jsxs("div",{className:"space-y-3 rounded-lg border border-orange-500/20 bg-orange-500/5 p-3",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx(We,{htmlFor:`oauth-client-id-${e}`,className:"text-orange-200",children:"Client ID"}),c.jsx(Xe,{id:`oauth-client-id-${e}`,value:r,onChange:C=>o(C.target.value),placeholder:"OAuth Client ID",className:"bg-black/20 border-orange-500/30"})]}),f?c.jsxs("div",{className:"space-y-1",children:[c.jsx(We,{htmlFor:`oauth-client-secret-${e}`,className:"text-orange-200",children:"Client Secret"}),c.jsx(Xe,{id:`oauth-client-secret-${e}`,type:"password",value:s,onChange:C=>i(C.target.value),placeholder:"OAuth Client Secret",className:"bg-black/20 border-orange-500/30"})]}):c.jsx("p",{className:"text-xs text-orange-200/80",children:"Client secret is saved locally for this service."}),x&&c.jsx(fe,{type:"button",size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>p(C=>!C),children:f?"Hide client secret field":"Update client secret"}),(h==null?void 0:h.hasStoredClientSecret)&&f&&c.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&&c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-medium text-orange-200 mb-1",children:"After connect"}),c.jsx(Xp,{items:m.afterConnect,className:"text-orange-100/80"})]}),k&&c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(fe,{size:"sm",className:"bg-orange-600 hover:bg-orange-700",disabled:a||u&&m.setupMode==="manual"&&!x&&(!r.trim()||!s.trim()),onClick:()=>w(g()),children:a?"Connecting…":x&&m.setupMode==="manual"?"Reconnect":m.setupMode==="dynamic"||m.setupMode==="managed"?"Connect":"Connect with credentials"}),m.docsUrl&&c.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),"Docs"]})]}),m.setupMode==="informational"&&m.docsUrl&&c.jsxs(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-200",onClick:()=>window.open(m.docsUrl,"_blank"),children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),"Docs"]})]})}function _f(e,t){e.invalidateQueries({queryKey:["/api/services"]}),e.invalidateQueries({queryKey:["/api/collection/warnings"]}),t&&(e.invalidateQueries({queryKey:["/api/services",t]}),e.invalidateQueries({queryKey:["/api/services",t,"tools"]}))}const nT="agent-deck:oauth-complete";function Fq(e){return typeof e=="object"&&e!==null&&e.type===nT}function Uq(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 qq({service:e,isOpen:t,onClose:n}){var oe,Re,le,Ce,Se,tt,Ke,pn,zn,G,ae,we,Ie,He,sn,er,Sn,Lr,mr,Ot,tr,Mt;const[r,o]=b.useState(null),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[u,d]=b.useState(""),[f,p]=b.useState(""),[h,y]=b.useState(!1),[m,x]=b.useState(!1),[g,v]=b.useState(null),w=b.useRef(null),k=nn(),{toast:C}=Wt(),j=e&&(g==null?void 0:g.id)===e.id?g:e,S=j,A=!!(S&&S.id&&S.url),{data:P,isLoading:$,error:T,refetch:I}=It({queryKey:["/api/mcp/discover",S==null?void 0:S.url],queryFn:async()=>{if(!S||S.type!=="mcp")return null;console.log(`🔍 Attempting MCP discovery for: ${S.url}`);try{const te=await(await Ne("POST","/api/mcp/discover",{url:S.url})).json();return console.log(`✅ MCP discovery successful for ${S.url}:`,te),te}catch(ve){throw console.log(`❌ MCP discovery failed for ${S.url}:`,ve),ve}},enabled:A&&S.type==="mcp"&&t,staleTime:0,gcTime:2*60*1e3}),U=((Re=(oe=P==null?void 0:P.data)==null?void 0:oe.oauth)==null?void 0:Re.required)===!0,{data:O,refetch:B}=It({queryKey:["/api/oauth",S==null?void 0:S.id,"status"],queryFn:async()=>{const ve=await Ne("GET",`/api/oauth/${S.id}/status`),te=await ve.json();if(!ve.ok||!te.success)throw new Error(te.error||"Failed to load OAuth status");return te.data},enabled:A&&S.type==="mcp"&&t&&U,refetchInterval:ve=>{const te=ve.state.data;return te!=null&&te.authenticated?!1:2e3}}),Q=U?O!=null&&O.authenticated?{status:"authenticated",message:null}:O!=null&&O.hasToken&&(O!=null&&O.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:S==null?void 0:S.id,apiServiceType:S==null?void 0:S.type,apiServiceUrl:S==null?void 0:S.url,isOpen:t,hasValidService:A,enabled:A&&S.type==="mcp"&&t,mcpDiscoveryLoading:$,mcpDiscoveryData:P?JSON.stringify(P,null,2):null,mcpDiscoveryDataKeys:P?Object.keys(P):null,oauthRequired:(Ce=(le=P==null?void 0:P.data)==null?void 0:le.oauth)==null?void 0:Ce.required,oauthData:(Se=P==null?void 0:P.data)!=null&&Se.oauth?JSON.stringify(P.data.oauth,null,2):null,toolsQueryEnabled:A&&S.type==="mcp"&&t&&!((Ke=(tt=P==null?void 0:P.data)==null?void 0:tt.oauth)!=null&&Ke.required)});const{data:H,isLoading:W,error:N,refetch:M}=It({queryKey:["/api/services",S==null?void 0:S.id,"tools"],queryFn:async()=>{if(!S||S.type!=="mcp"&&S.type!=="local-mcp")return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${S.id} at ${S.url}`);try{const te=await(await Ne("GET",`/api/services/${S.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${S.id}:`,te),te}catch(ve){throw console.log(`❌ MCP tools discovery failed for ${S.id}:`,ve),ve}},enabled:A&&(S.type==="mcp"||S.type==="local-mcp")&&t&&(S.type==="local-mcp"||Q.status==="authenticated"||Q.status==="not_required"),staleTime:0,gcTime:2*60*1e3});b.useEffect(()=>{if(!t||!(S!=null&&S.id)||S.type!=="mcp"&&S.type!=="local-mcp"||!(S.type==="local-mcp"||Q.status==="authenticated"||Q.status==="not_required")||W||N)return;let te=!1;return(async()=>{try{const Rt=await(await Ne("GET",`/api/services/${S.id}`)).json();!te&&(Rt!=null&&Rt.success)&&Rt.data&&v(Rt.data),k.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{te=!0}},[t,S==null?void 0:S.id,S==null?void 0:S.type,W,N,Q.status,k]),b.useEffect(()=>{if(!t||!(S!=null&&S.id)||S.type!=="a2a")return;let ve=!1;return(async()=>{try{await Ne("GET",`/api/services/${S.id}/health`);const jt=await(await Ne("GET",`/api/services/${S.id}`)).json();!ve&&(jt!=null&&jt.success)&&jt.data&&v(jt.data),k.invalidateQueries({queryKey:["/api/services"]})}catch{}})(),()=>{ve=!0}},[t,S==null?void 0:S.id,S==null?void 0:S.type,k]),console.log("MCP Tools Query Debug:",{hasValidService:A,apiServiceType:S==null?void 0:S.type,isOpen:t,oauthRequired:(zn=(pn=P==null?void 0:P.data)==null?void 0:pn.oauth)==null?void 0:zn.required,oauthStatus:Q.status,toolsQueryEnabled:A&&(S.type==="mcp"||S.type==="local-mcp")&&t&&(S.type==="local-mcp"||Q.status==="authenticated"||Q.status==="not_required"),mcpToolsLoading:W});const{data:V,isLoading:_,error:E}=It({queryKey:["/api/proxy/a2a",S==null?void 0:S.id,"manifest"],queryFn:async()=>{if(!S||S.type!=="a2a")return null;const te=await(await Ne("GET",`/api/proxy/a2a/${S.id}/manifest`)).text();return JSON.parse(te)},enabled:A&&S.type==="a2a"&&t,staleTime:0,gcTime:2*60*1e3}),R=(H==null?void 0:H.data)||[],D=V,K=W||_;console.log("ServiceDetailsModal Debug:",{service:e==null?void 0:e.id,serviceType:e==null?void 0:e.type,isOpen:t,mcpDiscoveryLoading:$,mcpDiscoveryData:P,mcpDiscoveryError:T?String(T):null,mcpToolsLoading:W,a2aManifestLoading:_,mcpToolsError:N?String(N):null,a2aManifestError:E?String(E):null,mcpToolsCount:R.length,mcpToolsData:H,hasA2aManifest:!!D,isLoading:K,oauthRequired:(ae=(G=P==null?void 0:P.data)==null?void 0:G.oauth)==null?void 0:ae.required,oauthStatus:Q.status,oauthMessage:Q.message,oauthAuthenticated:O==null?void 0:O.authenticated,expiresAt:O==null?void 0:O.expiresAt}),b.useEffect(()=>{if(!t){v(null),pe.current=!1,X.current=!1;return}e&&(v(e),d(e.name||""),p(e.description||""))},[e,t]);const X=b.useRef(!1),pe=b.useRef(!1);b.useEffect(()=>{if(!t||!(S!=null&&S.id)){X.current=!1;return}if(!(O!=null&&O.authenticated)){X.current=!1;return}if(X.current)return;X.current=!0,pe.current=!0,(async()=>{C({title:"OAuth completed",description:"Authentication successful! Refreshing service status..."}),_f(k,S.id),k.invalidateQueries({queryKey:["/api/mcp/discover",S.url]});try{const te=await Ne("GET",`/api/services/${S.id}`);if(te.ok){const Le=await te.json();v(Le.data??Le)}}catch{}await I(),k.invalidateQueries({queryKey:["/api/services",S.id,"tools"]}),await M(),pe.current=!1})()},[O==null?void 0:O.authenticated,t,S==null?void 0:S.id]);const ce=()=>(e==null?void 0:e.type)==="mcp"?c.jsx(jb,{className:"w-6 h-6"}):c.jsx(Sp,{className:"w-6 h-6"}),L=()=>(e==null?void 0:e.type)==="mcp"?"text-blue-400":"text-purple-400",q=()=>(e==null?void 0:e.type)==="mcp"?"bg-blue-500/20":"bg-purple-500/20",Y=ve=>new Date(ve).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});b.useEffect(()=>{var ve,te;s&&((ve=w.current)==null||ve.focus(),(te=w.current)==null||te.select())},[s]);const ne=async()=>{const ve=(j==null?void 0:j.name)||"",te=u.trim();if(!j||!te||te===ve){d(ve),i(!1);return}y(!0);try{await Ne("PUT",`/api/services/${j.id}`,{name:te}),v({...j,name:te}),k.invalidateQueries({queryKey:["/api/services"]}),k.invalidateQueries({queryKey:["/api/collection/warnings"]}),k.invalidateQueries({queryKey:["/api/decks"]}),i(!1)}catch(Le){d(ve),i(!1),C({title:"Could not rename service",description:Le instanceof Error?Le.message:"Failed to update name",variant:"destructive"})}finally{y(!1)}},Z=async()=>{if(e){x(!0);try{if((await Ne("PUT",`/api/services/${e.id}`,{description:f.trim()})).ok){if(g){const te={...g,description:f.trim()};v(te)}k.invalidateQueries({queryKey:["/api/services"]}),k.invalidateQueries({queryKey:["/api/collection/warnings"]}),k.invalidateQueries({queryKey:["/api/decks"]}),k.invalidateQueries({queryKey:["/api/decks"]}),C({title:"Description updated",description:"Service description has been updated successfully."}),l(!1)}else throw new Error("Failed to update description")}catch{C({title:"Update failed",description:"Failed to update service description. Please try again.",variant:"destructive"})}finally{x(!1)}}},re=ve=>{ve||(pe.current&&(_f(k,(S==null?void 0:S.id)??(e==null?void 0:e.id)),pe.current=!1),X.current=!1,n())};return c.jsx(Os,{open:t,onOpenChange:re,children:c.jsxs(Mo,{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:[c.jsx(Do,{children:c.jsxs(Lo,{className:"text-2xl font-bold flex items-center",children:[ce(),c.jsx("div",{className:"ml-3 flex min-w-0 items-center",children:s?c.jsx("input",{ref:w,type:"text",value:u,disabled:h,onChange:ve=>d(ve.target.value),onBlur:()=>{ne()},onKeyDown:ve=>{ve.key==="Enter"?(ve.preventDefault(),ne()):ve.key==="Escape"&&(ve.preventDefault(),d((j==null?void 0:j.name)||""),i(!1))},className:"max-w-[16rem] rounded border border-white/20 bg-white/10 px-2 py-1 text-2xl font-bold text-white focus:border-white/40 focus:outline-none sm:max-w-[20rem]","aria-label":"Service name","data-testid":"input-service-name"}):c.jsx("button",{type:"button",className:"min-w-0 truncate text-left hover:underline",title:"Click to rename",onClick:()=>{d((j==null?void 0:j.name)||""),i(!0)},"data-testid":"button-rename-service",children:j==null?void 0:j.name})}),c.jsx(Un,{className:`ml-3 ${q()} ${L()}`,children:(we=e==null?void 0:e.type)==null?void 0:we.toUpperCase()})]})}),e&&c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsx("div",{className:"mb-3",children:c.jsxs("h3",{className:"text-lg font-semibold flex items-center",children:[c.jsx(SM,{className:"w-5 h-5 mr-2"}),"Service Overview"]})}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx("p",{className:"text-gray-300 text-sm",children:"Description"}),!a&&c.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>l(!0),className:"h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity",title:"Edit description",children:c.jsx(Dv,{className:"w-3 h-3"})})]}),a?c.jsxs("div",{className:"space-y-2",children:[c.jsx("textarea",{value:f,onChange:ve=>p(ve.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}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(fe,{size:"sm",onClick:Z,disabled:m,className:"h-6 px-2 text-xs",children:m?"Saving...":"Save"}),c.jsx(fe,{size:"sm",variant:"outline",onClick:()=>{l(!1),p((j==null?void 0:j.description)||"")},className:"h-6 px-2 text-xs",children:"Cancel"})]})]}):c.jsx("p",{className:"text-white cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors",onClick:()=>l(!0),title:"Click to edit description",children:(j==null?void 0:j.description)||"No description"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Endpoint"}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center space-x-2",children:[c.jsx(Un,{variant:"outline",className:"border-blue-500/30 text-blue-300",children:S.type.toUpperCase()}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&c.jsx(Un,{variant:"outline",className:"border-green-500/30 text-green-300",children:"Custom Headers"})]}),c.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>window.open(S.url,"_blank"),className:"p-1 h-auto",children:c.jsx(_o,{className:"w-4 h-4"})})]}),c.jsx("div",{className:"text-xs text-gray-400 break-all bg-black/20 p-2 rounded border border-white/10",children:S.url||"No URL available"}),e.headers&&typeof e.headers=="object"&&Object.keys(e.headers).length>0&&c.jsxs("div",{className:"text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10",children:[c.jsx("p",{className:"font-semibold mb-1",children:"Custom Headers:"}),c.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(e.headers,null,2)})]})]})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Health Status"}),c.jsx(Un,{className:S.health==="healthy"?"bg-green-500/20 text-green-300":S.health==="unhealthy"?"bg-red-500/20 text-red-300":"bg-amber-500/20 text-amber-200",children:S.health==="healthy"?"Healthy":S.health==="unhealthy"?"Unreachable":Q.status==="required"||Q.status==="expired"?"Auth required":"Unknown"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Registered"}),c.jsx("p",{className:"text-white text-sm",children:Y(S.registeredAt)})]})]})]}),K&&c.jsxs("div",{className:"text-center py-8",children:[c.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4"}),c.jsx("p",{className:"text-gray-400",children:"Fetching service details..."})]}),r&&c.jsx("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:c.jsx("p",{className:"text-red-300",children:r})}),(e.type==="mcp"||e.type==="local-mcp")&&c.jsxs(c.Fragment,{children:[e.type==="local-mcp"&&c.jsxs("div",{className:"bg-cyan-500/15 border border-cyan-500/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-cyan-200 font-semibold mb-2",children:"Local MCP — auth happens outside Agent Deck"}),c.jsx("div",{className:"text-cyan-100/90 text-sm space-y-2",children:Uq(S)?c.jsxs(c.Fragment,{children:[c.jsxs("p",{children:["This card runs ",c.jsx("code",{className:"text-xs",children:"@piotr-agier/google-drive-mcp"})," on your machine. Agent Deck does ",c.jsx("strong",{children:"not"}),' handle Google OAuth for it. If Google shows "app not verified", that is ',c.jsx("strong",{children:"your Google Cloud project"}),", not Agent Deck."]}),c.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1",children:[c.jsxs("li",{children:["Create a GCP OAuth client type ",c.jsx("strong",{children:"Desktop app"})," (not Web)."]}),c.jsxs("li",{children:["Add yourself as a ",c.jsx("strong",{children:"Test user"})," on the consent screen."]}),c.jsxs("li",{children:["Run in terminal first:"," ",c.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"
411
- export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
412
- npx @piotr-agier/google-drive-mcp auth`})]}),c.jsxs("li",{children:["Set ",c.jsx("code",{className:"text-xs",children:"GOOGLE_DRIVE_MCP_TOKEN_PATH"})," in the card env to the same token file (",c.jsx("code",{className:"text-xs",children:"~/.config/google-drive-mcp/tokens.json"}),")."]})]}),c.jsxs("p",{className:"text-xs text-cyan-200/80",children:["Full steps: ",c.jsx("code",{className:"text-xs",children:"docs/GOOGLE_DRIVE_WORKAROUND.md"})," in the repo."]})]}):c.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."})})]}),c.jsx(zq,{serviceId:S.id,tools:R,isLoading:W})]}),e.type==="a2a"&&D&&c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[c.jsx(LM,{className:"w-5 h-5 mr-2"}),"Agent Overview"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Agent Name"}),c.jsx("p",{className:"text-white font-semibold",children:D.name})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Version"}),c.jsx("p",{className:"text-white",children:D.version})]}),c.jsxs("div",{className:"md:col-span-2",children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Description"}),c.jsx("p",{className:"text-white",children:D.description})]}),D.provider&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Provider"}),c.jsx("p",{className:"text-white",children:D.provider.organization})]}),D.documentationUrl&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-1",children:"Documentation"}),c.jsxs(fe,{size:"sm",variant:"ghost",onClick:()=>window.open(D.documentationUrl,"_blank"),className:"p-1 h-auto text-purple-300",children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),"View Docs"]})]})]})]}),D.capabilities&&c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[c.jsx(NE,{className:"w-5 h-5 mr-2"}),"Capabilities"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[D.capabilities.streaming&&c.jsx(Un,{className:"bg-green-500/20 text-green-300",children:"Streaming"}),D.capabilities.pushNotifications&&c.jsx(Un,{className:"bg-blue-500/20 text-blue-300",children:"Push Notifications"}),D.capabilities.stateTransitionHistory&&c.jsx(Un,{className:"bg-purple-500/20 text-purple-300",children:"State History"})]})]}),D.skills&&D.skills.length>0&&c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center",children:[c.jsx(Sp,{className:"w-5 h-5 mr-2"}),"Skills (",D.skills.length,")"]}),c.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:D.skills.map((ve,te)=>c.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:[c.jsx("div",{className:"absolute top-2 left-2 text-xs font-bold",children:c.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),c.jsx("div",{className:"absolute bottom-2 right-2 text-xs font-bold rotate-180",children:c.jsx("div",{className:"text-purple-300 leading-none",children:"S"})}),c.jsxs("div",{className:"absolute inset-x-3 top-8 bottom-8 flex flex-col items-center justify-center text-center",children:[c.jsx("div",{className:"text-purple-300 mb-2",children:c.jsx(Sp,{className:"w-6 h-6"})}),c.jsx("h4",{className:"font-bold text-sm mb-2 line-clamp-2 text-white",children:ve.name}),c.jsx("p",{className:"text-gray-300 text-xs line-clamp-4 mb-2",children:ve.description}),ve.tags&&ve.tags.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1 justify-center",children:ve.tags.slice(0,2).map((Le,jt)=>c.jsx("span",{className:"text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded",children:Le},jt))})]}),c.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"})]},te))})]}),(D.defaultInputModes||D.defaultOutputModes)&&c.jsxs("div",{className:"bg-black/20 rounded-lg p-4 border border-white/10",children:[c.jsxs("h3",{className:"text-lg font-semibold mb-3 flex items-center",children:[c.jsx(jb,{className:"w-5 h-5 mr-2"}),"Data Modes"]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[D.defaultInputModes&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Input Modes"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:D.defaultInputModes.map((ve,te)=>c.jsx(Un,{className:"bg-blue-500/20 text-blue-300 text-xs",children:ve},te))})]}),D.defaultOutputModes&&c.jsxs("div",{children:[c.jsx("p",{className:"text-gray-300 text-sm mb-2",children:"Output Modes"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:D.defaultOutputModes.map((ve,te)=>c.jsx(Un,{className:"bg-green-500/20 text-green-300 text-xs",children:ve},te))})]})]})]})]}),(e==null?void 0:e.type)==="mcp"&&Q.status==="not_required"&&(S==null?void 0:S.id)&&c.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"How to connect"}),c.jsx(Xk,{serviceId:S.id})]}),(e==null?void 0:e.type)==="mcp"&&Q.status!=="authenticated"&&Q.status!=="not_required"&&c.jsxs("div",{className:`${Q.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:[c.jsx("h3",{className:`${Q.status==="expired"?"text-red-300":"text-orange-300"} font-semibold mb-2`,children:Q.status==="expired"?"⏰ Token Expired":"🔐 Authentication Required"}),c.jsxs("div",{className:`${Q.status==="expired"?"text-red-200":"text-orange-200"} text-sm space-y-2`,children:[c.jsx("p",{children:c.jsx("strong",{children:Q.message})}),c.jsx("p",{children:Q.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."}),(S==null?void 0:S.id)&&c.jsx(Xk,{serviceId:S.id,onConnected:()=>void B()}),((He=(Ie=P==null?void 0:P.data)==null?void 0:Ie.oauth)==null?void 0:He.resourceName)&&c.jsx("div",{className:"mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20 text-xs text-orange-100",children:c.jsxs("p",{children:[c.jsx("strong",{children:"Resource:"})," ",P.data.oauth.resourceName]})})]})]}),(e==null?void 0:e.type)==="mcp"&&c.jsxs("div",{className:"bg-gray-800/50 border border-gray-600/30 rounded-lg p-4 mb-4",children:[c.jsx("h3",{className:"text-gray-300 font-semibold mb-2",children:"Connection Logs"}),c.jsxs("div",{className:"text-gray-200 text-sm space-y-2",children:[c.jsxs("div",{className:"bg-black/30 p-2 rounded text-xs",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 Attempting to discover tools for MCP service:"})}),c.jsxs("p",{children:["Service ID: ",e==null?void 0:e.id]}),c.jsxs("p",{children:["Service URL: ",S==null?void 0:S.url]}),c.jsxs("p",{children:["Status: ",W?"🔄 Loading...":N?"❌ Failed":"✅ Complete"]})]}),W&&c.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[c.jsxs("p",{children:["🔄 Making HTTP request to: ",c.jsxs("code",{children:["GET /api/services/",e==null?void 0:e.id,"/tools"]})]}),c.jsxs("p",{children:["Target MCP server: ",c.jsx("code",{children:S==null?void 0:S.url})]})]}),N&&c.jsxs("div",{className:"bg-red-500/20 p-2 rounded text-xs",children:[c.jsx("p",{children:"❌ Request failed:"}),c.jsx("pre",{className:"whitespace-pre-wrap overflow-x-auto",children:N instanceof Error?N.message:String(N)}),c.jsxs("div",{className:"mt-2 p-2 bg-black/30 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 What we tried:"})}),c.jsxs("p",{children:["• Service ID: ",e==null?void 0:e.id]}),c.jsxs("p",{children:["• Target URL: ",S==null?void 0:S.url]}),c.jsxs("p",{children:["• Request: GET /api/services/",e==null?void 0:e.id,"/tools"]}),(S==null?void 0:S.headers)&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"📋 Headers sent:"})}),c.jsx("pre",{className:"text-xs overflow-x-auto",children:JSON.stringify(S.headers,null,2)})]}),c.jsxs("div",{className:"mt-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"💡 What this means:"})}),c.jsxs("p",{children:["• The MCP server at ",S==null?void 0:S.url," returned an error"]}),c.jsx("p",{children:"• This could be due to authentication issues, server being down, or invalid configuration"}),c.jsx("p",{children:"• Check the error message above for specific details from the MCP server"})]})]})]}),!W&&!N&&R.length>0&&c.jsx("div",{className:"bg-green-500/20 p-2 rounded text-xs",children:c.jsxs("p",{children:["✅ Successfully discovered ",R.length," tools from MCP server"]})}),!W&&!N&&R.length===0&&c.jsxs("div",{className:"bg-yellow-500/20 p-2 rounded text-xs",children:[c.jsx("p",{children:"⚠️ Connected to MCP server but no tools were found"}),c.jsx("p",{children:"This could mean the server has no tools or requires specific authentication"})]})]})]}),N&&(e.type==="mcp"||e.type==="local-mcp")&&c.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"MCP Tool Discovery Failed"}),c.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"Raw Error:"})}),c.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap",children:N instanceof Error?N.message:String(N)}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service URL:"})," ",S==null?void 0:S.url]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service ID:"})," ",S==null?void 0:S.id]}),(S==null?void 0:S.headers)&&c.jsxs("div",{children:[c.jsx("p",{children:c.jsx("strong",{children:"Custom Headers:"})}),c.jsx("pre",{className:"bg-black/30 p-2 rounded text-xs overflow-x-auto",children:JSON.stringify(S.headers,null,2)})]})]})]}),E&&e.type==="a2a"&&c.jsxs("div",{className:"bg-red-500/20 border border-red-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-red-300 font-semibold mb-2",children:"A2A Manifest Discovery Failed"}),c.jsxs("div",{className:"text-red-200 text-sm space-y-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"Raw Error:"})}),c.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)}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service URL:"})," ",S==null?void 0:S.url]}),c.jsxs("p",{children:[c.jsx("strong",{children:"Service ID:"})," ",S==null?void 0:S.id]})]})]}),!K&&!N&&!E&&(e.type==="mcp"||e.type==="local-mcp")&&R.length===0&&(e.type==="local-mcp"||!((er=(sn=P==null?void 0:P.data)==null?void 0:sn.oauth)!=null&&er.required))&&c.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"No Tools Available"}),c.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to MCP server at ",S==null?void 0:S.url,", but no tools were discovered."]}),c.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"This could mean:"})}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsx("li",{children:"The MCP server has no tools registered"}),c.jsx("li",{children:"Tools require specific authentication"}),c.jsx("li",{children:"Tools are only available after certain operations"})]})]})]}),(e.type==="mcp"||e.type==="local-mcp")&&c.jsxs("div",{className:"bg-blue-500/20 border border-blue-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-blue-300 font-semibold mb-2",children:"🔍 MCP Server Analysis"}),c.jsxs("div",{className:"text-blue-200 text-sm space-y-2",children:[c.jsxs("p",{children:[c.jsx("strong",{children:"Server URL:"})," ",S==null?void 0:S.url]}),$&&c.jsx("div",{className:"mt-3 p-3 bg-black/30 rounded",children:c.jsx("p",{children:"🔍 Analyzing MCP server configuration..."})}),P&&c.jsxs("div",{className:"mt-3 p-3 bg-black/30 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"🔍 What we discovered:"})}),P.error&&P.analysis&&c.jsxs("div",{className:"text-yellow-200",children:[P.analysis.auth_type==="oauth2"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),c.jsx("p",{children:"• This MCP server requires OAuth 2.0 Bearer token authentication"}),c.jsx("p",{children:"• You'll need to provide OAuth credentials (client ID, client secret, authorization URL, token URL)"}),c.jsx("p",{children:"• Check the service provider's documentation for OAuth setup instructions"})]}),P.analysis.protocol==="sse"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"SSE Protocol Required"})]}),c.jsx("p",{children:"• This MCP server uses Server-Sent Events (SSE) protocol"}),c.jsx("p",{children:"• We'll need to connect using event streaming instead of HTTP"})]}),P.analysis.issue==="not_found"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Server Not Found"})]}),c.jsx("p",{children:"• The MCP server URL might be incorrect"}),c.jsx("p",{children:"• Check if the server is running and the URL is correct"})]}),P.analysis.issue==="server_error"&&c.jsxs("div",{children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Server Error"})]}),c.jsx("p",{children:"• The MCP server is experiencing internal errors"}),c.jsx("p",{children:"• Try again later or contact the service provider"})]}),P.analysis.message&&c.jsxs("p",{children:["• ",c.jsx("strong",{children:"Analysis:"})," ",P.analysis.message]})]}),((Lr=(Sn=P==null?void 0:P.data)==null?void 0:Sn.oauth)==null?void 0:Lr.required)&&c.jsxs("div",{className:"text-yellow-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"OAuth 2.0 Authentication Required"})]}),P.data.oauth.authorizationUrl&&c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx(fe,{size:"sm",variant:"default",className:"h-7",onClick:async()=>{var ve,te;if(S!=null&&S.id)try{C({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Le=await Ne("POST",`/api/oauth/${S.id}/auto-setup`,{});if(!Le.ok){const Rt=await Le.json();(ve=Rt.data)!=null&&ve.registrationUrl?(window.open(Rt.data.registrationUrl,"_blank"),C({title:"OAuth Registration Required",description:`${Rt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):C({title:"OAuth Setup Failed",description:Rt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const jt=await Le.json();jt.success&&((te=jt.data)!=null&&te.authorizationUrl)?(window.open(jt.data.authorizationUrl,"_blank"),C({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),B()):C({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Le){C({title:"OAuth Setup Failed",description:Le instanceof Error?Le.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),c.jsxs(fe,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.authorizationUrl,"_blank"),children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),"Open Raw Authorization URL"]})]}),!P.data.oauth.authorizationUrl&&P.data.oauth.protectedResourceConfigUrl&&c.jsx("div",{className:"mt-2",children:c.jsxs(fe,{size:"sm",variant:"ghost",className:"p-1 h-auto text-blue-300",onClick:()=>window.open(P.data.oauth.protectedResourceConfigUrl,"_blank"),children:[c.jsx(_o,{className:"w-4 h-4 mr-1"}),"View OAuth Configuration"]})}),P.data.oauth.authorizationServerMetadataUrl&&c.jsxs("div",{className:"mt-2 text-xs text-gray-300",children:[c.jsx("span",{className:"mr-1",children:"Auth Server Metadata:"}),c.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)&&!((Ot=(mr=P==null?void 0:P.data)==null?void 0:mr.oauth)!=null&&Ot.required)&&c.jsxs("div",{className:"text-green-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"✅ Server Analysis Complete"})]}),c.jsx("p",{children:"• MCP server is accessible and responding"}),c.jsx("p",{children:"• No authentication issues detected"}),c.jsx("p",{children:"• Protocol compatibility confirmed"})]}),((Mt=(tr=P==null?void 0:P.data)==null?void 0:tr.oauth)==null?void 0:Mt.required)&&c.jsxs("div",{className:"text-orange-200",children:[c.jsxs("p",{children:["• ",c.jsx("strong",{children:"🔐 OAuth 2.0 Authentication Required"})]}),c.jsx("p",{children:"• This MCP server requires OAuth authentication"}),P.data.oauth.resourceName&&c.jsxs("p",{children:["• Service: ",P.data.oauth.resourceName]}),P.data.oauth.authorizationUrl&&c.jsxs("p",{children:["• Authorization URL: ",P.data.oauth.authorizationUrl]}),P.data.oauth.tokenUrl&&c.jsxs("p",{children:["• Token URL: ",P.data.oauth.tokenUrl]}),c.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[c.jsx(fe,{size:"sm",variant:"default",className:"bg-orange-600 hover:bg-orange-700",onClick:async()=>{var ve,te;if(S!=null&&S.id)try{C({title:"Setting up OAuth...",description:"Automatically registering OAuth application and starting authorization flow..."});const Le=await Ne("POST",`/api/oauth/${S.id}/auto-setup`,{});if(!Le.ok){const Rt=await Le.json();(ve=Rt.data)!=null&&ve.registrationUrl?(window.open(Rt.data.registrationUrl,"_blank"),C({title:"OAuth Registration Required",description:`${Rt.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):C({title:"OAuth Setup Failed",description:Rt.error||"Failed to setup OAuth automatically. Please configure manually.",variant:"destructive"});return}const jt=await Le.json();jt.success&&((te=jt.data)!=null&&te.authorizationUrl)?(window.open(jt.data.authorizationUrl,"_blank"),C({title:"OAuth Setup Successful",description:"OAuth application registered automatically! Please complete the authorization in the new window.",duration:1e4}),B()):C({title:"OAuth Setup Failed",description:"Failed to get authorization URL. Please try again.",variant:"destructive"})}catch(Le){C({title:"OAuth Setup Failed",description:Le instanceof Error?Le.message:"Unknown error occurred",variant:"destructive"})}},children:"🔧 Auto-Setup OAuth"}),c.jsx(fe,{size:"sm",variant:"outline",className:"border-orange-500/30 text-orange-300 hover:bg-orange-500/10",onClick:()=>{const ve=`OAuth Setup Instructions:
413
-
414
- 1. Go to the service provider's OAuth/Developer settings
415
- 2. Create a new OAuth application
416
- 3. Set Redirect URL: http://localhost:8000/api/oauth/${S==null?void 0:S.id}/callback
417
- 4. Copy the Client ID and Client Secret
418
- 5. Edit this service and add the credentials
419
-
420
- ${P.data.oauth.authorizationUrl?`Authorization URL: ${P.data.oauth.authorizationUrl}`:""}
421
- ${P.data.oauth.tokenUrl?`Token URL: ${P.data.oauth.tokenUrl}`:""}
422
- ${P.data.oauth.issuer?`Issuer: ${P.data.oauth.issuer}`:""}`;C({title:"OAuth Setup Instructions",description:ve,duration:1e4})},children:"📋 Setup Instructions"})]})]}),c.jsxs("div",{className:"mt-2 text-xs",children:[c.jsx("p",{children:c.jsx("strong",{children:"💡 Next Steps:"})}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsx("li",{children:"For OAuth servers: Provide OAuth credentials in service settings"}),c.jsx("li",{children:"For SSE servers: We'll automatically use the correct protocol"}),c.jsx("li",{children:"For connection issues: Verify the server URL and status"})]})]})]}),T&&c.jsxs("div",{className:"mt-3 p-3 bg-red-500/20 rounded",children:[c.jsx("p",{children:c.jsx("strong",{children:"❌ Discovery Failed"})}),c.jsx("p",{children:"Could not analyze MCP server configuration"}),c.jsx("pre",{className:"text-xs overflow-x-auto",children:T instanceof Error?T.message:String(T)})]})]})]}),!K&&!N&&!E&&e.type==="a2a"&&!D&&c.jsxs("div",{className:"bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4",children:[c.jsx("h3",{className:"text-yellow-300 font-semibold mb-2",children:"Agent Details Not Available"}),c.jsxs("p",{className:"text-yellow-200 text-sm",children:["Successfully connected to A2A agent at ",S==null?void 0:S.url,", but no manifest was found."]}),c.jsxs("div",{className:"text-yellow-200 text-xs mt-2",children:[c.jsx("p",{children:c.jsx("strong",{children:"This could mean:"})}),c.jsxs("ul",{className:"list-disc list-inside ml-2 space-y-1",children:[c.jsx("li",{children:"The agent doesn't provide a manifest"}),c.jsx("li",{children:"Manifest endpoint is not implemented"}),c.jsx("li",{children:"Agent requires specific authentication"})]})]})]})]})]})})}function Vq({open:e,onOpenChange:t}){const[n,r]=b.useState(null),[o,s]=b.useState(null),[i,a]=b.useState(null),[l,u]=b.useState(!1),d=nn(),{toast:f}=Wt(),p=()=>{r(null),s(null),a(null),u(!1)},h=gt({mutationFn:async()=>{if(!n)throw new Error("Choose a bundle file first");const m=await n.text();let x;try{x=JSON.parse(m)}catch{throw new Error("File is not valid JSON")}return SF(x)},onSuccess:m=>{a(m),d.invalidateQueries({queryKey:["/api/decks"]}),d.invalidateQueries({queryKey:["/api/services"]}),d.invalidateQueries({queryKey:["/api/playbooks"]}),d.invalidateQueries({queryKey:["/api/playbooks/collection"]}),d.invalidateQueries({queryKey:["/api/credentials/collection"]}),d.invalidateQueries({queryKey:["/api/collection/warnings"]}),f({title:"Import complete",description:nk(m)})},onError:m=>{f({title:"Import failed",description:m.message,variant:"destructive"})}}),y=async m=>{var x,g,v;if(r(m),a(null),!m){s(null);return}try{const w=await m.text(),k=JSON.parse(w);s(`${((x=k.services)==null?void 0:x.length)??0} services · ${((g=k.playbooks)==null?void 0:g.length)??0} playbooks · ${((v=k.decks)==null?void 0:v.length)??0} decks`)}catch{s("Invalid JSON")}};return c.jsx(Os,{open:e,onOpenChange:m=>{m||p(),t(m)},children:c.jsxs(Mo,{className:"sm:max-w-lg border-border bg-[#161612] text-[#E8F6F4]",children:[c.jsxs(Do,{children:[c.jsx(Lo,{children:"Import bundle"}),c.jsx(Ii,{asChild:!0,children:c.jsxs("div",{className:"space-y-2 text-left text-sm text-[#A8C4C0]",children:[c.jsx("p",{children:"Adds MCP, playbooks, and decks from a JSON file."}),c.jsxs("div",{children:[c.jsx("p",{className:"font-medium text-amber-200/90",children:"Notes"}),c.jsxs("ul",{className:"mt-1 list-disc space-y-0.5 pl-4",children:[c.jsx("li",{children:"Same name as an existing card or deck is skipped (linked only)."}),c.jsx("li",{children:"No credentials or secrets — re-enter keys and reconnect OAuth."})]})]})]})})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"bundle-file",children:"Bundle file"}),c.jsx(Xe,{id:"bundle-file",type:"file",accept:".json,.agent-deck.json,application/json",className:"cursor-pointer bg-white/5 border-white/20",onChange:m=>{var x;return y(((x=m.target.files)==null?void 0:x[0])??null)},"data-testid":"input-import-bundle"}),o&&c.jsx("p",{className:"text-xs text-[#A8C4C0]","data-testid":"import-preview",children:o})]}),!i&&c.jsx(fe,{onClick:()=>h.mutate(),disabled:!n||h.isPending||o==="Invalid JSON",className:"rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},"data-testid":"button-import-apply",children:h.isPending?"Importing…":"Import"}),i&&c.jsxs("div",{className:"space-y-2 rounded-lg border border-white/10 bg-white/5 p-3 text-sm","data-testid":"import-report",children:[c.jsx("p",{className:"font-medium",children:nk(i)}),i.servicesNeedingOauth.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-amber-200",children:"Needs OAuth reconnect:"}),c.jsx("ul",{className:"list-disc pl-5 text-[#A8C4C0]",children:i.servicesNeedingOauth.map(m=>c.jsx("li",{children:m},m))})]}),i.warnings.length>0&&c.jsxs("div",{children:[c.jsx("p",{className:"text-amber-200",children:"Warnings:"}),c.jsx("ul",{className:"list-disc pl-5 text-[#A8C4C0]",children:i.warnings.map(m=>c.jsx("li",{children:m},m))})]}),c.jsx(fe,{variant:"outline",size:"sm",className:"rounded-full border border-white/20 text-white hover:bg-white/10",onClick:()=>u(m=>!m),children:l?"Hide id map":"Show id map"}),l&&c.jsx("pre",{className:"max-h-40 overflow-auto rounded bg-black/40 p-2 text-xs",children:JSON.stringify(i.idMap,null,2)}),c.jsx(fe,{className:"rounded-full border px-6 text-sm font-semibold hover:opacity-90",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},onClick:()=>{p(),t(!1)},children:"Done"})]})]})]})})}function Hq(){const[e,t]=b.useState("connecting"),[n,r]=b.useState(null),o=b.useRef(null),s=b.useRef(null),i=nn();return b.useEffect(()=>{const l=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws/events`,u=()=>{try{const f=new WebSocket(l);o.current=f,f.onopen=()=>{console.log("WebSocket connected"),t("connected")},f.onmessage=p=>{var h;try{const y=JSON.parse(p.data);r(y),y.type==="deck_update"?(console.log("Received deck update:",y),i.invalidateQueries({queryKey:["/api/decks"]})):y.type==="service_update"?(console.log("Received service update:",y),_f(i,typeof((h=y.data)==null?void 0:h.serviceId)=="string"?y.data.serviceId:void 0)):y.type==="connection_status"&&t(y.status==="connected"?"connected":"disconnected")}catch(y){console.error("Failed to parse WebSocket message:",y)}},f.onclose=()=>{console.log("WebSocket disconnected"),t("disconnected"),s.current=setTimeout(()=>{console.log("Attempting to reconnect WebSocket..."),t("connecting"),u()},3e3)},f.onerror=p=>{console.error("WebSocket error:",p),t("disconnected")}}catch(f){console.error("Failed to connect WebSocket:",f),t("disconnected")}};u();const d=f=>{f.origin===window.location.origin&&Fq(f.data)&&_f(i,f.data.serviceId)};return window.addEventListener("message",d),()=>{window.removeEventListener("message",d),s.current&&clearTimeout(s.current),o.current&&o.current.readyState===WebSocket.OPEN&&o.current.close()}},[i]),{connectionStatus:e,lastMessage:n}}async function e1(e,t){const n=e==="credential"?`credentialId=${encodeURIComponent(t)}`:`serviceId=${encodeURIComponent(t)}`;return(await(await Ne("GET",`/api/playbooks/dependents/check?${n}`)).json()).data??[]}function Bq(e){const[t,n]=b.useState(null),[r,o]=b.useState(null),[s,i]=b.useState(null),[a,l]=b.useState(!1),u=nn(),{toast:d}=Wt(),f=()=>{if(!e)throw new Error("Select a deck to edit first");return e},p=gt({mutationFn:async T=>{var Q,H,W;const I=f(),B=(Q=(await(await Ne("GET","/api/decks")).json()).data)==null?void 0:Q.find(N=>N.id===I);if(!B)throw new Error("Selected deck not found");if((H=B.services)!=null&&H.some(N=>N.id===T))throw new Error("Service is already in the deck");const J=((W=B.services)==null?void 0:W.length)??0;return Ne("POST",`/api/decks/${I}/services`,{serviceId:T,position:J})},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:T=>{d({title:"Failed to add service",description:T.message,variant:"destructive"})}}),h=gt({mutationFn:async T=>{var J,Q;const I=f(),B=(J=(await(await Ne("GET","/api/decks")).json()).data)==null?void 0:J.find(H=>H.id===I);if((Q=B==null?void 0:B.credentials)!=null&&Q.some(H=>H.id===T))throw new Error("API key is already in the deck");return Ne("POST",`/api/decks/${I}/credentials`,{credentialId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key added to deck",description:`${(r==null?void 0:r.label)||"API key"} is scoped to this deck.`})},onError:T=>{d({title:"Failed to add API key",description:T.message,variant:"destructive"})}}),y=gt({mutationFn:async T=>{var J,Q;const I=f(),B=(J=(await(await Ne("GET","/api/decks")).json()).data)==null?void 0:J.find(H=>H.id===I);if((Q=B==null?void 0:B.playbooks)!=null&&Q.some(H=>H.id===T))throw new Error("Playbook is already in the deck");return Ne("POST",`/api/decks/${I}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook added to deck",description:`${(s==null?void 0:s.title)||"Playbook"} is on this deck.`})},onError:T=>{d({title:"Failed to add playbook",description:T.message,variant:"destructive"})}}),m=gt({mutationFn:async T=>{const I=await e1("service",T);if(I.length>0){const O=I.map(J=>J.title).join(", ");if(!window.confirm(`Warning: ${I.length} playbook(s) depend on this MCP (${O}). Remove from deck anyway?`))throw new Error("Cancelled")}const U=f();return Ne("DELETE",`/api/decks/${U}/services`,{serviceId:T})},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:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove service",description:T.message,variant:"destructive"})}}),x=gt({mutationFn:async T=>{const I=await e1("credential",T);if(I.length>0){const O=I.map(J=>J.title).join(", ");if(!window.confirm(`Warning: ${I.length} playbook(s) depend on this API key (${O}). Remove from deck anyway?`))throw new Error("Cancelled")}const U=f();return Ne("DELETE",`/api/decks/${U}/credentials`,{credentialId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"API key removed from deck",description:`${(r==null?void 0:r.label)||"API key"} is no longer on this deck.`})},onError:T=>{T.message!=="Cancelled"&&d({title:"Failed to remove API key",description:T.message,variant:"destructive"})}}),g=gt({mutationFn:async T=>{const I=f();return Ne("DELETE",`/api/decks/${I}/playbooks`,{playbookId:T})},onSuccess:()=>{u.invalidateQueries({queryKey:["/api/decks"]}),d({title:"Playbook removed from deck",description:`${(s==null?void 0:s.title)||"Playbook"} is no longer on this deck.`})},onError:T=>{d({title:"Failed to remove playbook",description:T.message,variant:"destructive"})}}),v=(T,I)=>{T.currentTarget instanceof HTMLElement&&(T.currentTarget.style.opacity=I)},w=(T,I)=>{T.dataTransfer.setData("text/plain",I.id),T.dataTransfer.setData("application/json",JSON.stringify(I)),T.dataTransfer.effectAllowed=I.fromDeck?"move":"copy"},k=(T,I,U=!1)=>{n(I),o(null),i(null),l(U),w(T,{kind:"service",id:I.id,fromDeck:U}),v(T,"0.5")},C=(T,I,U=!1)=>{o(I),n(null),i(null),l(U),w(T,{kind:"credential",id:I.id,fromDeck:U}),v(T,"0.5")},j=(T,I,U=!1)=>{i(I),n(null),o(null),l(U),w(T,{kind:"playbook",id:I.id,fromDeck:U}),v(T,"0.5")},S=T=>{n(null),o(null),i(null),v(T,"1")},A=T=>{if(T.kind==="service"){T.fromDeck?m.mutate(T.id):p.mutate(T.id);return}if(T.kind==="credential"){T.fromDeck?x.mutate(T.id):h.mutate(T.id);return}T.fromDeck?g.mutate(T.id):y.mutate(T.id)};return{draggedService:t,draggedCredential:r,draggedPlaybook:s,isDraggingFromDeck:a,handleDragStart:k,handleCredentialDragStart:C,handlePlaybookDragStart:j,handleDragEnd:S,handleDrop:T=>{T.preventDefault();const I=T.dataTransfer.getData("application/json");if(I){try{A(JSON.parse(I))}catch{const U=T.dataTransfer.getData("text/plain");U&&t&&p.mutate(U)}n(null),o(null),i(null),l(!1)}},handleGlobalDrop:T=>{T.preventDefault();const I=T.dataTransfer.getData("application/json");if(I){try{const U=JSON.parse(I);U.fromDeck&&A(U)}catch{}n(null),o(null),i(null),l(!1)}},isDropping:p.isPending||h.isPending||y.isPending||m.isPending||x.isPending||g.isPending}}const em="agent-deck-editing-deck-id";function Wq(e){const[t,n]=b.useState(()=>typeof window>"u"?null:localStorage.getItem(em));b.useEffect(()=>{if(e.length===0)return;if(!(t&&e.some(i=>i.id===t))){const i=e[0].id;n(i),localStorage.setItem(em,i)}},[e,t]);const r=s=>{n(s),localStorage.setItem(em,s)};return{editingDeck:e.find(s=>s.id===t)??null,editingDeckId:t,setEditingDeckId:r}}function t1(e,[t,n]){return Math.min(n,Math.max(t,e))}var Kq=[" ","Enter","ArrowUp","ArrowDown"],Zq=[" ","Enter"],Ei="Select",[Rh,$h,Qq]=$v(Ei),[dl,eee]=ro(Ei,[Qq,ll]),Ih=ll(),[Gq,Ds]=dl(Ei),[Jq,Yq]=dl(Ei),rT=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:p,required:h,form:y}=e,m=Ih(t),[x,g]=b.useState(null),[v,w]=b.useState(null),[k,C]=b.useState(!1),j=o0(u),[S,A]=Es({prop:r,defaultProp:o??!1,onChange:s,caller:Ei}),[P,$]=Es({prop:i,defaultProp:a,onChange:l,caller:Ei}),T=b.useRef(null),I=x?y||!!x.closest("form"):!0,[U,O]=b.useState(new Set),B=Array.from(U).map(J=>J.props.value).join(";");return c.jsx(dN,{...m,children:c.jsxs(Gq,{required:h,scope:t,trigger:x,onTriggerChange:g,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:Co(),value:P,onValueChange:$,open:S,onOpenChange:A,dir:j,triggerPointerDownPosRef:T,disabled:p,children:[c.jsx(Rh.Provider,{scope:t,children:c.jsx(Jq,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(J=>{O(Q=>new Set(Q).add(J))},[]),onNativeOptionRemove:b.useCallback(J=>{O(Q=>{const H=new Set(Q);return H.delete(J),H})},[]),children:n})}),I?c.jsxs(NT,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:J=>$(J.target.value),disabled:p,form:y,children:[P===void 0?c.jsx("option",{value:""}):null,Array.from(U)]},B):null]})})};rT.displayName=Ei;var oT="SelectTrigger",sT=b.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Ih(n),i=Ds(oT,n),a=i.disabled||r,l=Ye(t,i.onTriggerChange),u=$h(n),d=b.useRef("touch"),[f,p,h]=PT(m=>{const x=u().filter(w=>!w.disabled),g=x.find(w=>w.value===i.value),v=TT(x,m,g);v!==void 0&&i.onValueChange(v.value)}),y=m=>{a||(i.onOpenChange(!0),h()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return c.jsx(mh,{asChild:!0,...s,children:c.jsx(Te.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":jT(i.value)?"":void 0,...o,ref:l,onClick:be(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:be(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:be(o.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(x&&m.key===" ")&&Kq.includes(m.key)&&(y(),m.preventDefault())})})})});sT.displayName=oT;var iT="SelectValue",aT=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=Ds(iT,n),{onValueNodeHasChildrenChange:u}=l,d=s!==void 0,f=Ye(t,l.onValueNodeChange);return tn(()=>{u(d)},[u,d]),c.jsx(Te.span,{...a,ref:f,style:{pointerEvents:"none"},children:jT(l.value)?c.jsx(c.Fragment,{children:i}):s})});aT.displayName=iT;var Xq="SelectIcon",lT=b.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return c.jsx(Te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});lT.displayName=Xq;var eV="SelectPortal",cT=e=>c.jsx(Zc,{asChild:!0,...e});cT.displayName=eV;var Ni="SelectContent",uT=b.forwardRef((e,t)=>{const n=Ds(Ni,e.__scopeSelect),[r,o]=b.useState();if(tn(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?$i.createPortal(c.jsx(dT,{scope:e.__scopeSelect,children:c.jsx(Rh.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),s):null}return c.jsx(fT,{...e,ref:t})});uT.displayName=Ni;var wr=10,[dT,Ls]=dl(Ni),tV="SelectContentImpl",nV=ki("SelectContent.RemoveScroll"),fT=b.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:y,hideWhenDetached:m,avoidCollisions:x,...g}=e,v=Ds(Ni,n),[w,k]=b.useState(null),[C,j]=b.useState(null),S=Ye(t,K=>k(K)),[A,P]=b.useState(null),[$,T]=b.useState(null),I=$h(n),[U,O]=b.useState(!1),B=b.useRef(!1);b.useEffect(()=>{if(w)return Xv(w)},[w]),Yv();const J=b.useCallback(K=>{const[X,...pe]=I().map(q=>q.ref.current),[ce]=pe.slice(-1),L=document.activeElement;for(const q of K)if(q===L||(q==null||q.scrollIntoView({block:"nearest"}),q===X&&C&&(C.scrollTop=0),q===ce&&C&&(C.scrollTop=C.scrollHeight),q==null||q.focus(),document.activeElement!==L))return},[I,C]),Q=b.useCallback(()=>J([A,w]),[J,A,w]);b.useEffect(()=>{U&&Q()},[U,Q]);const{onOpenChange:H,triggerPointerDownPosRef:W}=v;b.useEffect(()=>{if(w){let K={x:0,y:0};const X=ce=>{var L,q;K={x:Math.abs(Math.round(ce.pageX)-(((L=W.current)==null?void 0:L.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((q=W.current)==null?void 0:q.y)??0))}},pe=ce=>{K.x<=10&&K.y<=10?ce.preventDefault():w.contains(ce.target)||H(!1),document.removeEventListener("pointermove",X),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",X),document.addEventListener("pointerup",pe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",pe,{capture:!0})}}},[w,H,W]),b.useEffect(()=>{const K=()=>H(!1);return window.addEventListener("blur",K),window.addEventListener("resize",K),()=>{window.removeEventListener("blur",K),window.removeEventListener("resize",K)}},[H]);const[N,M]=PT(K=>{const X=I().filter(L=>!L.disabled),pe=X.find(L=>L.ref.current===document.activeElement),ce=TT(X,K,pe);ce&&setTimeout(()=>ce.ref.current.focus())}),V=b.useCallback((K,X,pe)=>{const ce=!B.current&&!pe;(v.value!==void 0&&v.value===X||ce)&&(P(K),ce&&(B.current=!0))},[v.value]),_=b.useCallback(()=>w==null?void 0:w.focus(),[w]),E=b.useCallback((K,X,pe)=>{const ce=!B.current&&!pe;(v.value!==void 0&&v.value===X||ce)&&T(K)},[v.value]),R=r==="popper"?Kg:hT,D=R===Kg?{side:a,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:y,hideWhenDetached:m,avoidCollisions:x}:{};return c.jsx(dT,{scope:n,content:w,viewport:C,onViewportChange:j,itemRefCallback:V,selectedItem:A,onItemLeave:_,itemTextRefCallback:E,focusSelectedItem:Q,selectedItemText:$,position:r,isPositioned:U,searchRef:N,children:c.jsx(wh,{as:nV,allowPinchZoom:!0,children:c.jsx(vh,{asChild:!0,trapped:v.open,onMountAutoFocus:K=>{K.preventDefault()},onUnmountAutoFocus:be(o,K=>{var X;(X=v.trigger)==null||X.focus({preventScroll:!0}),K.preventDefault()}),children:c.jsx(ol,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:K=>K.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:c.jsx(R,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:K=>K.preventDefault(),...g,...D,onPlaced:()=>O(!0),ref:S,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:be(g.onKeyDown,K=>{const X=K.ctrlKey||K.altKey||K.metaKey;if(K.key==="Tab"&&K.preventDefault(),!X&&K.key.length===1&&M(K.key),["ArrowUp","ArrowDown","Home","End"].includes(K.key)){let ce=I().filter(L=>!L.disabled).map(L=>L.ref.current);if(["ArrowUp","End"].includes(K.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(K.key)){const L=K.target,q=ce.indexOf(L);ce=ce.slice(q+1)}setTimeout(()=>J(ce)),K.preventDefault()}})})})})})})});fT.displayName=tV;var rV="SelectItemAlignedPosition",hT=b.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Ds(Ni,n),i=Ls(Ni,n),[a,l]=b.useState(null),[u,d]=b.useState(null),f=Ye(t,S=>d(S)),p=$h(n),h=b.useRef(!1),y=b.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:g,focusSelectedItem:v}=i,w=b.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&x&&g){const S=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),P=s.valueNode.getBoundingClientRect(),$=g.getBoundingClientRect();if(s.dir!=="rtl"){const L=$.left-A.left,q=P.left-L,Y=S.left-q,ne=S.width+Y,Z=Math.max(ne,A.width),re=window.innerWidth-wr,oe=t1(q,[wr,Math.max(wr,re-Z)]);a.style.minWidth=ne+"px",a.style.left=oe+"px"}else{const L=A.right-$.right,q=window.innerWidth-P.right-L,Y=window.innerWidth-S.right-q,ne=S.width+Y,Z=Math.max(ne,A.width),re=window.innerWidth-wr,oe=t1(q,[wr,Math.max(wr,re-Z)]);a.style.minWidth=ne+"px",a.style.right=oe+"px"}const T=p(),I=window.innerHeight-wr*2,U=m.scrollHeight,O=window.getComputedStyle(u),B=parseInt(O.borderTopWidth,10),J=parseInt(O.paddingTop,10),Q=parseInt(O.borderBottomWidth,10),H=parseInt(O.paddingBottom,10),W=B+J+U+H+Q,N=Math.min(x.offsetHeight*5,W),M=window.getComputedStyle(m),V=parseInt(M.paddingTop,10),_=parseInt(M.paddingBottom,10),E=S.top+S.height/2-wr,R=I-E,D=x.offsetHeight/2,K=x.offsetTop+D,X=B+J+K,pe=W-X;if(X<=E){const L=T.length>0&&x===T[T.length-1].ref.current;a.style.bottom="0px";const q=u.clientHeight-m.offsetTop-m.offsetHeight,Y=Math.max(R,D+(L?_:0)+q+Q),ne=X+Y;a.style.height=ne+"px"}else{const L=T.length>0&&x===T[0].ref.current;a.style.top="0px";const Y=Math.max(E,B+m.offsetTop+(L?V:0)+D)+pe;a.style.height=Y+"px",m.scrollTop=X-E+m.offsetTop}a.style.margin=`${wr}px 0`,a.style.minHeight=N+"px",a.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,s.trigger,s.valueNode,a,u,m,x,g,s.dir,r]);tn(()=>w(),[w]);const[k,C]=b.useState();tn(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=b.useCallback(S=>{S&&y.current===!0&&(w(),v==null||v(),y.current=!1)},[w,v]);return c.jsx(sV,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:c.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:c.jsx(Te.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});hT.displayName=rV;var oV="SelectPopperPosition",Kg=b.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=wr,...s}=e,i=Ih(n);return c.jsx(Kv,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Kg.displayName=oV;var[sV,N0]=dl(Ni,{}),Zg="SelectViewport",pT=b.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Ls(Zg,n),i=N0(Zg,n),a=Ye(t,s.onViewportChange),l=b.useRef(0);return c.jsxs(c.Fragment,{children:[c.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:r}),c.jsx(Rh.Slot,{scope:n,children:c.jsx(Te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:be(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=i;if(p!=null&&p.current&&f){const h=Math.abs(l.current-d.scrollTop);if(h>0){const y=window.innerHeight-wr*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),g=Math.max(m,x);if(g<y){const v=g+h,w=Math.min(y,v),k=v-w;f.style.height=w+"px",f.style.bottom==="0px"&&(d.scrollTop=k>0?k:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});pT.displayName=Zg;var mT="SelectGroup",[iV,aV]=dl(mT),lV=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Co();return c.jsx(iV,{scope:n,id:o,children:c.jsx(Te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});lV.displayName=mT;var gT="SelectLabel",yT=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=aV(gT,n);return c.jsx(Te.div,{id:o.id,...r,ref:t})});yT.displayName=gT;var Sf="SelectItem",[cV,vT]=dl(Sf),xT=b.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=Ds(Sf,n),l=Ls(Sf,n),u=a.value===r,[d,f]=b.useState(s??""),[p,h]=b.useState(!1),y=Ye(t,v=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,v,r,o)}),m=Co(),x=b.useRef("touch"),g=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")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 c.jsx(cV,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:b.useCallback(v=>{f(w=>w||((v==null?void 0:v.textContent)??"").trim())},[]),children:c.jsx(Rh.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:c.jsx(Te.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:y,onFocus:be(i.onFocus,()=>h(!0)),onBlur:be(i.onBlur,()=>h(!1)),onClick:be(i.onClick,()=>{x.current!=="mouse"&&g()}),onPointerUp:be(i.onPointerUp,()=>{x.current==="mouse"&&g()}),onPointerDown:be(i.onPointerDown,v=>{x.current=v.pointerType}),onPointerMove:be(i.onPointerMove,v=>{var w;x.current=v.pointerType,o?(w=l.onItemLeave)==null||w.call(l):x.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:be(i.onPointerLeave,v=>{var w;v.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:be(i.onKeyDown,v=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&v.key===" "||(Zq.includes(v.key)&&g(),v.key===" "&&v.preventDefault())})})})})});xT.displayName=Sf;var Ll="SelectItemText",wT=b.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Ds(Ll,n),a=Ls(Ll,n),l=vT(Ll,n),u=Yq(Ll,n),[d,f]=b.useState(null),p=Ye(t,g=>f(g),l.onItemTextChange,g=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,g,l.value,l.disabled)}),h=d==null?void 0:d.textContent,y=b.useMemo(()=>c.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return tn(()=>(m(y),()=>x(y)),[m,x,y]),c.jsxs(c.Fragment,{children:[c.jsx(Te.span,{id:l.textId,...s,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?$i.createPortal(s.children,i.valueNode):null]})});wT.displayName=Ll;var bT="SelectItemIndicator",kT=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return vT(bT,n).isSelected?c.jsx(Te.span,{"aria-hidden":!0,...r,ref:t}):null});kT.displayName=bT;var Qg="SelectScrollUpButton",_T=b.forwardRef((e,t)=>{const n=Ls(Qg,e.__scopeSelect),r=N0(Qg,e.__scopeSelect),[o,s]=b.useState(!1),i=Ye(t,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(CT,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});_T.displayName=Qg;var Gg="SelectScrollDownButton",ST=b.forwardRef((e,t)=>{const n=Ls(Gg,e.__scopeSelect),r=N0(Gg,e.__scopeSelect),[o,s]=b.useState(!1),i=Ye(t,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<u;s(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?c.jsx(CT,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});ST.displayName=Gg;var CT=b.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Ls("SelectScrollButton",n),i=b.useRef(null),a=$h(n),l=b.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return b.useEffect(()=>()=>l(),[l]),tn(()=>{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]),c.jsx(Te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:be(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:be(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:be(o.onPointerLeave,()=>{l()})})}),uV="SelectSeparator",ET=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c.jsx(Te.div,{"aria-hidden":!0,...r,ref:t})});ET.displayName=uV;var Jg="SelectArrow",dV=b.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ih(n),s=Ds(Jg,n),i=Ls(Jg,n);return s.open&&i.position==="popper"?c.jsx(Zv,{...o,...r,ref:t}):null});dV.displayName=Jg;var fV="SelectBubbleInput",NT=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=b.useRef(null),s=Ye(r,o),i=zj(t);return b.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),c.jsx(Te.select,{...n,style:{...oE,...n.style},ref:s,defaultValue:t})});NT.displayName=fV;function jT(e){return e===""||e===void 0}function PT(e){const t=fr(e),n=b.useRef(""),r=b.useRef(0),o=b.useCallback(i=>{const a=n.current+i;t(a),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=b.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function TT(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=hV(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const l=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function hV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pV=rT,RT=sT,mV=aT,gV=lT,yV=cT,$T=uT,vV=pT,IT=yT,AT=xT,xV=wT,wV=kT,OT=_T,MT=ST,DT=ET;const bV=pV,kV=mV,LT=b.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(RT,{ref:r,className:je("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),...n,children:[t,c.jsx(gV,{asChild:!0,children:c.jsx(ch,{className:"h-4 w-4 opacity-50"})})]}));LT.displayName=RT.displayName;const zT=b.forwardRef(({className:e,...t},n)=>c.jsx(OT,{ref:n,className:je("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(PM,{className:"h-4 w-4"})}));zT.displayName=OT.displayName;const FT=b.forwardRef(({className:e,...t},n)=>c.jsx(MT,{ref:n,className:je("flex cursor-default items-center justify-center py-1",e),...t,children:c.jsx(ch,{className:"h-4 w-4"})}));FT.displayName=MT.displayName;const UT=b.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>c.jsx(yV,{children:c.jsxs($T,{ref:o,className:je("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]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[c.jsx(zT,{}),c.jsx(vV,{className:je("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),c.jsx(FT,{})]})}));UT.displayName=$T.displayName;const _V=b.forwardRef(({className:e,...t},n)=>c.jsx(IT,{ref:n,className:je("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));_V.displayName=IT.displayName;const Bi=b.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(AT,{ref:r,className:je("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),...n,children:[c.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(wV,{children:c.jsx(jE,{className:"h-4 w-4"})})}),c.jsx(xV,{children:t})]}));Bi.displayName=AT.displayName;const SV=b.forwardRef(({className:e,...t},n)=>c.jsx(DT,{ref:n,className:je("-mx-1 my-1 h-px bg-muted",e),...t}));SV.displayName=DT.displayName;const CV="/assets/AgentDeckLogo3-X5qCXS2A.png";function EV(){const[e,t]=b.useState(""),[n,r]=b.useState(""),[o,s]=b.useState(!1),[i,a]=b.useState(!1),[l,u]=b.useState(null),[d,f]=b.useState(!1),[p,h]=b.useState(!1),[y,m]=b.useState(null),[x,g]=b.useState(!1),[v,w]=b.useState(!1),[k,C]=b.useState(null),[j,S]=b.useState(!1),[A,P]=b.useState(!1),[$,T]=b.useState(!1),[I,U]=b.useState(null),{toast:O}=Wt(),{data:B=[]}=It({queryKey:["/api/playbook-patches","proposed"],queryFn:()=>Lj("proposed")}),J=async()=>{T(!0);try{const te=await Mj({scope:"collection"});Dj(te,"backup.agent-deck.json"),O({title:"Exported collection",description:`${te.services.length} services, ${te.playbooks.length} playbooks, ${te.decks.length} decks`})}catch(te){O({title:"Export failed",description:te instanceof Error?te.message:"Unknown error",variant:"destructive"})}finally{T(!1)}},{connectionStatus:Q}=Hq(),{data:H,isLoading:W,error:N}=It({queryKey:["/api/decks"]}),M=(H==null?void 0:H.data)||[],{editingDeck:V,editingDeckId:_,setEditingDeckId:E}=Wq(M),{handleDragStart:R,handleCredentialDragStart:D,handlePlaybookDragStart:K,handleDragEnd:X,handleDrop:pe,handleGlobalDrop:ce,isDraggingFromDeck:L}=Bq(_),{data:q,isLoading:Y,error:ne}=It({queryKey:["/api/services"]}),{data:Z,isLoading:re}=It({queryKey:["/api/credentials/vault"]}),{data:oe,isLoading:Re}=It({queryKey:["/api/playbooks/vault"]}),{data:le}=It({queryKey:["/api/collection/warnings"],staleTime:6e4}),Ce=(q==null?void 0:q.data)||[],Se=(Z==null?void 0:Z.data)||[],tt=(oe==null?void 0:oe.data)||[],Ke=b.useMemo(()=>aL(le==null?void 0:le.data),[le==null?void 0:le.data]),pn=(te,Le)=>o?te==="service"?Ke.serviceWarnings.has(Le):te==="credential"?Ke.credentialWarnings.has(Le):Ke.playbookWarnings.has(Le):!0,zn=Ce.filter(te=>{var Rt;if(!pn("service",te.id)||n==="api-key"||n==="playbook")return!1;const Le=te.name.toLowerCase().includes(e.toLowerCase())||((Rt=te.description)==null?void 0:Rt.toLowerCase().includes(e.toLowerCase())),jt=!n||n==="all"||te.type===n;return Le&&jt}),G=Se.filter(te=>!pn("credential",te.id)||n&&n!=="all"&&n!=="api-key"?!1:te.label.toLowerCase().includes(e.toLowerCase())),ae=tt.filter(te=>!pn("playbook",te.id)||n&&n!=="all"&&n!=="playbook"?!1:te.title.toLowerCase().includes(e.toLowerCase())||te.body.toLowerCase().includes(e.toLowerCase())),we=zn.length+G.length+ae.length;ne&&console.error("Services error:",ne),N&&console.error("Decks error:",N);const Ie=()=>{t(""),r(""),s(!1)},He=!!(e||n||o),sn=new Set(((V==null?void 0:V.credentials)??[]).map(te=>te.id)),er=new Set(((V==null?void 0:V.playbooks)??[]).map(te=>te.id)),Sn=(V==null?void 0:V.services)||[],Lr=(V==null?void 0:V.playbooks)||[],mr=te=>{u(te),f(!0)},Ot=te=>{C(te.id),S(!0)},tr=te=>{m(te.id),g(!0)},Mt=te=>{U(te)};if(ne||N){const te=(N instanceof Error?N.message:null)??(ne instanceof Error?ne.message:null)??"There was an error loading the application data.";return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:c.jsxs("div",{className:"text-center max-w-lg px-4",children:[c.jsx("h2",{className:"text-2xl font-bold text-red-400 mb-4",children:"Error Loading Data"}),c.jsx("p",{className:"text-gray-300 mb-2",children:"There was an error loading the application data."}),c.jsx("p",{className:"text-gray-400 text-sm mb-4",children:te}),c.jsxs("p",{className:"text-gray-500 text-xs mb-6",children:["Is the API running? Try ",c.jsx("code",{className:"text-gray-300",children:"agent-deck stop && agent-deck start"})]}),c.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 Y||W||re||Re?c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-900",children:c.jsxs("div",{className:"text-center",children:[c.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-yellow-400 mx-auto mb-4"}),c.jsx("p",{className:"text-gray-300",children:"Loading AgentDeck..."})]})}):c.jsxs("div",{className:"flex min-h-dvh flex-col overflow-x-hidden",onDrop:ce,onDragOver:te=>te.preventDefault(),style:{position:"relative",...L&&{background:"linear-gradient(to bottom right, #1a1a2e, #16213e, #0f3460)"}},children:[c.jsx("header",{className:"relative z-20 shrink-0 bg-black/30 backdrop-blur-md border-b border-white/10",children:c.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-4",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[c.jsx("img",{src:CV,alt:"Agent Deck Logo",className:"h-12 w-12 shrink-0 object-contain sm:h-16 sm:w-16"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("h1",{className:"text-xl font-bold bg-gradient-to-r from-yellow-400 to-yellow-600 bg-clip-text text-transparent sm:text-2xl",style:{background:"linear-gradient(to right, #C4B643, #D4C760)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"AgentDeck"}),c.jsx("p",{className:"text-xs sm:text-sm",style:{color:"#92E4DD"},children:"Build tool deck for your agent"})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3 sm:gap-6",children:[c.jsxs("div",{className:`flex items-center space-x-2 px-3 py-1 rounded-full border ${Q==="connected"?"bg-emerald-500/20 border-emerald-500/30":"bg-red-500/20 border-red-500/30"}`,children:[c.jsx("div",{className:`w-2 h-2 rounded-full animate-pulse ${Q==="connected"?"bg-emerald-400":"bg-red-400"}`}),c.jsx("button",{className:`text-sm hover:underline cursor-pointer ${Q==="connected"?"text-emerald-300":"text-red-300"}`,"data-testid":"button-copy-mcp-url",onClick:()=>{navigator.clipboard.writeText("http://localhost:3001/mcp").then(()=>{O({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"})]}),c.jsx(Fz,{highlightDeckId:_??void 0}),c.jsx(OC,{href:"/playbook-patches",children:c.jsxs(fe,{variant:"outline",size:"sm",className:"relative border-white/20 bg-white/5 text-[#E8F6F4]",children:[c.jsx($M,{className:"mr-2 h-4 w-4"}),"Review",B.length>0&&c.jsx("span",{className:"ml-2 rounded-full bg-amber-500 px-2 py-0.5 text-xs font-semibold text-black",children:B.length})]})})]})]})})}),L&&c.jsx("div",{className:"fixed inset-0 pointer-events-none z-50 flex items-center justify-center",children:c.jsxs("div",{className:"bg-red-500/20 border-2 border-dashed border-red-500/50 rounded-lg p-8 text-center",children:[c.jsx("div",{className:"text-red-400 text-lg font-bold mb-2",children:"Drop to Remove"}),c.jsx("div",{className:"text-red-300 text-sm",children:"Release to remove card from deck"})]})}),c.jsx("main",{className:"container mx-auto flex min-h-0 flex-1 flex-col px-4 py-4 sm:py-6",children:c.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-4 sm:gap-6 xl:min-h-0 xl:flex-1 xl:grid-cols-4 xl:overflow-hidden",children:[c.jsxs("div",{className:"min-w-0 space-y-4 sm:space-y-6 xl:col-span-1 xl:min-h-0 xl:overflow-y-auto",children:[c.jsx("div",{className:"panel-surface h-64 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80",children:c.jsx(EF,{decks:M,editingDeckId:_,onSelectDeck:E,isLoading:W})}),c.jsxs("div",{className:"panel-surface p-4",children:[c.jsxs("h2",{className:"text-lg font-bold mb-3 flex items-center",children:[c.jsx(NE,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),c.jsx("span",{style:{color:"#92E4DD"},children:"Add Cards"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Zr}`,style:Qr(vn),onClick:()=>a(!0),"data-testid":"button-register-mcp",children:[c.jsx(uf,{className:"w-3 h-3 mr-2"}),"Register MCP"]}),c.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Zr}`,style:Qr(Pn),onClick:()=>h(!0),"data-testid":"button-register-api-key",children:[c.jsx(Sg,{className:"w-3 h-3 mr-2"}),"Register API key"]}),c.jsxs(fe,{variant:"ghost",className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Zr}`,style:Qr(_r),onClick:()=>w(!0),"data-testid":"button-register-playbook",children:[c.jsx(Mv,{className:"w-3 h-3 mr-2"}),"Register Playbook"]})]})]})]}),c.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:gap-6 xl:col-span-3 xl:h-full xl:min-h-0",children:[c.jsx("div",{className:"panel-surface h-64 shrink-0 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80",children:V?c.jsx("div",{className:"h-full",children:c.jsx(EL,{deck:V,services:Sn,credentials:V.credentials??[],playbooks:Lr,allServices:Ce,collectionWarnings:Ke,onDrop:pe,onDragStart:R,onCredentialDragStart:D,onPlaybookDragStart:K,onDragEnd:X,onCardClick:mr,onPlaybookClick:Ot,onCredentialClick:tr})}):c.jsxs("div",{className:"text-center h-full flex flex-col justify-center",children:[c.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:c.jsx(cf,{className:"w-6 h-6 text-yellow-400"})}),c.jsx("h3",{className:"text-lg font-bold mb-2",style:{color:"#92E4DD"},children:"No deck selected"}),c.jsx("p",{className:"text-gray-300 mb-4 text-sm",children:"Create a deck or select one from the sidebar to edit its cards."}),c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsxs(fe,{onClick:()=>{const te=document.querySelector('[data-testid="create-deck-button"]');te&&te.click()},className:"border text-sm py-2",style:{background:"#C4B643",borderColor:"#C4B643",color:"black"},children:[c.jsx(ni,{className:"w-4 h-4 mr-2"}),"Create New Deck"]}),c.jsxs(fe,{variant:"outline",className:"border-white/20 text-white hover:bg-white/10 text-sm py-2",onClick:()=>{const te=document.querySelector('[data-testid="deck-management-panel"]');te&&te.scrollIntoView({behavior:"smooth"})},children:[c.jsx(cf,{className:"w-4 h-4 mr-2"}),"Manage Decks"]})]})]})}),c.jsxs("div",{className:"panel-surface flex min-h-[20rem] flex-col overflow-hidden p-4 min-w-0 sm:min-h-[24rem] xl:min-h-0 xl:flex-1","data-testid":"collection-panel",children:[c.jsxs("div",{className:"mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2",children:[c.jsxs("h2",{className:"text-lg font-bold flex items-center",children:[c.jsx(IM,{className:"w-4 h-4 mr-2",style:{color:"#92E4DD"}}),c.jsx("span",{style:{color:"#92E4DD"},children:"My Collection"}),c.jsxs("span",{className:"ml-3 text-sm font-normal text-gray-400",children:["(",we," cards)"]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:J,disabled:$,title:"Export all MCP, playbooks, and decks","data-testid":"button-export-all",children:[c.jsx(RE,{className:"w-3 h-3 mr-1"}),$?"Exporting…":"Export all"]}),c.jsxs(fe,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:()=>P(!0),title:"Import a bundle file","data-testid":"button-import-bundle",children:[c.jsx(DM,{className:"w-3 h-3 mr-1"}),"Import"]}),c.jsxs("div",{className:"relative",children:[c.jsx($E,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),c.jsx(Xe,{placeholder:"Search...",value:e,onChange:te=>t(te.target.value),className:"h-8 w-36 pl-8 text-sm bg-white/10 border-white/20 text-white placeholder-gray-400 sm:w-48","data-testid":"input-search"})]}),c.jsxs(bV,{value:n||"all",onValueChange:te=>r(te==="all"?"":te),children:[c.jsxs(LT,{className:"w-[7.5rem] h-8 bg-white/10 border-white/20 text-white text-xs shrink-0","data-testid":"select-type",children:[c.jsx(RM,{className:"w-3 h-3 mr-1 shrink-0"}),c.jsx(kV,{placeholder:"Type"})]}),c.jsxs(UT,{children:[c.jsx(Bi,{value:"all",children:"All"}),c.jsx(Bi,{value:"mcp",children:"MCP"}),c.jsx(Bi,{value:"local-mcp",children:"Local MCP"}),c.jsx(Bi,{value:"api-key",children:"API Key"}),c.jsx(Bi,{value:"playbook",children:"Playbook"})]})]}),(e||n||o)&&c.jsx(fe,{size:"sm",variant:"outline",className:"h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10",onClick:Ie,title:"Clear all filters",children:"Clear"})]})]}),Ke.total>0&&c.jsx("button",{type:"button",onClick:()=>s(te=>!te),className:`mb-3 w-full shrink-0 rounded-lg border px-3 py-2 text-left text-sm transition-colors ${o?"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:c.jsxs("span",{className:"flex items-start gap-2",children:[c.jsx(jr,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-300"}),c.jsx("span",{children:o?c.jsxs(c.Fragment,{children:["Showing ",c.jsx("strong",{children:we})," card",we===1?"":"s"," needing attention.",c.jsx("span",{className:"text-amber-200/80",children:" Click to show all cards."})]}):c.jsxs(c.Fragment,{children:[c.jsx("strong",{children:Ke.total})," card",Ke.total===1?"":"s"," need attention",Ke.byKind.oauth_expired+Ke.byKind.oauth_required>0&&c.jsxs(c.Fragment,{children:[" ","(",Ke.byKind.oauth_expired+Ke.byKind.oauth_required," ","OAuth)"]}),". ",c.jsx("span",{className:"text-amber-200/80",children:"Click to filter."})]})})]})}),c.jsx("div",{className:"min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-1 py-2",children:Y||re||Re?c.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12",children:Array.from({length:10}).map((te,Le)=>c.jsx("div",{className:"animate-pulse",children:c.jsx("div",{className:"bg-white/10 rounded-lg w-32 h-48 aspect-[2/3]"})},Le))}):we===0?c.jsxs("div",{className:"text-center py-12",children:[c.jsx("div",{className:"text-gray-400 mb-4",children:c.jsx("i",{className:"fas fa-layer-group text-4xl"})}),c.jsx("h3",{className:"text-lg font-semibold text-gray-300 mb-2",children:"No cards yet"}),c.jsx("p",{className:"text-gray-400 text-sm mb-4",children:He?o?"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"}),!He&&c.jsxs("div",{className:"flex gap-3 justify-center",children:[c.jsxs(fe,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Zr}`,style:Qr(vn),onClick:()=>a(!0),"data-testid":"button-register-mcp-empty",children:[c.jsx(uf,{className:"w-3 h-3 mr-1"}),"Register MCP"]}),c.jsxs(fe,{variant:"ghost",size:"sm",className:`border-2 hover:opacity-90 ${Zr}`,style:Qr(Pn),onClick:()=>h(!0),"data-testid":"button-register-api-key-empty",children:[c.jsx(Sg,{className:"w-3 h-3 mr-1"}),"Register API key"]})]})]}):c.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:[ae.map((te,Le)=>c.jsx("div",{className:"relative group",style:{zIndex:I===te.id?999999:we-Le},children:c.jsx(gL,{playbook:te,isInActiveDeck:er.has(te.id),activeDeck:V??void 0,isInCollection:!0,onDragStart:K,onDragEnd:X,onCardClick:Ot,onMouseEnter:()=>Mt(te.id),onMouseLeave:()=>Mt(null),warnings:Ke.playbookWarnings.get(te.id)})},te.id)),G.map((te,Le)=>c.jsx("div",{className:"relative group",style:{zIndex:I===te.id?999999:we-ae.length-Le},children:c.jsx(pL,{credential:te,isInActiveDeck:sn.has(te.id),activeDeck:V??void 0,isInCollection:!0,onDragStart:D,onDragEnd:X,onMouseEnter:()=>Mt(te.id),onMouseLeave:()=>Mt(null),onCardClick:tr,warnings:Ke.credentialWarnings.get(te.id)})},te.id)),zn.map((te,Le)=>{var jt;return c.jsx("div",{className:"relative group",style:{zIndex:I===te.id?999999:we-ae.length-G.length-Le},children:c.jsx(dL,{service:te,onDragStart:R,onDragEnd:X,isInActiveDeck:((jt=V==null?void 0:V.services)==null?void 0:jt.some(Rt=>Rt.id===te.id))||!1,onCardClick:mr,isInCollection:!0,onMouseEnter:()=>Mt(te.id),onMouseLeave:()=>Mt(null),activeDeck:V??void 0,warnings:Ke.serviceWarnings.get(te.id)})},te.id)})]})})]})]})]})}),c.jsxs("div",{className:"fixed inset-0 pointer-events-none z-0 overflow-hidden",children:[c.jsx("div",{className:"absolute top-20 left-20",children:c.jsx("div",{className:"h-96 w-96 rounded-full bg-cyan-500/10 blur-3xl animate-orb-drift-1"})}),c.jsx("div",{className:"absolute bottom-20 right-20",children:c.jsx("div",{className:"h-96 w-96 rounded-full bg-pink-500/10 blur-3xl animate-orb-drift-2"})}),c.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:c.jsx("div",{className:"h-96 w-96 rounded-full bg-purple-500/5 blur-3xl animate-orb-drift-3"})})]}),c.jsx(_F,{type:"mcp",open:i,onOpenChange:a}),c.jsx(qq,{service:l,isOpen:d,onClose:()=>f(!1)}),c.jsx(NF,{open:p,onOpenChange:h}),c.jsx(AF,{credentialId:y,open:x,onOpenChange:g}),c.jsx(jF,{open:v,onOpenChange:w}),c.jsx(IF,{playbookId:k,open:j,onOpenChange:S}),c.jsx(Vq,{open:A,onOpenChange:P})]})}const Go=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:je("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Go.displayName="Card";const Ws=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:je("flex flex-col space-y-1.5 p-6",e),...t}));Ws.displayName="CardHeader";const Ks=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:je("text-2xl font-semibold leading-none tracking-tight",e),...t}));Ks.displayName="CardTitle";const Cd=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:je("text-sm text-muted-foreground",e),...t}));Cd.displayName="CardDescription";const Jo=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:je("p-6 pt-0",e),...t}));Jo.displayName="CardContent";const NV=b.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:je("flex items-center p-6 pt-0",e),...t}));NV.displayName="CardFooter";function jV(){return c.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gray-50",children:c.jsx(Go,{className:"w-full max-w-md mx-4",children:c.jsxs(Jo,{className:"pt-6",children:[c.jsxs("div",{className:"flex mb-4 gap-2",children:[c.jsx(PE,{className:"h-8 w-8 text-red-500"}),c.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"404 Page Not Found"})]}),c.jsx("p",{className:"mt-4 text-sm text-gray-600",children:"Did you forget to add the page to the router?"})]})})})}function PV(){const[e]=zA(),[t,n]=b.useState("loading"),[r,o]=b.useState("Authenticating...");return b.useEffect(()=>{(async()=>{try{const i=new URL(window.location.href),a=i.searchParams.get("success"),l=i.searchParams.get("error"),u=i.searchParams.get("serviceId");a==="true"?(n("success"),o("Authentication successful! This window will close automatically."),window.opener&&!window.opener.closed&&window.opener.postMessage({type:nT,serviceId:u??void 0},window.location.origin),setTimeout(()=>{window.close()},2e3)):a==="false"?(n("error"),o(`OAuth Error: ${l||"Authentication failed"}`)):(n("error"),o("Invalid OAuth callback - please try again"))}catch(i){n("error"),o(i instanceof Error?i.message:"Authentication failed")}})()},[e]),c.jsx("div",{className:"flex items-center justify-center min-h-screen bg-background",children:c.jsxs("div",{className:"text-center space-y-4",children:[t==="loading"&&c.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto"}),t==="success"&&c.jsx("div",{className:"text-green-500 text-4xl",children:"✓"}),t==="error"&&c.jsx("div",{className:"text-red-500 text-4xl",children:"✗"}),c.jsx("h1",{className:"text-xl font-semibold",children:r}),t==="error"&&c.jsx("button",{onClick:()=>window.close(),className:"px-4 py-2 bg-primary text-primary-foreground rounded hover:bg-primary/90",children:"Close Window"})]})})}function la(e){const t=()=>{throw new Error(`Invalid url to pass to open(): ${e}`)};let n;try{n=new URL(e)}catch{t()}return n.protocol!=="https:"&&n.protocol!=="http:"&&t(),n.hostname!==encodeURIComponent(n.hostname)&&t(),n.username&&(n.username=encodeURIComponent(n.username)),n.password&&(n.password=encodeURIComponent(n.password)),n.pathname=n.pathname.slice(0,1)+encodeURIComponent(n.pathname.slice(1)).replace(/%2f/ig,"/"),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(TV).join("&"),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}function TV([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:""}`}var n1=class{constructor(e,t={}){lo(this,"serverUrl");lo(this,"storageKeyPrefix");lo(this,"serverUrlHash");lo(this,"clientName");lo(this,"clientUri");lo(this,"callbackUrl");lo(this,"preventAutoAuth");lo(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=la(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 la(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(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,n),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(n){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,n),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(),n=`${this.storageKeyPrefix}:state_${t}`,r={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(n,JSON.stringify(r)),e.searchParams.set("state",t);const o=e.toString(),s=la(o);return localStorage.setItem(this.getKey("last_auth_url"),s),s}async redirectToAuthorization(e){if(this.preventAutoAuth)return;const t=await this.prepareAuthorizationUrl(e),n="width=600,height=700,resizable=yes,scrollbars=yes,status=yes";try{const r=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,r),!r||r.closed||typeof r.closed>"u"?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(r.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(r){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,r)}}getLastAttemptedAuthUrl(){const e=localStorage.getItem(this.getKey("last_auth_url"));return e?la(e):null}clearStorage(){const e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[];let r=0;for(let s=0;s<localStorage.length;s++){const i=localStorage.key(s);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{const a=localStorage.getItem(i);a&&JSON.parse(a).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(a){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,a)}}}return[...new Set(n)].forEach(s=>{localStorage.removeItem(s),r++}),r}hashString(e){let t=0;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}};const RV=Object.freeze({status:"aborted"});function ee(e,t,n){function r(a,l){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,l);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=l}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var l;const u=n!=null&&n.Parent?new s:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var l,u;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class Ac extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const qT={};function Ps(e){return qT}function $V(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function IV(e,t){return typeof t=="bigint"?t.toString():t}function j0(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function P0(e){return e==null}function T0(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function AV(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}function ft(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Ah(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pl(e){return JSON.stringify(e)}const VT=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Cf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const OV=j0(()=>{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 Ef(e){if(Cf(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Cf(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const MV=new Set(["string","number","symbol"]);function ru(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Oi(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function ye(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 DV(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const LV={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 zV(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return Oi(e,{...e._zod.def,shape:n,checks:[]})}function FV(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return Oi(e,{...e._zod.def,shape:n,checks:[]})}function UV(e,t){if(!Ef(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Ah(this,"shape",r),r},checks:[]};return Oi(e,n)}function qV(e,t){return Oi(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ah(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function VV(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)o[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return Oi(t,{...t._zod.def,shape:o,checks:[]})}function HV(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return Oi(t,{...t._zod.def,shape:o,checks:[]})}function oc(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function ri(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ku(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ts(e,t,n){var o,s,i,a,l,u;const r={...e,path:e.path??[]};if(!e.message){const d=Ku((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??Ku((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Ku((l=n.customError)==null?void 0:l.call(n,e))??Ku((u=n.localeError)==null?void 0:u.call(n,e))??"Invalid input";r.message=d}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function R0(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Oc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const HT=(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,IV,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},BT=ee("$ZodError",HT),WT=ee("$ZodError",HT,{Parent:Error});function BV(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function WV(e,t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(n(i));else{let a=r,l=0;for(;l<i.path.length;){const u=i.path[l];l===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(i))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return o(e),r}const KV=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Ac;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(l=>Ts(l,s,Ps())));throw VT(a,o==null?void 0:o.callee),a}return i.value},ZV=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(l=>Ts(l,s,Ps())));throw VT(a,o==null?void 0:o.callee),a}return i.value},KT=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Ac;return s.issues.length?{success:!1,error:new(e??BT)(s.issues.map(i=>Ts(i,o,Ps())))}:{success:!0,data:s.value}},ZT=KT(WT),QT=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ts(i,o,Ps())))}:{success:!0,data:s.value}},QV=QT(WT),GV=/^[cC][^\s-]{8,}$/,JV=/^[0-9a-z]+$/,YV=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,XV=/^[0-9a-vA-V]{20}$/,eH=/^[A-Za-z0-9]{27}$/,tH=/^[a-zA-Z0-9_-]{21}$/,nH=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rH=/^([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})$/,r1=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)$/,oH=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,sH="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function iH(){return new RegExp(sH,"u")}const aH=/^(?:(?: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])$/,lH=/^(([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})$/,cH=/^((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])$/,uH=/^(([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])$/,dH=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,GT=/^[A-Za-z0-9_-]*$/,fH=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,hH=/^\+(?:[0-9]){6,14}[0-9]$/,JT="(?:(?:\\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])))",pH=new RegExp(`^${JT}$`);function YT(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 mH(e){return new RegExp(`^${YT(e)}$`)}function gH(e){const t=YT({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${JT}T(?:${r})$`)}const yH=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}$`)},vH=/^\d+$/,xH=/^-?\d+(?:\.\d+)?/i,wH=/true|false/i,bH=/null/i,kH=/^[^A-Z]*$/,_H=/^[^a-z]*$/,Ln=ee("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),XT={number:"number",bigint:"bigint",object:"date"},e2=ee("$ZodCheckLessThan",(e,t)=>{Ln.init(e,t);const n=XT[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),t2=ee("$ZodCheckGreaterThan",(e,t)=>{Ln.init(e,t);const n=XT[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),SH=ee("$ZodCheckMultipleOf",(e,t)=>{Ln.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):AV(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),CH=ee("$ZodCheckNumberFormat",(e,t)=>{var i;Ln.init(e,t),t.format=t.format||"float64";const n=(i=t.format)==null?void 0:i.includes("int"),r=n?"int":"number",[o,s]=LV[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=vH)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inst:e})}}),EH=ee("$ZodCheckMaxLength",(e,t)=>{var n;Ln.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!P0(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=R0(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),NH=ee("$ZodCheckMinLength",(e,t)=>{var n;Ln.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!P0(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=R0(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),jH=ee("$ZodCheckLengthEquals",(e,t)=>{var n;Ln.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!P0(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=R0(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Oh=ee("$ZodCheckStringFormat",(e,t)=>{var n,r;Ln.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),PH=ee("$ZodCheckRegex",(e,t)=>{Oh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),TH=ee("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kH),Oh.init(e,t)}),RH=ee("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=_H),Oh.init(e,t)}),$H=ee("$ZodCheckIncludes",(e,t)=>{Ln.init(e,t);const n=ru(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),IH=ee("$ZodCheckStartsWith",(e,t)=>{Ln.init(e,t);const n=new RegExp(`^${ru(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),AH=ee("$ZodCheckEndsWith",(e,t)=>{Ln.init(e,t);const n=new RegExp(`.*${ru(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),OH=ee("$ZodCheckOverwrite",(e,t)=>{Ln.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class MH{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 r=t.split(`
423
- `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
424
- `))}}const DH={major:4,minor:0,patch:0},it=ee("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=DH;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const i of s._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,l)=>{let u=oc(i),d;for(const f of a){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,h=f._zod.check(i);if(h instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Ac;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,i.issues.length!==p&&(u||(u=oc(i,p)))});else{if(i.issues.length===p)continue;u||(u=oc(i,p))}}return d?d.then(()=>i):i};e._zod.run=(i,a)=>{const l=e._zod.parse(i,a);if(l instanceof Promise){if(a.async===!1)throw new Ac;return l.then(u=>s(u,r,a))}return s(l,r,a)}}e["~standard"]={validate:s=>{var i;try{const a=ZT(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return QV(e,s).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),$0=ee("$ZodString",(e,t)=>{var n;it.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??yH(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),yt=ee("$ZodStringFormat",(e,t)=>{Oh.init(e,t),$0.init(e,t)}),LH=ee("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rH),yt.init(e,t)}),zH=ee("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=r1(r))}else t.pattern??(t.pattern=r1());yt.init(e,t)}),FH=ee("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=oH),yt.init(e,t)}),UH=ee("$ZodURL",(e,t)=>{yt.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),s=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:fH.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&s.endsWith("/")?n.value=s.slice(0,-1):n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),qH=ee("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=iH()),yt.init(e,t)}),VH=ee("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=tH),yt.init(e,t)}),HH=ee("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=GV),yt.init(e,t)}),BH=ee("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=JV),yt.init(e,t)}),WH=ee("$ZodULID",(e,t)=>{t.pattern??(t.pattern=YV),yt.init(e,t)}),KH=ee("$ZodXID",(e,t)=>{t.pattern??(t.pattern=XV),yt.init(e,t)}),ZH=ee("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=eH),yt.init(e,t)}),QH=ee("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=gH(t)),yt.init(e,t)}),GH=ee("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=pH),yt.init(e,t)}),JH=ee("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=mH(t)),yt.init(e,t)}),YH=ee("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=nH),yt.init(e,t)}),XH=ee("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=aH),yt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),eB=ee("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lH),yt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),tB=ee("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cH),yt.init(e,t)}),nB=ee("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=uH),yt.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function n2(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const rB=ee("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=dH),yt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{n2(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function oB(e){if(!GT.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return n2(n)}const sB=ee("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=GT),yt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{oB(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),iB=ee("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hH),yt.init(e,t)});function aB(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const lB=ee("$ZodJWT",(e,t)=>{yt.init(e,t),e._zod.check=n=>{aB(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),r2=ee("$ZodNumber",(e,t)=>{it.init(e,t),e._zod.pattern=e._zod.bag.pattern??xH,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),cB=ee("$ZodNumber",(e,t)=>{CH.init(e,t),r2.init(e,t)}),uB=ee("$ZodBoolean",(e,t)=>{it.init(e,t),e._zod.pattern=wH,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),dB=ee("$ZodNull",(e,t)=>{it.init(e,t),e._zod.pattern=bH,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),fB=ee("$ZodAny",(e,t)=>{it.init(e,t),e._zod.parse=n=>n}),hB=ee("$ZodUnknown",(e,t)=>{it.init(e,t),e._zod.parse=n=>n}),pB=ee("$ZodNever",(e,t)=>{it.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function o1(e,t,n){e.issues.length&&t.issues.push(...ri(n,e.issues)),t.value[n]=e.value}const mB=ee("$ZodArray",(e,t)=>{it.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(u=>o1(u,n,i))):o1(l,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function Zu(e,t,n){e.issues.length&&t.issues.push(...ri(n,e.issues)),t.value[n]=e.value}function s1(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...ri(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const gB=ee("$ZodObject",(e,t)=>{it.init(e,t);const n=j0(()=>{const f=Object.keys(t.shape);for(const h of f)if(!(t.shape[h]instanceof it))throw new Error(`Invalid element at key "${h}": expected a Zod schema`);const p=DV(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(p)}});ft(e._zod,"propValues",()=>{const f=t.shape,p={};for(const h in f){const y=f[h]._zod;if(y.values){p[h]??(p[h]=new Set);for(const m of y.values)p[h].add(m)}}return p});const r=f=>{const p=new MH(["shape","payload","ctx"]),h=n.value,y=v=>{const w=Pl(v);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};p.write("const input = payload.value;");const m=Object.create(null);let x=0;for(const v of h.keys)m[v]=`key_${x++}`;p.write("const newResult = {}");for(const v of h.keys)if(h.optionalKeys.has(v)){const w=m[v];p.write(`const ${w} = ${y(v)};`);const k=Pl(v);p.write(`
425
- if (${w}.issues.length) {
426
- if (input[${k}] === undefined) {
427
- if (${k} in input) {
428
- newResult[${k}] = undefined;
429
- }
430
- } else {
431
- payload.issues = payload.issues.concat(
432
- ${w}.issues.map((iss) => ({
433
- ...iss,
434
- path: iss.path ? [${k}, ...iss.path] : [${k}],
435
- }))
436
- );
437
- }
438
- } else if (${w}.value === undefined) {
439
- if (${k} in input) newResult[${k}] = undefined;
440
- } else {
441
- newResult[${k}] = ${w}.value;
442
- }
443
- `)}else{const w=m[v];p.write(`const ${w} = ${y(v)};`),p.write(`
444
- if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
445
- ...iss,
446
- path: iss.path ? [${Pl(v)}, ...iss.path] : [${Pl(v)}]
447
- })));`),p.write(`newResult[${Pl(v)}] = ${w}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");const g=p.compile();return(v,w)=>g(f,v,w)};let o;const s=Cf,i=!qT.jitless,l=i&&OV.value,u=t.catchall;let d;e._zod.parse=(f,p)=>{d??(d=n.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;const y=[];if(i&&l&&(p==null?void 0:p.async)===!1&&p.jitless!==!0)o||(o=r(t.shape)),f=o(f,p);else{f.value={};const w=d.shape;for(const k of d.keys){const C=w[k],j=C._zod.run({value:h[k],issues:[]},p),S=C._zod.optin==="optional"&&C._zod.optout==="optional";j instanceof Promise?y.push(j.then(A=>S?s1(A,f,k,h):Zu(A,f,k))):S?s1(j,f,k,h):Zu(j,f,k)}}if(!u)return y.length?Promise.all(y).then(()=>f):f;const m=[],x=d.keySet,g=u._zod,v=g.def.type;for(const w of Object.keys(h)){if(x.has(w))continue;if(v==="never"){m.push(w);continue}const k=g.run({value:h[w],issues:[]},p);k instanceof Promise?y.push(k.then(C=>Zu(C,f,w))):Zu(k,f,w)}return m.length&&f.issues.push({code:"unrecognized_keys",keys:m,input:h,inst:e}),y.length?Promise.all(y).then(()=>f):f}});function i1(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>Ts(s,r,Ps())))}),t}const o2=ee("$ZodUnion",(e,t)=>{it.init(e,t),ft(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),ft(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ft(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),ft(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>T0(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>i1(i,n,e,r)):i1(s,n,e,r)}}),yB=ee("$ZodDiscriminatedUnion",(e,t)=>{o2.init(e,t);const n=e._zod.parse;ft(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,l]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of l)o[a].add(u)}}return o});const r=j0(()=>{const o=t.options,s=new Map;for(const i of o){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 l of a){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!Cf(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),vB=ee("$ZodIntersection",(e,t)=>{it.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,u])=>a1(n,l,u)):a1(n,s,i)}});function Yg(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(Ef(e)&&Ef(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=Yg(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=Yg(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function a1(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),oc(e))return e;const r=Yg(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const xB=ee("$ZodRecord",(e,t)=>{it.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Ef(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const l of i)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const u=t.valueType._zod.run({value:o[l],issues:[]},r);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&n.issues.push(...ri(l,d.issues)),n.value[l]=d.value})):(u.issues.length&&n.issues.push(...ri(l,u.issues)),n.value[l]=u.value)}let a;for(const l in o)i.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Ts(u,r,Ps())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[i],issues:[]},r);l instanceof Promise?s.push(l.then(u=>{u.issues.length&&n.issues.push(...ri(i,u.issues)),n.value[a.value]=u.value})):(l.issues.length&&n.issues.push(...ri(i,l.issues)),n.value[a.value]=l.value)}}return s.length?Promise.all(s).then(()=>n):n}}),wB=ee("$ZodEnum",(e,t)=>{it.init(e,t);const n=$V(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>MV.has(typeof r)).map(r=>typeof r=="string"?ru(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),bB=ee("$ZodLiteral",(e,t)=>{it.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ru(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),kB=ee("$ZodTransform",(e,t)=>{it.init(e,t),e._zod.parse=(n,r)=>{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Ac;return n.value=o,n}}),_B=ee("$ZodOptional",(e,t)=>{it.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ft(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ft(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${T0(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),SB=ee("$ZodNullable",(e,t)=>{it.init(e,t),ft(e._zod,"optin",()=>t.innerType._zod.optin),ft(e._zod,"optout",()=>t.innerType._zod.optout),ft(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${T0(n.source)}|null)$`):void 0}),ft(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),CB=ee("$ZodDefault",(e,t)=>{it.init(e,t),e._zod.optin="optional",ft(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>l1(s,t)):l1(o,t)}});function l1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const EB=ee("$ZodPrefault",(e,t)=>{it.init(e,t),e._zod.optin="optional",ft(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),NB=ee("$ZodNonOptional",(e,t)=>{it.init(e,t),ft(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>c1(s,e)):c1(o,e)}});function c1(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 jB=ee("$ZodCatch",(e,t)=>{it.init(e,t),e._zod.optin="optional",ft(e._zod,"optout",()=>t.innerType._zod.optout),ft(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Ts(i,r,Ps()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Ts(s,r,Ps()))},input:n.value}),n.issues=[]),n)}}),PB=ee("$ZodPipe",(e,t)=>{it.init(e,t),ft(e._zod,"values",()=>t.in._zod.values),ft(e._zod,"optin",()=>t.in._zod.optin),ft(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>u1(s,t,r)):u1(o,t,r)}});function u1(e,t,n){return oc(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const TB=ee("$ZodReadonly",(e,t)=>{it.init(e,t),ft(e._zod,"propValues",()=>t.innerType._zod.propValues),ft(e._zod,"values",()=>t.innerType._zod.values),ft(e._zod,"optin",()=>t.innerType._zod.optin),ft(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(d1):d1(o)}});function d1(e){return e.value=Object.freeze(e.value),e}const RB=ee("$ZodCustom",(e,t)=>{Ln.init(e,t),it.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>f1(s,n,r,e));f1(o,n,r,e)}});function f1(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Oc(o))}}class $B{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function IB(){return new $B}const Qu=IB();function AB(e,t){return new e({type:"string",...ye(t)})}function OB(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function h1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function MB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function DB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function LB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function zB(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function s2(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function FB(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function UB(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function qB(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function VB(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function HB(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function BB(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function WB(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function KB(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function ZB(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function QB(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function GB(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function JB(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function YB(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function XB(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function eW(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function tW(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(t)})}function nW(e,t){return new e({type:"string",format:"date",check:"string_format",...ye(t)})}function rW(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function oW(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function sW(e,t){return new e({type:"number",checks:[],...ye(t)})}function iW(e,t){return new e({type:"number",coerce:!0,checks:[],...ye(t)})}function aW(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function lW(e,t){return new e({type:"boolean",...ye(t)})}function cW(e,t){return new e({type:"null",...ye(t)})}function uW(e){return new e({type:"any"})}function dW(e){return new e({type:"unknown"})}function fW(e,t){return new e({type:"never",...ye(t)})}function p1(e,t){return new e2({check:"less_than",...ye(t),value:e,inclusive:!1})}function tm(e,t){return new e2({check:"less_than",...ye(t),value:e,inclusive:!0})}function m1(e,t){return new t2({check:"greater_than",...ye(t),value:e,inclusive:!1})}function nm(e,t){return new t2({check:"greater_than",...ye(t),value:e,inclusive:!0})}function g1(e,t){return new SH({check:"multiple_of",...ye(t),value:e})}function i2(e,t){return new EH({check:"max_length",...ye(t),maximum:e})}function Nf(e,t){return new NH({check:"min_length",...ye(t),minimum:e})}function a2(e,t){return new jH({check:"length_equals",...ye(t),length:e})}function hW(e,t){return new PH({check:"string_format",format:"regex",...ye(t),pattern:e})}function pW(e){return new TH({check:"string_format",format:"lowercase",...ye(e)})}function mW(e){return new RH({check:"string_format",format:"uppercase",...ye(e)})}function gW(e,t){return new $H({check:"string_format",format:"includes",...ye(t),includes:e})}function yW(e,t){return new IH({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function vW(e,t){return new AH({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function ou(e){return new OH({check:"overwrite",tx:e})}function xW(e){return ou(t=>t.normalize(e))}function wW(){return ou(e=>e.trim())}function bW(){return ou(e=>e.toLowerCase())}function kW(){return ou(e=>e.toUpperCase())}function _W(e,t,n){return new e({type:"array",element:t,...ye(n)})}function SW(e,t,n){const r=ye(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function CW(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}const EW=ee("ZodISODateTime",(e,t)=>{QH.init(e,t),Ct.init(e,t)});function l2(e){return tW(EW,e)}const NW=ee("ZodISODate",(e,t)=>{GH.init(e,t),Ct.init(e,t)});function jW(e){return nW(NW,e)}const PW=ee("ZodISOTime",(e,t)=>{JH.init(e,t),Ct.init(e,t)});function TW(e){return rW(PW,e)}const RW=ee("ZodISODuration",(e,t)=>{YH.init(e,t),Ct.init(e,t)});function $W(e){return oW(RW,e)}const IW=(e,t)=>{BT.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>WV(e,n)},flatten:{value:n=>BV(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Mh=ee("ZodError",IW,{Parent:Error}),AW=KV(Mh),OW=ZV(Mh),MW=KT(Mh),DW=QT(Mh),vt=ee("ZodType",(e,t)=>(it.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>Oi(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>AW(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>MW(e,n,r),e.parseAsync=async(n,r)=>OW(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>DW(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(TK(n,r)),e.superRefine=n=>e.check(RK(n)),e.overwrite=n=>e.check(ou(n)),e.optional=()=>bt(e),e.nullable=()=>x1(e),e.nullish=()=>bt(x1(e)),e.nonoptional=n=>kK(e,n),e.array=()=>ue(e),e.or=n=>xt([e,n]),e.and=n=>A0(e,n),e.transform=n=>ey(e,p2(n)),e.default=n=>xK(e,n),e.prefault=n=>bK(e,n),e.catch=n=>SK(e,n),e.pipe=n=>ey(e,n),e.readonly=()=>NK(e),e.describe=n=>{const r=e.clone();return Qu.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Qu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Qu.get(e);const r=e.clone();return Qu.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),c2=ee("_ZodString",(e,t)=>{$0.init(e,t),vt.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(hW(...r)),e.includes=(...r)=>e.check(gW(...r)),e.startsWith=(...r)=>e.check(yW(...r)),e.endsWith=(...r)=>e.check(vW(...r)),e.min=(...r)=>e.check(Nf(...r)),e.max=(...r)=>e.check(i2(...r)),e.length=(...r)=>e.check(a2(...r)),e.nonempty=(...r)=>e.check(Nf(1,...r)),e.lowercase=r=>e.check(pW(r)),e.uppercase=r=>e.check(mW(r)),e.trim=()=>e.check(wW()),e.normalize=(...r)=>e.check(xW(...r)),e.toLowerCase=()=>e.check(bW()),e.toUpperCase=()=>e.check(kW())}),LW=ee("ZodString",(e,t)=>{$0.init(e,t),c2.init(e,t),e.email=n=>e.check(OB(zW,n)),e.url=n=>e.check(s2(u2,n)),e.jwt=n=>e.check(eW(tK,n)),e.emoji=n=>e.check(FB(UW,n)),e.guid=n=>e.check(h1(y1,n)),e.uuid=n=>e.check(MB(Gu,n)),e.uuidv4=n=>e.check(DB(Gu,n)),e.uuidv6=n=>e.check(LB(Gu,n)),e.uuidv7=n=>e.check(zB(Gu,n)),e.nanoid=n=>e.check(UB(qW,n)),e.guid=n=>e.check(h1(y1,n)),e.cuid=n=>e.check(qB(VW,n)),e.cuid2=n=>e.check(VB(HW,n)),e.ulid=n=>e.check(HB(BW,n)),e.base64=n=>e.check(JB(YW,n)),e.base64url=n=>e.check(YB(XW,n)),e.xid=n=>e.check(BB(WW,n)),e.ksuid=n=>e.check(WB(KW,n)),e.ipv4=n=>e.check(KB(ZW,n)),e.ipv6=n=>e.check(ZB(QW,n)),e.cidrv4=n=>e.check(QB(GW,n)),e.cidrv6=n=>e.check(GB(JW,n)),e.e164=n=>e.check(XB(eK,n)),e.datetime=n=>e.check(l2(n)),e.date=n=>e.check(jW(n)),e.time=n=>e.check(TW(n)),e.duration=n=>e.check($W(n))});function F(e){return AB(LW,e)}const Ct=ee("ZodStringFormat",(e,t)=>{yt.init(e,t),c2.init(e,t)}),zW=ee("ZodEmail",(e,t)=>{FH.init(e,t),Ct.init(e,t)}),y1=ee("ZodGUID",(e,t)=>{LH.init(e,t),Ct.init(e,t)}),Gu=ee("ZodUUID",(e,t)=>{zH.init(e,t),Ct.init(e,t)}),u2=ee("ZodURL",(e,t)=>{UH.init(e,t),Ct.init(e,t)});function FW(e){return s2(u2,e)}const UW=ee("ZodEmoji",(e,t)=>{qH.init(e,t),Ct.init(e,t)}),qW=ee("ZodNanoID",(e,t)=>{VH.init(e,t),Ct.init(e,t)}),VW=ee("ZodCUID",(e,t)=>{HH.init(e,t),Ct.init(e,t)}),HW=ee("ZodCUID2",(e,t)=>{BH.init(e,t),Ct.init(e,t)}),BW=ee("ZodULID",(e,t)=>{WH.init(e,t),Ct.init(e,t)}),WW=ee("ZodXID",(e,t)=>{KH.init(e,t),Ct.init(e,t)}),KW=ee("ZodKSUID",(e,t)=>{ZH.init(e,t),Ct.init(e,t)}),ZW=ee("ZodIPv4",(e,t)=>{XH.init(e,t),Ct.init(e,t)}),QW=ee("ZodIPv6",(e,t)=>{eB.init(e,t),Ct.init(e,t)}),GW=ee("ZodCIDRv4",(e,t)=>{tB.init(e,t),Ct.init(e,t)}),JW=ee("ZodCIDRv6",(e,t)=>{nB.init(e,t),Ct.init(e,t)}),YW=ee("ZodBase64",(e,t)=>{rB.init(e,t),Ct.init(e,t)}),XW=ee("ZodBase64URL",(e,t)=>{sB.init(e,t),Ct.init(e,t)}),eK=ee("ZodE164",(e,t)=>{iB.init(e,t),Ct.init(e,t)}),tK=ee("ZodJWT",(e,t)=>{lB.init(e,t),Ct.init(e,t)}),I0=ee("ZodNumber",(e,t)=>{r2.init(e,t),vt.init(e,t),e.gt=(r,o)=>e.check(m1(r,o)),e.gte=(r,o)=>e.check(nm(r,o)),e.min=(r,o)=>e.check(nm(r,o)),e.lt=(r,o)=>e.check(p1(r,o)),e.lte=(r,o)=>e.check(tm(r,o)),e.max=(r,o)=>e.check(tm(r,o)),e.int=r=>e.check(v1(r)),e.safe=r=>e.check(v1(r)),e.positive=r=>e.check(m1(0,r)),e.nonnegative=r=>e.check(nm(0,r)),e.negative=r=>e.check(p1(0,r)),e.nonpositive=r=>e.check(tm(0,r)),e.multipleOf=(r,o)=>e.check(g1(r,o)),e.step=(r,o)=>e.check(g1(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ge(e){return sW(I0,e)}const nK=ee("ZodNumberFormat",(e,t)=>{cB.init(e,t),I0.init(e,t)});function v1(e){return aW(nK,e)}const rK=ee("ZodBoolean",(e,t)=>{uB.init(e,t),vt.init(e,t)});function ut(e){return lW(rK,e)}const oK=ee("ZodNull",(e,t)=>{dB.init(e,t),vt.init(e,t)});function sK(e){return cW(oK,e)}const iK=ee("ZodAny",(e,t)=>{fB.init(e,t),vt.init(e,t)});function aK(){return uW(iK)}const lK=ee("ZodUnknown",(e,t)=>{hB.init(e,t),vt.init(e,t)});function _t(){return dW(lK)}const cK=ee("ZodNever",(e,t)=>{pB.init(e,t),vt.init(e,t)});function uK(e){return fW(cK,e)}const dK=ee("ZodArray",(e,t)=>{mB.init(e,t),vt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Nf(n,r)),e.nonempty=n=>e.check(Nf(1,n)),e.max=(n,r)=>e.check(i2(n,r)),e.length=(n,r)=>e.check(a2(n,r)),e.unwrap=()=>e.element});function ue(e,t){return _W(dK,e,t)}const d2=ee("ZodObject",(e,t)=>{gB.init(e,t),vt.init(e,t),ft(e,"shape",()=>t.shape),e.keyof=()=>Yn(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_t()}),e.loose=()=>e.clone({...e._zod.def,catchall:_t()}),e.strict=()=>e.clone({...e._zod.def,catchall:uK()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>UV(e,n),e.merge=n=>qV(e,n),e.pick=n=>zV(e,n),e.omit=n=>FV(e,n),e.partial=(...n)=>VV(m2,e,n[0]),e.required=(...n)=>HV(g2,e,n[0])});function de(e,t){const n={type:"object",get shape(){return Ah(this,"shape",{...e}),this.shape},...ye(t)};return new d2(n)}function Yt(e,t){return new d2({type:"object",get shape(){return Ah(this,"shape",{...e}),this.shape},catchall:_t(),...ye(t)})}const f2=ee("ZodUnion",(e,t)=>{o2.init(e,t),vt.init(e,t),e.options=t.options});function xt(e,t){return new f2({type:"union",options:e,...ye(t)})}const fK=ee("ZodDiscriminatedUnion",(e,t)=>{f2.init(e,t),yB.init(e,t)});function h2(e,t,n){return new fK({type:"union",options:t,discriminator:e,...ye(n)})}const hK=ee("ZodIntersection",(e,t)=>{vB.init(e,t),vt.init(e,t)});function A0(e,t){return new hK({type:"intersection",left:e,right:t})}const pK=ee("ZodRecord",(e,t)=>{xB.init(e,t),vt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function ht(e,t,n){return new pK({type:"record",keyType:e,valueType:t,...ye(n)})}const Xg=ee("ZodEnum",(e,t)=>{wB.init(e,t),vt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Xg({...t,checks:[],...ye(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Xg({...t,checks:[],...ye(o),entries:s})}});function Yn(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Xg({type:"enum",entries:n,...ye(t)})}const mK=ee("ZodLiteral",(e,t)=>{bB.init(e,t),vt.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 xe(e,t){return new mK({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const gK=ee("ZodTransform",(e,t)=>{kB.init(e,t),vt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=s=>{if(typeof s=="string")n.issues.push(Oc(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),n.issues.push(Oc(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function p2(e){return new gK({type:"transform",transform:e})}const m2=ee("ZodOptional",(e,t)=>{_B.init(e,t),vt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function bt(e){return new m2({type:"optional",innerType:e})}const yK=ee("ZodNullable",(e,t)=>{SB.init(e,t),vt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function x1(e){return new yK({type:"nullable",innerType:e})}const vK=ee("ZodDefault",(e,t)=>{CB.init(e,t),vt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xK(e,t){return new vK({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const wK=ee("ZodPrefault",(e,t)=>{EB.init(e,t),vt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function bK(e,t){return new wK({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const g2=ee("ZodNonOptional",(e,t)=>{NB.init(e,t),vt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kK(e,t){return new g2({type:"nonoptional",innerType:e,...ye(t)})}const _K=ee("ZodCatch",(e,t)=>{jB.init(e,t),vt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function SK(e,t){return new _K({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const CK=ee("ZodPipe",(e,t)=>{PB.init(e,t),vt.init(e,t),e.in=t.in,e.out=t.out});function ey(e,t){return new CK({type:"pipe",in:e,out:t})}const EK=ee("ZodReadonly",(e,t)=>{TB.init(e,t),vt.init(e,t)});function NK(e){return new EK({type:"readonly",innerType:e})}const y2=ee("ZodCustom",(e,t)=>{RB.init(e,t),vt.init(e,t)});function jK(e){const t=new Ln({check:"custom"});return t._zod.check=e,t}function PK(e,t){return SW(y2,e??(()=>!0),t)}function TK(e,t={}){return CW(y2,e,t)}function RK(e){const t=jK(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Oc(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Oc(o))}},e(n.value,n)));return t}function v2(e,t){return ey(p2(e),t)}const $K={custom:"custom"};function IK(e){return iW(I0,e)}const Dh="2025-11-25",AK=[Dh,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Zs="io.modelcontextprotocol/related-task",Lh="2.0",qt=PK(e=>e!==null&&(typeof e=="object"||typeof e=="function")),x2=xt([F(),Ge().int()]),w2=F();Yt({ttl:Ge().optional(),pollInterval:Ge().optional()});const OK=de({ttl:Ge().optional()}),MK=de({taskId:F()}),O0=Yt({progressToken:x2.optional(),[Zs]:MK.optional()}),Xn=de({_meta:O0.optional()}),su=Xn.extend({task:OK.optional()}),DK=e=>su.safeParse(e).success,rn=de({method:F(),params:Xn.loose().optional()}),hr=de({_meta:O0.optional()}),pr=de({method:F(),params:hr.loose().optional()}),on=Yt({_meta:O0.optional()}),zh=xt([F(),Ge().int()]),b2=de({jsonrpc:xe(Lh),id:zh,...rn.shape}).strict(),ty=e=>b2.safeParse(e).success,k2=de({jsonrpc:xe(Lh),...pr.shape}).strict(),LK=e=>k2.safeParse(e).success,M0=de({jsonrpc:xe(Lh),id:zh,result:on}).strict(),zl=e=>M0.safeParse(e).success;var $e;(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"})($e||($e={}));const D0=de({jsonrpc:xe(Lh),id:zh.optional(),error:de({code:Ge().int(),message:F(),data:_t().optional()})}).strict(),zK=e=>D0.safeParse(e).success,Ed=xt([b2,k2,M0,D0]);xt([M0,D0]);const ca=on.strict(),FK=hr.extend({requestId:zh.optional(),reason:F().optional()}),L0=pr.extend({method:xe("notifications/cancelled"),params:FK}),UK=de({src:F(),mimeType:F().optional(),sizes:ue(F()).optional(),theme:Yn(["light","dark"]).optional()}),iu=de({icons:ue(UK).optional()}),Ga=de({name:F(),title:F().optional()}),_2=Ga.extend({...Ga.shape,...iu.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),qK=A0(de({applyDefaults:ut().optional()}),ht(F(),_t())),VK=v2(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,A0(de({form:qK.optional(),url:qt.optional()}),ht(F(),_t()).optional())),HK=Yt({list:qt.optional(),cancel:qt.optional(),requests:Yt({sampling:Yt({createMessage:qt.optional()}).optional(),elicitation:Yt({create:qt.optional()}).optional()}).optional()}),BK=Yt({list:qt.optional(),cancel:qt.optional(),requests:Yt({tools:Yt({call:qt.optional()}).optional()}).optional()}),WK=de({experimental:ht(F(),qt).optional(),sampling:de({context:qt.optional(),tools:qt.optional()}).optional(),elicitation:VK.optional(),roots:de({listChanged:ut().optional()}).optional(),tasks:HK.optional(),extensions:ht(F(),qt).optional()}),KK=Xn.extend({protocolVersion:F(),capabilities:WK,clientInfo:_2}),ZK=rn.extend({method:xe("initialize"),params:KK}),QK=de({experimental:ht(F(),qt).optional(),logging:qt.optional(),completions:qt.optional(),prompts:de({listChanged:ut().optional()}).optional(),resources:de({subscribe:ut().optional(),listChanged:ut().optional()}).optional(),tools:de({listChanged:ut().optional()}).optional(),tasks:BK.optional(),extensions:ht(F(),qt).optional()}),S2=on.extend({protocolVersion:F(),capabilities:QK,serverInfo:_2,instructions:F().optional()}),C2=pr.extend({method:xe("notifications/initialized"),params:hr.optional()}),GK=e=>C2.safeParse(e).success,z0=rn.extend({method:xe("ping"),params:Xn.optional()}),JK=de({progress:Ge(),total:bt(Ge()),message:bt(F())}),YK=de({...hr.shape,...JK.shape,progressToken:x2}),F0=pr.extend({method:xe("notifications/progress"),params:YK}),XK=Xn.extend({cursor:w2.optional()}),au=rn.extend({params:XK.optional()}),lu=on.extend({nextCursor:w2.optional()}),e7=Yn(["working","input_required","completed","failed","cancelled"]),cu=de({taskId:F(),status:e7,ttl:xt([Ge(),sK()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:bt(Ge()),statusMessage:bt(F())}),Mc=on.extend({task:cu}),t7=hr.merge(cu),jf=pr.extend({method:xe("notifications/tasks/status"),params:t7}),U0=rn.extend({method:xe("tasks/get"),params:Xn.extend({taskId:F()})}),q0=on.merge(cu),V0=rn.extend({method:xe("tasks/result"),params:Xn.extend({taskId:F()})});on.loose();const H0=au.extend({method:xe("tasks/list")}),B0=lu.extend({tasks:ue(cu)}),W0=rn.extend({method:xe("tasks/cancel"),params:Xn.extend({taskId:F()})}),n7=on.merge(cu),E2=de({uri:F(),mimeType:bt(F()),_meta:ht(F(),_t()).optional()}),N2=E2.extend({text:F()}),K0=F().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),j2=E2.extend({blob:K0}),uu=Yn(["user","assistant"]),fl=de({audience:ue(uu).optional(),priority:Ge().min(0).max(1).optional(),lastModified:l2({offset:!0}).optional()}),P2=de({...Ga.shape,...iu.shape,uri:F(),description:bt(F()),mimeType:bt(F()),size:bt(Ge()),annotations:fl.optional(),_meta:bt(Yt({}))}),r7=de({...Ga.shape,...iu.shape,uriTemplate:F(),description:bt(F()),mimeType:bt(F()),annotations:fl.optional(),_meta:bt(Yt({}))}),o7=au.extend({method:xe("resources/list")}),Pf=lu.extend({resources:ue(P2)}),s7=au.extend({method:xe("resources/templates/list")}),T2=lu.extend({resourceTemplates:ue(r7)}),Z0=Xn.extend({uri:F()}),i7=Z0,a7=rn.extend({method:xe("resources/read"),params:i7}),Q0=on.extend({contents:ue(xt([N2,j2]))}),R2=pr.extend({method:xe("notifications/resources/list_changed"),params:hr.optional()}),l7=Z0,c7=rn.extend({method:xe("resources/subscribe"),params:l7}),u7=Z0,d7=rn.extend({method:xe("resources/unsubscribe"),params:u7}),f7=hr.extend({uri:F()}),h7=pr.extend({method:xe("notifications/resources/updated"),params:f7}),p7=de({name:F(),description:bt(F()),required:bt(ut())}),m7=de({...Ga.shape,...iu.shape,description:bt(F()),arguments:bt(ue(p7)),_meta:bt(Yt({}))}),g7=au.extend({method:xe("prompts/list")}),Tf=lu.extend({prompts:ue(m7)}),y7=Xn.extend({name:F(),arguments:ht(F(),F()).optional()}),v7=rn.extend({method:xe("prompts/get"),params:y7}),G0=de({type:xe("text"),text:F(),annotations:fl.optional(),_meta:ht(F(),_t()).optional()}),J0=de({type:xe("image"),data:K0,mimeType:F(),annotations:fl.optional(),_meta:ht(F(),_t()).optional()}),Y0=de({type:xe("audio"),data:K0,mimeType:F(),annotations:fl.optional(),_meta:ht(F(),_t()).optional()}),x7=de({type:xe("tool_use"),name:F(),id:F(),input:ht(F(),_t()),_meta:ht(F(),_t()).optional()}),w7=de({type:xe("resource"),resource:xt([N2,j2]),annotations:fl.optional(),_meta:ht(F(),_t()).optional()}),b7=P2.extend({type:xe("resource_link")}),X0=xt([G0,J0,Y0,b7,w7]),k7=de({role:uu,content:X0}),ex=on.extend({description:F().optional(),messages:ue(k7)}),$2=pr.extend({method:xe("notifications/prompts/list_changed"),params:hr.optional()}),_7=de({title:F().optional(),readOnlyHint:ut().optional(),destructiveHint:ut().optional(),idempotentHint:ut().optional(),openWorldHint:ut().optional()}),S7=de({taskSupport:Yn(["required","optional","forbidden"]).optional()}),I2=de({...Ga.shape,...iu.shape,description:F().optional(),inputSchema:de({type:xe("object"),properties:ht(F(),qt).optional(),required:ue(F()).optional()}).catchall(_t()),outputSchema:de({type:xe("object"),properties:ht(F(),qt).optional(),required:ue(F()).optional()}).catchall(_t()).optional(),annotations:_7.optional(),execution:S7.optional(),_meta:ht(F(),_t()).optional()}),C7=au.extend({method:xe("tools/list")}),tx=lu.extend({tools:ue(I2)}),du=on.extend({content:ue(X0).default([]),structuredContent:ht(F(),_t()).optional(),isError:ut().optional()});du.or(on.extend({toolResult:_t()}));const E7=su.extend({name:F(),arguments:ht(F(),_t()).optional()}),N7=rn.extend({method:xe("tools/call"),params:E7}),A2=pr.extend({method:xe("notifications/tools/list_changed"),params:hr.optional()}),j7=de({autoRefresh:ut().default(!0),debounceMs:Ge().int().nonnegative().default(300)}),O2=Yn(["debug","info","notice","warning","error","critical","alert","emergency"]),P7=Xn.extend({level:O2}),T7=rn.extend({method:xe("logging/setLevel"),params:P7}),R7=hr.extend({level:O2,logger:F().optional(),data:_t()}),$7=pr.extend({method:xe("notifications/message"),params:R7}),I7=de({name:F().optional()}),A7=de({hints:ue(I7).optional(),costPriority:Ge().min(0).max(1).optional(),speedPriority:Ge().min(0).max(1).optional(),intelligencePriority:Ge().min(0).max(1).optional()}),O7=de({mode:Yn(["auto","required","none"]).optional()}),M7=de({type:xe("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:ue(X0).default([]),structuredContent:de({}).loose().optional(),isError:ut().optional(),_meta:ht(F(),_t()).optional()}),D7=h2("type",[G0,J0,Y0]),Rf=h2("type",[G0,J0,Y0,x7,M7]),L7=de({role:uu,content:xt([Rf,ue(Rf)]),_meta:ht(F(),_t()).optional()}),z7=su.extend({messages:ue(L7),modelPreferences:A7.optional(),systemPrompt:F().optional(),includeContext:Yn(["none","thisServer","allServers"]).optional(),temperature:Ge().optional(),maxTokens:Ge().int(),stopSequences:ue(F()).optional(),metadata:qt.optional(),tools:ue(I2).optional(),toolChoice:O7.optional()}),M2=rn.extend({method:xe("sampling/createMessage"),params:z7}),D2=on.extend({model:F(),stopReason:bt(Yn(["endTurn","stopSequence","maxTokens"]).or(F())),role:uu,content:D7}),L2=on.extend({model:F(),stopReason:bt(Yn(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:uu,content:xt([Rf,ue(Rf)])}),F7=de({type:xe("boolean"),title:F().optional(),description:F().optional(),default:ut().optional()}),U7=de({type:xe("string"),title:F().optional(),description:F().optional(),minLength:Ge().optional(),maxLength:Ge().optional(),format:Yn(["email","uri","date","date-time"]).optional(),default:F().optional()}),q7=de({type:Yn(["number","integer"]),title:F().optional(),description:F().optional(),minimum:Ge().optional(),maximum:Ge().optional(),default:Ge().optional()}),V7=de({type:xe("string"),title:F().optional(),description:F().optional(),enum:ue(F()),default:F().optional()}),H7=de({type:xe("string"),title:F().optional(),description:F().optional(),oneOf:ue(de({const:F(),title:F()})),default:F().optional()}),B7=de({type:xe("string"),title:F().optional(),description:F().optional(),enum:ue(F()),enumNames:ue(F()).optional(),default:F().optional()}),W7=xt([V7,H7]),K7=de({type:xe("array"),title:F().optional(),description:F().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:de({type:xe("string"),enum:ue(F())}),default:ue(F()).optional()}),Z7=de({type:xe("array"),title:F().optional(),description:F().optional(),minItems:Ge().optional(),maxItems:Ge().optional(),items:de({anyOf:ue(de({const:F(),title:F()}))}),default:ue(F()).optional()}),Q7=xt([K7,Z7]),G7=xt([B7,W7,Q7]),J7=xt([G7,F7,U7,q7]),Y7=su.extend({mode:xe("form").optional(),message:F(),requestedSchema:de({type:xe("object"),properties:ht(F(),J7),required:ue(F()).optional()})}),X7=su.extend({mode:xe("url"),message:F(),elicitationId:F(),url:F().url()}),eZ=xt([Y7,X7]),z2=rn.extend({method:xe("elicitation/create"),params:eZ}),tZ=hr.extend({elicitationId:F()}),nZ=pr.extend({method:xe("notifications/elicitation/complete"),params:tZ}),F2=on.extend({action:Yn(["accept","decline","cancel"]),content:v2(e=>e===null?void 0:e,ht(F(),xt([F(),Ge(),ut(),ue(F())])).optional())}),rZ=de({type:xe("ref/resource"),uri:F()}),oZ=de({type:xe("ref/prompt"),name:F()}),sZ=Xn.extend({ref:xt([oZ,rZ]),argument:de({name:F(),value:F()}),context:de({arguments:ht(F(),F()).optional()}).optional()}),iZ=rn.extend({method:xe("completion/complete"),params:sZ}),U2=on.extend({completion:Yt({values:ue(F()).max(100),total:bt(Ge().int()),hasMore:bt(ut())})}),aZ=de({uri:F().startsWith("file://"),name:F().optional(),_meta:ht(F(),_t()).optional()}),lZ=rn.extend({method:xe("roots/list"),params:Xn.optional()}),cZ=on.extend({roots:ue(aZ)}),uZ=pr.extend({method:xe("notifications/roots/list_changed"),params:hr.optional()});xt([z0,ZK,iZ,T7,v7,g7,o7,s7,a7,c7,d7,N7,C7,U0,V0,H0,W0]);xt([L0,F0,C2,uZ,jf]);xt([ca,D2,L2,F2,cZ,q0,B0,Mc]);xt([z0,M2,z2,lZ,U0,V0,H0,W0]);xt([L0,F0,$7,h7,R2,A2,$2,jf,nZ]);xt([ca,S2,U2,ex,Tf,Pf,T2,Q0,du,tx,q0,B0,Mc]);class Ee extends Error{constructor(t,n,r){super(`MCP error ${t}: ${n}`),this.code=t,this.data=r,this.name="McpError"}static fromError(t,n,r){if(t===$e.UrlElicitationRequired&&r){const o=r;if(o.elicitations)return new dZ(o.elicitations,n)}return new Ee(t,n,r)}}class dZ extends Ee{constructor(t,n=`URL elicitation${t.length>1?"s":""} required`){super($e.UrlElicitationRequired,n,{elicitations:t})}get elicitations(){var t;return((t=this.data)==null?void 0:t.elicitations)??[]}}class w1 extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function rm(e){}function q2(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=rm,onError:n=rm,onRetry:r=rm,onComment:o}=e;let s="",i=!0,a,l="",u="";function d(m){const x=i?m.replace(/^\xEF\xBB\xBF/,""):m,[g,v]=fZ(`${s}${x}`);for(const w of g)f(w);s=v,i=!1}function f(m){if(m===""){h();return}if(m.startsWith(":")){o&&o(m.slice(m.startsWith(": ")?2:1));return}const x=m.indexOf(":");if(x!==-1){const g=m.slice(0,x),v=m[x+1]===" "?2:1,w=m.slice(x+v);p(g,w,m);return}p(m,"",m)}function p(m,x,g){switch(m){case"event":u=x;break;case"data":l=`${l}${x}
448
- `;break;case"id":a=x.includes("\0")?void 0:x;break;case"retry":/^\d+$/.test(x)?r(parseInt(x,10)):n(new w1(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:g}));break;default:n(new w1(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:x,line:g}));break}}function h(){l.length>0&&t({id:a,event:u||void 0,data:l.endsWith(`
449
- `)?l.slice(0,-1):l}),a=void 0,l="",u=""}function y(m={}){s&&m.consume&&f(s),i=!0,a=void 0,l="",u="",s=""}return{feed:d,reset:y}}function fZ(e){const t=[];let n="",r=0;for(;r<e.length;){const o=e.indexOf("\r",r),s=e.indexOf(`
450
- `,r);let i=-1;if(o!==-1&&s!==-1?i=Math.min(o,s):o!==-1?o===e.length-1?i=-1:i=o:s!==-1&&(i=s),i===-1){n=e.slice(r);break}else{const a=e.slice(r,i);t.push(a),r=i+1,e[r-1]==="\r"&&e[r]===`
451
- `&&r++}}return[t,n]}class b1 extends Event{constructor(t,n){var r,o;super(t),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(o=n==null?void 0:n.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](t,n,r){return r(k1(this),n)}[Symbol.for("Deno.customInspect")](t,n){return t(k1(this),n)}}function hZ(e){const t=globalThis.DOMException;return typeof t=="function"?new t(e,"SyntaxError"):new SyntaxError(e)}function ny(e){return e instanceof Error?"errors"in e&&Array.isArray(e.errors)?e.errors.map(ny).join(", "):"cause"in e&&e.cause instanceof Error?`${e}: ${ny(e.cause)}`:e.message:`${e}`}function k1(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var V2=e=>{throw TypeError(e)},nx=(e,t,n)=>t.has(e)||V2("Cannot "+n),Ue=(e,t,n)=>(nx(e,t,"read from private field"),n?n.call(e):t.get(e)),Dt=(e,t,n)=>t.has(e)?V2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),pt=(e,t,n,r)=>(nx(e,t,"write to private field"),t.set(e,n),n),po=(e,t,n)=>(nx(e,t,"access private method"),n),Tn,Gs,Wi,Nd,$f,sc,ua,ic,ts,Ki,ba,Zi,Fl,br,ry,oy,sy,_1,iy,ay,Ul,ly,cy;class jd extends EventTarget{constructor(t,n){var r,o;super(),Dt(this,br),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Dt(this,Tn),Dt(this,Gs),Dt(this,Wi),Dt(this,Nd),Dt(this,$f),Dt(this,sc),Dt(this,ua),Dt(this,ic,null),Dt(this,ts),Dt(this,Ki),Dt(this,ba,null),Dt(this,Zi,null),Dt(this,Fl,null),Dt(this,oy,async s=>{var i;Ue(this,Ki).reset();const{body:a,redirected:l,status:u,headers:d}=s;if(u===204){po(this,br,Ul).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(l?pt(this,Wi,new URL(s.url)):pt(this,Wi,void 0),u!==200){po(this,br,Ul).call(this,`Non-200 status code (${u})`,u);return}if(!(d.get("content-type")||"").startsWith("text/event-stream")){po(this,br,Ul).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(Ue(this,Tn)===this.CLOSED)return;pt(this,Tn,this.OPEN);const f=new Event("open");if((i=Ue(this,Fl))==null||i.call(this,f),this.dispatchEvent(f),typeof a!="object"||!a||!("getReader"in a)){po(this,br,Ul).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const p=new TextDecoder,h=a.getReader();let y=!0;do{const{done:m,value:x}=await h.read();x&&Ue(this,Ki).feed(p.decode(x,{stream:!m})),m&&(y=!1,Ue(this,Ki).reset(),po(this,br,ly).call(this))}while(y)}),Dt(this,sy,s=>{pt(this,ts,void 0),!(s.name==="AbortError"||s.type==="aborted")&&po(this,br,ly).call(this,ny(s))}),Dt(this,iy,s=>{typeof s.id=="string"&&pt(this,ic,s.id);const i=new MessageEvent(s.event||"message",{data:s.data,origin:Ue(this,Wi)?Ue(this,Wi).origin:Ue(this,Gs).origin,lastEventId:s.id||""});Ue(this,Zi)&&(!s.event||s.event==="message")&&Ue(this,Zi).call(this,i),this.dispatchEvent(i)}),Dt(this,ay,s=>{pt(this,sc,s)}),Dt(this,cy,()=>{pt(this,ua,void 0),Ue(this,Tn)===this.CONNECTING&&po(this,br,ry).call(this)});try{if(t instanceof URL)pt(this,Gs,t);else if(typeof t=="string")pt(this,Gs,new URL(t,pZ()));else throw new Error("Invalid URL")}catch{throw hZ("An invalid or illegal string was specified")}pt(this,Ki,q2({onEvent:Ue(this,iy),onRetry:Ue(this,ay)})),pt(this,Tn,this.CONNECTING),pt(this,sc,3e3),pt(this,$f,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),pt(this,Nd,(o=n==null?void 0:n.withCredentials)!=null?o:!1),po(this,br,ry).call(this)}get readyState(){return Ue(this,Tn)}get url(){return Ue(this,Gs).href}get withCredentials(){return Ue(this,Nd)}get onerror(){return Ue(this,ba)}set onerror(t){pt(this,ba,t)}get onmessage(){return Ue(this,Zi)}set onmessage(t){pt(this,Zi,t)}get onopen(){return Ue(this,Fl)}set onopen(t){pt(this,Fl,t)}addEventListener(t,n,r){const o=n;super.addEventListener(t,o,r)}removeEventListener(t,n,r){const o=n;super.removeEventListener(t,o,r)}close(){Ue(this,ua)&&clearTimeout(Ue(this,ua)),Ue(this,Tn)!==this.CLOSED&&(Ue(this,ts)&&Ue(this,ts).abort(),pt(this,Tn,this.CLOSED),pt(this,ts,void 0))}}Tn=new WeakMap,Gs=new WeakMap,Wi=new WeakMap,Nd=new WeakMap,$f=new WeakMap,sc=new WeakMap,ua=new WeakMap,ic=new WeakMap,ts=new WeakMap,Ki=new WeakMap,ba=new WeakMap,Zi=new WeakMap,Fl=new WeakMap,br=new WeakSet,ry=function(){pt(this,Tn,this.CONNECTING),pt(this,ts,new AbortController),Ue(this,$f)(Ue(this,Gs),po(this,br,_1).call(this)).then(Ue(this,oy)).catch(Ue(this,sy))},oy=new WeakMap,sy=new WeakMap,_1=function(){var e;const t={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...Ue(this,ic)?{"Last-Event-ID":Ue(this,ic)}:void 0},cache:"no-store",signal:(e=Ue(this,ts))==null?void 0:e.signal};return"window"in globalThis&&(t.credentials=this.withCredentials?"include":"same-origin"),t},iy=new WeakMap,ay=new WeakMap,Ul=function(e,t){var n;Ue(this,Tn)!==this.CLOSED&&pt(this,Tn,this.CLOSED);const r=new b1("error",{code:t,message:e});(n=Ue(this,ba))==null||n.call(this,r),this.dispatchEvent(r)},ly=function(e,t){var n;if(Ue(this,Tn)===this.CLOSED)return;pt(this,Tn,this.CONNECTING);const r=new b1("error",{code:t,message:e});(n=Ue(this,ba))==null||n.call(this,r),this.dispatchEvent(r),pt(this,ua,setTimeout(Ue(this,cy),Ue(this,sc)))},cy=new WeakMap,jd.CONNECTING=0,jd.OPEN=1,jd.CLOSED=2;function pZ(){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 If(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function H2(e=fetch,t){return t?async(n,r)=>{const o={...t,...r,headers:r!=null&&r.headers?{...If(t.headers),...If(r.headers)}:t.headers};return e(n,o)}:e}let rx;rx=globalThis.crypto;async function mZ(e){return(await rx).getRandomValues(new Uint8Array(e))}async function gZ(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let n="";const r=await mZ(e);for(let o=0;o<e;o++){const s=r[o]%t.length;n+=t[s]}return n}async function yZ(e){return await gZ(e)}async function vZ(e){const t=await(await rx).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function xZ(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await yZ(e),n=await vZ(t);return{code_verifier:t,code_challenge:n}}const Gt=FW().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:$K.custom,message:"URL must be parseable",fatal:!0}),RV}).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"}),wZ=Yt({resource:F().url(),authorization_servers:ue(Gt).optional(),jwks_uri:F().url().optional(),scopes_supported:ue(F()).optional(),bearer_methods_supported:ue(F()).optional(),resource_signing_alg_values_supported:ue(F()).optional(),resource_name:F().optional(),resource_documentation:F().optional(),resource_policy_uri:F().url().optional(),resource_tos_uri:F().url().optional(),tls_client_certificate_bound_access_tokens:ut().optional(),authorization_details_types_supported:ue(F()).optional(),dpop_signing_alg_values_supported:ue(F()).optional(),dpop_bound_access_tokens_required:ut().optional()}),B2=Yt({issuer:F(),authorization_endpoint:Gt,token_endpoint:Gt,registration_endpoint:Gt.optional(),scopes_supported:ue(F()).optional(),response_types_supported:ue(F()),response_modes_supported:ue(F()).optional(),grant_types_supported:ue(F()).optional(),token_endpoint_auth_methods_supported:ue(F()).optional(),token_endpoint_auth_signing_alg_values_supported:ue(F()).optional(),service_documentation:Gt.optional(),revocation_endpoint:Gt.optional(),revocation_endpoint_auth_methods_supported:ue(F()).optional(),revocation_endpoint_auth_signing_alg_values_supported:ue(F()).optional(),introspection_endpoint:F().optional(),introspection_endpoint_auth_methods_supported:ue(F()).optional(),introspection_endpoint_auth_signing_alg_values_supported:ue(F()).optional(),code_challenge_methods_supported:ue(F()).optional(),client_id_metadata_document_supported:ut().optional()}),bZ=Yt({issuer:F(),authorization_endpoint:Gt,token_endpoint:Gt,userinfo_endpoint:Gt.optional(),jwks_uri:Gt,registration_endpoint:Gt.optional(),scopes_supported:ue(F()).optional(),response_types_supported:ue(F()),response_modes_supported:ue(F()).optional(),grant_types_supported:ue(F()).optional(),acr_values_supported:ue(F()).optional(),subject_types_supported:ue(F()),id_token_signing_alg_values_supported:ue(F()),id_token_encryption_alg_values_supported:ue(F()).optional(),id_token_encryption_enc_values_supported:ue(F()).optional(),userinfo_signing_alg_values_supported:ue(F()).optional(),userinfo_encryption_alg_values_supported:ue(F()).optional(),userinfo_encryption_enc_values_supported:ue(F()).optional(),request_object_signing_alg_values_supported:ue(F()).optional(),request_object_encryption_alg_values_supported:ue(F()).optional(),request_object_encryption_enc_values_supported:ue(F()).optional(),token_endpoint_auth_methods_supported:ue(F()).optional(),token_endpoint_auth_signing_alg_values_supported:ue(F()).optional(),display_values_supported:ue(F()).optional(),claim_types_supported:ue(F()).optional(),claims_supported:ue(F()).optional(),service_documentation:F().optional(),claims_locales_supported:ue(F()).optional(),ui_locales_supported:ue(F()).optional(),claims_parameter_supported:ut().optional(),request_parameter_supported:ut().optional(),request_uri_parameter_supported:ut().optional(),require_request_uri_registration:ut().optional(),op_policy_uri:Gt.optional(),op_tos_uri:Gt.optional(),client_id_metadata_document_supported:ut().optional()}),kZ=de({...bZ.shape,...B2.pick({code_challenge_methods_supported:!0}).shape}),_Z=de({access_token:F(),id_token:F().optional(),token_type:F(),expires_in:IK().optional(),scope:F().optional(),refresh_token:F().optional()}).strip(),SZ=de({error:F(),error_description:F().optional(),error_uri:F().optional()}),S1=Gt.optional().or(xe("").transform(()=>{})),CZ=de({redirect_uris:ue(Gt),token_endpoint_auth_method:F().optional(),grant_types:ue(F()).optional(),response_types:ue(F()).optional(),client_name:F().optional(),client_uri:Gt.optional(),logo_uri:S1,scope:F().optional(),contacts:ue(F()).optional(),tos_uri:S1,policy_uri:F().optional(),jwks_uri:Gt.optional(),jwks:aK().optional(),software_id:F().optional(),software_version:F().optional(),software_statement:F().optional()}).strip(),EZ=de({client_id:F(),client_secret:F().optional(),client_id_issued_at:Ge().optional(),client_secret_expires_at:Ge().optional()}).strip(),NZ=CZ.merge(EZ);de({error:F(),error_description:F().optional()}).strip();de({token:F(),token_type_hint:F().optional()}).strip();function jZ(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function PZ({requestedResource:e,configuredResource:t}){const n=typeof e=="string"?new URL(e):new URL(e.href),r=typeof t=="string"?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length<r.pathname.length)return!1;const o=n.pathname.endsWith("/")?n.pathname:n.pathname+"/",s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return o.startsWith(s)}class Kt extends Error{constructor(t,n){super(t),this.errorUri=n,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 uy extends Kt{}uy.errorCode="invalid_request";class Af extends Kt{}Af.errorCode="invalid_client";class Of extends Kt{}Of.errorCode="invalid_grant";class Mf extends Kt{}Mf.errorCode="unauthorized_client";class dy extends Kt{}dy.errorCode="unsupported_grant_type";class fy extends Kt{}fy.errorCode="invalid_scope";class hy extends Kt{}hy.errorCode="access_denied";class Ja extends Kt{}Ja.errorCode="server_error";class py extends Kt{}py.errorCode="temporarily_unavailable";class my extends Kt{}my.errorCode="unsupported_response_type";class gy extends Kt{}gy.errorCode="unsupported_token_type";class yy extends Kt{}yy.errorCode="invalid_token";class vy extends Kt{}vy.errorCode="method_not_allowed";class xy extends Kt{}xy.errorCode="too_many_requests";class Df extends Kt{}Df.errorCode="invalid_client_metadata";class wy extends Kt{}wy.errorCode="insufficient_scope";class by extends Kt{}by.errorCode="invalid_target";const TZ={[uy.errorCode]:uy,[Af.errorCode]:Af,[Of.errorCode]:Of,[Mf.errorCode]:Mf,[dy.errorCode]:dy,[fy.errorCode]:fy,[hy.errorCode]:hy,[Ja.errorCode]:Ja,[py.errorCode]:py,[my.errorCode]:my,[gy.errorCode]:gy,[yy.errorCode]:yy,[vy.errorCode]:vy,[xy.errorCode]:xy,[Df.errorCode]:Df,[wy.errorCode]:wy,[by.errorCode]:by};class Hn extends Error{constructor(t){super(t??"Unauthorized")}}function RZ(e){return["client_secret_basic","client_secret_post","none"].includes(e)}const om="code",sm="S256";function $Z(e,t){const n=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&RZ(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?n?"client_secret_basic":"none":n&&t.includes("client_secret_basic")?"client_secret_basic":n&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":n?"client_secret_post":"none"}function IZ(e,t,n,r){const{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":AZ(o,s,n);return;case"client_secret_post":OZ(o,s,r);return;case"none":MZ(o,r);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function AZ(e,t,n){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const r=btoa(`${e}:${t}`);n.set("Authorization",`Basic ${r}`)}function OZ(e,t,n){n.set("client_id",e),t&&n.set("client_secret",t)}function MZ(e,t){t.set("client_id",e)}async function W2(e){const t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{const r=SZ.parse(JSON.parse(n)),{error:o,error_description:s,error_uri:i}=r,a=TZ[o]||Ja;return new a(s||"",i)}catch(r){const o=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${r}. Raw body: ${n}`;return new Ja(o)}}async function Tr(e,t){var n,r;try{return await im(e,t)}catch(o){if(o instanceof Af||o instanceof Mf)return await((n=e.invalidateCredentials)==null?void 0:n.call(e,"all")),await im(e,t);if(o instanceof Of)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"tokens")),await im(e,t);throw o}}async function im(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:o,fetchFn:s}){var w,k,C,j,S;const i=await((w=e.discoveryState)==null?void 0:w.call(e));let a,l,u,d=o;if(!d&&(i!=null&&i.resourceMetadataUrl)&&(d=new URL(i.resourceMetadataUrl)),i!=null&&i.authorizationServerUrl){if(l=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await Z2(l,{fetchFn:s}),!a)try{a=await K2(t,{resourceMetadataUrl:d},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await((k=e.saveDiscoveryState)==null?void 0:k.call(e,{authorizationServerUrl:String(l),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}else{const A=await VZ(t,{resourceMetadataUrl:d,fetchFn:s});l=A.authorizationServerUrl,u=A.authorizationServerMetadata,a=A.resourceMetadata,await((C=e.saveDiscoveryState)==null?void 0:C.call(e,{authorizationServerUrl:String(l),resourceMetadataUrl:d==null?void 0:d.toString(),resourceMetadata:a,authorizationServerMetadata:u}))}const f=await LZ(t,e,a),p=r||((j=a==null?void 0:a.scopes_supported)==null?void 0:j.join(" "))||e.clientMetadata.scope;let h=await Promise.resolve(e.clientInformation());if(!h){if(n!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");const A=(u==null?void 0:u.client_id_metadata_document_supported)===!0,P=e.clientMetadataUrl;if(P&&!DZ(P))throw new Df(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${P}`);if(A&&P)h={client_id:P},await((S=e.saveClientInformation)==null?void 0:S.call(e,h));else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const T=await ZZ(l,{metadata:u,clientMetadata:e.clientMetadata,scope:p,fetchFn:s});await e.saveClientInformation(T),h=T}}const y=!e.redirectUrl;if(n!==void 0||y){const A=await KZ(e,l,{metadata:u,resource:f,authorizationCode:n,fetchFn:s});return await e.saveTokens(A),"AUTHORIZED"}const m=await e.tokens();if(m!=null&&m.refresh_token)try{const A=await WZ(l,{metadata:u,clientInformation:h,refreshToken:m.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(A),"AUTHORIZED"}catch(A){if(!(!(A instanceof Kt)||A instanceof Ja))throw A}const x=e.state?await e.state():void 0,{authorizationUrl:g,codeVerifier:v}=await HZ(l,{metadata:u,clientInformation:h,state:x,redirectUrl:e.redirectUrl,scope:p,resource:f});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(g),"REDIRECT"}function DZ(e){if(!e)return!1;try{const t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function LZ(e,t,n){const r=jZ(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n==null?void 0:n.resource);if(n){if(!PZ({requestedResource:r,configuredResource:n.resource}))throw new Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function Lf(e){const t=e.headers.get("WWW-Authenticate");if(!t)return{};const[n,r]=t.split(" ");if(n.toLowerCase()!=="bearer"||!r)return{};const o=am(e,"resource_metadata")||void 0;let s;if(o)try{s=new URL(o)}catch{}const i=am(e,"scope")||void 0,a=am(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function am(e,t){const n=e.headers.get("WWW-Authenticate");if(!n)return null;const r=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=n.match(r);return o?o[1]||o[2]:null}async function K2(e,t,n=fetch){var o,s;const r=await UZ(e,"oauth-protected-resource",n,{protocolVersion:t==null?void 0:t.protocolVersion,metadataUrl:t==null?void 0:t.resourceMetadataUrl});if(!r||r.status===404)throw await((o=r==null?void 0:r.body)==null?void 0:o.cancel()),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!r.ok)throw await((s=r.body)==null?void 0:s.cancel()),new Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return wZ.parse(await r.json())}async function ox(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?ox(e,void 0,n):void 0;throw r}}function zZ(e,t="",n={}){return t.endsWith("/")&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function C1(e,t,n=fetch){return await ox(e,{"MCP-Protocol-Version":t},n)}function FZ(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function UZ(e,t,n,r){const o=new URL(e),s=(r==null?void 0:r.protocolVersion)??Dh;let i;if(r!=null&&r.metadataUrl)i=new URL(r.metadataUrl);else{const l=zZ(t,o.pathname);i=new URL(l,(r==null?void 0:r.metadataServerUrl)??o),i.search=o.search}let a=await C1(i,s,n);if(!(r!=null&&r.metadataUrl)&&FZ(a,o.pathname)){const l=new URL(`/.well-known/${t}`,o);a=await C1(l,s,n)}return a}function qZ(e){const t=typeof e=="string"?new URL(e):e,n=t.pathname!=="/",r=[];if(!n)return r.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),r.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),r;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),r.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),r.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),r}async function Z2(e,{fetchFn:t=fetch,protocolVersion:n=Dh}={}){var s;const r={"MCP-Protocol-Version":n,Accept:"application/json"},o=qZ(e);for(const{url:i,type:a}of o){const l=await ox(i,r,t);if(l){if(!l.ok){if(await((s=l.body)==null?void 0:s.cancel()),l.status>=400&&l.status<500)continue;throw new Error(`HTTP ${l.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?B2.parse(await l.json()):kZ.parse(await l.json())}}}async function VZ(e,t){let n,r;try{n=await K2(e,{resourceMetadataUrl:t==null?void 0:t.resourceMetadataUrl},t==null?void 0:t.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||(r=String(new URL("/",e)));const o=await Z2(r,{fetchFn:t==null?void 0:t.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:o,resourceMetadata:n}}async function HZ(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(om))throw new Error(`Incompatible auth server: does not support response type ${om}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(sm))throw new Error(`Incompatible auth server: does not support code challenge method ${sm}`)}else a=new URL("/authorize",e);const l=await xZ(),u=l.code_verifier,d=l.code_challenge;return a.searchParams.set("response_type",om),a.searchParams.set("client_id",n.client_id),a.searchParams.set("code_challenge",d),a.searchParams.set("code_challenge_method",sm),a.searchParams.set("redirect_uri",String(r)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o!=null&&o.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function BZ(e,t,n){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(n)})}async function Q2(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:o,resource:s,fetchFn:i}){const a=t!=null&&t.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),l=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&n.set("resource",s.href),o)await o(l,n,a,t);else if(r){const d=(t==null?void 0:t.token_endpoint_auth_methods_supported)??[],f=$Z(r,d);IZ(f,r,l,n)}const u=await(i??fetch)(a,{method:"POST",headers:l,body:n});if(!u.ok)throw await W2(u);return _Z.parse(await u.json())}async function WZ(e,{metadata:t,clientInformation:n,refreshToken:r,resource:o,addClientAuthentication:s,fetchFn:i}){const a=new URLSearchParams({grant_type:"refresh_token",refresh_token:r}),l=await Q2(e,{metadata:t,tokenRequestParams:a,clientInformation:n,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:r,...l}}async function KZ(e,t,{metadata:n,resource:r,authorizationCode:o,fetchFn:s}={}){const i=e.clientMetadata.scope;let a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){if(!o)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=BZ(o,u,e.redirectUrl)}const l=await e.clientInformation();return Q2(t,{metadata:n,tokenRequestParams:a,clientInformation:l??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:s})}async function ZZ(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);const i=await(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,...r!==void 0?{scope:r}:{}})});if(!i.ok)throw await W2(i);return NZ.parse(await i.json())}class QZ extends Error{constructor(t,n,r){super(`SSE error: ${n}`),this.code=t,this.event=r}}class GZ{constructor(t,n){this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=n==null?void 0:n.eventSourceInit,this._requestInit=n==null?void 0:n.requestInit,this._authProvider=n==null?void 0:n.authProvider,this._fetch=n==null?void 0:n.fetch,this._fetchWithInit=H2(n==null?void 0:n.fetch,n==null?void 0:n.requestInit)}async _authThenStart(){var n;if(!this._authProvider)throw new Hn("No auth provider");let t;try{t=await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(n=this.onerror)==null||n.call(this,r),r}if(t!=="AUTHORIZED")throw new Hn;return await this._startOrAuth()}async _commonHeaders(){var r;const t={};if(this._authProvider){const o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=If((r=this._requestInit)==null?void 0:r.headers);return new Headers({...t,...n})}_startOrAuth(){var n;const t=((n=this==null?void 0:this._eventSourceInit)==null?void 0:n.fetch)??this._fetch??fetch;return new Promise((r,o)=>{this._eventSource=new jd(this._url.href,{...this._eventSourceInit,fetch:async(s,i)=>{const a=await this._commonHeaders();a.set("Accept","text/event-stream");const l=await t(s,{...i,headers:a});if(l.status===401&&l.headers.has("www-authenticate")){const{resourceMetadataUrl:u,scope:d}=Lf(l);this._resourceMetadataUrl=u,this._scope=d}return l}}),this._abortController=new AbortController,this._eventSource.onerror=s=>{var a;if(s.code===401&&this._authProvider){this._authThenStart().then(r,o);return}const i=new QZ(s.code,s.message,s);o(i),(a=this.onerror)==null||a.call(this,i)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",s=>{var a;const i=s;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(l){o(l),(a=this.onerror)==null||a.call(this,l),this.close();return}r()}),this._eventSource.onmessage=s=>{var l,u;const i=s;let a;try{a=Ed.parse(JSON.parse(i.data))}catch(d){(l=this.onerror)==null||l.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 Hn("No auth provider");if(await Tr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Hn("Failed to authorize")}async close(){var t,n,r;(t=this._abortController)==null||t.abort(),(n=this._eventSource)==null||n.close(),(r=this.onclose)==null||r.call(this)}async send(t){var n,r,o;if(!this._endpoint)throw new Error("Not connected");try{const s=await this._commonHeaders();s.set("content-type","application/json");const i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:(n=this._abortController)==null?void 0:n.signal},a=await(this._fetch??fetch)(this._endpoint,i);if(!a.ok){const l=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){const{resourceMetadataUrl:u,scope:d}=Lf(a);if(this._resourceMetadataUrl=u,this._scope=d,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Hn;return this.send(t)}throw new Error(`Error POSTing to endpoint (HTTP ${a.status}): ${l}`)}await((r=a.body)==null?void 0:r.cancel())}catch(s){throw(o=this.onerror)==null||o.call(this,s),s}}setProtocolVersion(t){this._protocolVersion=t}}class JZ extends TransformStream{constructor({onError:t,onRetry:n,onComment:r}={}){let o;super({start(s){o=q2({onEvent:i=>{s.enqueue(i)},onError(i){t==="terminate"?s.error(i):typeof t=="function"&&t(i)},onRetry:n,onComment:r})},transform(s){o.feed(s)}})}}const YZ={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Ui extends Error{constructor(t,n){super(`Streamable HTTP error: ${n}`),this.code=t}}class XZ{constructor(t,n){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=n==null?void 0:n.requestInit,this._authProvider=n==null?void 0:n.authProvider,this._fetch=n==null?void 0:n.fetch,this._fetchWithInit=H2(n==null?void 0:n.fetch,n==null?void 0:n.requestInit),this._sessionId=n==null?void 0:n.sessionId,this._reconnectionOptions=(n==null?void 0:n.reconnectionOptions)??YZ}async _authThenStart(){var n;if(!this._authProvider)throw new Hn("No auth provider");let t;try{t=await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw(n=this.onerror)==null||n.call(this,r),r}if(t!=="AUTHORIZED")throw new Hn;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var r;const t={};if(this._authProvider){const o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);const n=If((r=this._requestInit)==null?void 0:r.headers);return new Headers({...t,...n})}async _startOrAuthSse(t){var r,o,s;const{resumptionToken:n}=t;try{const i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);const a=await(this._fetch??fetch)(this._url,{method:"GET",headers:i,signal:(r=this._abortController)==null?void 0:r.signal});if(!a.ok){if(await((o=a.body)==null?void 0:o.cancel()),a.status===401&&this._authProvider)return await this._authThenStart();if(a.status===405)return;throw new Ui(a.status,`Failed to open SSE stream: ${a.statusText}`)}this._handleSseStream(a.body,t,!0)}catch(i){throw(s=this.onerror)==null||s.call(this,i),i}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const n=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(n*Math.pow(r,t),o)}_scheduleReconnection(t,n=0){var s;const r=this._reconnectionOptions.maxRetries;if(n>=r){(s=this.onerror)==null||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}const o=this._getNextReconnectionDelay(n);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,n+1)})},o)}_handleSseStream(t,n,r){if(!t)return;const{onresumptiontoken:o,replayMessageId:s}=n;let i,a=!1,l=!1;(async()=>{var d,f,p,h;try{const y=t.pipeThrough(new TextDecoderStream).pipeThrough(new JZ({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){const{value:g,done:v}=await y.read();if(v)break;if(g.id&&(i=g.id,a=!0,o==null||o(g.id)),!!g.data&&(!g.event||g.event==="message"))try{const w=Ed.parse(JSON.parse(g.data));zl(w)&&(l=!0,s!==void 0&&(w.id=s)),(d=this.onmessage)==null||d.call(this,w)}catch(w){(f=this.onerror)==null||f.call(this,w)}}(r||a)&&!l&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(y){if((p=this.onerror)==null||p.call(this,new Error(`SSE stream disconnected: ${y}`)),(r||a)&&!l&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(g){(h=this.onerror)==null||h.call(this,new Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`))}}})()}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 Hn("No auth provider");if(await Tr(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Hn("Failed to authorize")}async close(){var t,n;this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),(t=this._abortController)==null||t.abort(),(n=this.onclose)==null||n.call(this)}async send(t,n){var r,o,s,i,a,l;try{const{resumptionToken:u,onresumptiontoken:d}=n||{};if(u){this._startOrAuthSse({resumptionToken:u,replayMessageId:ty(t)?t.id:void 0}).catch(v=>{var w;return(w=this.onerror)==null?void 0:w.call(this,v)});return}const f=await this._commonHeaders();f.set("content-type","application/json"),f.set("accept","application/json, text/event-stream");const p={...this._requestInit,method:"POST",headers:f,body:JSON.stringify(t),signal:(r=this._abortController)==null?void 0:r.signal},h=await(this._fetch??fetch)(this._url,p),y=h.headers.get("mcp-session-id");if(y&&(this._sessionId=y),!h.ok){const v=await h.text().catch(()=>null);if(h.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Ui(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:w,scope:k}=Lf(h);if(this._resourceMetadataUrl=w,this._scope=k,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Hn;return this._hasCompletedAuthFlow=!0,this.send(t)}if(h.status===403&&this._authProvider){const{resourceMetadataUrl:w,scope:k,error:C}=Lf(h);if(C==="insufficient_scope"){const j=h.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===j)throw new Ui(403,"Server returned 403 after trying upscoping");if(k&&(this._scope=k),w&&(this._resourceMetadataUrl=w),this._lastUpscopingHeader=j??void 0,await Tr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Hn;return this.send(t)}}throw new Ui(h.status,`Error POSTing to endpoint: ${v}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,h.status===202){await((o=h.body)==null?void 0:o.cancel()),GK(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var w;return(w=this.onerror)==null?void 0:w.call(this,v)});return}const x=(Array.isArray(t)?t:[t]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,g=h.headers.get("content-type");if(x)if(g!=null&&g.includes("text/event-stream"))this._handleSseStream(h.body,{onresumptiontoken:d},!1);else if(g!=null&&g.includes("application/json")){const v=await h.json(),w=Array.isArray(v)?v.map(k=>Ed.parse(k)):[Ed.parse(v)];for(const k of w)(s=this.onmessage)==null||s.call(this,k)}else throw await((i=h.body)==null?void 0:i.cancel()),new Ui(-1,`Unexpected content type: ${g}`);else await((a=h.body)==null?void 0:a.cancel())}catch(u){throw(l=this.onerror)==null||l.call(this,u),u}}get sessionId(){return this._sessionId}async terminateSession(){var t,n,r;if(this._sessionId)try{const o=await this._commonHeaders(),s={...this._requestInit,method:"DELETE",headers:o,signal:(t=this._abortController)==null?void 0:t.signal},i=await(this._fetch??fetch)(this._url,s);if(await((n=i.body)==null?void 0:n.cancel()),!i.ok&&i.status!==405)throw new Ui(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(o){throw(r=this.onerror)==null||r.call(this,o),o}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,n){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:n==null?void 0:n.onresumptiontoken})}}function Fh(e){return!!e._zod}function Yo(e,t){return Fh(e)?ZT(e,t):e.safeParse(t)}function G2(e){var n,r;if(!e)return;let t;if(Fh(e)?t=(r=(n=e._zod)==null?void 0:n.def)==null?void 0:r.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function eQ(e){var o;if(Fh(e)){const i=(o=e._zod)==null?void 0:o.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 n=e._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}const r=e.value;if(r!==void 0)return r}function Fs(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function E1(e){const t=G2(e),n=t==null?void 0:t.method;if(!n)throw new Error("Schema is missing a method literal");const r=eQ(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function N1(e,t){const n=Yo(e,t);if(!n.success)throw n.error;return n.data}const tQ=6e4;class nQ{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(L0,n=>{this._oncancel(n)}),this.setNotificationHandler(F0,n=>{this._onprogress(n)}),this.setRequestHandler(z0,n=>({})),this._taskStore=t==null?void 0:t.taskStore,this._taskMessageQueue=t==null?void 0:t.taskMessageQueue,this._taskStore&&(this.setRequestHandler(U0,async(n,r)=>{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new Ee($e.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(V0,async(n,r)=>{const o=async()=>{var a;const s=n.params.taskId;if(this._taskMessageQueue){let l;for(;l=await this._taskMessageQueue.dequeue(s,r.sessionId);){if(l.type==="response"||l.type==="error"){const u=l.message,d=u.id,f=this._requestResolvers.get(d);if(f)if(this._requestResolvers.delete(d),l.type==="response")f(u);else{const p=u,h=new Ee(p.error.code,p.error.message,p.error.data);f(h)}else{const p=l.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${d}`))}continue}await((a=this._transport)==null?void 0:a.send(l.message,{relatedRequestId:r.requestId}))}}const i=await this._taskStore.getTask(s,r.sessionId);if(!i)throw new Ee($e.InvalidParams,`Task not found: ${s}`);if(!Fs(i.status))return await this._waitForTaskUpdate(s,r.signal),await o();if(Fs(i.status)){const l=await this._taskStore.getTaskResult(s,r.sessionId);return this._clearTaskQueue(s),{...l,_meta:{...l._meta,[Zs]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(H0,async(n,r)=>{var o;try{const{tasks:s,nextCursor:i}=await this._taskStore.listTasks((o=n.params)==null?void 0:o.cursor,r.sessionId);return{tasks:s,nextCursor:i,_meta:{}}}catch(s){throw new Ee($e.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(W0,async(n,r)=>{try{const o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new Ee($e.InvalidParams,`Task not found: ${n.params.taskId}`);if(Fs(o.status))throw new Ee($e.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);const s=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!s)throw new Ee($e.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof Ee?o:new Ee($e.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;const n=this._requestHandlerAbortControllers.get(t.params.requestId);n==null||n.abort(t.params.reason)}_setupTimeout(t,n,r,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){const n=this._timeoutInfo.get(t);if(!n)return!1;const r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),Ee.fromError($e.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){const n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){var s,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 n=(s=this.transport)==null?void 0:s.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};const r=(i=this.transport)==null?void 0:i.onerror;this._transport.onerror=l=>{r==null||r(l),this._onerror(l)};const o=(a=this._transport)==null?void 0:a.onmessage;this._transport.onmessage=(l,u)=>{o==null||o(l,u),zl(l)||zK(l)?this._onresponse(l):ty(l)?this._onrequest(l,u):LK(l)?this._onnotification(l):this._onerror(new Error(`Unknown message type: ${JSON.stringify(l)}`))},await this._transport.start()}_onclose(){var r;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(const o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();const n=Ee.fromError($e.ConnectionClosed,"Connection closed");this._transport=void 0,(r=this.onclose)==null||r.call(this);for(const o of t.values())o(n)}_onerror(t){var n;(n=this.onerror)==null||n.call(this,t)}_onnotification(t){const n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(t,n){var d,f,p,h;const r=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=(p=(f=(d=t.params)==null?void 0:d._meta)==null?void 0:f[Zs])==null?void 0:p.taskId;if(r===void 0){const y={jsonrpc:"2.0",id:t.id,error:{code:$e.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:y,timestamp:Date.now()},o==null?void 0:o.sessionId).catch(m=>this._onerror(new Error(`Failed to enqueue error response: ${m}`))):o==null||o.send(y).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=DK(t.params)?t.params.task:void 0,l=this._taskStore?this.requestTaskStore(t,o==null?void 0:o.sessionId):void 0,u={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(h=t.params)==null?void 0:h._meta,sendNotification:async y=>{if(i.signal.aborted)return;const m={relatedRequestId:t.id};s&&(m.relatedTask={taskId:s}),await this.notification(y,m)},sendRequest:async(y,m,x)=>{var w;if(i.signal.aborted)throw new Ee($e.ConnectionClosed,"Request was cancelled");const g={...x,relatedRequestId:t.id};s&&!g.relatedTask&&(g.relatedTask={taskId:s});const v=((w=g.relatedTask)==null?void 0:w.taskId)??s;return v&&l&&await l.updateTaskStatus(v,"input_required"),await this.request(y,m,g)},authInfo:n==null?void 0:n.authInfo,requestId:t.id,requestInfo:n==null?void 0:n.requestInfo,taskId:s,taskStore:l,taskRequestedTtl:a==null?void 0:a.ttl,closeSSEStream:n==null?void 0:n.closeSSEStream,closeStandaloneSSEStream:n==null?void 0:n.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>r(t,u)).then(async y=>{if(i.signal.aborted)return;const m={result:y,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:m,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(m))},async y=>{if(i.signal.aborted)return;const m={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(y.code)?y.code:$e.InternalError,message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:m,timestamp:Date.now()},o==null?void 0:o.sessionId):await(o==null?void 0:o.send(m))}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){const{progressToken:n,...r}=t.params,o=Number(n),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}const i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(l){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(l);return}s(r)}_onresponse(t){const n=Number(t.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),zl(t))r(t);else{const i=new Ee(t.error.code,t.error.message,t.error.data);r(i)}return}const o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let s=!1;if(zl(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"&&(s=!0,this._taskProgressTokens.set(a.taskId,n))}}if(s||this._progressHandlers.delete(n),zl(t))o(t);else{const i=Ee.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){var t;await((t=this._transport)==null?void 0:t.close())}async*requestStream(t,n,r){var i,a;const{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(t,n,r)}}catch(l){yield{type:"error",error:l instanceof Ee?l:new Ee($e.InternalError,String(l))}}return}let s;try{const l=await this.request(t,Mc,r);if(l.task)s=l.task.taskId,yield{type:"taskCreated",task:l.task};else throw new Ee($e.InternalError,"Task creation did not return a task");for(;;){const u=await this.getTask({taskId:s},r);if(yield{type:"taskStatus",task:u},Fs(u.status)){u.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},n,r)}:u.status==="failed"?yield{type:"error",error:new Ee($e.InternalError,`Task ${s} failed`)}:u.status==="cancelled"&&(yield{type:"error",error:new Ee($e.InternalError,`Task ${s} was cancelled`)});return}if(u.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},n,r)};return}const d=u.pollInterval??((i=this._options)==null?void 0:i.defaultTaskPollInterval)??1e3;await new Promise(f=>setTimeout(f,d)),(a=r==null?void 0:r.signal)==null||a.throwIfAborted()}}catch(l){yield{type:"error",error:l instanceof Ee?l:new Ee($e.InternalError,String(l))}}}request(t,n,r){const{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:l}=r??{};return new Promise((u,d)=>{var v,w,k,C,j;const f=S=>{d(S)};if(!this._transport){f(new Error("Not connected"));return}if(((v=this._options)==null?void 0:v.enforceStrictCapabilities)===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(S){f(S);return}(w=r==null?void 0:r.signal)==null||w.throwIfAborted();const p=this._requestMessageId++,h={...t,jsonrpc:"2.0",id:p};r!=null&&r.onprogress&&(this._progressHandlers.set(p,r.onprogress),h.params={...t.params,_meta:{...((k=t.params)==null?void 0:k._meta)||{},progressToken:p}}),a&&(h.params={...h.params,task:a}),l&&(h.params={...h.params,_meta:{...((C=h.params)==null?void 0:C._meta)||{},[Zs]:l}});const y=S=>{var P;this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),(P=this._transport)==null||P.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(S)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch($=>this._onerror(new Error(`Failed to send cancellation: ${$}`)));const A=S instanceof Ee?S:new Ee($e.RequestTimeout,String(S));d(A)};this._responseHandlers.set(p,S=>{var A;if(!((A=r==null?void 0:r.signal)!=null&&A.aborted)){if(S instanceof Error)return d(S);try{const P=Yo(n,S.result);P.success?u(P.data):d(P.error)}catch(P){d(P)}}}),(j=r==null?void 0:r.signal)==null||j.addEventListener("abort",()=>{var S;y((S=r==null?void 0:r.signal)==null?void 0:S.reason)});const m=(r==null?void 0:r.timeout)??tQ,x=()=>y(Ee.fromError($e.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,r==null?void 0:r.maxTotalTimeout,x,(r==null?void 0:r.resetTimeoutOnProgress)??!1);const g=l==null?void 0:l.taskId;if(g){const S=A=>{const P=this._responseHandlers.get(p);P?P(A):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,S),this._enqueueTaskMessage(g,{type:"request",message:h,timestamp:Date.now()}).catch(A=>{this._cleanupTimeout(p),d(A)})}else this._transport.send(h,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(S=>{this._cleanupTimeout(p),d(S)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},q0,n)}async getTaskResult(t,n,r){return this.request({method:"tasks/result",params:t},n,r)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},B0,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},n7,n)}async notification(t,n){var a,l,u,d;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);const r=(a=n==null?void 0:n.relatedTask)==null?void 0:a.taskId;if(r){const f={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...((l=t.params)==null?void 0:l._meta)||{},[Zs]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:f,timestamp:Date.now()});return}if((((u=this._options)==null?void 0:u.debouncedNotificationMethods)??[]).includes(t.method)&&!t.params&&!(n!=null&&n.relatedRequestId)&&!(n!=null&&n.relatedTask)){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{var p,h;if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let f={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(f={...f,params:{...f.params,_meta:{...((p=f.params)==null?void 0:p._meta)||{},[Zs]:n.relatedTask}}}),(h=this._transport)==null||h.send(f,n).catch(y=>this._onerror(y))});return}let i={...t,jsonrpc:"2.0"};n!=null&&n.relatedTask&&(i={...i,params:{...i.params,_meta:{...((d=i.params)==null?void 0:d._meta)||{},[Zs]:n.relatedTask}}}),await this._transport.send(i,n)}setRequestHandler(t,n){const r=E1(t);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,s)=>{const i=N1(t,o);return Promise.resolve(n(i,s))})}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,n){const r=E1(t);this._notificationHandlers.set(r,o=>{const s=N1(t,o);return Promise.resolve(n(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){const n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,r){var s;if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const o=(s=this._options)==null?void 0:s.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,r,o)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(t,n);for(const o of r)if(o.type==="request"&&ty(o.message)){const s=o.message.id,i=this._requestResolvers.get(s);i?(i(new Ee($e.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n){var o,s;let r=((o=this._options)==null?void 0:o.defaultTaskPollInterval)??1e3;try{const i=await((s=this._taskStore)==null?void 0:s.getTask(t));i!=null&&i.pollInterval&&(r=i.pollInterval)}catch{}return new Promise((i,a)=>{if(n.aborted){a(new Ee($e.InvalidRequest,"Request cancelled"));return}const l=setTimeout(i,r);n.addEventListener("abort",()=>{clearTimeout(l),a(new Ee($e.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await r.createTask(o,t.id,{method:t.method,params:t.params},n)},getTask:async o=>{const s=await r.getTask(o,n);if(!s)throw new Ee($e.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await r.storeTaskResult(o,s,i,n);const a=await r.getTask(o,n);if(a){const l=jf.parse({method:"notifications/tasks/status",params:a});await this.notification(l),Fs(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,s,i)=>{const a=await r.getTask(o,n);if(!a)throw new Ee($e.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Fs(a.status))throw new Ee($e.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,s,i,n);const l=await r.getTask(o,n);if(l){const u=jf.parse({method:"notifications/tasks/status",params:l});await this.notification(u),Fs(l.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}}function j1(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function rQ(e,t){const n={...e};for(const r in t){const o=r,s=t[o];if(s===void 0)continue;const i=n[o];j1(i)&&j1(s)?n[o]={...i,...s}:n[o]=s}return n}var ky={exports:{}},J2={},uo={},Us={},fu={},De={},Dc={};(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 n extends t{constructor(v){if(super(),!e.IDENTIFIER.test(v))throw new Error("CodeGen: name must be a valid identifier");this.str=v}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=n;class r extends t{constructor(v){super(),this._items=typeof v=="string"?[v]:v}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const v=this._items[0];return v===""||v==='""'}get str(){var v;return(v=this._str)!==null&&v!==void 0?v:this._str=this._items.reduce((w,k)=>`${w}${k}`,"")}get names(){var v;return(v=this._names)!==null&&v!==void 0?v:this._names=this._items.reduce((w,k)=>(k instanceof n&&(w[k.str]=(w[k.str]||0)+1),w),{})}}e._Code=r,e.nil=new r("");function o(g,...v){const w=[g[0]];let k=0;for(;k<v.length;)a(w,v[k]),w.push(g[++k]);return new r(w)}e._=o;const s=new r("+");function i(g,...v){const w=[h(g[0])];let k=0;for(;k<v.length;)w.push(s),a(w,v[k]),w.push(s,h(g[++k]));return l(w),new r(w)}e.str=i;function a(g,v){v instanceof r?g.push(...v._items):v instanceof n?g.push(v):g.push(f(v))}e.addCodeArg=a;function l(g){let v=1;for(;v<g.length-1;){if(g[v]===s){const w=u(g[v-1],g[v+1]);if(w!==void 0){g.splice(v-1,3,w);continue}g[v++]="+"}v++}}function u(g,v){if(v==='""')return g;if(g==='""')return v;if(typeof g=="string")return v instanceof n||g[g.length-1]!=='"'?void 0:typeof v!="string"?`${g.slice(0,-1)}${v}"`:v[0]==='"'?g.slice(0,-1)+v.slice(1):void 0;if(typeof v=="string"&&v[0]==='"'&&!(g instanceof n))return`"${g}${v.slice(1)}`}function d(g,v){return v.emptyStr()?g:g.emptyStr()?v:i`${g}${v}`}e.strConcat=d;function f(g){return typeof g=="number"||typeof g=="boolean"||g===null?g:h(Array.isArray(g)?g.join(","):g)}function p(g){return new r(h(g))}e.stringify=p;function h(g){return JSON.stringify(g).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=h;function y(g){return typeof g=="string"&&e.IDENTIFIER.test(g)?new r(`.${g}`):o`[${g}]`}e.getProperty=y;function m(g){if(typeof g=="string"&&e.IDENTIFIER.test(g))return new r(`${g}`);throw new Error(`CodeGen: invalid export name: ${g}, use explicit $id name mapping`)}e.getEsmExportName=m;function x(g){return new r(g.toString())}e.regexpCode=x})(Dc);var _y={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Dc;class n extends Error{constructor(u){super(`CodeGen: "code" for ${u} not defined`),this.value=u.value}}var r;(function(l){l[l.Started=0]="Started",l[l.Completed=1]="Completed"})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{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=o;class s 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=s;const i=(0,t._)`\n`;class a extends o{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 s(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 p=this.toName(u),{prefix:h}=p,y=(f=d.key)!==null&&f!==void 0?f:d.ref;let m=this._values[h];if(m){const v=m.get(y);if(v)return v}else m=this._values[h]=new Map;m.set(y,p);const x=this._scope[h]||(this._scope[h]=[]),g=x.length;return x[g]=d.ref,p.setValue(d,{property:h,itemIndex:g}),p}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,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},d,f)}_reduceValues(u,d,f={},p){let h=t.nil;for(const y in u){const m=u[y];if(!m)continue;const x=f[y]=f[y]||new Map;m.forEach(g=>{if(x.has(g))return;x.set(g,r.Started);let v=d(g);if(v){const w=this.opts.es5?e.varKinds.var:e.varKinds.const;h=(0,t._)`${h}${w} ${g} = ${v};${this.opts._n}`}else if(v=p==null?void 0:p(g))h=(0,t._)`${h}${v}${this.opts._n}`;else throw new n(g);x.set(g,r.Completed)})}return h}}e.ValueScope=a})(_y);(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=Dc,n=_y;var r=Dc;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}});var o=_y;Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.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 s{optimizeNodes(){return this}optimizeNames(E,R){return this}}class i extends s{constructor(E,R,D){super(),this.varKind=E,this.name=R,this.rhs=D}render({es5:E,_n:R}){const D=E?n.varKinds.var:this.varKind,K=this.rhs===void 0?"":` = ${this.rhs}`;return`${D} ${this.name}${K};`+R}optimizeNames(E,R){if(E[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,E,R)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class a extends s{constructor(E,R,D){super(),this.lhs=E,this.rhs=R,this.sideEffects=D}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,R){if(!(this.lhs instanceof t.Name&&!E[this.lhs.str]&&!this.sideEffects))return this.rhs=O(this.rhs,E,R),this}get names(){const E=this.lhs instanceof t.Name?{}:{...this.lhs.names};return U(E,this.rhs)}}class l extends a{constructor(E,R,D,K){super(E,D,K),this.op=R}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}}class u extends s{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}}class d extends s{constructor(E){super(),this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}}class f extends s{constructor(E){super(),this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}}class p extends s{constructor(E){super(),this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,R){return this.code=O(this.code,E,R),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class h extends s{constructor(E=[]){super(),this.nodes=E}render(E){return this.nodes.reduce((R,D)=>R+D.render(E),"")}optimizeNodes(){const{nodes:E}=this;let R=E.length;for(;R--;){const D=E[R].optimizeNodes();Array.isArray(D)?E.splice(R,1,...D):D?E[R]=D:E.splice(R,1)}return E.length>0?this:void 0}optimizeNames(E,R){const{nodes:D}=this;let K=D.length;for(;K--;){const X=D[K];X.optimizeNames(E,R)||(B(E,X.names),D.splice(K,1))}return D.length>0?this:void 0}get names(){return this.nodes.reduce((E,R)=>I(E,R.names),{})}}class y extends h{render(E){return"{"+E._n+super.render(E)+"}"+E._n}}class m extends h{}class x extends y{}x.kind="else";class g extends y{constructor(E,R){super(R),this.condition=E}render(E){let R=`if(${this.condition})`+super.render(E);return this.else&&(R+="else "+this.else.render(E)),R}optimizeNodes(){super.optimizeNodes();const E=this.condition;if(E===!0)return this.nodes;let R=this.else;if(R){const D=R.optimizeNodes();R=this.else=Array.isArray(D)?new x(D):D}if(R)return E===!1?R instanceof g?R:R.nodes:this.nodes.length?this:new g(J(E),R instanceof g?[R]:R.nodes);if(!(E===!1||!this.nodes.length))return this}optimizeNames(E,R){var D;if(this.else=(D=this.else)===null||D===void 0?void 0:D.optimizeNames(E,R),!!(super.optimizeNames(E,R)||this.else))return this.condition=O(this.condition,E,R),this}get names(){const E=super.names;return U(E,this.condition),this.else&&I(E,this.else.names),E}}g.kind="if";class v extends y{}v.kind="for";class w extends v{constructor(E){super(),this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,R){if(super.optimizeNames(E,R))return this.iteration=O(this.iteration,E,R),this}get names(){return I(super.names,this.iteration.names)}}class k extends v{constructor(E,R,D,K){super(),this.varKind=E,this.name=R,this.from=D,this.to=K}render(E){const R=E.es5?n.varKinds.var:this.varKind,{name:D,from:K,to:X}=this;return`for(${R} ${D}=${K}; ${D}<${X}; ${D}++)`+super.render(E)}get names(){const E=U(super.names,this.from);return U(E,this.to)}}class C extends v{constructor(E,R,D,K){super(),this.loop=E,this.varKind=R,this.name=D,this.iterable=K}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,R){if(super.optimizeNames(E,R))return this.iterable=O(this.iterable,E,R),this}get names(){return I(super.names,this.iterable.names)}}class j extends y{constructor(E,R,D){super(),this.name=E,this.args=R,this.async=D}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}}j.kind="func";class S extends h{render(E){return"return "+super.render(E)}}S.kind="return";class A extends y{render(E){let R="try"+super.render(E);return this.catch&&(R+=this.catch.render(E)),this.finally&&(R+=this.finally.render(E)),R}optimizeNodes(){var E,R;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(R=this.finally)===null||R===void 0||R.optimizeNodes(),this}optimizeNames(E,R){var D,K;return super.optimizeNames(E,R),(D=this.catch)===null||D===void 0||D.optimizeNames(E,R),(K=this.finally)===null||K===void 0||K.optimizeNames(E,R),this}get names(){const E=super.names;return this.catch&&I(E,this.catch.names),this.finally&&I(E,this.finally.names),E}}class P extends y{constructor(E){super(),this.error=E}render(E){return`catch(${this.error})`+super.render(E)}}P.kind="catch";class $ extends y{render(E){return"finally"+super.render(E)}}$.kind="finally";class T{constructor(E,R={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...R,_n:R.lines?`
452
- `:""},this._extScope=E,this._scope=new n.Scope({parent:E}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,R){const D=this._extScope.value(E,R);return(this._values[D.prefix]||(this._values[D.prefix]=new Set)).add(D),D}getScopeValue(E,R){return this._extScope.getValue(E,R)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,R,D,K){const X=this._scope.toName(R);return D!==void 0&&K&&(this._constants[X.str]=D),this._leafNode(new i(E,X,D)),X}const(E,R,D){return this._def(n.varKinds.const,E,R,D)}let(E,R,D){return this._def(n.varKinds.let,E,R,D)}var(E,R,D){return this._def(n.varKinds.var,E,R,D)}assign(E,R,D){return this._leafNode(new a(E,R,D))}add(E,R){return this._leafNode(new l(E,e.operators.ADD,R))}code(E){return typeof E=="function"?E():E!==t.nil&&this._leafNode(new p(E)),this}object(...E){const R=["{"];for(const[D,K]of E)R.length>1&&R.push(","),R.push(D),(D!==K||this.opts.es5)&&(R.push(":"),(0,t.addCodeArg)(R,K));return R.push("}"),new t._Code(R)}if(E,R,D){if(this._blockNode(new g(E)),R&&D)this.code(R).else().code(D).endIf();else if(R)this.code(R).endIf();else if(D)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new g(E))}else(){return this._elseNode(new x)}endIf(){return this._endBlockNode(g,x)}_for(E,R){return this._blockNode(E),R&&this.code(R).endFor(),this}for(E,R){return this._for(new w(E),R)}forRange(E,R,D,K,X=this.opts.es5?n.varKinds.var:n.varKinds.let){const pe=this._scope.toName(E);return this._for(new k(X,pe,R,D),()=>K(pe))}forOf(E,R,D,K=n.varKinds.const){const X=this._scope.toName(E);if(this.opts.es5){const pe=R instanceof t.Name?R:this.var("_arr",R);return this.forRange("_i",0,(0,t._)`${pe}.length`,ce=>{this.var(X,(0,t._)`${pe}[${ce}]`),D(X)})}return this._for(new C("of",K,X,R),()=>D(X))}forIn(E,R,D,K=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,(0,t._)`Object.keys(${R})`,D);const X=this._scope.toName(E);return this._for(new C("in",K,X,R),()=>D(X))}endFor(){return this._endBlockNode(v)}label(E){return this._leafNode(new u(E))}break(E){return this._leafNode(new d(E))}return(E){const R=new S;if(this._blockNode(R),this.code(E),R.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(E,R,D){if(!R&&!D)throw new Error('CodeGen: "try" without "catch" and "finally"');const K=new A;if(this._blockNode(K),this.code(E),R){const X=this.name("e");this._currNode=K.catch=new P(X),R(X)}return D&&(this._currNode=K.finally=new $,this.code(D)),this._endBlockNode(P,$)}throw(E){return this._leafNode(new f(E))}block(E,R){return this._blockStarts.push(this._nodes.length),E&&this.code(E).endBlock(R),this}endBlock(E){const R=this._blockStarts.pop();if(R===void 0)throw new Error("CodeGen: not in self-balancing block");const D=this._nodes.length-R;if(D<0||E!==void 0&&D!==E)throw new Error(`CodeGen: wrong number of nodes: ${D} vs ${E} expected`);return this._nodes.length=R,this}func(E,R=t.nil,D,K){return this._blockNode(new j(E,R,D)),K&&this.code(K).endFunc(),this}endFunc(){return this._endBlockNode(j)}optimize(E=1){for(;E-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,R){const D=this._currNode;if(D instanceof E||R&&D instanceof R)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${R?`${E.kind}/${R.kind}`:E.kind}"`)}_elseNode(E){const R=this._currNode;if(!(R instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=R.else=E,this}get _root(){return this._nodes[0]}get _currNode(){const E=this._nodes;return E[E.length-1]}set _currNode(E){const R=this._nodes;R[R.length-1]=E}}e.CodeGen=T;function I(_,E){for(const R in E)_[R]=(_[R]||0)+(E[R]||0);return _}function U(_,E){return E instanceof t._CodeOrName?I(_,E.names):_}function O(_,E,R){if(_ instanceof t.Name)return D(_);if(!K(_))return _;return new t._Code(_._items.reduce((X,pe)=>(pe instanceof t.Name&&(pe=D(pe)),pe instanceof t._Code?X.push(...pe._items):X.push(pe),X),[]));function D(X){const pe=R[X.str];return pe===void 0||E[X.str]!==1?X:(delete E[X.str],pe)}function K(X){return X instanceof t._Code&&X._items.some(pe=>pe instanceof t.Name&&E[pe.str]===1&&R[pe.str]!==void 0)}}function B(_,E){for(const R in E)_[R]=(_[R]||0)-(E[R]||0)}function J(_){return typeof _=="boolean"||typeof _=="number"||_===null?!_:(0,t._)`!${V(_)}`}e.not=J;const Q=M(e.operators.AND);function H(..._){return _.reduce(Q)}e.and=H;const W=M(e.operators.OR);function N(..._){return _.reduce(W)}e.or=N;function M(_){return(E,R)=>E===t.nil?R:R===t.nil?E:(0,t._)`${V(E)} ${_} ${V(R)}`}function V(_){return _ instanceof t.Name?_:(0,t._)`(${_})`}})(De);var me={};Object.defineProperty(me,"__esModule",{value:!0});me.checkStrictMode=me.getErrorPath=me.Type=me.useFunc=me.setEvaluated=me.evaluatedPropsToName=me.mergeEvaluated=me.eachItem=me.unescapeJsonPointer=me.escapeJsonPointer=me.escapeFragment=me.unescapeFragment=me.schemaRefOrVal=me.schemaHasRulesButRef=me.schemaHasRules=me.checkUnknownRules=me.alwaysValidSchema=me.toHash=void 0;const rt=De,oQ=Dc;function sQ(e){const t={};for(const n of e)t[n]=!0;return t}me.toHash=sQ;function iQ(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Y2(e,t),!X2(t,e.self.RULES.all))}me.alwaysValidSchema=iQ;function Y2(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema||typeof t=="boolean")return;const o=r.RULES.keywords;for(const s in t)o[s]||nR(e,`unknown keyword: "${s}"`)}me.checkUnknownRules=Y2;function X2(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(t[n])return!0;return!1}me.schemaHasRules=X2;function aQ(e,t){if(typeof e=="boolean")return!e;for(const n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}me.schemaHasRulesButRef=aQ;function lQ({topSchemaRef:e,schemaPath:t},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,rt._)`${n}`}return(0,rt._)`${e}${t}${(0,rt.getProperty)(r)}`}me.schemaRefOrVal=lQ;function cQ(e){return eR(decodeURIComponent(e))}me.unescapeFragment=cQ;function uQ(e){return encodeURIComponent(sx(e))}me.escapeFragment=uQ;function sx(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}me.escapeJsonPointer=sx;function eR(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}me.unescapeJsonPointer=eR;function dQ(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)}me.eachItem=dQ;function P1({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(o,s,i,a)=>{const l=i===void 0?s:i instanceof rt.Name?(s instanceof rt.Name?e(o,s,i):t(o,s,i),i):s instanceof rt.Name?(t(o,i,s),s):n(s,i);return a===rt.Name&&!(l instanceof rt.Name)?r(o,l):l}}me.mergeEvaluated={props:P1({mergeNames:(e,t,n)=>e.if((0,rt._)`${n} !== true && ${t} !== undefined`,()=>{e.if((0,rt._)`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,(0,rt._)`${n} || {}`).code((0,rt._)`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if((0,rt._)`${n} !== true`,()=>{t===!0?e.assign(n,!0):(e.assign(n,(0,rt._)`${n} || {}`),ix(e,n,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:tR}),items:P1({mergeNames:(e,t,n)=>e.if((0,rt._)`${n} !== true && ${t} !== undefined`,()=>e.assign(n,(0,rt._)`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if((0,rt._)`${n} !== true`,()=>e.assign(n,t===!0?!0:(0,rt._)`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function tR(e,t){if(t===!0)return e.var("props",!0);const n=e.var("props",(0,rt._)`{}`);return t!==void 0&&ix(e,n,t),n}me.evaluatedPropsToName=tR;function ix(e,t,n){Object.keys(n).forEach(r=>e.assign((0,rt._)`${t}${(0,rt.getProperty)(r)}`,!0))}me.setEvaluated=ix;const T1={};function fQ(e,t){return e.scopeValue("func",{ref:t,code:T1[t.code]||(T1[t.code]=new oQ._Code(t.code))})}me.useFunc=fQ;var Sy;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Sy||(me.Type=Sy={}));function hQ(e,t,n){if(e instanceof rt.Name){const r=t===Sy.Num;return n?r?(0,rt._)`"[" + ${e} + "]"`:(0,rt._)`"['" + ${e} + "']"`:r?(0,rt._)`"/" + ${e}`:(0,rt._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,rt.getProperty)(e).toString():"/"+sx(e)}me.getErrorPath=hQ;function nR(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw new Error(t);e.self.logger.warn(t)}}me.checkStrictMode=nR;var ao={};Object.defineProperty(ao,"__esModule",{value:!0});const cn=De,pQ={data:new cn.Name("data"),valCxt:new cn.Name("valCxt"),instancePath:new cn.Name("instancePath"),parentData:new cn.Name("parentData"),parentDataProperty:new cn.Name("parentDataProperty"),rootData:new cn.Name("rootData"),dynamicAnchors:new cn.Name("dynamicAnchors"),vErrors:new cn.Name("vErrors"),errors:new cn.Name("errors"),this:new cn.Name("this"),self:new cn.Name("self"),scope:new cn.Name("scope"),json:new cn.Name("json"),jsonPos:new cn.Name("jsonPos"),jsonLen:new cn.Name("jsonLen"),jsonPart:new cn.Name("jsonPart")};ao.default=pQ;(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=De,n=me,r=ao;e.keywordError={message:({keyword:x})=>(0,t.str)`must pass "${x}" keyword validation`},e.keyword$DataError={message:({keyword:x,schemaType:g})=>g?(0,t.str)`"${x}" keyword must be ${g} ($data)`:(0,t.str)`"${x}" keyword is invalid ($data)`};function o(x,g=e.keywordError,v,w){const{it:k}=x,{gen:C,compositeRule:j,allErrors:S}=k,A=f(x,g,v);w??(j||S)?l(C,A):u(k,(0,t._)`[${A}]`)}e.reportError=o;function s(x,g=e.keywordError,v){const{it:w}=x,{gen:k,compositeRule:C,allErrors:j}=w,S=f(x,g,v);l(k,S),C||j||u(w,r.default.vErrors)}e.reportExtraError=s;function i(x,g){x.assign(r.default.errors,g),x.if((0,t._)`${r.default.vErrors} !== null`,()=>x.if(g,()=>x.assign((0,t._)`${r.default.vErrors}.length`,g),()=>x.assign(r.default.vErrors,null)))}e.resetErrorsCount=i;function a({gen:x,keyword:g,schemaValue:v,data:w,errsCount:k,it:C}){if(k===void 0)throw new Error("ajv implementation error");const j=x.name("err");x.forRange("i",k,r.default.errors,S=>{x.const(j,(0,t._)`${r.default.vErrors}[${S}]`),x.if((0,t._)`${j}.instancePath === undefined`,()=>x.assign((0,t._)`${j}.instancePath`,(0,t.strConcat)(r.default.instancePath,C.errorPath))),x.assign((0,t._)`${j}.schemaPath`,(0,t.str)`${C.errSchemaPath}/${g}`),C.opts.verbose&&(x.assign((0,t._)`${j}.schema`,v),x.assign((0,t._)`${j}.data`,w))})}e.extendErrors=a;function l(x,g){const v=x.const("err",g);x.if((0,t._)`${r.default.vErrors} === null`,()=>x.assign(r.default.vErrors,(0,t._)`[${v}]`),(0,t._)`${r.default.vErrors}.push(${v})`),x.code((0,t._)`${r.default.errors}++`)}function u(x,g){const{gen:v,validateName:w,schemaEnv:k}=x;k.$async?v.throw((0,t._)`new ${x.ValidationError}(${g})`):(v.assign((0,t._)`${w}.errors`,g),v.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(x,g,v){const{createErrors:w}=x.it;return w===!1?(0,t._)`{}`:p(x,g,v)}function p(x,g,v={}){const{gen:w,it:k}=x,C=[h(k,v),y(x,v)];return m(x,g,C),w.object(...C)}function h({errorPath:x},{instancePath:g}){const v=g?(0,t.str)`${x}${(0,n.getErrorPath)(g,n.Type.Str)}`:x;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,v)]}function y({keyword:x,it:{errSchemaPath:g}},{schemaPath:v,parentSchema:w}){let k=w?g:(0,t.str)`${g}/${x}`;return v&&(k=(0,t.str)`${k}${(0,n.getErrorPath)(v,n.Type.Str)}`),[d.schemaPath,k]}function m(x,{params:g,message:v},w){const{keyword:k,data:C,schemaValue:j,it:S}=x,{opts:A,propertyName:P,topSchemaRef:$,schemaPath:T}=S;w.push([d.keyword,k],[d.params,typeof g=="function"?g(x):g||(0,t._)`{}`]),A.messages&&w.push([d.message,typeof v=="function"?v(x):v]),A.verbose&&w.push([d.schema,j],[d.parentSchema,(0,t._)`${$}${T}`],[r.default.data,C]),P&&w.push([d.propertyName,P])}})(fu);var R1;function mQ(){if(R1)return Us;R1=1,Object.defineProperty(Us,"__esModule",{value:!0}),Us.boolOrEmptySchema=Us.topBoolOrEmptySchema=void 0;const e=fu,t=De,n=ao,r={message:"boolean schema is false"};function o(a){const{gen:l,schema:u,validateName:d}=a;u===!1?i(a,!1):typeof u=="object"&&u.$async===!0?l.return(n.default.data):(l.assign((0,t._)`${d}.errors`,null),l.return(!0))}Us.topBoolOrEmptySchema=o;function s(a,l){const{gen:u,schema:d}=a;d===!1?(u.var(l,!1),i(a)):u.var(l,!0)}Us.boolOrEmptySchema=s;function i(a,l){const{gen:u,data:d}=a,f={gen:u,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,e.reportError)(f,r,void 0,l)}return Us}var zt={},ji={};Object.defineProperty(ji,"__esModule",{value:!0});ji.getRules=ji.isJSONType=void 0;const gQ=["string","number","integer","boolean","null","object","array"],yQ=new Set(gQ);function vQ(e){return typeof e=="string"&&yQ.has(e)}ji.isJSONType=vQ;function xQ(){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:{}}}ji.getRules=xQ;var Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.shouldUseRule=Eo.shouldUseGroup=Eo.schemaHasRulesForType=void 0;function wQ({schema:e,self:t},n){const r=t.RULES.types[n];return r&&r!==!0&&rR(e,r)}Eo.schemaHasRulesForType=wQ;function rR(e,t){return t.rules.some(n=>oR(e,n))}Eo.shouldUseGroup=rR;function oR(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some(r=>e[r]!==void 0))}Eo.shouldUseRule=oR;Object.defineProperty(zt,"__esModule",{value:!0});zt.reportTypeError=zt.checkDataTypes=zt.checkDataType=zt.coerceAndCheckDataType=zt.getJSONTypes=zt.getSchemaTypes=zt.DataType=void 0;const bQ=ji,kQ=Eo,_Q=fu,Oe=De,sR=me;var ka;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ka||(zt.DataType=ka={}));function SQ(e){const t=iR(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}zt.getSchemaTypes=SQ;function iR(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(bQ.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}zt.getJSONTypes=iR;function CQ(e,t){const{gen:n,data:r,opts:o}=e,s=EQ(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,kQ.schemaHasRulesForType)(e,t[0]));if(i){const a=ax(t,r,o.strictNumbers,ka.Wrong);n.if(a,()=>{s.length?NQ(e,t,s):lx(e)})}return i}zt.coerceAndCheckDataType=CQ;const aR=new Set(["string","number","integer","boolean","null"]);function EQ(e,t){return t?e.filter(n=>aR.has(n)||t==="array"&&n==="array"):[]}function NQ(e,t,n){const{gen:r,data:o,opts:s}=e,i=r.let("dataType",(0,Oe._)`typeof ${o}`),a=r.let("coerced",(0,Oe._)`undefined`);s.coerceTypes==="array"&&r.if((0,Oe._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,(0,Oe._)`${o}[0]`).assign(i,(0,Oe._)`typeof ${o}`).if(ax(t,o,s.strictNumbers),()=>r.assign(a,o))),r.if((0,Oe._)`${a} !== undefined`);for(const u of n)(aR.has(u)||u==="array"&&s.coerceTypes==="array")&&l(u);r.else(),lx(e),r.endIf(),r.if((0,Oe._)`${a} !== undefined`,()=>{r.assign(o,a),jQ(e,a)});function l(u){switch(u){case"string":r.elseIf((0,Oe._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,Oe._)`"" + ${o}`).elseIf((0,Oe._)`${o} === null`).assign(a,(0,Oe._)`""`);return;case"number":r.elseIf((0,Oe._)`${i} == "boolean" || ${o} === null
453
- || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,Oe._)`+${o}`);return;case"integer":r.elseIf((0,Oe._)`${i} === "boolean" || ${o} === null
454
- || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,Oe._)`+${o}`);return;case"boolean":r.elseIf((0,Oe._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,Oe._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":r.elseIf((0,Oe._)`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(a,null);return;case"array":r.elseIf((0,Oe._)`${i} === "string" || ${i} === "number"
455
- || ${i} === "boolean" || ${o} === null`).assign(a,(0,Oe._)`[${o}]`)}}}function jQ({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,Oe._)`${t} !== undefined`,()=>e.assign((0,Oe._)`${t}[${n}]`,r))}function Cy(e,t,n,r=ka.Correct){const o=r===ka.Correct?Oe.operators.EQ:Oe.operators.NEQ;let s;switch(e){case"null":return(0,Oe._)`${t} ${o} null`;case"array":s=(0,Oe._)`Array.isArray(${t})`;break;case"object":s=(0,Oe._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,Oe._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,Oe._)`typeof ${t} ${o} ${e}`}return r===ka.Correct?s:(0,Oe.not)(s);function i(a=Oe.nil){return(0,Oe.and)((0,Oe._)`typeof ${t} == "number"`,a,n?(0,Oe._)`isFinite(${t})`:Oe.nil)}}zt.checkDataType=Cy;function ax(e,t,n,r){if(e.length===1)return Cy(e[0],t,n,r);let o;const s=(0,sR.toHash)(e);if(s.array&&s.object){const i=(0,Oe._)`typeof ${t} != "object"`;o=s.null?i:(0,Oe._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=Oe.nil;s.number&&delete s.integer;for(const i in s)o=(0,Oe.and)(o,Cy(i,t,n,r));return o}zt.checkDataTypes=ax;const PQ={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,Oe._)`{type: ${e}}`:(0,Oe._)`{type: ${t}}`};function lx(e){const t=TQ(e);(0,_Q.reportError)(t,PQ)}zt.reportTypeError=lx;function TQ(e){const{gen:t,data:n,schema:r}=e,o=(0,sR.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:e}}var Tl={},$1;function RQ(){if($1)return Tl;$1=1,Object.defineProperty(Tl,"__esModule",{value:!0}),Tl.assignDefaults=void 0;const e=De,t=me;function n(o,s){const{properties:i,items:a}=o.schema;if(s==="object"&&i)for(const l in i)r(o,l,i[l].default);else s==="array"&&Array.isArray(a)&&a.forEach((l,u)=>r(o,u,l.default))}Tl.assignDefaults=n;function r(o,s,i){const{gen:a,compositeRule:l,data:u,opts:d}=o;if(i===void 0)return;const f=(0,e._)`${u}${(0,e.getProperty)(s)}`;if(l){(0,t.checkStrictMode)(o,`default is ignored for: ${f}`);return}let p=(0,e._)`${f} === undefined`;d.useDefaults==="empty"&&(p=(0,e._)`${p} || ${f} === null || ${f} === ""`),a.if(p,(0,e._)`${f} = ${(0,e.stringify)(i)}`)}return Tl}var yr={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.validateUnion=ze.validateArray=ze.usePattern=ze.callValidateCode=ze.schemaProperties=ze.allSchemaProperties=ze.noPropertyInData=ze.propertyInData=ze.isOwnProperty=ze.hasPropFunc=ze.reportMissingProp=ze.checkMissingProp=ze.checkReportMissingProp=void 0;const ct=De,cx=me,Ho=ao,$Q=me;function IQ(e,t){const{gen:n,data:r,it:o}=e;n.if(dx(n,r,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ct._)`${t}`},!0),e.error()})}ze.checkReportMissingProp=IQ;function AQ({gen:e,data:t,it:{opts:n}},r,o){return(0,ct.or)(...r.map(s=>(0,ct.and)(dx(e,t,s,n.ownProperties),(0,ct._)`${o} = ${s}`)))}ze.checkMissingProp=AQ;function OQ(e,t){e.setParams({missingProperty:t},!0),e.error()}ze.reportMissingProp=OQ;function lR(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ct._)`Object.prototype.hasOwnProperty`})}ze.hasPropFunc=lR;function ux(e,t,n){return(0,ct._)`${lR(e)}.call(${t}, ${n})`}ze.isOwnProperty=ux;function MQ(e,t,n,r){const o=(0,ct._)`${t}${(0,ct.getProperty)(n)} !== undefined`;return r?(0,ct._)`${o} && ${ux(e,t,n)}`:o}ze.propertyInData=MQ;function dx(e,t,n,r){const o=(0,ct._)`${t}${(0,ct.getProperty)(n)} === undefined`;return r?(0,ct.or)(o,(0,ct.not)(ux(e,t,n))):o}ze.noPropertyInData=dx;function cR(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ze.allSchemaProperties=cR;function DQ(e,t){return cR(t).filter(n=>!(0,cx.alwaysValidSchema)(e,t[n]))}ze.schemaProperties=DQ;function LQ({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:s},it:i},a,l,u){const d=u?(0,ct._)`${e}, ${t}, ${r}${o}`:t,f=[[Ho.default.instancePath,(0,ct.strConcat)(Ho.default.instancePath,s)],[Ho.default.parentData,i.parentData],[Ho.default.parentDataProperty,i.parentDataProperty],[Ho.default.rootData,Ho.default.rootData]];i.opts.dynamicRef&&f.push([Ho.default.dynamicAnchors,Ho.default.dynamicAnchors]);const p=(0,ct._)`${d}, ${n.object(...f)}`;return l!==ct.nil?(0,ct._)`${a}.call(${l}, ${p})`:(0,ct._)`${a}(${p})`}ze.callValidateCode=LQ;const zQ=(0,ct._)`new RegExp`;function FQ({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(n,r);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ct._)`${o.code==="new RegExp"?zQ:(0,$Q.useFunc)(e,o)}(${n}, ${r})`})}ze.usePattern=FQ;function UQ(e){const{gen:t,data:n,keyword:r,it:o}=e,s=t.name("valid");if(o.allErrors){const a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){const l=t.const("len",(0,ct._)`${n}.length`);t.forRange("i",0,l,u=>{e.subschema({keyword:r,dataProp:u,dataPropType:cx.Type.Num},s),t.if((0,ct.not)(s),a)})}}ze.validateArray=UQ;function qQ(e){const{gen:t,schema:n,keyword:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(l=>(0,cx.alwaysValidSchema)(o,l))&&!o.opts.unevaluated)return;const i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,u)=>{const d=e.subschema({keyword:r,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ct._)`${i} || ${a}`),e.mergeValidEvaluated(d,a)||t.if((0,ct.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}ze.validateUnion=qQ;var I1;function VQ(){if(I1)return yr;I1=1,Object.defineProperty(yr,"__esModule",{value:!0}),yr.validateKeywordUsage=yr.validSchemaType=yr.funcKeywordCode=yr.macroKeywordCode=void 0;const e=De,t=ao,n=ze,r=fu;function o(p,h){const{gen:y,keyword:m,schema:x,parentSchema:g,it:v}=p,w=h.macro.call(v.self,x,g,v),k=u(y,m,w);v.opts.validateSchema!==!1&&v.self.validateSchema(w,!0);const C=y.name("valid");p.subschema({schema:w,schemaPath:e.nil,errSchemaPath:`${v.errSchemaPath}/${m}`,topSchemaRef:k,compositeRule:!0},C),p.pass(C,()=>p.error(!0))}yr.macroKeywordCode=o;function s(p,h){var y;const{gen:m,keyword:x,schema:g,parentSchema:v,$data:w,it:k}=p;l(k,h);const C=!w&&h.compile?h.compile.call(k.self,g,v,k):h.validate,j=u(m,x,C),S=m.let("valid");p.block$data(S,A),p.ok((y=h.valid)!==null&&y!==void 0?y:S);function A(){if(h.errors===!1)T(),h.modifying&&i(p),I(()=>p.error());else{const U=h.async?P():$();h.modifying&&i(p),I(()=>a(p,U))}}function P(){const U=m.let("ruleErrs",null);return m.try(()=>T((0,e._)`await `),O=>m.assign(S,!1).if((0,e._)`${O} instanceof ${k.ValidationError}`,()=>m.assign(U,(0,e._)`${O}.errors`),()=>m.throw(O))),U}function $(){const U=(0,e._)`${j}.errors`;return m.assign(U,null),T(e.nil),U}function T(U=h.async?(0,e._)`await `:e.nil){const O=k.opts.passContext?t.default.this:t.default.self,B=!("compile"in h&&!w||h.schema===!1);m.assign(S,(0,e._)`${U}${(0,n.callValidateCode)(p,j,O,B)}`,h.modifying)}function I(U){var O;m.if((0,e.not)((O=h.valid)!==null&&O!==void 0?O:S),U)}}yr.funcKeywordCode=s;function i(p){const{gen:h,data:y,it:m}=p;h.if(m.parentData,()=>h.assign(y,(0,e._)`${m.parentData}[${m.parentDataProperty}]`))}function a(p,h){const{gen:y}=p;y.if((0,e._)`Array.isArray(${h})`,()=>{y.assign(t.default.vErrors,(0,e._)`${t.default.vErrors} === null ? ${h} : ${t.default.vErrors}.concat(${h})`).assign(t.default.errors,(0,e._)`${t.default.vErrors}.length`),(0,r.extendErrors)(p)},()=>p.error())}function l({schemaEnv:p},h){if(h.async&&!p.$async)throw new Error("async keyword in sync schema")}function u(p,h,y){if(y===void 0)throw new Error(`keyword "${h}" failed to compile`);return p.scopeValue("keyword",typeof y=="function"?{ref:y}:{ref:y,code:(0,e.stringify)(y)})}function d(p,h,y=!1){return!h.length||h.some(m=>m==="array"?Array.isArray(p):m==="object"?p&&typeof p=="object"&&!Array.isArray(p):typeof p==m||y&&typeof p>"u")}yr.validSchemaType=d;function f({schema:p,opts:h,self:y,errSchemaPath:m},x,g){if(Array.isArray(x.keyword)?!x.keyword.includes(g):x.keyword!==g)throw new Error("ajv implementation error");const v=x.dependencies;if(v!=null&&v.some(w=>!Object.prototype.hasOwnProperty.call(p,w)))throw new Error(`parent schema must have dependencies of ${g}: ${v.join(",")}`);if(x.validateSchema&&!x.validateSchema(p[g])){const k=`keyword "${g}" value is invalid at path "${m}": `+y.errorsText(x.validateSchema.errors);if(h.validateSchema==="log")y.logger.error(k);else throw new Error(k)}}return yr.validateKeywordUsage=f,yr}var fo={},A1;function HQ(){if(A1)return fo;A1=1,Object.defineProperty(fo,"__esModule",{value:!0}),fo.extendSubschemaMode=fo.extendSubschemaData=fo.getSubschema=void 0;const e=De,t=me;function n(s,{keyword:i,schemaProp:a,schema:l,schemaPath:u,errSchemaPath:d,topSchemaRef:f}){if(i!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const p=s.schema[i];return a===void 0?{schema:p,schemaPath:(0,e._)`${s.schemaPath}${(0,e.getProperty)(i)}`,errSchemaPath:`${s.errSchemaPath}/${i}`}:{schema:p[a],schemaPath:(0,e._)`${s.schemaPath}${(0,e.getProperty)(i)}${(0,e.getProperty)(a)}`,errSchemaPath:`${s.errSchemaPath}/${i}/${(0,t.escapeFragment)(a)}`}}if(l!==void 0){if(u===void 0||d===void 0||f===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:u,topSchemaRef:f,errSchemaPath:d}}throw new Error('either "keyword" or "schema" must be passed')}fo.getSubschema=n;function r(s,i,{dataProp:a,dataPropType:l,data:u,dataTypes:d,propertyName:f}){if(u!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:p}=i;if(a!==void 0){const{errorPath:y,dataPathArr:m,opts:x}=i,g=p.let("data",(0,e._)`${i.data}${(0,e.getProperty)(a)}`,!0);h(g),s.errorPath=(0,e.str)`${y}${(0,t.getErrorPath)(a,l,x.jsPropertySyntax)}`,s.parentDataProperty=(0,e._)`${a}`,s.dataPathArr=[...m,s.parentDataProperty]}if(u!==void 0){const y=u instanceof e.Name?u:p.let("data",u,!0);h(y),f!==void 0&&(s.propertyName=f)}d&&(s.dataTypes=d);function h(y){s.data=y,s.dataLevel=i.dataLevel+1,s.dataTypes=[],i.definedProperties=new Set,s.parentData=i.data,s.dataNames=[...i.dataNames,y]}}fo.extendSubschemaData=r;function o(s,{jtdDiscriminator:i,jtdMetadata:a,compositeRule:l,createErrors:u,allErrors:d}){l!==void 0&&(s.compositeRule=l),u!==void 0&&(s.createErrors=u),d!==void 0&&(s.allErrors=d),s.jtdDiscriminator=i,s.jtdMetadata=a}return fo.extendSubschemaMode=o,fo}var Jt={},uR=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n},dR={exports:{}},hs=dR.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};Pd(t,r,o,e,"",e)};hs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};hs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};hs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};hs.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 Pd(e,t,n,r,o,s,i,a,l,u){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,o,s,i,a,l,u);for(var d in r){var f=r[d];if(Array.isArray(f)){if(d in hs.arrayKeywords)for(var p=0;p<f.length;p++)Pd(e,t,n,f[p],o+"/"+d+"/"+p,s,o,d,r,p)}else if(d in hs.propsKeywords){if(f&&typeof f=="object")for(var h in f)Pd(e,t,n,f[h],o+"/"+d+"/"+BQ(h),s,o,d,r,h)}else(d in hs.keywords||e.allKeys&&!(d in hs.skipKeywords))&&Pd(e,t,n,f,o+"/"+d,s,o,d,r)}n(r,o,s,i,a,l,u)}}function BQ(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var WQ=dR.exports;Object.defineProperty(Jt,"__esModule",{value:!0});Jt.getSchemaRefs=Jt.resolveUrl=Jt.normalizeId=Jt._getFullPath=Jt.getFullPath=Jt.inlineRef=void 0;const KQ=me,ZQ=uR,QQ=WQ,GQ=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function JQ(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ey(e):t?fR(e)<=t:!1}Jt.inlineRef=JQ;const YQ=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ey(e){for(const t in e){if(YQ.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(Ey)||typeof n=="object"&&Ey(n))return!0}return!1}function fR(e){let t=0;for(const n in e){if(n==="$ref")return 1/0;if(t++,!GQ.has(n)&&(typeof e[n]=="object"&&(0,KQ.eachItem)(e[n],r=>t+=fR(r)),t===1/0))return 1/0}return t}function hR(e,t="",n){n!==!1&&(t=_a(t));const r=e.parse(t);return pR(e,r)}Jt.getFullPath=hR;function pR(e,t){return e.serialize(t).split("#")[0]+"#"}Jt._getFullPath=pR;const XQ=/#\/?$/;function _a(e){return e?e.replace(XQ,""):""}Jt.normalizeId=_a;function eG(e,t,n){return n=_a(n),e.resolve(t,n)}Jt.resolveUrl=eG;const tG=/^[a-z_][-a-z0-9._]*$/i;function nG(e,t){if(typeof e=="boolean")return{};const{schemaId:n,uriResolver:r}=this.opts,o=_a(e[n]||t),s={"":o},i=hR(r,o,!1),a={},l=new Set;return QQ(e,{allKeys:!0},(f,p,h,y)=>{if(y===void 0)return;const m=i+p;let x=s[y];typeof f[n]=="string"&&(x=g.call(this,f[n])),v.call(this,f.$anchor),v.call(this,f.$dynamicAnchor),s[p]=x;function g(w){const k=this.opts.uriResolver.resolve;if(w=_a(x?k(x,w):w),l.has(w))throw d(w);l.add(w);let C=this.refs[w];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(f,C.schema,w):w!==_a(m)&&(w[0]==="#"?(u(f,a[w],w),a[w]=f):this.refs[w]=m),w}function v(w){if(typeof w=="string"){if(!tG.test(w))throw new Error(`invalid anchor "${w}"`);g.call(this,`#${w}`)}}}),a;function u(f,p,h){if(p!==void 0&&!ZQ(f,p))throw d(h)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}Jt.getSchemaRefs=nG;var O1;function Uh(){if(O1)return uo;O1=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.getData=uo.KeywordCxt=uo.validateFunctionCode=void 0;const e=mQ(),t=zt,n=Eo,r=zt,o=RQ(),s=VQ(),i=HQ(),a=De,l=ao,u=Jt,d=me,f=fu;function p(L){if(C(L)&&(S(L),k(L))){x(L);return}h(L,()=>(0,e.topBoolOrEmptySchema)(L))}uo.validateFunctionCode=p;function h({gen:L,validateName:q,schema:Y,schemaEnv:ne,opts:Z},re){Z.code.es5?L.func(q,(0,a._)`${l.default.data}, ${l.default.valCxt}`,ne.$async,()=>{L.code((0,a._)`"use strict"; ${v(Y,Z)}`),m(L,Z),L.code(re)}):L.func(q,(0,a._)`${l.default.data}, ${y(Z)}`,ne.$async,()=>L.code(v(Y,Z)).code(re))}function y(L){return(0,a._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${L.dynamicRef?(0,a._)`, ${l.default.dynamicAnchors}={}`:a.nil}}={}`}function m(L,q){L.if(l.default.valCxt,()=>{L.var(l.default.instancePath,(0,a._)`${l.default.valCxt}.${l.default.instancePath}`),L.var(l.default.parentData,(0,a._)`${l.default.valCxt}.${l.default.parentData}`),L.var(l.default.parentDataProperty,(0,a._)`${l.default.valCxt}.${l.default.parentDataProperty}`),L.var(l.default.rootData,(0,a._)`${l.default.valCxt}.${l.default.rootData}`),q.dynamicRef&&L.var(l.default.dynamicAnchors,(0,a._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{L.var(l.default.instancePath,(0,a._)`""`),L.var(l.default.parentData,(0,a._)`undefined`),L.var(l.default.parentDataProperty,(0,a._)`undefined`),L.var(l.default.rootData,l.default.data),q.dynamicRef&&L.var(l.default.dynamicAnchors,(0,a._)`{}`)})}function x(L){const{schema:q,opts:Y,gen:ne}=L;h(L,()=>{Y.$comment&&q.$comment&&U(L),$(L),ne.let(l.default.vErrors,null),ne.let(l.default.errors,0),Y.unevaluated&&g(L),A(L),O(L)})}function g(L){const{gen:q,validateName:Y}=L;L.evaluated=q.const("evaluated",(0,a._)`${Y}.evaluated`),q.if((0,a._)`${L.evaluated}.dynamicProps`,()=>q.assign((0,a._)`${L.evaluated}.props`,(0,a._)`undefined`)),q.if((0,a._)`${L.evaluated}.dynamicItems`,()=>q.assign((0,a._)`${L.evaluated}.items`,(0,a._)`undefined`))}function v(L,q){const Y=typeof L=="object"&&L[q.schemaId];return Y&&(q.code.source||q.code.process)?(0,a._)`/*# sourceURL=${Y} */`:a.nil}function w(L,q){if(C(L)&&(S(L),k(L))){j(L,q);return}(0,e.boolOrEmptySchema)(L,q)}function k({schema:L,self:q}){if(typeof L=="boolean")return!L;for(const Y in L)if(q.RULES.all[Y])return!0;return!1}function C(L){return typeof L.schema!="boolean"}function j(L,q){const{schema:Y,gen:ne,opts:Z}=L;Z.$comment&&Y.$comment&&U(L),T(L),I(L);const re=ne.const("_errs",l.default.errors);A(L,re),ne.var(q,(0,a._)`${re} === ${l.default.errors}`)}function S(L){(0,d.checkUnknownRules)(L),P(L)}function A(L,q){if(L.opts.jtd)return J(L,[],!1,q);const Y=(0,t.getSchemaTypes)(L.schema),ne=(0,t.coerceAndCheckDataType)(L,Y);J(L,Y,!ne,q)}function P(L){const{schema:q,errSchemaPath:Y,opts:ne,self:Z}=L;q.$ref&&ne.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(q,Z.RULES)&&Z.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function $(L){const{schema:q,opts:Y}=L;q.default!==void 0&&Y.useDefaults&&Y.strictSchema&&(0,d.checkStrictMode)(L,"default is ignored in the schema root")}function T(L){const q=L.schema[L.opts.schemaId];q&&(L.baseId=(0,u.resolveUrl)(L.opts.uriResolver,L.baseId,q))}function I(L){if(L.schema.$async&&!L.schemaEnv.$async)throw new Error("async schema in sync schema")}function U({gen:L,schemaEnv:q,schema:Y,errSchemaPath:ne,opts:Z}){const re=Y.$comment;if(Z.$comment===!0)L.code((0,a._)`${l.default.self}.logger.log(${re})`);else if(typeof Z.$comment=="function"){const oe=(0,a.str)`${ne}/$comment`,Re=L.scopeValue("root",{ref:q.root});L.code((0,a._)`${l.default.self}.opts.$comment(${re}, ${oe}, ${Re}.schema)`)}}function O(L){const{gen:q,schemaEnv:Y,validateName:ne,ValidationError:Z,opts:re}=L;Y.$async?q.if((0,a._)`${l.default.errors} === 0`,()=>q.return(l.default.data),()=>q.throw((0,a._)`new ${Z}(${l.default.vErrors})`)):(q.assign((0,a._)`${ne}.errors`,l.default.vErrors),re.unevaluated&&B(L),q.return((0,a._)`${l.default.errors} === 0`))}function B({gen:L,evaluated:q,props:Y,items:ne}){Y instanceof a.Name&&L.assign((0,a._)`${q}.props`,Y),ne instanceof a.Name&&L.assign((0,a._)`${q}.items`,ne)}function J(L,q,Y,ne){const{gen:Z,schema:re,data:oe,allErrors:Re,opts:le,self:Ce}=L,{RULES:Se}=Ce;if(re.$ref&&(le.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(re,Se))){Z.block(()=>K(L,"$ref",Se.all.$ref.definition));return}le.jtd||H(L,q),Z.block(()=>{for(const Ke of Se.rules)tt(Ke);tt(Se.post)});function tt(Ke){(0,n.shouldUseGroup)(re,Ke)&&(Ke.type?(Z.if((0,r.checkDataType)(Ke.type,oe,le.strictNumbers)),Q(L,Ke),q.length===1&&q[0]===Ke.type&&Y&&(Z.else(),(0,r.reportTypeError)(L)),Z.endIf()):Q(L,Ke),Re||Z.if((0,a._)`${l.default.errors} === ${ne||0}`))}}function Q(L,q){const{gen:Y,schema:ne,opts:{useDefaults:Z}}=L;Z&&(0,o.assignDefaults)(L,q.type),Y.block(()=>{for(const re of q.rules)(0,n.shouldUseRule)(ne,re)&&K(L,re.keyword,re.definition,q.type)})}function H(L,q){L.schemaEnv.meta||!L.opts.strictTypes||(W(L,q),L.opts.allowUnionTypes||N(L,q),M(L,L.dataTypes))}function W(L,q){if(q.length){if(!L.dataTypes.length){L.dataTypes=q;return}q.forEach(Y=>{_(L.dataTypes,Y)||R(L,`type "${Y}" not allowed by context "${L.dataTypes.join(",")}"`)}),E(L,q)}}function N(L,q){q.length>1&&!(q.length===2&&q.includes("null"))&&R(L,"use allowUnionTypes to allow union type keyword")}function M(L,q){const Y=L.self.RULES.all;for(const ne in Y){const Z=Y[ne];if(typeof Z=="object"&&(0,n.shouldUseRule)(L.schema,Z)){const{type:re}=Z.definition;re.length&&!re.some(oe=>V(q,oe))&&R(L,`missing type "${re.join(",")}" for keyword "${ne}"`)}}}function V(L,q){return L.includes(q)||q==="number"&&L.includes("integer")}function _(L,q){return L.includes(q)||q==="integer"&&L.includes("number")}function E(L,q){const Y=[];for(const ne of L.dataTypes)_(q,ne)?Y.push(ne):q.includes("integer")&&ne==="number"&&Y.push("integer");L.dataTypes=Y}function R(L,q){const Y=L.schemaEnv.baseId+L.errSchemaPath;q+=` at "${Y}" (strictTypes)`,(0,d.checkStrictMode)(L,q,L.opts.strictTypes)}class D{constructor(q,Y,ne){if((0,s.validateKeywordUsage)(q,Y,ne),this.gen=q.gen,this.allErrors=q.allErrors,this.keyword=ne,this.data=q.data,this.schema=q.schema[ne],this.$data=Y.$data&&q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(q,this.schema,ne,this.$data),this.schemaType=Y.schemaType,this.parentSchema=q.schema,this.params={},this.it=q,this.def=Y,this.$data)this.schemaCode=q.gen.const("vSchema",ce(this.$data,q));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,Y.schemaType,Y.allowUndefined))throw new Error(`${ne} value must be ${JSON.stringify(Y.schemaType)}`);("code"in Y?Y.trackErrors:Y.errors!==!1)&&(this.errsCount=q.gen.const("_errs",l.default.errors))}result(q,Y,ne){this.failResult((0,a.not)(q),Y,ne)}failResult(q,Y,ne){this.gen.if(q),ne?ne():this.error(),Y?(this.gen.else(),Y(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(q,Y){this.failResult((0,a.not)(q),void 0,Y)}fail(q){if(q===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(q),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(q){if(!this.$data)return this.fail(q);const{schemaCode:Y}=this;this.fail((0,a._)`${Y} !== undefined && (${(0,a.or)(this.invalid$data(),q)})`)}error(q,Y,ne){if(Y){this.setParams(Y),this._error(q,ne),this.setParams({});return}this._error(q,ne)}_error(q,Y){(q?f.reportExtraError:f.reportError)(this,this.def.error,Y)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(q){this.allErrors||this.gen.if(q)}setParams(q,Y){Y?Object.assign(this.params,q):this.params=q}block$data(q,Y,ne=a.nil){this.gen.block(()=>{this.check$data(q,ne),Y()})}check$data(q=a.nil,Y=a.nil){if(!this.$data)return;const{gen:ne,schemaCode:Z,schemaType:re,def:oe}=this;ne.if((0,a.or)((0,a._)`${Z} === undefined`,Y)),q!==a.nil&&ne.assign(q,!0),(re.length||oe.validateSchema)&&(ne.elseIf(this.invalid$data()),this.$dataError(),q!==a.nil&&ne.assign(q,!1)),ne.else()}invalid$data(){const{gen:q,schemaCode:Y,schemaType:ne,def:Z,it:re}=this;return(0,a.or)(oe(),Re());function oe(){if(ne.length){if(!(Y instanceof a.Name))throw new Error("ajv implementation error");const le=Array.isArray(ne)?ne:[ne];return(0,a._)`${(0,r.checkDataTypes)(le,Y,re.opts.strictNumbers,r.DataType.Wrong)}`}return a.nil}function Re(){if(Z.validateSchema){const le=q.scopeValue("validate$data",{ref:Z.validateSchema});return(0,a._)`!${le}(${Y})`}return a.nil}}subschema(q,Y){const ne=(0,i.getSubschema)(this.it,q);(0,i.extendSubschemaData)(ne,this.it,q),(0,i.extendSubschemaMode)(ne,q);const Z={...this.it,...ne,items:void 0,props:void 0};return w(Z,Y),Z}mergeEvaluated(q,Y){const{it:ne,gen:Z}=this;ne.opts.unevaluated&&(ne.props!==!0&&q.props!==void 0&&(ne.props=d.mergeEvaluated.props(Z,q.props,ne.props,Y)),ne.items!==!0&&q.items!==void 0&&(ne.items=d.mergeEvaluated.items(Z,q.items,ne.items,Y)))}mergeValidEvaluated(q,Y){const{it:ne,gen:Z}=this;if(ne.opts.unevaluated&&(ne.props!==!0||ne.items!==!0))return Z.if(Y,()=>this.mergeEvaluated(q,a.Name)),!0}}uo.KeywordCxt=D;function K(L,q,Y,ne){const Z=new D(L,Y,q);"code"in Y?Y.code(Z,ne):Z.$data&&Y.validate?(0,s.funcKeywordCode)(Z,Y):"macro"in Y?(0,s.macroKeywordCode)(Z,Y):(Y.compile||Y.validate)&&(0,s.funcKeywordCode)(Z,Y)}const X=/^\/(?:[^~]|~0|~1)*$/,pe=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ce(L,{dataLevel:q,dataNames:Y,dataPathArr:ne}){let Z,re;if(L==="")return l.default.rootData;if(L[0]==="/"){if(!X.test(L))throw new Error(`Invalid JSON-pointer: ${L}`);Z=L,re=l.default.rootData}else{const Ce=pe.exec(L);if(!Ce)throw new Error(`Invalid JSON-pointer: ${L}`);const Se=+Ce[1];if(Z=Ce[2],Z==="#"){if(Se>=q)throw new Error(le("property/index",Se));return ne[q-Se]}if(Se>q)throw new Error(le("data",Se));if(re=Y[q-Se],!Z)return re}let oe=re;const Re=Z.split("/");for(const Ce of Re)Ce&&(re=(0,a._)`${re}${(0,a.getProperty)((0,d.unescapeJsonPointer)(Ce))}`,oe=(0,a._)`${oe} && ${re}`);return oe;function le(Ce,Se){return`Cannot access ${Ce} ${Se} levels up, current level is ${q}`}}return uo.getData=ce,uo}var Ju={},M1;function fx(){if(M1)return Ju;M1=1,Object.defineProperty(Ju,"__esModule",{value:!0});class e extends Error{constructor(n){super("validation failed"),this.errors=n,this.ajv=this.validation=!0}}return Ju.default=e,Ju}var hl={};Object.defineProperty(hl,"__esModule",{value:!0});const lm=Jt;class rG extends Error{constructor(t,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,lm.resolveUrl)(t,n,r),this.missingSchema=(0,lm.normalizeId)((0,lm.getFullPath)(t,this.missingRef))}}hl.default=rG;var $n={};Object.defineProperty($n,"__esModule",{value:!0});$n.resolveSchema=$n.getCompilingSchema=$n.resolveRef=$n.compileSchema=$n.SchemaEnv=void 0;const vr=De,oG=fx(),qs=ao,Pr=Jt,D1=me,sG=Uh();class qh{constructor(t){var n;this.refs={},this.dynamicAnchors={};let r;typeof t.schema=="object"&&(r=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,Pr.normalizeId)(r==null?void 0:r[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=r==null?void 0:r.$async,this.refs={}}}$n.SchemaEnv=qh;function hx(e){const t=mR.call(this,e);if(t)return t;const n=(0,Pr.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new vr.CodeGen(this.scope,{es5:r,lines:o,ownProperties:s});let a;e.$async&&(a=i.scopeValue("Error",{ref:oG.default,code:(0,vr._)`require("ajv/dist/runtime/validation_error").default`}));const l=i.scopeName("validate");e.validateName=l;const u={gen:i,allErrors:this.opts.allErrors,data:qs.default.data,parentData:qs.default.parentData,parentDataProperty:qs.default.parentDataProperty,dataNames:[qs.default.data],dataPathArr:[vr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,vr.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:vr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,vr._)`""`,opts:this.opts,self:this};let d;try{this._compilations.add(e),(0,sG.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);const f=i.toString();d=`${i.scopeRefs(qs.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,e));const h=new Function(`${qs.default.self}`,`${qs.default.scope}`,d)(this,this.scope.get());if(this.scope.value(l,{ref:h}),h.errors=null,h.schema=e.schema,h.schemaEnv=e,e.$async&&(h.$async=!0),this.opts.code.source===!0&&(h.source={validateName:l,validateCode:f,scopeValues:i._values}),this.opts.unevaluated){const{props:y,items:m}=u;h.evaluated={props:y instanceof vr.Name?void 0:y,items:m instanceof vr.Name?void 0:m,dynamicProps:y instanceof vr.Name,dynamicItems:m instanceof vr.Name},h.source&&(h.source.evaluated=(0,vr.stringify)(h.evaluated))}return e.validate=h,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)}}$n.compileSchema=hx;function iG(e,t,n){var r;n=(0,Pr.resolveUrl)(this.opts.uriResolver,t,n);const o=e.refs[n];if(o)return o;let s=cG.call(this,e,n);if(s===void 0){const i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;i&&(s=new qh({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[n]=aG.call(this,s)}$n.resolveRef=iG;function aG(e){return(0,Pr.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:hx.call(this,e)}function mR(e){for(const t of this._compilations)if(lG(t,e))return t}$n.getCompilingSchema=mR;function lG(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function cG(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||Vh.call(this,e,t)}function Vh(e,t){const n=this.opts.uriResolver.parse(t),r=(0,Pr._getFullPath)(this.opts.uriResolver,n);let o=(0,Pr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===o)return cm.call(this,n,e);const s=(0,Pr.normalizeId)(r),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){const a=Vh.call(this,e,i);return typeof(a==null?void 0:a.schema)!="object"?void 0:cm.call(this,n,a)}if(typeof(i==null?void 0:i.schema)=="object"){if(i.validate||hx.call(this,i),s===(0,Pr.normalizeId)(t)){const{schema:a}=i,{schemaId:l}=this.opts,u=a[l];return u&&(o=(0,Pr.resolveUrl)(this.opts.uriResolver,o,u)),new qh({schema:a,schemaId:l,root:e,baseId:o})}return cm.call(this,n,i)}}$n.resolveSchema=Vh;const uG=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function cm(e,{baseId:t,schema:n,root:r}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(const a of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;const l=n[(0,D1.unescapeFragment)(a)];if(l===void 0)return;n=l;const u=typeof n=="object"&&n[this.opts.schemaId];!uG.has(a)&&u&&(t=(0,Pr.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof n!="boolean"&&n.$ref&&!(0,D1.schemaHasRulesButRef)(n,this.RULES)){const a=(0,Pr.resolveUrl)(this.opts.uriResolver,t,n.$ref);s=Vh.call(this,r,a)}const{schemaId:i}=this.opts;if(s=s||new qh({schema:n,schemaId:i,root:r,baseId:t}),s.schema!==s.root.schema)return s}const dG="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",fG="Meta-schema for $data reference (JSON AnySchema extension proposal)",hG="object",pG=["$data"],mG={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},gG=!1,yG={$id:dG,description:fG,type:hG,required:pG,properties:mG,additionalProperties:gG};var px={},Hh={exports:{}};const vG={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 xG={HEX:vG};const{HEX:wG}=xG,bG=/^(?:(?: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 gR(e){if(vR(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(bG)||[],[n]=t;return n?{host:_G(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function L1(e,t=!1){let n="",r=!0;for(const o of e){if(wG[o]===void 0)return;o!=="0"&&r===!0&&(r=!1),r||(n+=o)}return t&&n.length===0&&(n="0"),n}function kG(e){let t=0;const n={error:!1,address:"",zone:""},r=[],o=[];let s=!1,i=!1,a=!1;function l(){if(o.length){if(s===!1){const u=L1(o);if(u!==void 0)r.push(u);else return n.error=!0,!1}o.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),!l())break;if(t++,r.push(":"),t>7){n.error=!0;break}u-1>=0&&e[u-1]===":"&&(i=!0);continue}else if(d==="%"){if(!l())break;s=!0}else{o.push(d);continue}}return o.length&&(s?n.zone=o.join(""):a?r.push(o.join("")):r.push(L1(o))),n.address=r.join(""),n}function yR(e){if(vR(e,":")<2)return{host:e,isIPV6:!1};const t=kG(e);if(t.error)return{host:e,isIPV6:!1};{let n=t.address,r=t.address;return t.zone&&(n+="%"+t.zone,r+="%25"+t.zone),{host:n,escapedHost:r,isIPV6:!0}}}function _G(e,t){let n="",r=!0;const o=e.length;for(let s=0;s<o;s++){const i=e[s];i==="0"&&r?(s+1<=o&&e[s+1]===t||s+1===o)&&(n+=i,r=!1):(i===t?r=!0:r=!1,n+=i)}return n}function vR(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}const z1=/^\.\.?\//u,F1=/^\/\.(?:\/|$)/u,U1=/^\/\.\.(?:\/|$)/u,SG=/^\/?(?:.|\n)*?(?=\/|$)/u;function CG(e){const t=[];for(;e.length;)if(e.match(z1))e=e.replace(z1,"");else if(e.match(F1))e=e.replace(F1,"/");else if(e.match(U1))e=e.replace(U1,"/"),t.pop();else if(e==="."||e==="..")e="";else{const n=e.match(SG);if(n){const r=n[0];e=e.slice(r.length),t.push(r)}else throw new Error("Unexpected dot segment condition")}return t.join("")}function EG(e,t){const n=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function NG(e){const t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let n=unescape(e.host);const r=gR(n);if(r.isIPV4)n=r.host;else{const o=yR(r.host);o.isIPV6===!0?n=`[${o.escapedHost}]`:n=e.host}t.push(n)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}var jG={recomposeAuthority:NG,normalizeComponentEncoding:EG,removeDotSegments:CG,normalizeIPv4:gR,normalizeIPv6:yR};const PG=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,TG=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function xR(e){return typeof e.secure=="boolean"?e.secure:String(e.scheme).toLowerCase()==="wss"}function wR(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function bR(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 RG(e){return e.secure=xR(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function $G(e){if((e.port===(xR(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,n]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function IG(e,t){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(TG);if(n){const r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=`${r}:${t.nid||e.nid}`,s=mx[o];e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function AG(e,t){const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),o=`${n}:${t.nid||r}`,s=mx[o];s&&(e=s.serialize(e,t));const i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function OG(e,t){const n=e;return n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!PG.test(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function MG(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t}const kR={scheme:"http",domainHost:!0,parse:wR,serialize:bR},DG={scheme:"https",domainHost:kR.domainHost,parse:wR,serialize:bR},Td={scheme:"ws",domainHost:!0,parse:RG,serialize:$G},LG={scheme:"wss",domainHost:Td.domainHost,parse:Td.parse,serialize:Td.serialize},zG={scheme:"urn",parse:IG,serialize:AG,skipNormalize:!0},FG={scheme:"urn:uuid",parse:OG,serialize:MG,skipNormalize:!0},mx={http:kR,https:DG,ws:Td,wss:LG,urn:zG,"urn:uuid":FG};var UG=mx;const{normalizeIPv6:qG,normalizeIPv4:VG,removeDotSegments:ql,recomposeAuthority:HG,normalizeComponentEncoding:Yu}=jG,gx=UG;function BG(e,t){return typeof e=="string"?e=Yr(Ao(e,t),t):typeof e=="object"&&(e=Ao(Yr(e,t),t)),e}function WG(e,t,n){const r=Object.assign({scheme:"null"},n),o=_R(Ao(e,r),Ao(t,r),r,!0);return Yr(o,{...r,skipEscape:!0})}function _R(e,t,n,r){const o={};return r||(e=Ao(Yr(e,n),n),t=Ao(Yr(t,n),n)),n=n||{},!n.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ql(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ql(t.path||""),o.query=t.query):(t.path?(t.path.charAt(0)==="/"?o.path=ql(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=ql(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function KG(e,t,n){return typeof e=="string"?(e=unescape(e),e=Yr(Yu(Ao(e,n),!0),{...n,skipEscape:!0})):typeof e=="object"&&(e=Yr(Yu(e,!0),{...n,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Yr(Yu(Ao(t,n),!0),{...n,skipEscape:!0})):typeof t=="object"&&(t=Yr(Yu(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Yr(e,t){const n={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:""},r=Object.assign({},t),o=[],s=gx[(r.scheme||n.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(n,r),n.path!==void 0&&(r.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split("%3A").join(":")))),r.reference!=="suffix"&&n.scheme&&o.push(n.scheme,":");const i=HG(n);if(i!==void 0&&(r.reference!=="suffix"&&o.push("//"),o.push(i),n.path&&n.path.charAt(0)!=="/"&&o.push("/")),n.path!==void 0){let a=n.path;!r.absolutePath&&(!s||!s.absolutePath)&&(a=ql(a)),i===void 0&&(a=a.replace(/^\/\//u,"/%2F")),o.push(a)}return n.query!==void 0&&o.push("?",n.query),n.fragment!==void 0&&o.push("#",n.fragment),o.join("")}const ZG=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));function QG(e){let t=0;for(let n=0,r=e.length;n<r;++n)if(t=e.charCodeAt(n),t>126||ZG[t])return!0;return!1}const GG=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ao(e,t){const n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=e.indexOf("%")!==-1;let s=!1;n.reference==="suffix"&&(e=(n.scheme?n.scheme+":":"")+"//"+e);const i=e.match(GG);if(i){if(r.scheme=i[1],r.userinfo=i[3],r.host=i[4],r.port=parseInt(i[5],10),r.path=i[6]||"",r.query=i[7],r.fragment=i[8],isNaN(r.port)&&(r.port=i[5]),r.host){const l=VG(r.host);if(l.isIPV4===!1){const u=qG(l.host);r.host=u.host.toLowerCase(),s=u.isIPV6}else r.host=l.host,s=!0}r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path?r.reference="same-document":r.scheme===void 0?r.reference="relative":r.fragment===void 0?r.reference="absolute":r.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==r.reference&&(r.error=r.error||"URI is not a "+n.reference+" reference.");const a=gx[(n.scheme||r.scheme||"").toLowerCase()];if(!n.unicodeSupport&&(!a||!a.unicodeSupport)&&r.host&&(n.domainHost||a&&a.domainHost)&&s===!1&&QG(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(l){r.error=r.error||"Host's domain name can not be converted to ASCII: "+l}(!a||a&&!a.skipNormalize)&&(o&&r.scheme!==void 0&&(r.scheme=unescape(r.scheme)),o&&r.host!==void 0&&(r.host=unescape(r.host)),r.path&&(r.path=escape(unescape(r.path))),r.fragment&&(r.fragment=encodeURI(decodeURIComponent(r.fragment)))),a&&a.parse&&a.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return r}const yx={SCHEMES:gx,normalize:BG,resolve:WG,resolveComponents:_R,equal:KG,serialize:Yr,parse:Ao};Hh.exports=yx;Hh.exports.default=yx;Hh.exports.fastUri=yx;var JG=Hh.exports;Object.defineProperty(px,"__esModule",{value:!0});const SR=JG;SR.code='require("ajv/dist/runtime/uri").default';px.default=SR;(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=Uh();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=De;Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return n.CodeGen}});const r=fx(),o=hl,s=ji,i=$n,a=De,l=Jt,u=zt,d=me,f=yG,p=px,h=(N,M)=>new RegExp(N,M);h.code="new RegExp";const y=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),x={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."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},v=200;function w(N){var M,V,_,E,R,D,K,X,pe,ce,L,q,Y,ne,Z,re,oe,Re,le,Ce,Se,tt,Ke,pn,zn;const G=N.strict,ae=(M=N.code)===null||M===void 0?void 0:M.optimize,we=ae===!0||ae===void 0?1:ae||0,Ie=(_=(V=N.code)===null||V===void 0?void 0:V.regExp)!==null&&_!==void 0?_:h,He=(E=N.uriResolver)!==null&&E!==void 0?E:p.default;return{strictSchema:(D=(R=N.strictSchema)!==null&&R!==void 0?R:G)!==null&&D!==void 0?D:!0,strictNumbers:(X=(K=N.strictNumbers)!==null&&K!==void 0?K:G)!==null&&X!==void 0?X:!0,strictTypes:(ce=(pe=N.strictTypes)!==null&&pe!==void 0?pe:G)!==null&&ce!==void 0?ce:"log",strictTuples:(q=(L=N.strictTuples)!==null&&L!==void 0?L:G)!==null&&q!==void 0?q:"log",strictRequired:(ne=(Y=N.strictRequired)!==null&&Y!==void 0?Y:G)!==null&&ne!==void 0?ne:!1,code:N.code?{...N.code,optimize:we,regExp:Ie}:{optimize:we,regExp:Ie},loopRequired:(Z=N.loopRequired)!==null&&Z!==void 0?Z:v,loopEnum:(re=N.loopEnum)!==null&&re!==void 0?re:v,meta:(oe=N.meta)!==null&&oe!==void 0?oe:!0,messages:(Re=N.messages)!==null&&Re!==void 0?Re:!0,inlineRefs:(le=N.inlineRefs)!==null&&le!==void 0?le:!0,schemaId:(Ce=N.schemaId)!==null&&Ce!==void 0?Ce:"$id",addUsedSchema:(Se=N.addUsedSchema)!==null&&Se!==void 0?Se:!0,validateSchema:(tt=N.validateSchema)!==null&&tt!==void 0?tt:!0,validateFormats:(Ke=N.validateFormats)!==null&&Ke!==void 0?Ke:!0,unicodeRegExp:(pn=N.unicodeRegExp)!==null&&pn!==void 0?pn:!0,int32range:(zn=N.int32range)!==null&&zn!==void 0?zn:!0,uriResolver:He}}class k{constructor(M={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,M=this.opts={...M,...w(M)};const{es5:V,lines:_}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:m,es5:V,lines:_}),this.logger=I(M.logger);const E=M.validateFormats;M.validateFormats=!1,this.RULES=(0,s.getRules)(),C.call(this,x,M,"NOT SUPPORTED"),C.call(this,g,M,"DEPRECATED","warn"),this._metaOpts=$.call(this),M.formats&&A.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),M.keywords&&P.call(this,M.keywords),typeof M.meta=="object"&&this.addMetaSchema(M.meta),S.call(this),M.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:M,meta:V,schemaId:_}=this.opts;let E=f;_==="id"&&(E={...f},E.id=E.$id,delete E.$id),V&&M&&this.addMetaSchema(E,E[_],!1)}defaultMeta(){const{meta:M,schemaId:V}=this.opts;return this.opts.defaultMeta=typeof M=="object"?M[V]||M:void 0}validate(M,V){let _;if(typeof M=="string"){if(_=this.getSchema(M),!_)throw new Error(`no schema with key or ref "${M}"`)}else _=this.compile(M);const E=_(V);return"$async"in _||(this.errors=_.errors),E}compile(M,V){const _=this._addSchema(M,V);return _.validate||this._compileSchemaEnv(_)}compileAsync(M,V){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:_}=this.opts;return E.call(this,M,V);async function E(ce,L){await R.call(this,ce.$schema);const q=this._addSchema(ce,L);return q.validate||D.call(this,q)}async function R(ce){ce&&!this.getSchema(ce)&&await E.call(this,{$ref:ce},!0)}async function D(ce){try{return this._compileSchemaEnv(ce)}catch(L){if(!(L instanceof o.default))throw L;return K.call(this,L),await X.call(this,L.missingSchema),D.call(this,ce)}}function K({missingSchema:ce,missingRef:L}){if(this.refs[ce])throw new Error(`AnySchema ${ce} is loaded but ${L} cannot be resolved`)}async function X(ce){const L=await pe.call(this,ce);this.refs[ce]||await R.call(this,L.$schema),this.refs[ce]||this.addSchema(L,ce,V)}async function pe(ce){const L=this._loading[ce];if(L)return L;try{return await(this._loading[ce]=_(ce))}finally{delete this._loading[ce]}}}addSchema(M,V,_,E=this.opts.validateSchema){if(Array.isArray(M)){for(const D of M)this.addSchema(D,void 0,_,E);return this}let R;if(typeof M=="object"){const{schemaId:D}=this.opts;if(R=M[D],R!==void 0&&typeof R!="string")throw new Error(`schema ${D} must be string`)}return V=(0,l.normalizeId)(V||R),this._checkUnique(V),this.schemas[V]=this._addSchema(M,_,V,E,!0),this}addMetaSchema(M,V,_=this.opts.validateSchema){return this.addSchema(M,V,!0,_),this}validateSchema(M,V){if(typeof M=="boolean")return!0;let _;if(_=M.$schema,_!==void 0&&typeof _!="string")throw new Error("$schema must be a string");if(_=_||this.opts.defaultMeta||this.defaultMeta(),!_)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const E=this.validate(_,M);if(!E&&V){const R="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(R);else throw new Error(R)}return E}getSchema(M){let V;for(;typeof(V=j.call(this,M))=="string";)M=V;if(V===void 0){const{schemaId:_}=this.opts,E=new i.SchemaEnv({schema:{},schemaId:_});if(V=i.resolveSchema.call(this,E,M),!V)return;this.refs[M]=V}return V.validate||this._compileSchemaEnv(V)}removeSchema(M){if(M instanceof RegExp)return this._removeAllSchemas(this.schemas,M),this._removeAllSchemas(this.refs,M),this;switch(typeof M){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const V=j.call(this,M);return typeof V=="object"&&this._cache.delete(V.schema),delete this.schemas[M],delete this.refs[M],this}case"object":{const V=M;this._cache.delete(V);let _=M[this.opts.schemaId];return _&&(_=(0,l.normalizeId)(_),delete this.schemas[_],delete this.refs[_]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(M){for(const V of M)this.addKeyword(V);return this}addKeyword(M,V){let _;if(typeof M=="string")_=M,typeof V=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),V.keyword=_);else if(typeof M=="object"&&V===void 0){if(V=M,_=V.keyword,Array.isArray(_)&&!_.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(O.call(this,_,V),!V)return(0,d.eachItem)(_,R=>B.call(this,R)),this;Q.call(this,V);const E={...V,type:(0,u.getJSONTypes)(V.type),schemaType:(0,u.getJSONTypes)(V.schemaType)};return(0,d.eachItem)(_,E.type.length===0?R=>B.call(this,R,E):R=>E.type.forEach(D=>B.call(this,R,E,D))),this}getKeyword(M){const V=this.RULES.all[M];return typeof V=="object"?V.definition:!!V}removeKeyword(M){const{RULES:V}=this;delete V.keywords[M],delete V.all[M];for(const _ of V.rules){const E=_.rules.findIndex(R=>R.keyword===M);E>=0&&_.rules.splice(E,1)}return this}addFormat(M,V){return typeof V=="string"&&(V=new RegExp(V)),this.formats[M]=V,this}errorsText(M=this.errors,{separator:V=", ",dataVar:_="data"}={}){return!M||M.length===0?"No errors":M.map(E=>`${_}${E.instancePath} ${E.message}`).reduce((E,R)=>E+V+R)}$dataMetaSchema(M,V){const _=this.RULES.all;M=JSON.parse(JSON.stringify(M));for(const E of V){const R=E.split("/").slice(1);let D=M;for(const K of R)D=D[K];for(const K in _){const X=_[K];if(typeof X!="object")continue;const{$data:pe}=X.definition,ce=D[K];pe&&ce&&(D[K]=W(ce))}}return M}_removeAllSchemas(M,V){for(const _ in M){const E=M[_];(!V||V.test(_))&&(typeof E=="string"?delete M[_]:E&&!E.meta&&(this._cache.delete(E.schema),delete M[_]))}}_addSchema(M,V,_,E=this.opts.validateSchema,R=this.opts.addUsedSchema){let D;const{schemaId:K}=this.opts;if(typeof M=="object")D=M[K];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof M!="boolean")throw new Error("schema must be object or boolean")}let X=this._cache.get(M);if(X!==void 0)return X;_=(0,l.normalizeId)(D||_);const pe=l.getSchemaRefs.call(this,M,_);return X=new i.SchemaEnv({schema:M,schemaId:K,meta:V,baseId:_,localRefs:pe}),this._cache.set(X.schema,X),R&&!_.startsWith("#")&&(_&&this._checkUnique(_),this.refs[_]=X),E&&this.validateSchema(M,!0),X}_checkUnique(M){if(this.schemas[M]||this.refs[M])throw new Error(`schema with key or id "${M}" already exists`)}_compileSchemaEnv(M){if(M.meta?this._compileMetaSchema(M):i.compileSchema.call(this,M),!M.validate)throw new Error("ajv implementation error");return M.validate}_compileMetaSchema(M){const V=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,M)}finally{this.opts=V}}}k.ValidationError=r.default,k.MissingRefError=o.default,e.default=k;function C(N,M,V,_="error"){for(const E in N){const R=E;R in M&&this.logger[_](`${V}: option ${E}. ${N[R]}`)}}function j(N){return N=(0,l.normalizeId)(N),this.schemas[N]||this.refs[N]}function S(){const N=this.opts.schemas;if(N)if(Array.isArray(N))this.addSchema(N);else for(const M in N)this.addSchema(N[M],M)}function A(){for(const N in this.opts.formats){const M=this.opts.formats[N];M&&this.addFormat(N,M)}}function P(N){if(Array.isArray(N)){this.addVocabulary(N);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const M in N){const V=N[M];V.keyword||(V.keyword=M),this.addKeyword(V)}}function $(){const N={...this.opts};for(const M of y)delete N[M];return N}const T={log(){},warn(){},error(){}};function I(N){if(N===!1)return T;if(N===void 0)return console;if(N.log&&N.warn&&N.error)return N;throw new Error("logger must implement log, warn and error methods")}const U=/^[a-z_$][a-z0-9_$:-]*$/i;function O(N,M){const{RULES:V}=this;if((0,d.eachItem)(N,_=>{if(V.keywords[_])throw new Error(`Keyword ${_} is already defined`);if(!U.test(_))throw new Error(`Keyword ${_} has invalid name`)}),!!M&&M.$data&&!("code"in M||"validate"in M))throw new Error('$data keyword must have "code" or "validate" function')}function B(N,M,V){var _;const E=M==null?void 0:M.post;if(V&&E)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:R}=this;let D=E?R.post:R.rules.find(({type:X})=>X===V);if(D||(D={type:V,rules:[]},R.rules.push(D)),R.keywords[N]=!0,!M)return;const K={keyword:N,definition:{...M,type:(0,u.getJSONTypes)(M.type),schemaType:(0,u.getJSONTypes)(M.schemaType)}};M.before?J.call(this,D,K,M.before):D.rules.push(K),R.all[N]=K,(_=M.implements)===null||_===void 0||_.forEach(X=>this.addKeyword(X))}function J(N,M,V){const _=N.rules.findIndex(E=>E.keyword===V);_>=0?N.rules.splice(_,0,M):(N.rules.push(M),this.logger.warn(`rule ${V} is not defined`))}function Q(N){let{metaSchema:M}=N;M!==void 0&&(N.$data&&this.opts.$data&&(M=W(M)),N.validateSchema=this.compile(M,!0))}const H={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function W(N){return{anyOf:[N,H]}}})(J2);var vx={},xx={},wx={};Object.defineProperty(wx,"__esModule",{value:!0});const YG={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};wx.default=YG;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.callRef=Pi.getValidate=void 0;const XG=hl,q1=ze,jn=De,qi=ao,V1=$n,Xu=me,eJ={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:l}=r,{root:u}=s;if((n==="#"||n==="#/")&&o===u.baseId)return f();const d=V1.resolveRef.call(l,u,o,n);if(d===void 0)throw new XG.default(r.opts.uriResolver,o,n);if(d instanceof V1.SchemaEnv)return p(d);return h(d);function f(){if(s===u)return Rd(e,i,s,s.$async);const y=t.scopeValue("root",{ref:u});return Rd(e,(0,jn._)`${y}.validate`,u,u.$async)}function p(y){const m=CR(e,y);Rd(e,m,y,y.$async)}function h(y){const m=t.scopeValue("schema",a.code.source===!0?{ref:y,code:(0,jn.stringify)(y)}:{ref:y}),x=t.name("valid"),g=e.subschema({schema:y,dataTypes:[],schemaPath:jn.nil,topSchemaRef:m,errSchemaPath:n},x);e.mergeEvaluated(g),e.ok(x)}}};function CR(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,jn._)`${n.scopeValue("wrapper",{ref:t})}.validate`}Pi.getValidate=CR;function Rd(e,t,n,r){const{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:l}=s,u=l.passContext?qi.default.this:jn.nil;r?d():f();function d(){if(!a.$async)throw new Error("async schema referenced by sync schema");const y=o.let("valid");o.try(()=>{o.code((0,jn._)`await ${(0,q1.callValidateCode)(e,t,u)}`),h(t),i||o.assign(y,!0)},m=>{o.if((0,jn._)`!(${m} instanceof ${s.ValidationError})`,()=>o.throw(m)),p(m),i||o.assign(y,!1)}),e.ok(y)}function f(){e.result((0,q1.callValidateCode)(e,t,u),()=>h(t),()=>p(t))}function p(y){const m=(0,jn._)`${y}.errors`;o.assign(qi.default.vErrors,(0,jn._)`${qi.default.vErrors} === null ? ${m} : ${qi.default.vErrors}.concat(${m})`),o.assign(qi.default.errors,(0,jn._)`${qi.default.vErrors}.length`)}function h(y){var m;if(!s.opts.unevaluated)return;const x=(m=n==null?void 0:n.validate)===null||m===void 0?void 0:m.evaluated;if(s.props!==!0)if(x&&!x.dynamicProps)x.props!==void 0&&(s.props=Xu.mergeEvaluated.props(o,x.props,s.props));else{const g=o.var("props",(0,jn._)`${y}.evaluated.props`);s.props=Xu.mergeEvaluated.props(o,g,s.props,jn.Name)}if(s.items!==!0)if(x&&!x.dynamicItems)x.items!==void 0&&(s.items=Xu.mergeEvaluated.items(o,x.items,s.items));else{const g=o.var("items",(0,jn._)`${y}.evaluated.items`);s.items=Xu.mergeEvaluated.items(o,g,s.items,jn.Name)}}}Pi.callRef=Rd;Pi.default=eJ;Object.defineProperty(xx,"__esModule",{value:!0});const tJ=wx,nJ=Pi,rJ=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",tJ.default,nJ.default];xx.default=rJ;var bx={},kx={};Object.defineProperty(kx,"__esModule",{value:!0});const zf=De,Bo=zf.operators,Ff={maximum:{okStr:"<=",ok:Bo.LTE,fail:Bo.GT},minimum:{okStr:">=",ok:Bo.GTE,fail:Bo.LT},exclusiveMaximum:{okStr:"<",ok:Bo.LT,fail:Bo.GTE},exclusiveMinimum:{okStr:">",ok:Bo.GT,fail:Bo.LTE}},oJ={message:({keyword:e,schemaCode:t})=>(0,zf.str)`must be ${Ff[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,zf._)`{comparison: ${Ff[e].okStr}, limit: ${t}}`},sJ={keyword:Object.keys(Ff),type:"number",schemaType:"number",$data:!0,error:oJ,code(e){const{keyword:t,data:n,schemaCode:r}=e;e.fail$data((0,zf._)`${n} ${Ff[t].fail} ${r} || isNaN(${n})`)}};kx.default=sJ;var _x={};Object.defineProperty(_x,"__esModule",{value:!0});const ac=De,iJ={message:({schemaCode:e})=>(0,ac.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ac._)`{multipleOf: ${e}}`},aJ={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:iJ,code(e){const{gen:t,data:n,schemaCode:r,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,ac._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,ac._)`${i} !== parseInt(${i})`;e.fail$data((0,ac._)`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};_x.default=aJ;var Sx={},Cx={};Object.defineProperty(Cx,"__esModule",{value:!0});function ER(e){const t=e.length;let n=0,r=0,o;for(;r<t;)n++,o=e.charCodeAt(r++),o>=55296&&o<=56319&&r<t&&(o=e.charCodeAt(r),(o&64512)===56320&&r++);return n}Cx.default=ER;ER.code='require("ajv/dist/runtime/ucs2length").default';Object.defineProperty(Sx,"__esModule",{value:!0});const Js=De,lJ=me,cJ=Cx,uJ={message({keyword:e,schemaCode:t}){const n=e==="maxLength"?"more":"fewer";return(0,Js.str)`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>(0,Js._)`{limit: ${e}}`},dJ={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:uJ,code(e){const{keyword:t,data:n,schemaCode:r,it:o}=e,s=t==="maxLength"?Js.operators.GT:Js.operators.LT,i=o.opts.unicode===!1?(0,Js._)`${n}.length`:(0,Js._)`${(0,lJ.useFunc)(e.gen,cJ.default)}(${n})`;e.fail$data((0,Js._)`${i} ${s} ${r}`)}};Sx.default=dJ;var Ex={};Object.defineProperty(Ex,"__esModule",{value:!0});const fJ=ze,Uf=De,hJ={message:({schemaCode:e})=>(0,Uf.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Uf._)`{pattern: ${e}}`},pJ={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:hJ,code(e){const{data:t,$data:n,schema:r,schemaCode:o,it:s}=e,i=s.opts.unicodeRegExp?"u":"",a=n?(0,Uf._)`(new RegExp(${o}, ${i}))`:(0,fJ.usePattern)(e,r);e.fail$data((0,Uf._)`!${a}.test(${t})`)}};Ex.default=pJ;var Nx={};Object.defineProperty(Nx,"__esModule",{value:!0});const lc=De,mJ={message({keyword:e,schemaCode:t}){const n=e==="maxProperties"?"more":"fewer";return(0,lc.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,lc._)`{limit: ${e}}`},gJ={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:mJ,code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxProperties"?lc.operators.GT:lc.operators.LT;e.fail$data((0,lc._)`Object.keys(${n}).length ${o} ${r}`)}};Nx.default=gJ;var jx={};Object.defineProperty(jx,"__esModule",{value:!0});const Rl=ze,cc=De,yJ=me,vJ={message:({params:{missingProperty:e}})=>(0,cc.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,cc._)`{missingProperty: ${e}}`},xJ={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vJ,code(e){const{gen:t,schema:n,schemaCode:r,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&n.length===0)return;const l=n.length>=a.loopRequired;if(i.allErrors?u():d(),a.strictRequired){const h=e.parentSchema.properties,{definedProperties:y}=e.it;for(const m of n)if((h==null?void 0:h[m])===void 0&&!y.has(m)){const x=i.schemaEnv.baseId+i.errSchemaPath,g=`required property "${m}" is not defined at "${x}" (strictRequired)`;(0,yJ.checkStrictMode)(i,g,i.opts.strictRequired)}}function u(){if(l||s)e.block$data(cc.nil,f);else for(const h of n)(0,Rl.checkReportMissingProp)(e,h)}function d(){const h=t.let("missing");if(l||s){const y=t.let("valid",!0);e.block$data(y,()=>p(h,y)),e.ok(y)}else t.if((0,Rl.checkMissingProp)(e,n,h)),(0,Rl.reportMissingProp)(e,h),t.else()}function f(){t.forOf("prop",r,h=>{e.setParams({missingProperty:h}),t.if((0,Rl.noPropertyInData)(t,o,h,a.ownProperties),()=>e.error())})}function p(h,y){e.setParams({missingProperty:h}),t.forOf(h,r,()=>{t.assign(y,(0,Rl.propertyInData)(t,o,h,a.ownProperties)),t.if((0,cc.not)(y),()=>{e.error(),t.break()})},cc.nil)}}};jx.default=xJ;var Px={};Object.defineProperty(Px,"__esModule",{value:!0});const uc=De,wJ={message({keyword:e,schemaCode:t}){const n=e==="maxItems"?"more":"fewer";return(0,uc.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,uc._)`{limit: ${e}}`},bJ={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:wJ,code(e){const{keyword:t,data:n,schemaCode:r}=e,o=t==="maxItems"?uc.operators.GT:uc.operators.LT;e.fail$data((0,uc._)`${n}.length ${o} ${r}`)}};Px.default=bJ;var Tx={},hu={};Object.defineProperty(hu,"__esModule",{value:!0});const NR=uR;NR.code='require("ajv/dist/runtime/equal").default';hu.default=NR;Object.defineProperty(Tx,"__esModule",{value:!0});const um=zt,Zt=De,kJ=me,_J=hu,SJ={message:({params:{i:e,j:t}})=>(0,Zt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Zt._)`{i: ${e}, j: ${t}}`},CJ={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:SJ,code(e){const{gen:t,data:n,$data:r,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!r&&!o)return;const l=t.let("valid"),u=s.items?(0,um.getSchemaTypes)(s.items):[];e.block$data(l,d,(0,Zt._)`${i} === false`),e.ok(l);function d(){const y=t.let("i",(0,Zt._)`${n}.length`),m=t.let("j");e.setParams({i:y,j:m}),t.assign(l,!0),t.if((0,Zt._)`${y} > 1`,()=>(f()?p:h)(y,m))}function f(){return u.length>0&&!u.some(y=>y==="object"||y==="array")}function p(y,m){const x=t.name("item"),g=(0,um.checkDataTypes)(u,x,a.opts.strictNumbers,um.DataType.Wrong),v=t.const("indices",(0,Zt._)`{}`);t.for((0,Zt._)`;${y}--;`,()=>{t.let(x,(0,Zt._)`${n}[${y}]`),t.if(g,(0,Zt._)`continue`),u.length>1&&t.if((0,Zt._)`typeof ${x} == "string"`,(0,Zt._)`${x} += "_"`),t.if((0,Zt._)`typeof ${v}[${x}] == "number"`,()=>{t.assign(m,(0,Zt._)`${v}[${x}]`),e.error(),t.assign(l,!1).break()}).code((0,Zt._)`${v}[${x}] = ${y}`)})}function h(y,m){const x=(0,kJ.useFunc)(t,_J.default),g=t.name("outer");t.label(g).for((0,Zt._)`;${y}--;`,()=>t.for((0,Zt._)`${m} = ${y}; ${m}--;`,()=>t.if((0,Zt._)`${x}(${n}[${y}], ${n}[${m}])`,()=>{e.error(),t.assign(l,!1).break(g)})))}}};Tx.default=CJ;var Rx={};Object.defineProperty(Rx,"__esModule",{value:!0});const Ny=De,EJ=me,NJ=hu,jJ={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ny._)`{allowedValue: ${e}}`},PJ={keyword:"const",$data:!0,error:jJ,code(e){const{gen:t,data:n,$data:r,schemaCode:o,schema:s}=e;r||s&&typeof s=="object"?e.fail$data((0,Ny._)`!${(0,EJ.useFunc)(t,NJ.default)}(${n}, ${o})`):e.fail((0,Ny._)`${s} !== ${n}`)}};Rx.default=PJ;var $x={};Object.defineProperty($x,"__esModule",{value:!0});const Vl=De,TJ=me,RJ=hu,$J={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Vl._)`{allowedValues: ${e}}`},IJ={keyword:"enum",schemaType:"array",$data:!0,error:$J,code(e){const{gen:t,data:n,$data:r,schema:o,schemaCode:s,it:i}=e;if(!r&&o.length===0)throw new Error("enum must have non-empty array");const a=o.length>=i.opts.loopEnum;let l;const u=()=>l??(l=(0,TJ.useFunc)(t,RJ.default));let d;if(a||r)d=t.let("valid"),e.block$data(d,f);else{if(!Array.isArray(o))throw new Error("ajv implementation error");const h=t.const("vSchema",s);d=(0,Vl.or)(...o.map((y,m)=>p(h,m)))}e.pass(d);function f(){t.assign(d,!1),t.forOf("v",s,h=>t.if((0,Vl._)`${u()}(${n}, ${h})`,()=>t.assign(d,!0).break()))}function p(h,y){const m=o[y];return typeof m=="object"&&m!==null?(0,Vl._)`${u()}(${n}, ${h}[${y}])`:(0,Vl._)`${n} === ${m}`}}};$x.default=IJ;Object.defineProperty(bx,"__esModule",{value:!0});const AJ=kx,OJ=_x,MJ=Sx,DJ=Ex,LJ=Nx,zJ=jx,FJ=Px,UJ=Tx,qJ=Rx,VJ=$x,HJ=[AJ.default,OJ.default,MJ.default,DJ.default,LJ.default,zJ.default,FJ.default,UJ.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},qJ.default,VJ.default];bx.default=HJ;var Ix={},pl={};Object.defineProperty(pl,"__esModule",{value:!0});pl.validateAdditionalItems=void 0;const Ys=De,jy=me,BJ={message:({params:{len:e}})=>(0,Ys.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ys._)`{limit: ${e}}`},WJ={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:BJ,code(e){const{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){(0,jy.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}jR(e,r)}};function jR(e,t){const{gen:n,schema:r,data:o,keyword:s,it:i}=e;i.items=!0;const a=n.const("len",(0,Ys._)`${o}.length`);if(r===!1)e.setParams({len:t.length}),e.pass((0,Ys._)`${a} <= ${t.length}`);else if(typeof r=="object"&&!(0,jy.alwaysValidSchema)(i,r)){const u=n.var("valid",(0,Ys._)`${a} <= ${t.length}`);n.if((0,Ys.not)(u),()=>l(u)),e.ok(u)}function l(u){n.forRange("i",t.length,a,d=>{e.subschema({keyword:s,dataProp:d,dataPropType:jy.Type.Num},u),i.allErrors||n.if((0,Ys.not)(u),()=>n.break())})}}pl.validateAdditionalItems=jR;pl.default=WJ;var Ax={},ml={};Object.defineProperty(ml,"__esModule",{value:!0});ml.validateTuple=void 0;const H1=De,$d=me,KJ=ze,ZJ={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return PR(e,"additionalItems",t);n.items=!0,!(0,$d.alwaysValidSchema)(n,t)&&e.ok((0,KJ.validateArray)(e))}};function PR(e,t,n=e.schema){const{gen:r,parentSchema:o,data:s,keyword:i,it:a}=e;d(o),a.opts.unevaluated&&n.length&&a.items!==!0&&(a.items=$d.mergeEvaluated.items(r,n.length,a.items));const l=r.name("valid"),u=r.const("len",(0,H1._)`${s}.length`);n.forEach((f,p)=>{(0,$d.alwaysValidSchema)(a,f)||(r.if((0,H1._)`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l))});function d(f){const{opts:p,errSchemaPath:h}=a,y=n.length,m=y===f.minItems&&(y===f.maxItems||f[t]===!1);if(p.strictTuples&&!m){const x=`"${i}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${h}"`;(0,$d.checkStrictMode)(a,x,p.strictTuples)}}}ml.validateTuple=PR;ml.default=ZJ;Object.defineProperty(Ax,"__esModule",{value:!0});const QJ=ml,GJ={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,QJ.validateTuple)(e,"items")};Ax.default=GJ;var Ox={};Object.defineProperty(Ox,"__esModule",{value:!0});const B1=De,JJ=me,YJ=ze,XJ=pl,eY={message:({params:{len:e}})=>(0,B1.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,B1._)`{limit: ${e}}`},tY={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:eY,code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:o}=n;r.items=!0,!(0,JJ.alwaysValidSchema)(r,t)&&(o?(0,XJ.validateAdditionalItems)(e,o):e.ok((0,YJ.validateArray)(e)))}};Ox.default=tY;var Mx={};Object.defineProperty(Mx,"__esModule",{value:!0});const rr=De,ed=me,nY={message:({params:{min:e,max:t}})=>t===void 0?(0,rr.str)`must contain at least ${e} valid item(s)`:(0,rr.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,rr._)`{minContains: ${e}}`:(0,rr._)`{minContains: ${e}, maxContains: ${t}}`},rY={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:nY,code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:s}=e;let i,a;const{minContains:l,maxContains:u}=r;s.opts.next?(i=l===void 0?1:l,a=u):i=1;const d=t.const("len",(0,rr._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,ed.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ed.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ed.alwaysValidSchema)(s,n)){let m=(0,rr._)`${d} >= ${i}`;a!==void 0&&(m=(0,rr._)`${m} && ${d} <= ${a}`),e.pass(m);return}s.items=!0;const f=t.name("valid");a===void 0&&i===1?h(f,()=>t.if(f,()=>t.break())):i===0?(t.let(f,!0),a!==void 0&&t.if((0,rr._)`${o}.length > 0`,p)):(t.let(f,!1),p()),e.result(f,()=>e.reset());function p(){const m=t.name("_valid"),x=t.let("count",0);h(m,()=>t.if(m,()=>y(x)))}function h(m,x){t.forRange("i",0,d,g=>{e.subschema({keyword:"contains",dataProp:g,dataPropType:ed.Type.Num,compositeRule:!0},m),x()})}function y(m){t.code((0,rr._)`${m}++`),a===void 0?t.if((0,rr._)`${m} >= ${i}`,()=>t.assign(f,!0).break()):(t.if((0,rr._)`${m} > ${a}`,()=>t.assign(f,!1).break()),i===1?t.assign(f,!0):t.if((0,rr._)`${m} >= ${i}`,()=>t.assign(f,!0)))}}};Mx.default=rY;var TR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=De,n=me,r=ze;e.error={message:({params:{property:l,depsCount:u,deps:d}})=>{const f=u===1?"property":"properties";return(0,t.str)`must have ${f} ${d} when property ${l} is present`},params:({params:{property:l,depsCount:u,deps:d,missingProperty:f}})=>(0,t._)`{property: ${l},
456
- missingProperty: ${f},
457
- depsCount: ${u},
458
- deps: ${d}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(l){const[u,d]=s(l);i(l,u),a(l,d)}};function s({schema:l}){const u={},d={};for(const f in l){if(f==="__proto__")continue;const p=Array.isArray(l[f])?u:d;p[f]=l[f]}return[u,d]}function i(l,u=l.schema){const{gen:d,data:f,it:p}=l;if(Object.keys(u).length===0)return;const h=d.let("missing");for(const y in u){const m=u[y];if(m.length===0)continue;const x=(0,r.propertyInData)(d,f,y,p.opts.ownProperties);l.setParams({property:y,depsCount:m.length,deps:m.join(", ")}),p.allErrors?d.if(x,()=>{for(const g of m)(0,r.checkReportMissingProp)(l,g)}):(d.if((0,t._)`${x} && (${(0,r.checkMissingProp)(l,m,h)})`),(0,r.reportMissingProp)(l,h),d.else())}}e.validatePropertyDeps=i;function a(l,u=l.schema){const{gen:d,data:f,keyword:p,it:h}=l,y=d.name("valid");for(const m in u)(0,n.alwaysValidSchema)(h,u[m])||(d.if((0,r.propertyInData)(d,f,m,h.opts.ownProperties),()=>{const x=l.subschema({keyword:p,schemaProp:m},y);l.mergeValidEvaluated(x,y)},()=>d.var(y,!0)),l.ok(y))}e.validateSchemaDeps=a,e.default=o})(TR);var Dx={};Object.defineProperty(Dx,"__esModule",{value:!0});const RR=De,oY=me,sY={message:"property name must be valid",params:({params:e})=>(0,RR._)`{propertyName: ${e.propertyName}}`},iY={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:sY,code(e){const{gen:t,schema:n,data:r,it:o}=e;if((0,oY.alwaysValidSchema)(o,n))return;const s=t.name("valid");t.forIn("key",r,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,RR.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Dx.default=iY;var Bh={};Object.defineProperty(Bh,"__esModule",{value:!0});const td=ze,xr=De,aY=ao,nd=me,lY={message:"must NOT have additional properties",params:({params:e})=>(0,xr._)`{additionalProperty: ${e.additionalProperty}}`},cY={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lY,code(e){const{gen:t,schema:n,parentSchema:r,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");const{allErrors:a,opts:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&(0,nd.alwaysValidSchema)(i,n))return;const u=(0,td.allSchemaProperties)(r.properties),d=(0,td.allSchemaProperties)(r.patternProperties);f(),e.ok((0,xr._)`${s} === ${aY.default.errors}`);function f(){t.forIn("key",o,x=>{!u.length&&!d.length?y(x):t.if(p(x),()=>y(x))})}function p(x){let g;if(u.length>8){const v=(0,nd.schemaRefOrVal)(i,r.properties,"properties");g=(0,td.isOwnProperty)(t,v,x)}else u.length?g=(0,xr.or)(...u.map(v=>(0,xr._)`${x} === ${v}`)):g=xr.nil;return d.length&&(g=(0,xr.or)(g,...d.map(v=>(0,xr._)`${(0,td.usePattern)(e,v)}.test(${x})`))),(0,xr.not)(g)}function h(x){t.code((0,xr._)`delete ${o}[${x}]`)}function y(x){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){h(x);return}if(n===!1){e.setParams({additionalProperty:x}),e.error(),a||t.break();return}if(typeof n=="object"&&!(0,nd.alwaysValidSchema)(i,n)){const g=t.name("valid");l.removeAdditional==="failing"?(m(x,g,!1),t.if((0,xr.not)(g),()=>{e.reset(),h(x)})):(m(x,g),a||t.if((0,xr.not)(g),()=>t.break()))}}function m(x,g,v){const w={keyword:"additionalProperties",dataProp:x,dataPropType:nd.Type.Str};v===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(w,g)}}};Bh.default=cY;var Lx={};Object.defineProperty(Lx,"__esModule",{value:!0});const uY=Uh(),W1=ze,dm=me,K1=Bh,dY={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:r,data:o,it:s}=e;s.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&K1.default.code(new uY.KeywordCxt(s,K1.default,"additionalProperties"));const i=(0,W1.allSchemaProperties)(n);for(const f of i)s.definedProperties.add(f);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=dm.mergeEvaluated.props(t,(0,dm.toHash)(i),s.props));const a=i.filter(f=>!(0,dm.alwaysValidSchema)(s,n[f]));if(a.length===0)return;const l=t.name("valid");for(const f of a)u(f)?d(f):(t.if((0,W1.propertyInData)(t,o,f,s.opts.ownProperties)),d(f),s.allErrors||t.else().var(l,!0),t.endIf()),e.it.definedProperties.add(f),e.ok(l);function u(f){return s.opts.useDefaults&&!s.compositeRule&&n[f].default!==void 0}function d(f){e.subschema({keyword:"properties",schemaProp:f,dataProp:f},l)}}};Lx.default=dY;var zx={};Object.defineProperty(zx,"__esModule",{value:!0});const Z1=ze,rd=De,Q1=me,G1=me,fY={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:r,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,Z1.allSchemaProperties)(n),l=a.filter(m=>(0,Q1.alwaysValidSchema)(s,n[m]));if(a.length===0||l.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;const u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,d=t.name("valid");s.props!==!0&&!(s.props instanceof rd.Name)&&(s.props=(0,G1.evaluatedPropsToName)(t,s.props));const{props:f}=s;p();function p(){for(const m of a)u&&h(m),s.allErrors?y(m):(t.var(d,!0),y(m),t.if(d))}function h(m){for(const x in u)new RegExp(m).test(x)&&(0,Q1.checkStrictMode)(s,`property ${x} matches pattern ${m} (use allowMatchingProperties)`)}function y(m){t.forIn("key",r,x=>{t.if((0,rd._)`${(0,Z1.usePattern)(e,m)}.test(${x})`,()=>{const g=l.includes(m);g||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:x,dataPropType:G1.Type.Str},d),s.opts.unevaluated&&f!==!0?t.assign((0,rd._)`${f}[${x}]`,!0):!g&&!s.allErrors&&t.if((0,rd.not)(d),()=>t.break())})})}}};zx.default=fY;var Fx={};Object.defineProperty(Fx,"__esModule",{value:!0});const hY=me,pY={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,hY.alwaysValidSchema)(r,n)){e.fail();return}const o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Fx.default=pY;var Ux={};Object.defineProperty(Ux,"__esModule",{value:!0});const mY=ze,gY={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mY.validateUnion,error:{message:"must match a schema in anyOf"}};Ux.default=gY;var qx={};Object.defineProperty(qx,"__esModule",{value:!0});const Id=De,yY=me,vY={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Id._)`{passingSchemas: ${e.passing}}`},xY={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:vY,code(e){const{gen:t,schema:n,parentSchema:r,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;const s=n,i=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((d,f)=>{let p;(0,yY.alwaysValidSchema)(o,d)?t.var(l,!0):p=e.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},l),f>0&&t.if((0,Id._)`${l} && ${i}`).assign(i,!1).assign(a,(0,Id._)`[${a}, ${f}]`).else(),t.if(l,()=>{t.assign(i,!0),t.assign(a,f),p&&e.mergeEvaluated(p,Id.Name)})})}}};qx.default=xY;var Vx={};Object.defineProperty(Vx,"__esModule",{value:!0});const wY=me,bY={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const o=t.name("valid");n.forEach((s,i)=>{if((0,wY.alwaysValidSchema)(r,s))return;const a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Vx.default=bY;var Hx={};Object.defineProperty(Hx,"__esModule",{value:!0});const qf=De,$R=me,kY={message:({params:e})=>(0,qf.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,qf._)`{failingKeyword: ${e.ifClause}}`},_Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:kY,code(e){const{gen:t,parentSchema:n,it:r}=e;n.then===void 0&&n.else===void 0&&(0,$R.checkStrictMode)(r,'"if" without "then" and "else" is ignored');const o=J1(r,"then"),s=J1(r,"else");if(!o&&!s)return;const i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),o&&s){const d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else o?t.if(a,u("then")):t.if((0,qf.not)(a),u("else"));e.pass(i,()=>e.error(!0));function l(){const d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,f){return()=>{const p=e.subschema({keyword:d},a);t.assign(i,a),e.mergeValidEvaluated(p,i),f?t.assign(f,(0,qf._)`${d}`):e.setParams({ifClause:d})}}}};function J1(e,t){const n=e.schema[t];return n!==void 0&&!(0,$R.alwaysValidSchema)(e,n)}Hx.default=_Y;var Bx={};Object.defineProperty(Bx,"__esModule",{value:!0});const SY=me,CY={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,SY.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};Bx.default=CY;Object.defineProperty(Ix,"__esModule",{value:!0});const EY=pl,NY=Ax,jY=ml,PY=Ox,TY=Mx,RY=TR,$Y=Dx,IY=Bh,AY=Lx,OY=zx,MY=Fx,DY=Ux,LY=qx,zY=Vx,FY=Hx,UY=Bx;function qY(e=!1){const t=[MY.default,DY.default,LY.default,zY.default,FY.default,UY.default,$Y.default,IY.default,RY.default,AY.default,OY.default];return e?t.push(NY.default,PY.default):t.push(EY.default,jY.default),t.push(TY.default),t}Ix.default=qY;var Wx={},Kx={};Object.defineProperty(Kx,"__esModule",{value:!0});const Pt=De,VY={message:({schemaCode:e})=>(0,Pt.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Pt._)`{format: ${e}}`},HY={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:VY,code(e,t){const{gen:n,data:r,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=a;if(!l.validateFormats)return;o?p():h();function p(){const y=n.scopeValue("formats",{ref:f.formats,code:l.code.formats}),m=n.const("fDef",(0,Pt._)`${y}[${i}]`),x=n.let("fType"),g=n.let("format");n.if((0,Pt._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>n.assign(x,(0,Pt._)`${m}.type || "string"`).assign(g,(0,Pt._)`${m}.validate`),()=>n.assign(x,(0,Pt._)`"string"`).assign(g,m)),e.fail$data((0,Pt.or)(v(),w()));function v(){return l.strictSchema===!1?Pt.nil:(0,Pt._)`${i} && !${g}`}function w(){const k=d.$async?(0,Pt._)`(${m}.async ? await ${g}(${r}) : ${g}(${r}))`:(0,Pt._)`${g}(${r})`,C=(0,Pt._)`(typeof ${g} == "function" ? ${k} : ${g}.test(${r}))`;return(0,Pt._)`${g} && ${g} !== true && ${x} === ${t} && !${C}`}}function h(){const y=f.formats[s];if(!y){v();return}if(y===!0)return;const[m,x,g]=w(y);m===t&&e.pass(k());function v(){if(l.strictSchema===!1){f.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(C){const j=C instanceof RegExp?(0,Pt.regexpCode)(C):l.code.formats?(0,Pt._)`${l.code.formats}${(0,Pt.getProperty)(s)}`:void 0,S=n.scopeValue("formats",{key:s,ref:C,code:j});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,Pt._)`${S}.validate`]:["string",C,S]}function k(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!d.$async)throw new Error("async format in sync schema");return(0,Pt._)`await ${g}(${r})`}return typeof x=="function"?(0,Pt._)`${g}(${r})`:(0,Pt._)`${g}.test(${r})`}}}};Kx.default=HY;Object.defineProperty(Wx,"__esModule",{value:!0});const BY=Kx,WY=[BY.default];Wx.default=WY;var Ya={};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.contentVocabulary=Ya.metadataVocabulary=void 0;Ya.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ya.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(vx,"__esModule",{value:!0});const KY=xx,ZY=bx,QY=Ix,GY=Wx,Y1=Ya,JY=[KY.default,ZY.default,(0,QY.default)(),GY.default,Y1.metadataVocabulary,Y1.contentVocabulary];vx.default=JY;var Zx={},Wh={};Object.defineProperty(Wh,"__esModule",{value:!0});Wh.DiscrError=void 0;var X1;(function(e){e.Tag="tag",e.Mapping="mapping"})(X1||(Wh.DiscrError=X1={}));Object.defineProperty(Zx,"__esModule",{value:!0});const Qi=De,Py=Wh,e_=$n,YY=hl,XY=me,eX={message:({params:{discrError:e,tagName:t}})=>e===Py.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,Qi._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},tX={keyword:"discriminator",type:"object",schemaType:"object",error:eX,code(e){const{gen:t,data:n,schema:r,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");const a=r.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");const l=t.let("valid",!1),u=t.const("tag",(0,Qi._)`${n}${(0,Qi.getProperty)(a)}`);t.if((0,Qi._)`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:Py.DiscrError.Tag,tag:u,tagName:a})),e.ok(l);function d(){const h=p();t.if(!1);for(const y in h)t.elseIf((0,Qi._)`${u} === ${y}`),t.assign(l,f(h[y]));t.else(),e.error(!1,{discrError:Py.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function f(h){const y=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:h},y);return e.mergeEvaluated(m,Qi.Name),y}function p(){var h;const y={},m=g(o);let x=!0;for(let k=0;k<i.length;k++){let C=i[k];if(C!=null&&C.$ref&&!(0,XY.schemaHasRulesButRef)(C,s.self.RULES)){const S=C.$ref;if(C=e_.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,S),C instanceof e_.SchemaEnv&&(C=C.schema),C===void 0)throw new YY.default(s.opts.uriResolver,s.baseId,S)}const j=(h=C==null?void 0:C.properties)===null||h===void 0?void 0:h[a];if(typeof j!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);x=x&&(m||g(C)),v(j,k)}if(!x)throw new Error(`discriminator: "${a}" must be required`);return y;function g({required:k}){return Array.isArray(k)&&k.includes(a)}function v(k,C){if(k.const)w(k.const,C);else if(k.enum)for(const j of k.enum)w(j,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(k,C){if(typeof k!="string"||k in y)throw new Error(`discriminator: "${a}" values must be unique strings`);y[k]=C}}}};Zx.default=tX;const nX="http://json-schema.org/draft-07/schema#",rX="http://json-schema.org/draft-07/schema#",oX="Core schema meta-schema",sX={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:[]}},iX=["object","boolean"],aX={$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:"#"}},lX={$schema:nX,$id:rX,title:oX,definitions:sX,type:iX,properties:aX,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 n=J2,r=vx,o=Zx,s=lX,i=["/properties"],a="http://json-schema.org/draft-07/schema";class l extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const y=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(y,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=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=Uh();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=De;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=fx();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=hl;Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})(ky,ky.exports);var IR=ky.exports;const cX=Xa(IR);var Ty={exports:{}},AR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(T,I){return{validate:T,compare:I}}e.fullFormats={date:t(s,i),time:t(l(!0),u),"date-time":t(p(!0),h),"iso-time":t(l(),d),"iso-date-time":t(p(),y),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:g,"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:$,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:w,int32:{type:"number",validate:j},int64:{type:"number",validate:S},float:{type:"number",validate:A},double:{type:"number",validate:A},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,h),"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,y),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 n(T){return T%4===0&&(T%100!==0||T%400===0)}const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(T){const I=r.exec(T);if(!I)return!1;const U=+I[1],O=+I[2],B=+I[3];return O>=1&&O<=12&&B>=1&&B<=(O===2&&n(U)?29:o[O])}function i(T,I){if(T&&I)return T>I?1:T<I?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(T){return function(U){const O=a.exec(U);if(!O)return!1;const B=+O[1],J=+O[2],Q=+O[3],H=O[4],W=O[5]==="-"?-1:1,N=+(O[6]||0),M=+(O[7]||0);if(N>23||M>59||T&&!H)return!1;if(B<=23&&J<=59&&Q<60)return!0;const V=J-M*W,_=B-N*W-(V<0?1:0);return(_===23||_===-1)&&(V===59||V===-1)&&Q<61}}function u(T,I){if(!(T&&I))return;const U=new Date("2020-01-01T"+T).valueOf(),O=new Date("2020-01-01T"+I).valueOf();if(U&&O)return U-O}function d(T,I){if(!(T&&I))return;const U=a.exec(T),O=a.exec(I);if(U&&O)return T=U[1]+U[2]+U[3],I=O[1]+O[2]+O[3],T>I?1:T<I?-1:0}const f=/t|\s/i;function p(T){const I=l(T);return function(O){const B=O.split(f);return B.length===2&&s(B[0])&&I(B[1])}}function h(T,I){if(!(T&&I))return;const U=new Date(T).valueOf(),O=new Date(I).valueOf();if(U&&O)return U-O}function y(T,I){if(!(T&&I))return;const[U,O]=T.split(f),[B,J]=I.split(f),Q=i(U,B);if(Q!==void 0)return Q||u(O,J)}const m=/\/|:/,x=/^(?:[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 g(T){return m.test(T)&&x.test(T)}const v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function w(T){return v.lastIndex=0,v.test(T)}const k=-2147483648,C=2**31-1;function j(T){return Number.isInteger(T)&&T<=C&&T>=k}function S(T){return Number.isInteger(T)}function A(){return!0}const P=/[^\\]\\Z/;function $(T){if(P.test(T))return!1;try{return new RegExp(T),!0}catch{return!1}}})(AR);var OR={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=IR,n=De,r=n.operators,o={formatMaximum:{okStr:"<=",ok:r.LTE,fail:r.GT},formatMinimum:{okStr:">=",ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},s={message:({keyword:a,schemaCode:l})=>(0,n.str)`should be ${o[a].okStr} ${l}`,params:({keyword:a,schemaCode:l})=>(0,n._)`{comparison: ${o[a].okStr}, limit: ${l}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(a){const{gen:l,data:u,schemaCode:d,keyword:f,it:p}=a,{opts:h,self:y}=p;if(!h.validateFormats)return;const m=new t.KeywordCxt(p,y.RULES.all.format.definition,"format");m.$data?x():g();function x(){const w=l.scopeValue("formats",{ref:y.formats,code:h.code.formats}),k=l.const("fmt",(0,n._)`${w}[${m.schemaCode}]`);a.fail$data((0,n.or)((0,n._)`typeof ${k} != "object"`,(0,n._)`${k} instanceof RegExp`,(0,n._)`typeof ${k}.compare != "function"`,v(k)))}function g(){const w=m.schema,k=y.formats[w];if(!k||k===!0)return;if(typeof k!="object"||k instanceof RegExp||typeof k.compare!="function")throw new Error(`"${f}": format "${w}" does not define "compare" function`);const C=l.scopeValue("formats",{key:w,ref:k,code:h.code.formats?(0,n._)`${h.code.formats}${(0,n.getProperty)(w)}`:void 0});a.fail$data(v(C))}function v(w){return(0,n._)`${w}.compare(${u}, ${d}) ${o[f].fail} 0`}},dependencies:["format"]};const i=a=>(a.addKeyword(e.formatLimitDefinition),a);e.default=i})(OR);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const n=AR,r=OR,o=De,s=new o.Name("fullFormats"),i=new o.Name("fastFormats"),a=(u,d={keywords:!0})=>{if(Array.isArray(d))return l(u,d,n.fullFormats,s),u;const[f,p]=d.mode==="fast"?[n.fastFormats,i]:[n.fullFormats,s],h=d.formats||n.formatNames;return l(u,h,f,p),d.keywords&&(0,r.default)(u),u};a.get=(u,d="full")=>{const p=(d==="fast"?n.fastFormats:n.fullFormats)[u];if(!p)throw new Error(`Unknown format "${u}"`);return p};function l(u,d,f,p){var h,y;(h=(y=u.opts.code).formats)!==null&&h!==void 0||(y.formats=(0,o._)`require("ajv-formats/dist/formats").${p}`);for(const m of d)u.addFormat(m,f[m])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a})(Ty,Ty.exports);var uX=Ty.exports;const dX=Xa(uX);function fX(){const e=new cX({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return dX(e),e}class hX{constructor(t){this._ajv=t??fX()}getValidator(t){const n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}}class pX{constructor(t){this._client=t}async*callToolStream(t,n=du,r){const o=this._client,s={...r,task:(r==null?void 0:r.task)??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},n,s),a=o.getToolOutputValidator(t.name);for await(const l of i){if(l.type==="result"&&a){const u=l.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new Ee($e.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 Ee($e.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof Ee){yield{type:"error",error:d};return}yield{type:"error",error:new Ee($e.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield l}}async getTask(t,n){return this._client.getTask({taskId:t},n)}async getTaskResult(t,n,r){return this._client.getTaskResult({taskId:t},n,r)}async listTasks(t,n){return this._client.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._client.cancelTask({taskId:t},n)}requestStream(t,n,r){return this._client.requestStream(t,n,r)}}function mX(e,t,n){var r;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!((r=e.tools)!=null&&r.call))throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break}}function gX(e,t,n){var r,o;if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!((r=e.sampling)!=null&&r.createMessage))throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!((o=e.elicitation)!=null&&o.create))throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break}}function Ad(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){const n=t,r=e.properties;for(const o of Object.keys(r)){const s=r[o];n[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(n[o]=s.default),n[o]!==void 0&&Ad(s,n[o])}}if(Array.isArray(e.anyOf))for(const n of e.anyOf)typeof n!="boolean"&&Ad(n,t);if(Array.isArray(e.oneOf))for(const n of e.oneOf)typeof n!="boolean"&&Ad(n,t)}}function yX(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};const t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}class vX extends nQ{constructor(t,n){super(n),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=(n==null?void 0:n.capabilities)??{},this._jsonSchemaValidator=(n==null?void 0:n.jsonSchemaValidator)??new hX,n!=null&&n.listChanged&&(this._pendingListChangedConfig=n.listChanged)}_setupListChangedHandlers(t){var n,r,o,s,i,a;t.tools&&((r=(n=this._serverCapabilities)==null?void 0:n.tools)!=null&&r.listChanged)&&this._setupListChangedHandler("tools",A2,t.tools,async()=>(await this.listTools()).tools),t.prompts&&((s=(o=this._serverCapabilities)==null?void 0:o.prompts)!=null&&s.listChanged)&&this._setupListChangedHandler("prompts",$2,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&((a=(i=this._serverCapabilities)==null?void 0:i.resources)!=null&&a.listChanged)&&this._setupListChangedHandler("resources",R2,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new pX(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=rQ(this._capabilities,t)}setRequestHandler(t,n){var a;const r=G2(t),o=r==null?void 0:r.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(Fh(o)){const l=o,u=(a=l._zod)==null?void 0:a.def;s=(u==null?void 0:u.value)??l.value}else{const l=o,u=l._def;s=(u==null?void 0:u.value)??l.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");const i=s;if(i==="elicitation/create"){const l=async(u,d)=>{var w,k;const f=Yo(z2,u);if(!f.success){const C=f.error instanceof Error?f.error.message:String(f.error);throw new Ee($e.InvalidParams,`Invalid elicitation request: ${C}`)}const{params:p}=f.data;p.mode=p.mode??"form";const{supportsFormMode:h,supportsUrlMode:y}=yX(this._capabilities.elicitation);if(p.mode==="form"&&!h)throw new Ee($e.InvalidParams,"Client does not support form-mode elicitation requests");if(p.mode==="url"&&!y)throw new Ee($e.InvalidParams,"Client does not support URL-mode elicitation requests");const m=await Promise.resolve(n(u,d));if(p.task){const C=Yo(Mc,m);if(!C.success){const j=C.error instanceof Error?C.error.message:String(C.error);throw new Ee($e.InvalidParams,`Invalid task creation result: ${j}`)}return C.data}const x=Yo(F2,m);if(!x.success){const C=x.error instanceof Error?x.error.message:String(x.error);throw new Ee($e.InvalidParams,`Invalid elicitation result: ${C}`)}const g=x.data,v=p.mode==="form"?p.requestedSchema:void 0;if(p.mode==="form"&&g.action==="accept"&&g.content&&v&&(k=(w=this._capabilities.elicitation)==null?void 0:w.form)!=null&&k.applyDefaults)try{Ad(v,g.content)}catch{}return g};return super.setRequestHandler(t,l)}if(i==="sampling/createMessage"){const l=async(u,d)=>{const f=Yo(M2,u);if(!f.success){const g=f.error instanceof Error?f.error.message:String(f.error);throw new Ee($e.InvalidParams,`Invalid sampling request: ${g}`)}const{params:p}=f.data,h=await Promise.resolve(n(u,d));if(p.task){const g=Yo(Mc,h);if(!g.success){const v=g.error instanceof Error?g.error.message:String(g.error);throw new Ee($e.InvalidParams,`Invalid task creation result: ${v}`)}return g.data}const m=p.tools||p.toolChoice?L2:D2,x=Yo(m,h);if(!x.success){const g=x.error instanceof Error?x.error.message:String(x.error);throw new Ee($e.InvalidParams,`Invalid sampling result: ${g}`)}return x.data};return super.setRequestHandler(t,l)}return super.setRequestHandler(t,n)}assertCapability(t,n){var r;if(!((r=this._serverCapabilities)!=null&&r[t]))throw new Error(`Server does not support ${t} (required for ${n})`)}async connect(t,n){if(await super.connect(t),t.sessionId===void 0)try{const r=await this.request({method:"initialize",params:{protocolVersion:Dh,capabilities:this._capabilities,clientInfo:this._clientInfo}},S2,n);if(r===void 0)throw new Error(`Server sent invalid initialize result: ${r}`);if(!AK.includes(r.protocolVersion))throw new Error(`Server's protocol version is not supported: ${r.protocolVersion}`);this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(r.protocolVersion),this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){var n,r,o,s,i;switch(t){case"logging/setLevel":if(!((n=this._serverCapabilities)!=null&&n.logging))throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!((r=this._serverCapabilities)!=null&&r.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(!((o=this._serverCapabilities)!=null&&o.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(!((s=this._serverCapabilities)!=null&&s.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 n;switch(t){case"notifications/roots/list_changed":if(!((n=this._capabilities.roots)!=null&&n.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 n,r;mX((r=(n=this._serverCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests,t,"Server")}assertTaskHandlerCapability(t){var n;this._capabilities&&gX((n=this._capabilities.tasks)==null?void 0:n.requests,t,"Client")}async ping(t){return this.request({method:"ping"},ca,t)}async complete(t,n){return this.request({method:"completion/complete",params:t},U2,n)}async setLoggingLevel(t,n){return this.request({method:"logging/setLevel",params:{level:t}},ca,n)}async getPrompt(t,n){return this.request({method:"prompts/get",params:t},ex,n)}async listPrompts(t,n){return this.request({method:"prompts/list",params:t},Tf,n)}async listResources(t,n){return this.request({method:"resources/list",params:t},Pf,n)}async listResourceTemplates(t,n){return this.request({method:"resources/templates/list",params:t},T2,n)}async readResource(t,n){return this.request({method:"resources/read",params:t},Q0,n)}async subscribeResource(t,n){return this.request({method:"resources/subscribe",params:t},ca,n)}async unsubscribeResource(t,n){return this.request({method:"resources/unsubscribe",params:t},ca,n)}async callTool(t,n=du,r){if(this.isToolTaskRequired(t.name))throw new Ee($e.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const o=await this.request({method:"tools/call",params:t},n,r),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new Ee($e.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{const i=s(o.structuredContent);if(!i.valid)throw new Ee($e.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof Ee?i:new Ee($e.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}isToolTask(t){var n,r,o,s;return(s=(o=(r=(n=this._serverCapabilities)==null?void 0:n.tasks)==null?void 0:r.requests)==null?void 0:o.tools)!=null&&s.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){var n;this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const r of t){if(r.outputSchema){const s=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,s)}const o=(n=r.execution)==null?void 0:n.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,n){const r=await this.request({method:"tools/list",params:t},tx,n);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(t,n,r,o){const s=j7.safeParse(r);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof r.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);const{autoRefresh:i,debounceMs:a}=s.data,{onChanged:l}=r,u=async()=>{if(!i){l(null,null);return}try{const f=await o();l(null,f)}catch(f){const p=f instanceof Error?f:new Error(String(f));l(p,null)}},d=()=>{if(a){const f=this._listChangedDebounceTimers.get(t);f&&clearTimeout(f);const p=setTimeout(u,a);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(n,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function $l(e,t){if(!e)throw new Error(t)}var t_=3e3,xX=5e3,fm=5*60*1e3;function wX(e){const{url:t,clientName:n,clientUri:r,callbackUrl:o=typeof window<"u"?la(new URL("/oauth/callback",window.location.origin).toString()):"/oauth/callback",storageKeyPrefix:s="mcp:auth",clientConfig:i={},customHeaders:a={},autoRetry:l=!1,autoReconnect:u=t_,transportType:d="auto",preventAutoAuth:f=!1,onPopupWindow:p}=e,[h,y]=b.useState("discovering"),[m,x]=b.useState([]),[g,v]=b.useState([]),[w,k]=b.useState([]),[C,j]=b.useState([]),[S,A]=b.useState(void 0),[P,$]=b.useState([]),[T,I]=b.useState(void 0),U=b.useRef(null),O=b.useRef(null),B=b.useRef(null),J=b.useRef(!1),Q=b.useRef(!0),H=b.useRef(0),W=b.useRef(null),N=b.useRef(h),M=b.useRef(u),V=b.useRef(null);b.useEffect(()=>{N.current=h,M.current=u},[h,u]);const _=b.useCallback((Z,re,...oe)=>{const Re=oe.length>0?`${re} ${oe.map(le=>JSON.stringify(le)).join(" ")}`:re;console[Z](`[useMcp] ${Re}`),Q.current&&$(le=>[...le.slice(-100),{level:Z,message:Re,timestamp:Date.now()}])},[]),E=b.useCallback(async(Z=!1)=>{Z||_("info","Disconnecting..."),J.current=!1,W.current&&clearTimeout(W.current),W.current=null;const re=O.current;if(U.current=null,O.current=null,Q.current&&!Z&&(y("discovering"),x([]),v([]),k([]),j([]),A(void 0),I(void 0)),re)try{await re.close(),Z||_("debug","Transport closed")}catch(oe){Z||_("warn","Error closing transport:",oe)}},[_]),R=b.useCallback((Z,re)=>{var oe;if(_("error",Z,re??""),Q.current){y("failed"),A(Z);const Re=(oe=B.current)==null?void 0:oe.getLastAttemptedAuthUrl();Re&&(I(Re),_("info","Manual authentication URL may be available.",Re))}J.current=!1},[_]),D=b.useCallback(async()=>{if(J.current){_("debug","Connection attempt already in progress.");return}if(!Q.current){_("debug","Connect called after unmount, aborting.");return}J.current=!0,H.current+=1,A(void 0),I(void 0),V.current=null,y("discovering"),_("info",`Connecting attempt #${H.current} to ${t}...`),B.current||(B.current=new n1(t,{storageKeyPrefix:s,clientName:n,clientUri:r,callbackUrl:o,preventAutoAuth:f,onPopupWindow:p}),_("debug","BrowserOAuthClientProvider initialized in connect.")),U.current||(U.current=new vX({name:i.name||"use-mcp-react-client",version:i.version||"0.1.0"},{capabilities:{}}),_("debug","MCP Client initialized in connect."));const Z=async oe=>{_("info",`Attempting connection with ${oe.toUpperCase()} transport...`),N.current!=="authenticating"&&y("connecting");let Re;try{$l(B.current,"Auth Provider must be initialized"),$l(U.current,"Client must be initialized"),O.current&&(await O.current.close().catch(tt=>_("warn",`Error closing previous transport: ${tt.message}`)),O.current=null);const le={authProvider:B.current,requestInit:{headers:{Accept:"application/json, text/event-stream",...a}}},Ce=la(t),Se=new URL(Ce);_("debug",`Creating ${oe.toUpperCase()} transport for URL: ${Se.toString()}`),_("debug","Transport options:",{authProvider:!!B.current,headers:a,url:Se.toString()}),oe==="http"?(_("debug","Creating StreamableHTTPClientTransport..."),Re=new XZ(Se,le),_("debug","StreamableHTTPClientTransport created successfully")):(_("debug","Creating SSEClientTransport..."),Re=new GZ(Se,le),_("debug","SSEClientTransport created successfully")),O.current=Re,_("debug",`${oe.toUpperCase()} transport created and assigned to ref.`)}catch(le){return R(`Failed to create ${oe.toUpperCase()} transport: ${le instanceof Error?le.message:String(le)}`,le instanceof Error?le:void 0),"failed"}Re.onmessage=le=>{var Ce,Se;_("debug",`[Transport] Received: ${JSON.stringify(le)}`),(Se=(Ce=U.current)==null?void 0:Ce.handleMessage)==null||Se.call(Ce,le)},Re.onerror=le=>{_("warn",`Transport error event (${oe.toUpperCase()}):`,le),_("debug","Error details:",{message:le.message,stack:le.stack,name:le.name,cause:le.cause}),R(`Transport error (${oe.toUpperCase()}): ${le.message}`,le)},Re.onclose=()=>{if(!Q.current||J.current)return;_("info",`Transport connection closed (${V.current||"unknown"} type).`);const le=N.current,Ce=M.current;if(le==="ready"&&Ce){const Se=typeof Ce=="number"?Ce:t_;_("info",`Attempting to reconnect in ${Se}ms...`),y("connecting"),setTimeout(()=>{Q.current&&D()},Se)}else le!=="failed"&&le!=="authenticating"&&R("Connection closed unexpectedly.")};try{_("info",`Connecting client via ${oe.toUpperCase()}...`),_("debug","About to call client.connect() with transport instance"),_("debug",`Transport instance type: ${Re.constructor.name}`),await U.current.connect(Re),_("info",`Client connected via ${oe.toUpperCase()}. Loading tools, resources, and prompts...`),V.current=oe,y("loading");const le=await U.current.request({method:"tools/list"},tx);let Ce={resources:[],resourceTemplates:[]};try{Ce=await U.current.request({method:"resources/list"},Pf)}catch(tt){_("debug","Server does not support resources/list method",tt)}let Se={prompts:[]};try{Se=await U.current.request({method:"prompts/list"},Tf)}catch(tt){_("debug","Server does not support prompts/list method",tt)}if(Q.current){x(le.tools),v(Ce.resources),k(Array.isArray(Ce.resourceTemplates)?Ce.resourceTemplates:[]),j(Se.prompts);const tt=[`Loaded ${le.tools.length} tools`];return(Ce.resources.length>0||Ce.resourceTemplates&&Ce.resourceTemplates.length>0)&&(tt.push(`${Ce.resources.length} resources`),Array.isArray(Ce.resourceTemplates)&&Ce.resourceTemplates.length>0&&tt.push(`${Ce.resourceTemplates.length} resource templates`)),Se.prompts.length>0&&tt.push(`${Se.prompts.length} prompts`),_("info",tt.join(", ")+"."),y("ready"),H.current=0,"success"}else return"failed"}catch(le){_("debug",`Client connect error via ${oe.toUpperCase()}:`,le),_("debug","Connect error details:",{message:le instanceof Error?le.message:String(le),stack:le instanceof Error?le.stack:"N/A",name:le instanceof Error?le.name:"Unknown",cause:le instanceof Error?le.cause:void 0});const Ce=le instanceof Error?le:new Error(String(le)),Se=Ce.message,tt=Se.includes("404")||Se.includes("Not Found"),Ke=Se.includes("405")||Se.includes("Method Not Allowed"),pn=Se==="Failed to fetch"||Se==="NetworkError when attempting to fetch resource."||Se==="Load failed";if(oe==="http"&&(tt||Ke||pn))return _("warn",`HTTP transport failed (${pn?"CORS":tt?"404":"405"}).`),"fallback";if(Ce instanceof Hn||Se.includes("Unauthorized")||Se.includes("401")){_("info","Authentication required."),$l(B.current,"Auth Provider not available for auth flow");const zn=await B.current.tokens();if(f&&!zn)return _("info","Authentication required but auto-auth prevented. User action needed."),y("pending_auth"),"auth_redirect";N.current!=="authenticating"&&N.current!=="pending_auth"&&(y("authenticating"),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{},fm));try{const G=await Tr(B.current,{serverUrl:t});if(!Q.current)return"failed";if(G==="AUTHORIZED")return _("info","Authentication successful via existing token or refresh. Re-attempting connection..."),W.current&&clearTimeout(W.current),J.current=!1,D(),"failed";if(G==="REDIRECT")return _("info","Redirecting for authentication. Waiting for callback..."),"auth_redirect"}catch(G){return Q.current&&(W.current&&clearTimeout(W.current),R(`Failed to initiate authentication: ${G instanceof Error?G.message:String(G)}`,G instanceof Error?G:void 0)),"failed"}}return R(`Failed to connect via ${oe.toUpperCase()}: ${Se}`,Ce),"failed"}};let re="failed";if(console.log({transportType:d}),d==="sse")_("debug","Using SSE-only transport mode"),re=await Z("sse");else if(d==="http")_("debug","Using HTTP-only transport mode"),re=await Z("http");else{_("debug","Using auto transport mode (HTTP with SSE fallback)");const oe=await Z("http");if(oe==="fallback"&&Q.current&&N.current!=="authenticating"){_("info","HTTP failed, attempting SSE fallback...");const Re=await Z("sse");re=Re,Re==="failed"&&Q.current}else re=oe}(re==="success"||re==="failed")&&(J.current=!1),_("debug",`Connection sequence finished with status: ${re}`)},[_,R,E,Tr,t,s,n,r,o,i.name,i.version]),K=b.useCallback(async(Z,re)=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot call tool "${Z}".`);_("info",`Calling tool: ${Z}`,re);try{const oe=await U.current.request({method:"tools/call",params:{name:Z,arguments:re}},du);return _("info",`Tool "${Z}" call successful:`,oe),oe}catch(oe){_("error",`Error calling tool "${Z}": ${oe instanceof Error?oe.message:String(oe)}`,oe);const Re=oe instanceof Error?oe:new Error(String(oe));if(Re instanceof Hn||Re.message.includes("Unauthorized")||Re.message.includes("401")){_("warn","Tool call unauthorized, attempting re-authentication..."),y("authenticating"),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{},fm);try{$l(B.current,"Auth Provider not available for tool re-auth");const le=await Tr(B.current,{serverUrl:t});if(!Q.current)return;le==="AUTHORIZED"?(_("info","Re-authentication successful. Retrying tool call is recommended, or reconnecting."),W.current&&clearTimeout(W.current),J.current=!1,D()):le==="REDIRECT"&&_("info","Redirecting for re-authentication for tool call.")}catch(le){if(!Q.current)return;W.current&&clearTimeout(W.current),R(`Re-authentication failed: ${le instanceof Error?le.message:String(le)}`,le instanceof Error?le:void 0)}}if(N.current!=="authenticating")throw oe;return}},[h,t,_,R,D]),X=b.useCallback(()=>{N.current==="failed"?(_("info","Retry requested..."),D()):_("warn",`Retry called but state is not 'failed' (state: ${N.current}). Ignoring.`)},[_,D]),pe=b.useCallback(async()=>{var re;_("info","Manual authentication requested...");const Z=N.current;if(Z==="failed")_("info","Attempting to reconnect and authenticate via retry..."),X();else if(Z==="pending_auth"){_("info","Proceeding with authentication from pending state..."),y("authenticating"),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{},fm);try{$l(B.current,"Auth Provider not available for manual auth");const oe=await Tr(B.current,{serverUrl:t});if(!Q.current)return;oe==="AUTHORIZED"?(_("info","Manual authentication successful. Re-attempting connection..."),W.current&&clearTimeout(W.current),J.current=!1,D()):oe==="REDIRECT"&&_("info","Redirecting for manual authentication. Waiting for callback...")}catch(oe){if(!Q.current)return;W.current&&clearTimeout(W.current),R(`Manual authentication failed: ${oe instanceof Error?oe.message:String(oe)}`,oe instanceof Error?oe:void 0)}}else if(Z==="authenticating"){_("warn","Already attempting authentication. Check for blocked popups or wait for timeout.");const oe=(re=B.current)==null?void 0:re.getLastAttemptedAuthUrl();oe&&!T&&(I(oe),_("info","Manual authentication URL retrieved:",oe))}else _("info",`Client not in a state requiring manual authentication trigger (state: ${Z}). If needed, try disconnecting and reconnecting.`)},[_,X,T,t,R,D]),ce=b.useCallback(()=>{if(B.current){const Z=B.current.clearStorage();_("info",`Cleared ${Z} item(s) from localStorage for ${t}.`),I(void 0),E()}else _("warn","Auth provider not initialized, cannot clear storage.")},[t,_,E]),L=b.useCallback(async()=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list resources.`);_("info","Listing resources...");try{const Z=await U.current.request({method:"resources/list"},Pf);Q.current&&(v(Z.resources),k(Array.isArray(Z.resourceTemplates)?Z.resourceTemplates:[]),_("info",`Listed ${Z.resources.length} resources, ${Array.isArray(Z.resourceTemplates)?Z.resourceTemplates.length:0} resource templates.`))}catch(Z){throw _("error",`Error listing resources: ${Z instanceof Error?Z.message:String(Z)}`,Z),Z}},[h,_]),q=b.useCallback(async Z=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot read resource "${Z}".`);_("info",`Reading resource: ${Z}`);try{const re=await U.current.request({method:"resources/read",params:{uri:Z}},Q0);return _("info",`Resource "${Z}" read successfully`),re}catch(re){throw _("error",`Error reading resource "${Z}": ${re instanceof Error?re.message:String(re)}`,re),re}},[h,_]),Y=b.useCallback(async()=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot list prompts.`);_("info","Listing prompts...");try{const Z=await U.current.request({method:"prompts/list"},Tf);Q.current&&(j(Z.prompts),_("info",`Listed ${Z.prompts.length} prompts.`))}catch(Z){throw _("error",`Error listing prompts: ${Z instanceof Error?Z.message:String(Z)}`,Z),Z}},[h,_]),ne=b.useCallback(async(Z,re)=>{if(N.current!=="ready"||!U.current)throw new Error(`MCP client is not ready (current state: ${h}). Cannot get prompt "${Z}".`);_("info",`Getting prompt: ${Z}`,re);try{const oe=await U.current.request({method:"prompts/get",params:{name:Z,arguments:re}},ex);return _("info",`Prompt "${Z}" retrieved successfully`),oe}catch(oe){throw _("error",`Error getting prompt "${Z}": ${oe instanceof Error?oe.message:String(oe)}`,oe),oe}},[h,_]);return b.useEffect(()=>{const Z=re=>{var oe;re.origin===window.location.origin&&((oe=re.data)==null?void 0:oe.type)==="mcp_auth_callback"&&(_("info","Received auth callback message.",re.data),W.current&&clearTimeout(W.current),re.data.success?(_("info","Authentication successful via popup. Reconnecting client..."),J.current=!1,D()):R(`Authentication failed in callback: ${re.data.error||"Unknown reason."}`))};return window.addEventListener("message",Z),_("debug","Auth callback message listener added."),()=>{window.removeEventListener("message",Z),_("debug","Auth callback message listener removed."),W.current&&clearTimeout(W.current)}},[_,R,D]),b.useEffect(()=>(Q.current=!0,_("debug","useMcp mounted, initiating connection."),H.current=0,(!B.current||B.current.serverUrl!==t)&&(B.current=new n1(t,{storageKeyPrefix:s,clientName:n,clientUri:r,callbackUrl:o,preventAutoAuth:f,onPopupWindow:p}),_("debug","BrowserOAuthClientProvider initialized/updated on mount/option change.")),D(),()=>{Q.current=!1,_("debug","useMcp unmounting, disconnecting."),E(!0)}),[t,s,o,n,r,i.name,i.version,D,E]),b.useEffect(()=>{let Z=null;if(h==="failed"&&l&&H.current>0){const re=typeof l=="number"?l:xX;_("info",`Connection failed, auto-retrying in ${re}ms...`),Z=setTimeout(()=>{Q.current&&N.current==="failed"&&X()},re)}return()=>{Z&&clearTimeout(Z)}},[h,l,X,_]),{state:h,tools:m,resources:g,resourceTemplates:w,prompts:C,error:S,log:P,authUrl:T,callTool:K,listResources:L,readResource:q,listPrompts:Y,getPrompt:ne,retry:X,disconnect:E,authenticate:pe,clearStorage:ce}}function bX({service:e,autoConnect:t=!1,onConnected:n,onError:r}){const{toast:o}=Wt(),{state:s,tools:i,resources:a,prompts:l,error:u,authUrl:d,callTool:f,readResource:p,listResources:h,getPrompt:y,listPrompts:m,retry:x,disconnect:g,authenticate:v,clearStorage:w}=wX({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}),k=s==="ready",C=s==="connecting"||s==="loading",j=s==="authenticating"||s==="pending_auth",S=s==="failed";return Vr.useEffect(()=>{k&&n&&(n(),o({title:"Connected to MCP service",description:`Successfully connected to ${e.name}`}))},[k,n,e.name,o]),Vr.useEffect(()=>{S&&u&&r&&(r(u),o({title:"MCP connection failed",description:u,variant:"destructive"}))},[S,u,r,o]),{isConnected:k,isConnecting:C,isAuthenticating:j,hasError:S,error:u,tools:i,resources:a,prompts:l,connect:()=>{x()},disconnect:g,retry:x,authenticate:v,callTool:async(U,O)=>{try{return await f(U,O)}catch(B){const J=B instanceof Error?B.message:"Unknown error";throw o({title:"Tool call failed",description:J,variant:"destructive"}),B}},readResource:async U=>{try{return await p(U)}catch(O){const B=O instanceof Error?O.message:"Unknown error";throw o({title:"Resource read failed",description:B,variant:"destructive"}),O}},listResources:async()=>{try{await h()}catch(U){const O=U instanceof Error?U.message:"Unknown error";throw o({title:"Resource listing failed",description:O,variant:"destructive"}),U}},getPrompt:async(U,O)=>{try{return await y(U,O)}catch(B){const J=B instanceof Error?B.message:"Unknown error";throw o({title:"Prompt retrieval failed",description:J,variant:"destructive"}),B}},listPrompts:async()=>{try{await m()}catch(U){const O=U instanceof Error?U.message:"Unknown error";throw o({title:"Prompt listing failed",description:O,variant:"destructive"}),U}},authUrl:d,clearStorage:w}}function kX(){const[e,t]=b.useState("https://api.githubcopilot.com/mcp"),[n,r]=b.useState("get_me"),[o,s]=b.useState("{}"),[i,a]=b.useState(""),l={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:p,error:h,tools:y,resources:m,prompts:x,connect:g,disconnect:v,retry:w,authenticate:k,callTool:C,authUrl:j,clearStorage:S}=bX({service:l,autoConnect:!1,onConnected:()=>{console.log("Connected to test MCP service")},onError:T=>{console.error("Test MCP service error:",T)}}),P=d?{status:"connecting",icon:Pb,color:"text-yellow-500"}:f?{status:"authenticating",icon:Ou,color:"text-blue-500"}:u?{status:"connected",icon:_g,color:"text-green-500"}:p?{status:"error",icon:Nb,color:"text-red-500"}:{status:"disconnected",icon:Nb,color:"text-gray-500"},$=async()=>{try{let T={};o.trim()&&(T=JSON.parse(o));const I=await C(n,T);a(JSON.stringify(I,null,2))}catch(T){a(`Error: ${T instanceof Error?T.message:"Unknown error"}`)}};return c.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-3xl font-bold mb-2",children:"use-mcp Integration Test"}),c.jsx("p",{className:"text-muted-foreground",children:"Testing the new use-mcp library integration with OAuth support"})]}),c.jsxs(Go,{children:[c.jsxs(Ws,{children:[c.jsxs(Ks,{className:"flex items-center gap-2",children:[c.jsx(P.icon,{className:`w-5 h-5 ${P.color}`}),"Connection Status: ",P.status]}),c.jsx(Cd,{children:"Current connection state and available actions"})]}),c.jsxs(Jo,{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx(We,{children:"Service URL"}),c.jsx(Xe,{value:e,onChange:T=>t(T.target.value),placeholder:"Enter MCP service URL"})]}),c.jsxs("div",{className:"flex gap-2",children:[!u&&!d&&c.jsx(fe,{onClick:g,children:"Connect"}),u&&c.jsx(fe,{onClick:v,variant:"outline",children:"Disconnect"}),p&&c.jsxs(fe,{onClick:w,variant:"outline",children:[c.jsx(Pb,{className:"w-4 h-4 mr-1"}),"Retry"]}),j&&!u&&c.jsxs(fe,{onClick:k,variant:"outline",children:[c.jsx(Ou,{className:"w-4 h-4 mr-1"}),"Authenticate"]})]})]}),h&&c.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[c.jsx(PE,{className:"w-4 h-4 text-destructive"}),c.jsx("span",{className:"text-sm text-destructive",children:h})]})]})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[c.jsxs(Go,{children:[c.jsx(Ws,{children:c.jsxs(Ks,{className:"flex items-center gap-2",children:[c.jsx(Dv,{className:"w-4 h-4"}),"Tools (",y.length,")"]})}),c.jsx(Jo,{children:y.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:u?"No tools available":"Connect to see tools"}):c.jsxs("div",{className:"space-y-2",children:[y.slice(0,5).map((T,I)=>c.jsx("div",{className:"text-sm",children:c.jsx(Un,{variant:"outline",className:"text-xs",children:T.name})},I)),y.length>5&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",y.length-5," more tools"]})]})})]}),c.jsxs(Go,{children:[c.jsx(Ws,{children:c.jsxs(Ks,{children:["Resources (",m.length,")"]})}),c.jsx(Jo,{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${m.length} resources available`:"Connect to see resources"})})]}),c.jsxs(Go,{children:[c.jsx(Ws,{children:c.jsxs(Ks,{children:["Prompts (",x.length,")"]})}),c.jsx(Jo,{children:c.jsx("p",{className:"text-sm text-muted-foreground",children:u?`${x.length} prompts available`:"Connect to see prompts"})})]})]}),u&&c.jsxs(Go,{children:[c.jsxs(Ws,{children:[c.jsx(Ks,{children:"Test Tool Call"}),c.jsx(Cd,{children:"Test calling a tool on the connected MCP service"})]}),c.jsxs(Jo,{className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"toolName",children:"Tool Name"}),c.jsx(Xe,{id:"toolName",value:n,onChange:T=>r(T.target.value),placeholder:"e.g., get_me"})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{htmlFor:"toolArgs",children:"Arguments (JSON)"}),c.jsx(Xe,{id:"toolArgs",value:o,onChange:T=>s(T.target.value),placeholder:'{"key": "value"}'})]})]}),c.jsxs(fe,{onClick:$,disabled:!u,children:[c.jsx(AM,{className:"w-4 h-4 mr-1"}),"Call Tool"]}),i&&c.jsxs("div",{className:"space-y-2",children:[c.jsx(We,{children:"Result"}),c.jsx(wo,{value:i,readOnly:!0,rows:10,className:"font-mono text-sm"})]})]})]}),j&&c.jsxs(Go,{children:[c.jsxs(Ws,{children:[c.jsxs(Ks,{className:"flex items-center gap-2",children:[c.jsx(Ou,{className:"w-4 h-4"}),"OAuth Authentication"]}),c.jsx(Cd,{children:"This service requires OAuth authentication"})]}),c.jsxs(Jo,{className:"space-y-4",children:[c.jsx("div",{className:"p-3 bg-blue-50 border border-blue-200 rounded-md",children:c.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.'})}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(fe,{onClick:k,variant:"outline",children:[c.jsx(Ou,{className:"w-4 h-4 mr-1"}),"Start OAuth Flow"]}),c.jsx(fe,{onClick:S,variant:"outline",children:"Clear OAuth Data"})]})]})]})]})}function MR(e){return e.before.title!==e.after.title||e.before.body!==e.after.body||e.before.triggers.join(`
459
- `)!==e.after.triggers.join(`
460
- `)}class _X{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,l,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},a=n.length,l=t.length;let u=1,d=a+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=l&&y+1>=a)return i(this.buildValues(h[0].lastComponent,n,t));let m=-1/0,x=1/0;const g=()=>{for(let v=Math.max(m,-u);v<=Math.min(x,u);v+=2){let w;const k=h[v-1],C=h[v+1];k&&(h[v-1]=void 0);let j=!1;if(C){const A=C.oldPos-v;j=C&&0<=A&&A<a}const S=k&&k.oldPos+1<l;if(!j&&!S){h[v]=void 0;continue}if(!S||j&&k.oldPos<C.oldPos?w=this.addToPath(C,!0,!1,0,r):w=this.addToPath(k,!1,!0,1,r),y=this.extractCommon(w,n,t,v,r),w.oldPos+1>=l&&y+1>=a)return i(this.buildValues(w.lastComponent,n,t))||!0;h[v]=w,w.oldPos+1>=l&&(x=Math.min(x,v-1)),y+1>=a&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>p)return o(void 0);g()||v()},0)})();else for(;u<=d&&Date.now()<=p;){const v=g();if(v)return v}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,a=r.length;let l=t.oldPos,u=l-o,d=0;for(;u+1<i&&l+1<a&&this.equals(r[l+1],n[u+1],s);)u++,l++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=l,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let a=0,l=0,u=0;for(;a<i;a++){const d=o[a];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(l,l+d.count);f=f.map(function(p,h){const y=r[u+h];return y.length>p.length?y:p}),d.value=this.join(f)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}}return o}}class SX extends _X{constructor(){super(...arguments),this.tokenize=NX}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
461
- `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
462
- `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
463
- `)&&(t=t.slice(0,-1)),n.endsWith(`
464
- `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const CX=new SX;function EX(e,t,n){return CX.diff(e,t,n)}function NX(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
465
- `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}const hm=3,jX=10;function PX(e){return e===""?[]:e.replace(/\n$/,"").split(`
466
- `)}function TX(e,t){const n=EX(e,t),r=[];let o=1,s=1;for(const i of n){const a=PX(i.value);if(!i.added&&!i.removed&&a.length>=jX){const u=a.slice(0,hm),d=a.slice(-hm),f=a.length-hm*2;for(const p of u)r.push({kind:"unchanged",text:p,oldLine:o++,newLine:s++});f>0&&(r.push({kind:"ellipsis",text:`${f} unchanged lines`}),o+=f,s+=f);for(const p of d)r.push({kind:"unchanged",text:p,oldLine:o++,newLine:s++});continue}for(const u of a)i.added?r.push({kind:"added",text:u,newLine:s++}):i.removed?r.push({kind:"removed",text:u,oldLine:o++}):r.push({kind:"unchanged",text:u,oldLine:o++,newLine:s++})}return r}function RX(e){return e.some(t=>t.kind==="added"||t.kind==="removed")}const Qx="max-h-[min(52vh,32rem)] max-w-full overflow-auto rounded-md border border-gray-800 bg-gray-950 font-mono text-xs leading-5";function $X(e){switch(e){case"added":return"bg-emerald-950/70 text-emerald-100";case"removed":return"bg-rose-950/70 text-rose-100";case"ellipsis":return"bg-gray-900 text-gray-500 italic";default:return"bg-gray-950 text-gray-300"}}function IX(e){switch(e){case"added":return"+";case"removed":return"-";case"ellipsis":return"…";default:return" "}}function AX({rows:e,emptyLabel:t}){return e.length===0?c.jsx("p",{className:"text-sm text-gray-500",children:t}):c.jsx("div",{className:Qx,children:e.map((n,r)=>c.jsxs("div",{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] gap-0 ${$X(n.kind)}`,children:[c.jsx("span",{className:"select-none border-r border-gray-800/80 px-2 py-0.5 text-right text-gray-600",children:n.oldLine??""}),c.jsx("span",{className:"select-none border-r border-gray-800/80 px-2 py-0.5 text-right text-gray-600",children:n.newLine??""}),c.jsxs("div",{className:"flex min-w-0 gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 select-none text-gray-500",children:IX(n.kind)}),c.jsx("span",{className:"min-w-0 whitespace-pre-wrap break-words",children:n.text||" "})]})]},`${n.kind}-${r}-${n.oldLine??""}-${n.newLine??""}`))})}function OX({before:e,after:t}){const n=e.filter(o=>!t.includes(o)),r=t.filter(o=>!e.includes(o));return n.length===0&&r.length===0?null:c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Triggers"}),c.jsxs("div",{className:`${Qx} p-0`,children:[n.map(o=>c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-rose-950/70 text-rose-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"-"}),c.jsx("span",{children:o})]})]},`removed-${o}`)),r.map(o=>c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-emerald-950/70 text-emerald-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"+"}),c.jsx("span",{children:o})]})]},`added-${o}`))]})]})}function MX({preview:e}){const t=MR(e),n=TX(e.before.body,e.after.body),r=e.before.body.trim()!==e.after.body.trim()&&e.after.body.length>0&&!e.after.body.includes(e.before.body.slice(0,40))&&RX(n),o=e.before.title!==e.after.title,s=e.before.triggers.join(`
467
- `)!==e.after.triggers.join(`
468
- `);return c.jsxs("div",{className:"min-w-0 space-y-4",children:[!t&&c.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 text-sm text-amber-100",children:["No change detected — ops did not alter the playbook body or triggers. Reject this proposal and re-propose with a matching list anchor or ",c.jsx("code",{children:"rewrite_body"}),"."]}),r&&c.jsx("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 text-sm text-amber-100",children:"Full-body rewrite proposed — review carefully."}),o&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Title"}),c.jsxs("div",{className:`${Qx} p-0`,children:[e.before.title&&c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-rose-950/70 text-rose-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"-"}),c.jsx("span",{children:e.before.title})]})]}),e.after.title&&c.jsxs("div",{className:"grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-emerald-950/70 text-emerald-100",children:[c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsx("span",{className:"border-r border-gray-800/80 px-2 py-0.5"}),c.jsxs("div",{className:"flex gap-2 px-2 py-0.5",children:[c.jsx("span",{className:"w-3 shrink-0 text-gray-500",children:"+"}),c.jsx("span",{children:e.after.title})]})]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("h4",{className:"text-sm font-medium text-gray-400",children:"Body"}),c.jsx(AX,{rows:n,emptyLabel:"No body changes."})]}),s&&c.jsx(OX,{before:e.before.triggers,after:e.after.triggers})]})}function DX(e){if(!e)return[];try{return JSON.parse(e)}catch{return[]}}function LX({conflicts:e,title:t="Trigger overlap warnings"}){return e.length===0?null:c.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/10 p-4 text-sm text-amber-50",children:[c.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-amber-200/90",children:t}),c.jsx("p",{className:"mt-2 text-amber-100/90",children:"These triggers overlap with other playbooks on the deck. Accept is still allowed — disambiguate triggers or propose a merge if the wrong playbook keeps firing."}),c.jsx("ul",{className:"mt-3 space-y-2",children:e.map(n=>c.jsxs("li",{className:"rounded border border-amber-500/20 bg-gray-950/60 p-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(Un,{variant:"outline",className:"border-amber-400/40 text-amber-100",children:n.level}),c.jsx("span",{className:"font-medium text-amber-50",children:n.otherPlaybookTitle}),c.jsx("span",{className:"font-mono text-xs text-amber-200/70",children:n.otherPlaybookId})]}),c.jsxs("p",{className:"mt-2 text-amber-100/90",children:[c.jsx("span",{className:"text-amber-200/80",children:"Candidate:"})," ",n.trigger]}),c.jsxs("p",{className:"text-amber-100/80",children:[c.jsx("span",{className:"text-amber-200/80",children:"Other:"})," ",n.otherTrigger]})]},`${n.trigger}-${n.otherPlaybookId}-${n.level}`))})]})}function zX(e){if(!e.evidenceJson)return null;try{return JSON.parse(e.evidenceJson)}catch{return null}}function FX(){const[e,t]=b.useState(null),[n,r]=b.useState(""),{toast:o}=Wt(),s=nn(),{data:i=[],isLoading:a}=It({queryKey:["/api/playbook-patches","proposed"],queryFn:()=>Lj("proposed")}),{data:l,isLoading:u,isError:d,error:f}=It({queryKey:["/api/playbook-patches",e,"preview"],queryFn:()=>PF(e),enabled:!!e}),p=l?MR(l):!1,h=i.find(x=>x.id===e)??null,y=gt({mutationFn:x=>TF(x),onSuccess:()=>{o({title:"Patch accepted"}),t(null),s.invalidateQueries({queryKey:["/api/playbook-patches"]}),s.invalidateQueries({queryKey:["/api/playbooks"]})},onError:x=>{o({title:"Accept failed",description:x.message,variant:"destructive"})}}),m=gt({mutationFn:({id:x,reason:g})=>RF(x,g),onSuccess:()=>{o({title:"Patch rejected"}),t(null),r(""),s.invalidateQueries({queryKey:["/api/playbook-patches"]})},onError:x=>{o({title:"Reject failed",description:x.message,variant:"destructive"})}});return c.jsxs("div",{className:"flex min-h-dvh flex-col bg-gray-950 text-gray-100",children:[c.jsx("header",{className:"shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6",children:c.jsxs("div",{className:"mx-auto flex max-w-7xl items-center gap-3",children:[c.jsx(OC,{href:"/",children:c.jsxs(fe,{variant:"ghost",size:"sm",className:"text-gray-300",children:[c.jsx(CM,{className:"mr-1 h-4 w-4"}),"Deck"]})}),c.jsx("h1",{className:"text-lg font-semibold",children:"Playbook review queue"}),c.jsxs(Un,{variant:"secondary",children:[i.length," proposed"]})]})}),c.jsxs("main",{className:"mx-auto grid w-full max-w-7xl flex-1 gap-6 px-4 py-6 sm:px-6 lg:min-h-0 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)] lg:items-stretch lg:overflow-hidden",children:[c.jsxs("section",{className:"min-w-0 lg:min-h-0 lg:overflow-y-auto",children:[c.jsx("h2",{className:"mb-3 text-sm font-medium text-gray-400",children:"Proposals"}),a&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading…"}),!a&&i.length===0&&c.jsx("p",{className:"text-sm text-gray-500",children:"No proposals waiting for review."}),c.jsx("ul",{className:"space-y-2",children:i.map(x=>c.jsx("li",{children:c.jsxs("button",{type:"button",onClick:()=>t(x.id),className:`w-full rounded-lg border p-3 text-left transition ${e===x.id?"border-blue-500 bg-gray-900":"border-gray-800 bg-gray-900/50 hover:border-gray-700"}`,children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("span",{className:"block font-medium leading-snug",children:x.kind==="create"?`New: ${x.displayTitle}`:x.displayTitle}),x.playbookId&&x.kind!=="create"&&c.jsx("span",{className:"mt-0.5 block truncate font-mono text-xs text-gray-600",children:x.playbookId}),rk(x.deckNames)&&c.jsxs("span",{className:"mt-1 block text-xs text-gray-500",children:["Decks: ",rk(x.deckNames)]})]}),c.jsx(Un,{variant:"outline",className:"shrink-0",children:x.kind})]}),c.jsx("p",{className:"mt-1 line-clamp-2 text-sm text-gray-400",children:x.rationale}),c.jsxs("p",{className:"mt-1 text-xs text-gray-600",children:[x.source," · ",new Date(x.createdAt).toLocaleString()]})]})},x.id))})]}),c.jsxs("section",{className:"flex min-w-0 flex-col lg:min-h-0 lg:flex-1 lg:overflow-hidden",children:[c.jsx("h2",{className:"mb-3 shrink-0 text-sm font-medium text-gray-400",children:"Detail"}),!h&&c.jsx("p",{className:"text-sm text-gray-500",children:"Select a proposal to preview the diff."}),h&&c.jsxs("div",{className:"flex flex-col overflow-hidden rounded-lg border border-gray-800 bg-gray-900/50 lg:min-h-0 lg:flex-1",children:[c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 sm:p-5",children:c.jsxs("div",{className:"min-w-0 space-y-4",children:[c.jsx("p",{className:"text-sm leading-relaxed text-gray-300",children:h.rationale}),(()=>{const x=zX(h);return x?c.jsxs("div",{className:"rounded-md border border-gray-700 bg-gray-950 p-4 text-sm",children:[c.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Your correction"}),c.jsxs("p",{className:"mt-2 italic text-gray-200",children:["“",x.user_feedback_excerpt,"”"]}),x.failure_summary&&c.jsx("p",{className:"mt-2 text-gray-400",children:x.failure_summary})]}):null})(),(()=>{const x=DX(h.conflictsJson),g=(l==null?void 0:l.trigger_conflicts)??[],v=g.length>0?g:x;return c.jsx(LX,{conflicts:v})})(),u&&c.jsx("p",{className:"text-sm text-gray-500",children:"Loading preview…"}),d&&c.jsxs("div",{className:"rounded-md border border-rose-500/50 bg-rose-500/10 p-3 text-sm text-rose-100",children:["Preview failed — ",(f==null?void 0:f.message)??"could not apply ops to the current playbook."," ","Reject and re-propose with exact list anchors or ",c.jsx("code",{children:"rewrite_body"}),"."]}),l&&c.jsx(MX,{preview:l}),h.status==="stale"&&c.jsx("p",{className:"text-sm text-amber-400",children:"Stale — playbook changed since proposal. Re-propose from a fresh session."})]})}),c.jsxs("div",{className:"relative z-10 shrink-0 space-y-4 border-t border-gray-800 bg-gray-950 p-4 shadow-[0_-16px_32px_rgba(0,0,0,0.55)] sm:p-5",children:[c.jsx("h3",{className:"text-sm font-medium text-gray-400",children:"Your decision"}),c.jsx(fe,{variant:"gold",className:"w-full sm:w-auto",onClick:()=>y.mutate(h.id),disabled:y.isPending||d||!p,children:"Accept"}),c.jsxs("div",{className:"space-y-2 rounded-md border border-gray-800 bg-gray-900/80 p-3",children:[c.jsx(wo,{placeholder:"Rejection reason (required)",value:n,onChange:x=>r(x.target.value),className:"min-h-[88px] bg-gray-950"}),c.jsx(fe,{variant:"destructive",disabled:!n.trim()||m.isPending,onClick:()=>m.mutate({id:h.id,reason:n.trim()}),children:"Reject"})]})]})]})]})]})]})}function UX(){return c.jsxs(qA,{children:[c.jsx(Sl,{path:"/",component:EV}),c.jsx(Sl,{path:"/oauth/callback",component:PV}),c.jsx(Sl,{path:"/playbook-patches",component:FX}),c.jsx(Sl,{path:"/mcp-test",component:kX}),c.jsx(Sl,{component:jV})]})}function qX(){return c.jsx(cO,{client:SO,children:c.jsxs(oL,{children:[c.jsx(w4,{}),c.jsx(UX,{})]})})}SC(document.getElementById("root")).render(c.jsx(b.StrictMode,{children:c.jsx(qX,{})}));