@agent-deck/backend 2.5.4 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/agent-run/records.d.ts +6 -0
- package/dist/agent-run/records.d.ts.map +1 -1
- package/dist/agent-run/records.js.map +1 -1
- package/dist/agent-run/service.d.ts +6 -0
- package/dist/agent-run/service.d.ts.map +1 -1
- package/dist/agent-run/service.js +1 -0
- package/dist/agent-run/service.js.map +1 -1
- package/dist/audit/store.d.ts +2 -2
- package/dist/audit/store.d.ts.map +1 -1
- package/dist/audit/store.js +3 -0
- package/dist/audit/store.js.map +1 -1
- package/dist/bootstrap/real-intent.js +1 -1
- package/dist/bootstrap/real-intent.js.map +1 -1
- package/dist/lib/deck-switch-approval-url.d.ts +16 -0
- package/dist/lib/deck-switch-approval-url.d.ts.map +1 -0
- package/dist/lib/deck-switch-approval-url.js +59 -0
- package/dist/lib/deck-switch-approval-url.js.map +1 -0
- package/dist/lib/mcp-connection-error.d.ts +14 -0
- package/dist/lib/mcp-connection-error.d.ts.map +1 -1
- package/dist/lib/mcp-connection-error.js +36 -0
- package/dist/lib/mcp-connection-error.js.map +1 -1
- package/dist/mcp-server.d.ts +73 -0
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +443 -95
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-session-binding.d.ts +29 -0
- package/dist/mcp-session-binding.d.ts.map +1 -1
- package/dist/mcp-session-binding.js +48 -0
- package/dist/mcp-session-binding.js.map +1 -1
- package/dist/mcp-tools/elicitation.d.ts +105 -7
- package/dist/mcp-tools/elicitation.d.ts.map +1 -1
- package/dist/mcp-tools/elicitation.js +291 -48
- package/dist/mcp-tools/elicitation.js.map +1 -1
- package/dist/mcp-tools/register.d.ts +14 -2
- package/dist/mcp-tools/register.d.ts.map +1 -1
- package/dist/mcp-tools/register.js +29 -2
- package/dist/mcp-tools/register.js.map +1 -1
- package/dist/models/database.d.ts.map +1 -1
- package/dist/models/database.js +13 -2
- package/dist/models/database.js.map +1 -1
- package/dist/playbooks/apply-patch-ops.js +1 -1
- package/dist/playbooks/apply-patch-ops.js.map +1 -1
- package/dist/routes/agent-runs.d.ts.map +1 -1
- package/dist/routes/agent-runs.js +19 -4
- package/dist/routes/agent-runs.js.map +1 -1
- package/dist/routes/decks.d.ts.map +1 -1
- package/dist/routes/decks.js.map +1 -1
- package/dist/routes/local-mcp.d.ts.map +1 -1
- package/dist/routes/local-mcp.js.map +1 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +1 -1
- package/dist/routes/mcp.js.map +1 -1
- package/dist/routes/oauth.d.ts.map +1 -1
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/services.d.ts.map +1 -1
- package/dist/routes/services.js.map +1 -1
- package/dist/routes/trusted-session.d.ts.map +1 -1
- package/dist/routes/trusted-session.js +125 -9
- package/dist/routes/trusted-session.js.map +1 -1
- package/dist/routes/websocket.d.ts.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/services/local-mcp-server-manager.d.ts.map +1 -1
- package/dist/services/mcp-client-manager.d.ts +19 -1
- package/dist/services/mcp-client-manager.d.ts.map +1 -1
- package/dist/services/mcp-client-manager.js +69 -13
- package/dist/services/mcp-client-manager.js.map +1 -1
- package/dist/services/oauth-manager.d.ts +6 -0
- package/dist/services/oauth-manager.d.ts.map +1 -1
- package/dist/services/oauth-manager.js +31 -1
- package/dist/services/oauth-manager.js.map +1 -1
- package/dist/services/service-manager.d.ts.map +1 -1
- package/dist/services/service-manager.js +6 -1
- package/dist/services/service-manager.js.map +1 -1
- package/dist/test-local-mcp.js.map +1 -1
- package/dist/trusted-session/store.d.ts +73 -0
- package/dist/trusted-session/store.d.ts.map +1 -1
- package/dist/trusted-session/store.js +196 -0
- package/dist/trusted-session/store.js.map +1 -1
- package/dist/vault/oauth-token-vault.d.ts +13 -0
- package/dist/vault/oauth-token-vault.d.ts.map +1 -1
- package/dist/vault/oauth-token-vault.js +21 -1
- package/dist/vault/oauth-token-vault.js.map +1 -1
- package/package.json +17 -9
- package/static-ui/assets/index-CMWVYf0r.js +266 -0
- package/static-ui/assets/index-ehit12GK.css +1 -0
- package/static-ui/index.html +2 -2
- package/static-ui/assets/index-B5GT9yb2.js +0 -266
- package/static-ui/assets/index-DBeN8gfw.css +0 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(i(n)),l(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=s((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=s(((e,t)=>{t.exports=f()})),m=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`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`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),h=s(((e,t)=>{t.exports=m()})),g=s((e=>{var t=h();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.8`})),_=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=s((e=>{var t=p(),n=h(),r=_();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;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.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,m=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function R(e){return{current:e}}function z(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function B(e,t){ne++,te[ne]=e.current,e.current=t}var re=R(null),ie=R(null),ae=R(null),oe=R(null);function se(e,t){switch(B(ae,t),B(ie,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qd(t),e=Jd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}z(re),B(re,e)}function ce(){z(re),z(ie),z(ae)}function le(e){e.memoizedState!==null&&B(oe,e);var t=re.current,n=Jd(t,e.type);t!==n&&(B(ie,e),B(re,n))}function ue(e){ie.current===e&&(z(re),z(ie)),oe.current===e&&(z(oe),ip._currentValue=ee)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
|
|
2
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
+
`+de+e+fe}var me=!1;function he(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
+
`),l=s.split(`
|
|
5
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,V=t.unstable_now,Ce=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function Ne(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var Pe=Math.clz32?Math.clz32:Le,Fe=Math.log,Ie=Math.LN2;function Le(e){return e>>>=0,e===0?32:31-(Fe(e)/Ie|0)|0}var Re=256,ze=262144,Be=4194304;function Ve(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function He(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ve(n))):i=Ve(o):i=Ve(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ve(n))):i=Ve(o)):i=Ve(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=Be;return Be<<=1,!(Be&62914560)&&(Be=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Pe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ye(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ye(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Pe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Xe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Pe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ze(e,t){var n=t&-t;return n=n&42?1:Qe(n),(n&(e.suspendedLanes|t))===0?n:0}function Qe(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $e(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function et(){var e=L.p;return e===0?(e=window.event,e===void 0?32:bp(e.type)):e}function tt(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var nt=Math.random().toString(36).slice(2),rt=`__reactFiber$`+nt,it=`__reactProps$`+nt,at=`__reactContainer$`+nt,ot=`__reactEvents$`+nt,st=`__reactListeners$`+nt,ct=`__reactHandles$`+nt,lt=`__reactResources$`+nt,ut=`__reactMarker$`+nt;function dt(e){delete e[rt],delete e[it],delete e[ot],delete e[st],delete e[ct]}function ft(e){var t=e[rt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[at]||n[rt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=_f(e);e!==null;){if(n=e[rt])return n;e=_f(e)}return t}e=n,n=e.parentNode}return null}function pt(e){if(e=e[rt]||e[at]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ht(e){var t=e[lt];return t||=e[lt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function gt(e){e[ut]=!0}var _t=new Set,vt={};function yt(e,t){bt(e,t),bt(e+`Capture`,t)}function bt(e,t){for(vt[e]=t,e=0;e<t.length;e++)_t.add(t[e])}var xt=RegExp(`^[: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]*$`),St={},Ct={};function wt(e){return ve.call(Ct,e)?!0:ve.call(St,e)?!1:xt.test(e)?Ct[e]=!0:(St[e]=!0,!1)}function Tt(e,t,n){if(wt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function Et(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Dt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ot(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function At(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jt(e){if(!e._valueTracker){var t=kt(e)?`checked`:`value`;e._valueTracker=At(e,t,``+e[t])}}function Mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=kt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Nt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Pt=/[\n"\\]/g;function Ft(e){return e.replace(Pt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function It(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ot(t)):e.value!==``+Ot(t)&&(e.value=``+Ot(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Rt(e,o,Ot(n)):Rt(e,o,Ot(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ot(s):e.removeAttribute(`name`)}function Lt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){jt(e);return}n=n==null?``:``+Ot(n),t=t==null?n:``+Ot(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),jt(e)}function Rt(e,t,n){t===`number`&&Nt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function zt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Ot(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Bt(e,t,n){if(t!=null&&(t=``+Ot(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ot(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(F(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ot(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),jt(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ut=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Wt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ut.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Gt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Wt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Wt(e,o,t[o])}function Kt(e){if(e.indexOf(`-`)===-1)return!1;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 qt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`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`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`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`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`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`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Jt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yt(e){return Jt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Xt(){}var H=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=pt(e);if(t&&(e=t.stateNode)){var n=e[it]||null;a:switch(e=t.stateNode,t.type){case`input`:if(It(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ft(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[it]||null;if(!a)throw Error(i(90));It(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Mt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&zt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(wu(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[it]||null;if(r===null)return null;n=r[t];a: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 a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return un=i.slice(e,1<r?1-r:void 0)}function fn(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 U(){return!0}function pn(){return!1}function mn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?U:pn,this.isPropagationStopped=pn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=U)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=U)},persist:function(){},isPersistent:U}),t}var hn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gn=mn(hn),_n=f({},hn,{view:0,detail:0}),vn=mn(_n),yn,bn,xn,Sn=f({},_n,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nn,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!==xn&&(xn&&e.type===`mousemove`?(yn=e.screenX-xn.screenX,bn=e.screenY-xn.screenY):bn=yn=0,xn=e),yn)},movementY:function(e){return`movementY`in e?e.movementY:bn}}),Cn=mn(Sn),wn=mn(f({},Sn,{dataTransfer:0})),Tn=mn(f({},_n,{relatedTarget:0})),En=mn(f({},hn,{animationName:0,elapsedTime:0,pseudoElement:0})),Dn=mn(f({},hn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),On=mn(f({},hn,{data:0})),kn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},An={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`},jn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Mn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=jn[e])?!!t[e]:!1}function Nn(){return Mn}var Pn=mn(f({},_n,{key:function(e){if(e.key){var t=kn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?An[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Fn=mn(f({},Sn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=mn(f({},_n,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nn})),Ln=mn(f({},hn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=mn(f({},Sn,{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})),zn=mn(f({},hn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=an&&`CompositionEvent`in window,Hn=null;an&&`documentMode`in document&&(Hn=document.documentMode);var Un=an&&`TextEvent`in window&&!Hn,Wn=an&&(!Vn||Hn&&8<Hn&&11>=Hn),Gn=` `,Kn=!1;function qn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Jn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Yn=!1;function Xn(e,t){switch(e){case`compositionend`:return Jn(t);case`keypress`:return t.which===32?(Kn=!0,Gn):null;case`textInput`:return e=t.data,e===Gn&&Kn?null:e;default:return null}}function Zn(e,t){if(Yn)return e===`compositionend`||!Vn&&qn(e,t)?(e=dn(),un=ln=cn=null,Yn=!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 Wn&&t.locale!==`ko`?null:t.data;default:return null}}var Qn={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 $n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Qn[e.type]:t===`textarea`}function er(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=jd(t,`onChange`),0<t.length&&(n=new gn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var tr=null,nr=null;function rr(e){Cd(e,0)}function ir(e){if(Mt(mt(e)))return e}function ar(e,t){if(e===`change`)return t}var or=!1;if(an){var sr;if(an){var cr=`oninput`in document;if(!cr){var lr=document.createElement(`div`);lr.setAttribute(`oninput`,`return;`),cr=typeof lr.oninput==`function`}sr=cr}else sr=!1;or=sr&&(!document.documentMode||9<document.documentMode)}function ur(){tr&&(tr.detachEvent(`onpropertychange`,dr),nr=tr=null)}function dr(e){if(e.propertyName===`value`&&ir(nr)){var t=[];er(t,nr,e,Zt(e)),nn(rr,t)}}function fr(e,t,n){e===`focusin`?(ur(),tr=t,nr=n,tr.attachEvent(`onpropertychange`,dr)):e===`focusout`&&ur()}function pr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ir(nr)}function mr(e,t){if(e===`click`)return ir(t)}function hr(e,t){if(e===`input`||e===`change`)return ir(t)}function gr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var _r=typeof Object.is==`function`?Object.is:gr;function vr(e,t){if(_r(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)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 i=n[r];if(!ve.call(t,i)||!_r(e[i],t[i]))return!1}return!0}function yr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function br(e,t){var n=yr(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}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=yr(n)}}function xr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Sr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function Cr(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`)}var wr=an&&`documentMode`in document&&11>=document.documentMode,Tr=null,Er=null,Dr=null,Or=!1;function kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Or||Tr==null||Tr!==Nt(r)||(r=Tr,`selectionStart`in r&&Cr(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}),Dr&&vr(Dr,r)||(Dr=r,r=jd(Er,`onSelect`),0<r.length&&(t=new gn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Tr)))}function Ar(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var jr={animationend:Ar(`Animation`,`AnimationEnd`),animationiteration:Ar(`Animation`,`AnimationIteration`),animationstart:Ar(`Animation`,`AnimationStart`),transitionrun:Ar(`Transition`,`TransitionRun`),transitionstart:Ar(`Transition`,`TransitionStart`),transitioncancel:Ar(`Transition`,`TransitionCancel`),transitionend:Ar(`Transition`,`TransitionEnd`)},Mr={},Nr={};an&&(Nr=document.createElement(`div`).style,`AnimationEvent`in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),`TransitionEvent`in window||delete jr.transitionend.transition);function Pr(e){if(Mr[e])return Mr[e];if(!jr[e])return e;var t=jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Nr)return Mr[e]=t[n];return e}var Fr=Pr(`animationend`),Ir=Pr(`animationiteration`),Lr=Pr(`animationstart`),Rr=Pr(`transitionrun`),zr=Pr(`transitionstart`),Br=Pr(`transitioncancel`),Vr=Pr(`transitionend`),Hr=new Map,Ur=`abort auxClick beforeToggle 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(` `);Ur.push(`scrollEnd`);function Wr(e,t){Hr.set(e,t),yt(t,[e])}var Gr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Kr=[],qr=0,Jr=0;function Yr(){for(var e=qr,t=Jr=qr=0;t<e;){var n=Kr[t];Kr[t++]=null;var r=Kr[t];Kr[t++]=null;var i=Kr[t];Kr[t++]=null;var a=Kr[t];if(Kr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&$r(n,i,a)}}function Xr(e,t,n,r){Kr[qr++]=e,Kr[qr++]=t,Kr[qr++]=n,Kr[qr++]=r,Jr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Zr(e,t,n,r){return Xr(e,t,n,r),ei(e)}function Qr(e,t){return Xr(e,null,null,t),ei(e)}function $r(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Pe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ei(e){if(50<hu)throw hu=0,gu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ti={};function ni(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.refCleanup=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 ri(e,t,n,r){return new ni(e,t,n,r)}function ii(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ai(e,t){var n=e.alternate;return n===null?(n=ri(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&65011712,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.refCleanup=e.refCleanup,n}function oi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function si(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ii(e)&&(s=1);else if(typeof e==`string`)s=Yf(e,n,re.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ri(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ci(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ri(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ri(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ri(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ri(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ci(e,t,n,r){return e=ri(7,e,r,t),e.lanes=n,e}function li(e,t,n){return e=ri(6,e,null,t),e.lanes=n,e}function ui(e){var t=ri(18,null,null,0);return t.stateNode=e,t}function di(e,t,n){return t=ri(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var fi=new WeakMap;function W(e,t){if(typeof e==`object`&&e){var n=fi.get(e);return n===void 0?(t={value:e,source:t,stack:_e(t)},fi.set(e,t),t):n}return{value:e,source:t,stack:_e(t)}}var pi=[],mi=0,hi=null,gi=0,_i=[],vi=0,yi=null,bi=1,xi=``;function Si(e,t){pi[mi++]=gi,pi[mi++]=hi,hi=e,gi=t}function Ci(e,t,n){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,yi=e;var r=bi;e=xi;var i=32-Pe(r)-1;r&=~(1<<i),n+=1;var a=32-Pe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,bi=1<<32-Pe(t)+i|n<<i|r,xi=a+e}else bi=1<<a|n<<i|r,xi=e}function wi(e){e.return!==null&&(Si(e,1),Ci(e,1,0))}function Ti(e){for(;e===hi;)hi=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null;for(;e===yi;)yi=_i[--vi],_i[vi]=null,xi=_i[--vi],_i[vi]=null,bi=_i[--vi],_i[vi]=null}function Ei(e,t){_i[vi++]=bi,_i[vi++]=xi,_i[vi++]=yi,bi=t.id,xi=t.overflow,yi=e}var Di=null,Oi=null,ki=!1,Ai=null,ji=!1,Mi=Error(i(519));function Ni(e){throw zi(W(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Mi}function Pi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[rt]=e,t[it]=r,n){case`dialog`:wd(`cancel`,t),wd(`close`,t);break;case`iframe`:case`object`:case`embed`:wd(`load`,t);break;case`video`:case`audio`:for(n=0;n<xd.length;n++)wd(xd[n],t);break;case`source`:wd(`error`,t);break;case`img`:case`image`:case`link`:wd(`error`,t),wd(`load`,t);break;case`details`:wd(`toggle`,t);break;case`input`:wd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:wd(`invalid`,t);break;case`textarea`:wd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Ld(t.textContent,n)?(r.popover!=null&&(wd(`beforetoggle`,t),wd(`toggle`,t)),r.onScroll!=null&&wd(`scroll`,t),r.onScrollEnd!=null&&wd(`scrollend`,t),r.onClick!=null&&(t.onclick=Xt),t=!0):t=!1,t||Ni(e,!0)}function Fi(e){for(Di=e.return;Di;)switch(Di.tag){case 5:case 31:case 13:ji=!1;return;case 27:case 3:ji=!0;return;default:Di=Di.return}}function Ii(e){if(e!==Di)return!1;if(!ki)return Fi(e),ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Yd(e.type,e.memoizedProps)),n=!n),n&&Oi&&Ni(e),Fi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=gf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Oi=gf(e)}else t===27?(t=Oi,rf(e.type)?(e=hf,hf=null,Oi=e):Oi=t):Oi=Di?mf(e.stateNode.nextSibling):null;return!0}function Li(){Oi=Di=null,ki=!1}function Ri(){var e=Ai;return e!==null&&(tu===null?tu=e:tu.push.apply(tu,e),Ai=null),e}function zi(e){Ai===null?Ai=[e]:Ai.push(e)}var Bi=R(null),Vi=null,Hi=null;function Ui(e,t,n){B(Bi,t._currentValue),t._currentValue=n}function Wi(e){e._currentValue=Bi.current,z(Bi)}function Gi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ki(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Gi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Gi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function qi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;_r(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===oe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[ip]:e.push(ip))}a=a.return}e!==null&&Ki(t,e,n,r),t.flags|=262144}function Ji(e){for(e=e.firstContext;e!==null;){if(!_r(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Vi=e,Hi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xi(e){return Qi(Vi,e)}function Zi(e,t){return Vi===null&&Yi(e),Qi(e,t)}function Qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Hi===null){if(e===null)throw Error(i(308));Hi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Hi=Hi.next=t;return n}var $i=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ea=t.unstable_scheduleCallback,ta=t.unstable_NormalPriority,na={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ra(){return{controller:new $i,data:new Map,refCount:0}}function ia(e){e.refCount--,e.refCount===0&&ea(ta,function(){e.controller.abort()})}var aa=null,oa=0,sa=0,ca=null;function la(e,t){if(aa===null){var n=aa=[];oa=0,sa=hd(),ca={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return oa++,t.then(ua,ua),t}function ua(){if(--oa===0&&aa!==null){ca!==null&&(ca.status=`fulfilled`);var e=aa;aa=null,sa=0,ca=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function da(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var fa=I.S;I.S=function(e,t){iu=V(),typeof t==`object`&&t&&typeof t.then==`function`&&la(e,t),fa!==null&&fa(e,t)};var pa=R(null);function ma(){var e=pa.current;return e===null?zl.pooledCache:e}function ha(e,t){t===null?B(pa,pa.current):B(pa,t.pool)}function ga(){var e=ma();return e===null?null:{parent:na._currentValue,pool:e}}var _a=Error(i(460)),va=Error(i(474)),ya=Error(i(542)),ba={then:function(){}};function xa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Sa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Xt,Xt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e;default:if(typeof t.status==`string`)t.then(Xt,Xt);else{if(e=zl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ea(e),e}throw wa=t,_a}}function Ca(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(wa=e,_a):e}}var wa=null;function Ta(){if(wa===null)throw Error(i(459));var e=wa;return wa=null,e}function Ea(e){if(e===_a||e===ya)throw Error(i(483))}var Da=null,Oa=0;function ka(e){var t=Oa;return Oa+=1,Da===null&&(Da=[]),Sa(Da,e,t)}function Aa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ja(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ma(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ai(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=li(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Ca(i)===t.type)?(t=a(t,n.props),Aa(t,n),t.return=e,t):(t=si(n.type,n.key,n.props,null,e.mode,r),Aa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=di(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ci(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=li(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=si(t.type,t.key,t.props,null,e.mode,n),Aa(n,t),n.return=e,n;case v:return t=di(t,e.mode,n),t.return=e,t;case O:return t=Ca(t),f(e,t,n)}if(F(t)||M(t))return t=ci(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ka(t),n);if(t.$$typeof===C)return f(e,Zi(e,t),n);ja(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ca(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ka(n),r);if(n.$$typeof===C)return p(e,t,Zi(e,n),r);ja(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ca(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ka(r),i);if(r.$$typeof===C)return m(e,t,n,Zi(t,r),i);ja(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ki&&Si(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ki&&Si(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ki&&Si(i,h),l}function _(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ki&&Si(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ki&&Si(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ki&&Si(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case g:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ca(l)===r.type){n(e,r.sibling),c=a(r,o.props),Aa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===y?(c=ci(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=si(o.type,o.key,o.props,null,e.mode,c),Aa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=di(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ca(o),b(e,r,o,c)}if(F(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),_(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ka(o),c);if(o.$$typeof===C)return b(e,r,Zi(e,o),c);ja(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===_a||t===ya)throw t;var a=ri(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ei(e),$r(e,null,n),t}return Xr(e,r,t,n),ei(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=ca;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Vl&p)===p:(r&p)===p){p!==0&&p===sa&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Fa=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Yl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ka(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ga(n[e],t)}var qa=R(null),Ja=R(0);function Ya(e,t){e=ql,B(Ja,e),B(qa,t),ql=e|t.baseLanes}function Xa(){B(Ja,ql),B(qa,qa.current)}function Za(){ql=Ja.current,z(qa),z(Ja)}var Qa=R(null),$a=null;function eo(e){var t=e.alternate;B(ao,ao.current&1),B(Qa,e),$a===null&&(t===null||qa.current!==null||t.memoizedState!==null)&&($a=e)}function to(e){B(ao,ao.current),B(Qa,e),$a===null&&($a=e)}function no(e){e.tag===22?(B(ao,ao.current),B(Qa,e),$a===null&&($a=e)):ro(e)}function ro(){B(ao,ao.current),B(Qa,Qa.current)}function io(e){z(Qa),$a===e&&($a=null),z(ao)}var ao=R(0);function oo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||df(n)||ff(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 so=0,co=null,G=null,lo=null,uo=!1,fo=!1,po=!1,mo=0,ho=0,go=null,_o=0;function K(){throw Error(i(321))}function vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_r(e[n],t[n]))return!1;return!0}function yo(e,t,n,r,i,a){return so=a,co=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?Is:Ls,po=!1,a=n(r,i),po=!1,fo&&(a=xo(t,n,r,i)),bo(e),a}function bo(e){I.H=Fs;var t=G!==null&&G.next!==null;if(so=0,lo=G=co=null,uo=!1,ho=0,go=null,t)throw Error(i(300));e===null||ec||(e=e.dependencies,e!==null&&Ji(e)&&(ec=!0))}function xo(e,t,n,r){co=e;var a=0;do{if(fo&&(go=null),ho=0,fo=!1,25<=a)throw Error(i(301));if(a+=1,lo=G=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}I.H=Rs,o=t(n,r)}while(fo);return o}function So(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?ko(t):t,e=e.useState()[0],(G===null?null:G.memoizedState)!==e&&(co.flags|=1024),t}function Co(){var e=mo!==0;return mo=0,e}function wo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function To(e){if(uo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}uo=!1}so=0,lo=G=co=null,fo=!1,ho=mo=0,go=null}function Eo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lo===null?co.memoizedState=lo=e:lo=lo.next=e,lo}function Do(){if(G===null){var e=co.alternate;e=e===null?null:e.memoizedState}else e=G.next;var t=lo===null?co.memoizedState:lo.next;if(t!==null)lo=t,G=e;else{if(e===null)throw co.alternate===null?Error(i(467)):Error(i(310));G=e,e={memoizedState:G.memoizedState,baseState:G.baseState,baseQueue:G.baseQueue,queue:G.queue,next:null},lo===null?co.memoizedState=lo=e:lo=lo.next=e}return lo}function Oo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ko(e){var t=ho;return ho+=1,go===null&&(go=[]),e=Sa(go,e,t),t=co,(lo===null?t.memoizedState:lo.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?Is:Ls),e}function Ao(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ko(e);if(e.$$typeof===C)return Xi(e)}throw Error(i(438,String(e)))}function jo(e){var t=null,n=co.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=co.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Oo(),co.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Mo(e,t){return typeof t==`function`?t(e):t}function No(e){return Po(Do(),G,e)}function Po(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(so&f)===f:(Vl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===sa&&(d=!0);else if((so&p)===p){u=u.next,p===sa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,co.lanes|=p,Yl|=p;f=u.action,po&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,co.lanes|=f,Yl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!_r(o,e.memoizedState)&&(ec=!0,d&&(n=ca,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Fo(e){var t=Do(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);_r(o,t.memoizedState)||(ec=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Io(e,t,n){var r=co,a=Do(),o=ki;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!_r((G||a).memoizedState,n);if(s&&(a.memoizedState=n,ec=!0),a=a.queue,ss(zo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||lo!==null&&lo.memoizedState.tag&1){if(r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,a,n,t),null),zl===null)throw Error(i(349));o||so&127||Lo(r,t,n)}return n}function Lo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=co.updateQueue,t===null?(t=Oo(),co.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ro(e,t,n,r){t.value=n,t.getSnapshot=r,Bo(t)&&Vo(e)}function zo(e,t,n){return n(function(){Bo(t)&&Vo(e)})}function Bo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_r(e,n)}catch{return!0}}function Vo(e){var t=Qr(e,2);t!==null&&yu(t,e,2)}function Ho(e){var t=Eo();if(typeof e==`function`){var n=e;if(e=n(),po){Ne(!0);try{n()}finally{Ne(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:e},t}function Uo(e,t,n,r){return e.baseState=n,Po(e,G,typeof r==`function`?r:Mo)}function Wo(e,t,n,r,a){if(Ms(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};I.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Go(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Go(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Ko(e,t,s)}catch(n){Jo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Ko(e,t,a)}catch(n){Jo(e,t,n)}}function Ko(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){qo(e,t,n)},function(n){return Jo(e,t,n)}):qo(e,t,n)}function qo(e,t,n){t.status=`fulfilled`,t.value=n,Yo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Go(e,n)))}function Jo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Yo(t),t=t.next;while(t!==r)}e.action=null}function Yo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xo(e,t){return t}function Zo(e,t){if(ki){var n=zl.formState;if(n!==null){a:{var r=co;if(ki){if(Oi){b:{for(var i=Oi,a=ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=mf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Oi=mf(i.nextSibling),r=i.data===`F!`;break a}}Ni(r)}r=!1}r&&(t=n[0])}}return n=Eo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:t},n.queue=r,n=ks.bind(null,co,r),r.dispatch=n,r=Ho(!1),a=js.bind(null,co,!1,r.queue),r=Eo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Wo.bind(null,co,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Qo(e){return $o(Do(),G,e)}function $o(e,t,n){if(t=Po(e,t,Xo)[0],e=No(Mo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ko(t)}catch(e){throw e===_a?ya:e}else r=t;t=Do();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(co.flags|=2048,ns(9,{destroy:void 0},es.bind(null,i,n),null)),[r,a,e]}function es(e,t){e.action=t}function ts(e){var t=Do(),n=G;if(n!==null)return $o(t,n,e);Do(),t=t.memoizedState,n=Do();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ns(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=co.updateQueue,t===null&&(t=Oo(),co.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function rs(){return Do().memoizedState}function is(e,t,n,r){var i=Eo();co.flags|=e,i.memoizedState=ns(1|t,{destroy:void 0},n,r===void 0?null:r)}function as(e,t,n,r){var i=Do();r=r===void 0?null:r;var a=i.memoizedState.inst;G!==null&&r!==null&&vo(r,G.memoizedState.deps)?i.memoizedState=ns(t,a,n,r):(co.flags|=e,i.memoizedState=ns(1|t,a,n,r))}function os(e,t){is(8390656,8,e,t)}function ss(e,t){as(2048,8,e,t)}function cs(e){co.flags|=4;var t=co.updateQueue;if(t===null)t=Oo(),co.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ls(e){var t=Do().memoizedState;return cs({ref:t,nextImpl:e}),function(){if(Rl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function us(e,t){return as(4,2,e,t)}function ds(e,t){return as(4,4,e,t)}function fs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ps(e,t,n){n=n==null?null:n.concat([e]),as(4,4,fs.bind(null,t,e),n)}function ms(){}function hs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function gs(e,t){var n=Do();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&vo(t,r[1]))return r[0];if(r=e(),po){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r}function _s(e,t,n){return n===void 0||so&1073741824&&!(Vl&261930)?e.memoizedState=t:(e.memoizedState=n,e=vu(),co.lanes|=e,Yl|=e,n)}function vs(e,t,n,r){return _r(n,t)?n:qa.current===null?!(so&42)||so&1073741824&&!(Vl&261930)?(ec=!0,e.memoizedState=n):(e=vu(),co.lanes|=e,Yl|=e,t):(e=_s(e,n,r),_r(e,t)||(ec=!0),e)}function ys(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,js(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?As(e,t,da(c,r),_u(e)):As(e,t,r,_u(e))}catch(n){As(e,t,{then:function(){},status:`rejected`,reason:n},_u())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function bs(){}function xs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ss(e).queue;ys(e,a,t,ee,n===null?bs:function(){return Cs(e),n(r)})}function Ss(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:ee},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Cs(e){var t=Ss(e);t.next===null&&(t=e.alternate.memoizedState),As(e,t.next.queue,{},_u())}function ws(){return Xi(ip)}function Ts(){return Do().memoizedState}function Es(){return Do().memoizedState}function Ds(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=_u();e=Ra(n);var r=za(t,e,n);r!==null&&(yu(r,t,n),Ba(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function Os(e,t,n){var r=_u();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ms(e)?Ns(t,n):(n=Zr(e,t,n,r),n!==null&&(yu(n,e,r),Ps(n,t,r)))}function ks(e,t,n){As(e,t,n,_u())}function As(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ms(e))Ns(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,_r(s,o))return Xr(e,t,i,0),zl===null&&Yr(),!1}catch{}if(n=Zr(e,t,i,r),n!==null)return yu(n,e,r),Ps(n,t,r),!0}return!1}function js(e,t,n,r){if(r={lane:2,revertLane:hd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ms(e)){if(t)throw Error(i(479))}else t=Zr(e,n,r,2),t!==null&&yu(t,e,2)}function Ms(e){var t=e.alternate;return e===co||t!==null&&t===co}function Ns(e,t){fo=uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ps(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Fs={readContext:Xi,use:Ao,useCallback:K,useContext:K,useEffect:K,useImperativeHandle:K,useLayoutEffect:K,useInsertionEffect:K,useMemo:K,useReducer:K,useRef:K,useState:K,useDebugValue:K,useDeferredValue:K,useTransition:K,useSyncExternalStore:K,useId:K,useHostTransitionStatus:K,useFormState:K,useActionState:K,useOptimistic:K,useMemoCache:K,useCacheRefresh:K};Fs.useEffectEvent=K;var Is={readContext:Xi,use:Ao,useCallback:function(e,t){return Eo().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:os,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),is(4194308,4,fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){is(4,2,e,t)},useMemo:function(e,t){var n=Eo();t=t===void 0?null:t;var r=e();if(po){Ne(!0);try{e()}finally{Ne(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Eo();if(n!==void 0){var i=n(t);if(po){Ne(!0);try{n(t)}finally{Ne(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Os.bind(null,co,e),[r.memoizedState,e]},useRef:function(e){var t=Eo();return e={current:e},t.memoizedState=e},useState:function(e){e=Ho(e);var t=e.queue,n=ks.bind(null,co,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ms,useDeferredValue:function(e,t){return _s(Eo(),e,t)},useTransition:function(){var e=Ho(!1);return e=ys.bind(null,co,e.queue,!0,!1),Eo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=co,a=Eo();if(ki){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),zl===null)throw Error(i(349));Vl&127||Lo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,os(zo.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,{destroy:void 0},Ro.bind(null,r,o,n,t),null),n},useId:function(){var e=Eo(),t=zl.identifierPrefix;if(ki){var n=xi,r=bi;n=(r&~(1<<32-Pe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=mo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=_o++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ws,useFormState:Zo,useActionState:Zo,useOptimistic:function(e){var t=Eo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=js.bind(null,co,!0,n),n.dispatch=t,[e,t]},useMemoCache:jo,useCacheRefresh:function(){return Eo().memoizedState=Ds.bind(null,co)},useEffectEvent:function(e){var t=Eo(),n={impl:e};return t.memoizedState=n,function(){if(Rl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ls={readContext:Xi,use:Ao,useCallback:hs,useContext:Xi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:No,useRef:rs,useState:function(){return No(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){return vs(Do(),G.memoizedState,e,t)},useTransition:function(){var e=No(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:Qo,useActionState:Qo,useOptimistic:function(e,t){return Uo(Do(),G,e,t)},useMemoCache:jo,useCacheRefresh:Es};Ls.useEffectEvent=ls;var Rs={readContext:Xi,use:Ao,useCallback:hs,useContext:Xi,useEffect:ss,useImperativeHandle:ps,useInsertionEffect:us,useLayoutEffect:ds,useMemo:gs,useReducer:Fo,useRef:rs,useState:function(){return Fo(Mo)},useDebugValue:ms,useDeferredValue:function(e,t){var n=Do();return G===null?_s(n,e,t):vs(n,G.memoizedState,e,t)},useTransition:function(){var e=Fo(Mo)[0],t=Do().memoizedState;return[typeof e==`boolean`?e:ko(e),t]},useSyncExternalStore:Io,useId:Ts,useHostTransitionStatus:ws,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){var n=Do();return G===null?(n.baseState=e,[e,n.queue.dispatch]):Uo(n,G,e,t)},useMemoCache:jo,useCacheRefresh:Es};Rs.useEffectEvent=ls;function zs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=_u(),i=Ra(r);i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(yu(t,e,r),Ba(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=_u(),i=Ra(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=za(e,i,r),t!==null&&(yu(t,e,r),Ba(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=_u(),r=Ra(n);r.tag=2,t!=null&&(r.callback=t),t=za(e,r,n),t!==null&&(yu(t,e,n),Ba(t,e,n))}};function Vs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!vr(n,r)||!vr(i,a):!0}function Hs(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&&Bs.enqueueReplaceState(t,t.state,null)}function Us(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ws(e){Gr(e)}function Gs(e){console.error(e)}function Ks(e){Gr(e)}function qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Js(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ys(e,t,n){return n=Ra(n),n.tag=3,n.payload={element:null},n.callback=function(){qs(e,t)},n}function Xs(e){return e=Ra(e),e.tag=3,e}function Zs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Js(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Js(t,n,r),typeof i!=`function`&&(su===null?su=new Set([this]):su.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Qs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&qi(t,n,a,!0),n=Qa.current,n!==null){switch(n.tag){case 31:case 13:return $a===null?ju():n.alternate===null&&Jl===0&&(Jl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Yu(e,r,a)),!1;case 22:return n.flags|=65536,r===ba?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Yu(e,r,a)),!1}throw Error(i(435,n.tag))}return Yu(e,r,a),ju(),!1}if(ki)return t=Qa.current,t===null?(r!==Mi&&(t=Error(i(423),{cause:r}),zi(W(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=W(r,n),a=Ys(e.stateNode,r,a),Va(e,a),Jl!==4&&(Jl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Mi&&(e=Error(i(422),{cause:r}),zi(W(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=W(o,n),eu===null?eu=[o]:eu.push(o),Jl!==4&&(Jl=2),t===null)return!0;r=W(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ys(n.stateNode,r,e),Va(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(su===null||!su.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Xs(a),Zs(a,e,n,r),Va(n,a),!1}n=n.return}while(n!==null);return!1}var $s=Error(i(461)),ec=!1;function tc(e,t,n,r){t.child=e===null?Pa(t,null,n,r):Na(t,e.child,n,r)}function nc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Yi(t),r=yo(e,t,n,o,a,i),s=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(ki&&s&&wi(t),t.flags|=1,tc(e,t,r,i),t.child)}function rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ii(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ic(e,t,a,r,i)):(e=si(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Dc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?vr:n,n(o,r)&&e.ref===t.ref)return Ec(e,t,i)}return t.flags|=1,e=ai(a,r),e.ref=t.ref,e.return=t,t.child=e}function ic(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(vr(a,r)&&e.ref===t.ref){if(ec=!1,t.pendingProps=r=a,Dc(e,i))e.flags&131072&&(ec=!0);else return t.lanes=e.lanes,Ec(e,t,i)}}return fc(e,t,n,r,i)}function ac(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return sc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ha(t,a===null?null:a.cachePool),a===null?Xa():Ya(t,a),no(t);else return r=t.lanes=536870912,sc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ha(t,null),Xa(),ro(t)):(ha(t,a.cachePool),Ya(t,a),ro(t),t.memoizedState=null);return tc(e,t,i,n),t.child}function oc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sc(e,t,n,r,i){var a=ma();return a=a===null?null:{parent:na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ha(t,null),Xa(),no(t),e!==null&&qi(e,t,r,!0),t.childLanes=i,null}function cc(e,t){return t=xc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function lc(e,t,n){return Na(t,e.child,null,n),e=cc(t,t.pendingProps),e.flags|=2,io(t),t.memoizedState=null,e}function uc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(ki){if(r.mode===`hidden`)return e=cc(t,r),t.lanes=536870912,oc(null,e);if(to(t),(e=Oi)?(e=uf(e,ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return t.lanes=536870912,null}return cc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(to(t),a){if(t.flags&256)t.flags&=-257,t=lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(ec||qi(e,t,n,!1),a=(n&e.childLanes)!==0,ec||a){if(r=zl,r!==null&&(s=Ze(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Qr(e,s),yu(r,e,s),$s;ju(),t=lc(e,t,n)}else e=o.treeContext,Oi=mf(s.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=cc(t,r),t.flags|=4096;return t}return e=ai(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function dc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function fc(e,t,n,r,i){return Yi(t),n=yo(e,t,n,r,void 0,i),r=Co(),e!==null&&!ec?(wo(e,t,i),Ec(e,t,i)):(ki&&r&&wi(t),t.flags|=1,tc(e,t,n,i),t.child)}function pc(e,t,n,r,i,a){return Yi(t),t.updateQueue=null,n=xo(t,r,n,i),bo(e),r=Co(),e!==null&&!ec?(wo(e,t,a),Ec(e,t,a)):(ki&&r&&wi(t),t.flags|=1,tc(e,t,n,a),t.child)}function mc(e,t,n,r,i){if(Yi(t),t.stateNode===null){var a=ti,o=n.contextType;typeof o==`object`&&o&&(a=Xi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Bs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ia(t),o=n.contextType,a.context=typeof o==`object`&&o?Xi(o):ti,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(zs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Bs.enqueueReplaceState(a,a.state,null),Wa(t,r,a,i),Ua(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Us(n,s);a.props=c;var l=a.context,u=n.contextType;o=ti,typeof u==`object`&&u&&(o=Xi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Hs(t,a,r,o),Fa=!1;var f=t.memoizedState;a.state=f,Wa(t,r,a,i),Ua(),l=t.memoizedState,s||f!==l||Fa?(typeof d==`function`&&(zs(t,n,d,r),l=t.memoizedState),(c=Fa||Vs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,La(e,t),o=t.memoizedProps,u=Us(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ti,typeof l==`object`&&l&&(c=Xi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Hs(t,a,r,c),Fa=!1,f=t.memoizedState,a.state=f,Wa(t,r,a,i),Ua();var p=t.memoizedState;o!==d||f!==p||Fa||e!==null&&e.dependencies!==null&&Ji(e.dependencies)?(typeof s==`function`&&(zs(t,n,s,r),p=t.memoizedState),(u=Fa||Vs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ji(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,dc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Na(t,e.child,null,i),t.child=Na(t,null,n,i)):tc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ec(e,t,i),e}function hc(e,t,n,r){return Li(),t.flags|=256,tc(e,t,n,r),t.child}var gc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _c(e){return{baseLanes:e,cachePool:ga()}}function vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Ql),e}function yc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(ao.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(ki){if(a?eo(t):ro(t),(e=Oi)?(e=uf(e,ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:yi===null?null:{id:bi,overflow:xi},retryLane:536870912,hydrationErrors:null},n=ui(e),n.return=t,t.child=n,Di=t,Oi=null)):e=null,e===null)throw Ni(t);return ff(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(ro(t),a=t.mode,c=xc({mode:`hidden`,children:c},a),r=ci(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(null,r)):(eo(t),bc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(eo(t),t.flags&=-257,t=Sc(e,t,n)):t.memoizedState===null?(ro(t),c=r.fallback,a=t.mode,r=xc({mode:`visible`,children:r.children},a),c=ci(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Na(t,e.child,null,n),r=t.child,r.memoizedState=_c(n),r.childLanes=vc(e,s,n),t.memoizedState=gc,t=oc(null,r)):(ro(t),t.child=e.child,t.flags|=128,t=null);else if(eo(t),ff(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,zi({value:r,source:null,stack:null}),t=Sc(e,t,n)}else if(ec||qi(e,t,n,!1),s=(n&e.childLanes)!==0,ec||s){if(s=zl,s!==null&&(r=Ze(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Qr(e,r),yu(s,e,r),$s;df(c)||ju(),t=Sc(e,t,n)}else df(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Oi=mf(c.nextSibling),Di=t,ki=!0,Ai=null,ji=!1,e!==null&&Ei(t,e),t=bc(t,r.children),t.flags|=4096);return t}return a?(ro(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ai(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ci(c,a,n,null),c.flags|=2):c=ai(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,oc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=_c(n):(a=c.cachePool,a===null?a=ga():(l=na._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=vc(e,s,n),t.memoizedState=gc,oc(e.child,r)):(eo(t),n=e.child,e=n.sibling,n=ai(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function bc(e,t){return t=xc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function xc(e,t){return e=ri(22,e,null,t),e.lanes=0,e}function Sc(e,t,n){return Na(t,e.child,null,n),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gi(e.return,t,n)}function wc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Tc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ao.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,B(ao,o),tc(e,t,r,n),r=ki?gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Cc(e,n,t);else if(e.tag===19)Cc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&oo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),wc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&oo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}wc(t,!0,n,null,a,r);break;case`together`:wc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ec(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yl|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(qi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ai(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ai(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Dc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ji(e)))}function Oc(e,t,n){switch(t.tag){case 3:se(t,t.stateNode.containerInfo),Ui(t,na,e.memoizedState.cache),Li();break;case 27:case 5:le(t);break;case 4:se(t,t.stateNode.containerInfo);break;case 10:Ui(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,to(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(eo(t),e=Ec(e,t,n),e===null?null:e.sibling):yc(e,t,n):(eo(t),t.flags|=128,null);eo(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(qi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(ao,ao.current),r)break;return null;case 22:return t.lanes=0,ac(e,t,n,t.pendingProps);case 24:Ui(t,na,e.memoizedState.cache)}return Ec(e,t,n)}function kc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)ec=!0;else{if(!Dc(e,n)&&!(t.flags&128))return ec=!1,Oc(e,t,n);ec=!!(e.flags&131072)}}else ec=!1,ki&&t.flags&1048576&&Ci(t,gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ca(t.elementType),t.type=e,typeof e==`function`)ii(e)?(r=Us(e,r),t.tag=1,t=mc(null,t,e,r,n)):(t.tag=0,t=fc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=nc(null,t,e,r,n);break a}if(a===D){t.tag=14,t=rc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Us(r,t.pendingProps),mc(e,t,r,a,n);case 3:a:{if(se(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,La(e,t),Wa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ui(t,na,r),r!==o.cache&&Ki(t,[na],n,!0),Ua(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=hc(e,t,r,n);break a}if(r!==a){a=W(Error(i(424)),t),zi(a),t=hc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Oi=mf(e.firstChild),Di=t,ki=!0,Ai=null,ji=!0,n=Pa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Li(),r===a){t=Ec(e,t,n);break a}tc(e,t,r,n)}t=t.child}return t;case 26:return dc(e,t),e===null?(n=Ff(t.type,null,t.pendingProps,null))?t.memoizedState=n:ki||(n=t.type,e=t.pendingProps,r=Kd(ae.current).createElement(n),r[rt]=t,r[it]=e,Bd(r,n,e),gt(r),t.stateNode=r):t.memoizedState=Ff(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return le(t),e===null&&ki&&(r=t.stateNode=vf(t.type,t.pendingProps,ae.current),Di=t,ji=!0,a=Oi,rf(t.type)?(hf=a,Oi=mf(r.firstChild)):Oi=a),tc(e,t,t.pendingProps.children,n),dc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ki&&((a=r=Oi)&&(r=cf(r,t.type,t.pendingProps,ji),r===null?a=!1:(t.stateNode=r,Di=t,Oi=mf(r.firstChild),ji=!1,a=!0)),a||Ni(t)),le(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Yd(a,o)?r=null:s!==null&&Yd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=yo(e,t,So,null,null,n),ip._currentValue=a),dc(e,t),tc(e,t,r,n),t.child;case 6:return e===null&&ki&&((e=n=Oi)&&(n=lf(n,t.pendingProps,ji),n===null?e=!1:(t.stateNode=n,Di=t,Oi=null,e=!0)),e||Ni(t)),null;case 13:return yc(e,t,n);case 4:return se(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Na(t,null,r,n):tc(e,t,r,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return tc(e,t,t.pendingProps,n),t.child;case 8:return tc(e,t,t.pendingProps.children,n),t.child;case 12:return tc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ui(t,t.type,r.value),tc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Yi(t),a=Xi(a),r=r(a),t.flags|=1,tc(e,t,r,n),t.child;case 14:return rc(e,t,t.type,t.pendingProps,n);case 15:return ic(e,t,t.type,t.pendingProps,n);case 19:return Tc(e,t,n);case 31:return uc(e,t,n);case 22:return ac(e,t,n,t.pendingProps);case 24:return Yi(t),r=Xi(na),e===null?(a=ma(),a===null&&(a=zl,o=ra(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ia(t),Ui(t,na,a)):((e.lanes&n)!==0&&(La(e,t),Wa(t,null,null,n),Ua()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ui(t,na,r),r!==a.cache&&Ki(t,[na],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ui(t,na,r))),tc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ac(e){e.flags|=4}function jc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Ou())e.flags|=8192;else throw wa=ba,va}}else e.flags&=-16777217}function Mc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Xf(t)){if(Ou())e.flags|=8192;else throw wa=ba,va}}function Nc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ge(),e.lanes|=t,$l|=t)}function Pc(e,t){if(!ki)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 Fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ic(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fc(t),null;case 1:return Fc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Wi(na),ce(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ii(t)?Ac(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ri())),Fc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ac(t),o===null?(Fc(t),jc(t,a,null,r,n)):(Fc(t),Mc(t,o))):o?o===e.memoizedState?(Fc(t),t.flags&=-16777217):(Ac(t),Fc(t),Mc(t,o)):(e=e.memoizedProps,e!==r&&Ac(t),Fc(t),jc(t,a,e,r,n)),null;case 27:if(ue(t),n=ae.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}e=re.current,Ii(t)?Pi(t,e):(e=vf(a,r,n),t.stateNode=e,Ac(t))}return Fc(t),null;case 5:if(ue(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Fc(t),null}if(o=re.current,Ii(t))Pi(t,o);else{var s=Kd(ae.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[rt]=t,o[it]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Bd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ac(t)}}return Fc(t),jc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ac(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ae.current,Ii(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Di,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ld(e.nodeValue,n)),e||Ni(t,!0)}else e=Kd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Fc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ii(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),e=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(io(t),t):(io(t),null);if(t.flags&128)throw Error(i(558))}return Fc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Ii(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[rt]=t}else Li(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Fc(t),a=!1}else a=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(io(t),t):(io(t),null)}return io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nc(t,t.updateQueue),Fc(t),null);case 4:return ce(),e===null&&Dd(t.stateNode.containerInfo),Fc(t),null;case 10:return Wi(t.type),Fc(t),null;case 19:if(z(ao),r=t.memoizedState,r===null)return Fc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Pc(r,!1);else{if(Jl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=oo(e),o!==null){for(t.flags|=128,Pc(r,!1),e=o.updateQueue,t.updateQueue=e,Nc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oi(n,e),n=n.sibling;return B(ao,ao.current&1|2),ki&&Si(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&V()>au&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=oo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Nc(t,e),Pc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!ki)return Fc(t),null}else 2*V()-r.renderingStartTime>au&&n!==536870912&&(t.flags|=128,a=!0,Pc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Fc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=V(),e.sibling=null,n=ao.current,B(ao,a?n&1|2:n&1),ki&&Si(t,r.treeForkCount),e);case 22:case 23:return io(t),Za(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Fc(t),t.subtreeFlags&6&&(t.flags|=8192)):Fc(t),n=t.updateQueue,n!==null&&Nc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&z(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Wi(na),Fc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Lc(e,t){switch(Ti(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wi(na),ce(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ue(t),null;case 31:if(t.memoizedState!==null){if(io(t),t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Li()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(ao),null;case 4:return ce(),null;case 10:return Wi(t.type),null;case 22:case 23:return io(t),Za(),e!==null&&z(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Wi(na),null;case 25:return null;default:return null}}function Rc(e,t){switch(Ti(t),t.tag){case 3:Wi(na),ce();break;case 26:case 27:case 5:ue(t);break;case 4:ce();break;case 31:t.memoizedState!==null&&io(t);break;case 13:io(t);break;case 19:z(ao);break;case 10:Wi(t.type);break;case 22:case 23:io(t),Za(),e!==null&&z(pa);break;case 24:Wi(na)}}function zc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ju(t,t.return,e)}}function Bc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ju(t,t.return,e)}}function Vc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ka(t,n)}catch(t){Ju(e,e.return,t)}}}function Hc(e,t,n){n.props=Us(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ju(e,t,n)}}function Uc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ju(e,t,n)}}function Wc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Ju(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ju(e,t,n)}else n.current=null}}function Gc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ju(e,e.return,t)}}function Kc(e,t,n){try{var r=e.stateNode;Vd(r,e.type,n,t),r[it]=t}catch(t){Ju(e,e.return,t)}}function qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rf(e.type)||e.tag===4}function Jc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||qc(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.tag===27&&rf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xt));else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(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&&(r===27&&rf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Xc(e,t,n),e=e.sibling;e!==null;)Xc(e,t,n),e=e.sibling}function Zc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Bd(t,r,n),t[rt]=e,t[it]=n}catch(t){Ju(e,e.return,t)}}var Qc=!1,$c=!1,el=!1,tl=typeof WeakSet==`function`?WeakSet:Set,nl=null;function rl(e,t){if(e=e.containerInfo,Wd=pp,e=Sr(e),Cr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Gd={focusedElem:e,selectionRange:n},pp=!1,nl=t;nl!==null;)if(t=nl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,nl=e;else for(;nl!==null;){switch(t=nl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Us(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ju(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)sf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:sf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,nl=e;break}nl=t.return}}function il(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:yl(e,n),r&4&&zc(5,n);break;case 1:if(yl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ju(n,n.return,e)}else{var i=Us(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ju(n,n.return,e)}}}r&64&&Vc(n),r&512&&Uc(n,n.return);break;case 3:if(yl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ka(e,t)}catch(e){Ju(n,n.return,e)}}break;case 27:t===null&&r&4&&Zc(n);case 26:case 5:yl(e,n),t===null&&r&4&&Gc(n),r&512&&Uc(n,n.return);break;case 12:yl(e,n);break;case 31:yl(e,n),r&4&&ul(e,n);break;case 13:yl(e,n),r&4&&dl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Qu.bind(null,n),pf(e,n))));break;case 22:if(r=n.memoizedState!==null||Qc,!r){t=t!==null&&t.memoizedState!==null||$c,i=Qc;var a=$c;Qc=r,($c=t)&&!a?xl(e,n,!!(n.subtreeFlags&8772)):yl(e,n),Qc=i,$c=a}break;case 30:break;default:yl(e,n)}}function al(e){var t=e.alternate;t!==null&&(e.alternate=null,al(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ol=null,sl=!1;function cl(e,t,n){for(n=n.child;n!==null;)ll(e,t,n),n=n.sibling}function ll(e,t,n){if(Me&&typeof Me.onCommitFiberUnmount==`function`)try{Me.onCommitFiberUnmount(je,n)}catch{}switch(n.tag){case 26:$c||Wc(n,t),cl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:$c||Wc(n,t);var r=ol,i=sl;rf(n.type)&&(ol=n.stateNode,sl=!1),cl(e,t,n),yf(n.stateNode),ol=r,sl=i;break;case 5:$c||Wc(n,t);case 6:if(r=ol,i=sl,ol=null,cl(e,t,n),ol=r,sl=i,ol!==null){if(sl)try{(ol.nodeType===9?ol.body:ol.nodeName===`HTML`?ol.ownerDocument.body:ol).removeChild(n.stateNode)}catch(e){Ju(n,t,e)}else try{ol.removeChild(n.stateNode)}catch(e){Ju(n,t,e)}}break;case 18:ol!==null&&(sl?(e=ol,af(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),zp(e)):af(ol,n.stateNode));break;case 4:r=ol,i=sl,ol=n.stateNode.containerInfo,sl=!0,cl(e,t,n),ol=r,sl=i;break;case 0:case 11:case 14:case 15:Bc(2,n,t),$c||Bc(4,n,t),cl(e,t,n);break;case 1:$c||(Wc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Hc(n,t,r)),cl(e,t,n);break;case 21:cl(e,t,n);break;case 22:$c=(r=$c)||n.memoizedState!==null,cl(e,t,n),$c=r;break;default:cl(e,t,n)}}function ul(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{zp(e)}catch(e){Ju(t,t.return,e)}}}function dl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{zp(e)}catch(e){Ju(t,t.return,e)}}function fl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tl),t;default:throw Error(i(435,e.tag))}}function pl(e,t){var n=fl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=$u.bind(null,e,t);t.then(r,r)}})}function ml(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(rf(c.type)){ol=c.stateNode,sl=!1;break a}break;case 5:ol=c.stateNode,sl=!1;break a;case 3:case 4:ol=c.stateNode.containerInfo,sl=!0;break a}c=c.return}if(ol===null)throw Error(i(160));ll(o,s,a),ol=null,sl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gl(t,e),t=t.sibling}var hl=null;function gl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ml(t,e),_l(e),r&4&&(Bc(3,e,e.return),zc(3,e),Bc(5,e,e.return));break;case 1:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&64&&Qc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=hl;if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ut]||o[rt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Bd(o,r,n),o[rt]=e,gt(o),r=o;break a;case`link`:var s=qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=qf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Bd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[rt]=e,gt(o),r=o}e.stateNode=r}else Jf(a,e.type,e.stateNode)}else e.stateNode=Hf(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Kc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Jf(a,e.type,e.stateNode):Hf(a,r,e.memoizedProps))}break;case 27:ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),n!==null&&r&4&&Kc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ml(t,e),_l(e),r&512&&($c||n===null||Wc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){Ju(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Kc(e,a,n===null?a:n.memoizedProps)),r&1024&&(el=!0);break;case 6:if(ml(t,e),_l(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ju(e,e.return,t)}}break;case 3:if(Kf=null,a=hl,hl=Sf(t.containerInfo),ml(t,e),hl=a,_l(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zp(t.containerInfo)}catch(t){Ju(e,e.return,t)}el&&(el=!1,vl(e));break;case 4:r=hl,hl=Sf(e.stateNode.containerInfo),ml(t,e),_l(e),hl=r;break;case 12:ml(t,e),_l(e);break;case 31:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 13:ml(t,e),_l(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(ru=V()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Qc,d=$c;if(Qc=u||a,$c=d||l,ml(t,e),$c=d,Qc=u,_l(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Qc||$c||bl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ju(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ju(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?of(m,!0):of(l.stateNode,!1)}catch(e){Ju(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,pl(e,n))));break;case 19:ml(t,e),_l(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,pl(e,r)));break;case 30:break;case 21:break;default:ml(t,e),_l(e)}}function _l(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Xc(e,Jc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),Xc(e,Jc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Yc(e,Jc(e),s);break;default:throw Error(i(161))}}catch(t){Ju(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function vl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;vl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function yl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)il(e,t.alternate,t),t=t.sibling}function bl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Bc(4,t,t.return),bl(t);break;case 1:Wc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Hc(t,t.return,n),bl(t);break;case 27:yf(t.stateNode);case 26:case 5:Wc(t,t.return),bl(t);break;case 22:t.memoizedState===null&&bl(t);break;case 30:bl(t);break;default:bl(t)}e=e.sibling}}function xl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:xl(i,a,n),zc(4,a);break;case 1:if(xl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ju(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ga(c[i],s)}catch(e){Ju(r,r.return,e)}}n&&o&64&&Vc(a),Uc(a,a.return);break;case 27:Zc(a);case 26:case 5:xl(i,a,n),n&&r===null&&o&4&&Gc(a),Uc(a,a.return);break;case 12:xl(i,a,n);break;case 31:xl(i,a,n),n&&o&4&&ul(i,a);break;case 13:xl(i,a,n),n&&o&4&&dl(i,a);break;case 22:a.memoizedState===null&&xl(i,a,n),Uc(a,a.return);break;case 30:break;default:xl(i,a,n)}t=t.sibling}}function Sl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ia(n))}function Cl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e))}function wl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Tl(e,t,n,r),t=t.sibling}function Tl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:wl(e,t,n,r),i&2048&&zc(9,t);break;case 1:wl(e,t,n,r);break;case 3:wl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e)));break;case 12:if(i&2048){wl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ju(t,t.return,e)}}else wl(e,t,n,r);break;case 31:wl(e,t,n,r);break;case 13:wl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?wl(e,t,n,r):(a._visibility|=2,El(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?wl(e,t,n,r):Dl(e,t),i&2048&&Sl(o,t);break;case 24:wl(e,t,n,r),i&2048&&Cl(t.alternate,t);break;default:wl(e,t,n,r)}}function El(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:El(a,o,s,c,i),zc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,El(a,o,s,c,i)):u._visibility&2?El(a,o,s,c,i):Dl(a,o),i&&l&2048&&Sl(o.alternate,o);break;case 24:El(a,o,s,c,i),i&&l&2048&&Cl(o.alternate,o);break;default:El(a,o,s,c,i)}t=t.sibling}}function Dl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Dl(n,r),i&2048&&Sl(r.alternate,r);break;case 24:Dl(n,r),i&2048&&Cl(r.alternate,r);break;default:Dl(n,r)}t=t.sibling}}var Ol=8192;function kl(e,t,n){if(e.subtreeFlags&Ol)for(e=e.child;e!==null;)Al(e,t,n),e=e.sibling}function Al(e,t,n){switch(e.tag){case 26:kl(e,t,n),e.flags&Ol&&e.memoizedState!==null&&Zf(n,hl,e.memoizedState,e.memoizedProps);break;case 5:kl(e,t,n);break;case 3:case 4:var r=hl;hl=Sf(e.stateNode.containerInfo),kl(e,t,n),hl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ol,Ol=16777216,kl(e,t,n),Ol=r):kl(e,t,n));break;default:kl(e,t,n)}}function jl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Fl(r,e)}jl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Nl(e),e=e.sibling}function Nl(e){switch(e.tag){case 0:case 11:case 15:Ml(e),e.flags&2048&&Bc(9,e,e.return);break;case 3:Ml(e);break;case 12:Ml(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pl(e)):Ml(e);break;default:Ml(e)}}function Pl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];nl=r,Fl(r,e)}jl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Bc(8,t,t.return),Pl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Pl(t));break;default:Pl(t)}e=e.sibling}}function Fl(e,t){for(;nl!==null;){var n=nl;switch(n.tag){case 0:case 11:case 15:Bc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,nl=r;else a:for(n=e;nl!==null;){r=nl;var i=r.sibling,a=r.return;if(al(r),r===n){nl=null;break a}if(i!==null){i.return=a,nl=i;break a}nl=a}}}var Il={getCacheForType:function(e){var t=Xi(na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Xi(na).controller.signal}},Ll=typeof WeakMap==`function`?WeakMap:Map,Rl=0,zl=null,Bl=null,Vl=0,Hl=0,Ul=null,Wl=!1,Gl=!1,Kl=!1,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=null,tu=null,nu=!1,ru=0,iu=0,au=1/0,ou=null,su=null,cu=0,lu=null,uu=null,du=0,fu=0,pu=null,mu=null,hu=0,gu=null;function _u(){return Rl&2&&Vl!==0?Vl&-Vl:I.T===null?et():hd()}function vu(){if(Ql===0){if(!(Vl&536870912)||ki){var e=ze;ze<<=1,!(ze&3932160)&&(ze=262144),Ql=e}else Ql=536870912}return e=Qa.current,e!==null&&(e.flags|=32),Ql}function yu(e,t,n){(e===zl&&(Hl===2||Hl===9)||e.cancelPendingCommit!==null)&&(Eu(e,0),Cu(e,Vl,Ql,!1)),qe(e,n),(!(Rl&2)||e!==zl)&&(e===zl&&(!(Rl&2)&&(Xl|=n),Jl===4&&Cu(e,Vl,Ql,!1)),sd(e))}function bu(e,t,n){if(Rl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ue(e,t),a=r?Pu(e,t):Mu(e,t,!0),o=r;do{if(a===0){Gl&&!r&&Cu(e,t,0,!1);break}if(n=e.current.alternate,o&&!Su(n)){a=Mu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=eu;var l=c.current.memoizedState.isDehydrated;if(l&&(Eu(c,s).flags|=256),s=Mu(c,s,!1),s!==2){if(Kl&&!l){c.errorRecoveryDisabledLanes|=o,Xl|=o,a=4;break a}o=tu,tu=a,o!==null&&(tu===null?tu=o:tu.push.apply(tu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Eu(e,0),Cu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Cu(r,t,Ql,!Wl);break a;case 2:tu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=ru+300-V(),10<a)){if(Cu(r,t,Ql,!Wl),He(r,0,!0)!==0)break a;du=t,r.timeoutHandle=Qd(xu.bind(null,r,n,tu,ou,nu,t,Ql,Xl,$l,Wl,o,`Throttled`,-0,0),a);break a}xu(r,n,tu,ou,nu,t,Ql,Xl,$l,Wl,o,null,-0,0)}break}while(1);sd(e)}function xu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xt},Al(t,a,d);var m=(a&62914560)===a?ru-V():(a&4194048)===a?iu-V():0;if(m=$f(d,m),m!==null){du=a,e.cancelPendingCommit=m(Vu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Cu(e,a,o,!l);return}}Vu(e,t,a,n,r,i,o,s,c)}function Su(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!_r(a(),i))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 Cu(e,t,n,r){t&=~Zl,t&=~Xl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Pe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ye(e,n,t)}function wu(){return Rl&6?!0:(cd(0,!1),!1)}function Tu(){if(Bl!==null){if(Hl===0)var e=Bl.return;else e=Bl,Hi=Vi=null,To(e),Da=null,Oa=0,e=Bl;for(;e!==null;)Rc(e.alternate,e),e=e.return;Bl=null}}function Eu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,$d(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),du=0,Tu(),zl=e,Bl=n=ai(e.current,null),Vl=t,Hl=0,Ul=null,Wl=!1,Gl=Ue(e,t),Kl=!1,$l=Ql=Zl=Xl=Yl=Jl=0,tu=eu=null,nu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Pe(r),a=1<<i;t|=e[i],r&=~a}return ql=t,Yr(),n}function Du(e,t){co=null,I.H=Fs,t===_a||t===ya?(t=Ta(),Hl=3):t===va?(t=Ta(),Hl=4):Hl=t===$s?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ul=t,Bl===null&&(Jl=1,qs(e,W(t,e.current)))}function Ou(){var e=Qa.current;return e===null?!0:(Vl&4194048)===Vl?$a===null:(Vl&62914560)===Vl||Vl&536870912?e===$a:!1}function ku(){var e=I.H;return I.H=Fs,e===null?Fs:e}function Au(){var e=I.A;return I.A=Il,e}function ju(){Jl=4,Wl||(Vl&4194048)!==Vl&&Qa.current!==null||(Gl=!0),!(Yl&134217727)&&!(Xl&134217727)||zl===null||Cu(zl,Vl,Ql,!1)}function Mu(e,t,n){var r=Rl;Rl|=2;var i=ku(),a=Au();(zl!==e||Vl!==t)&&(ou=null,Eu(e,t)),t=!1;var o=Jl;a:do try{if(Hl!==0&&Bl!==null){var s=Bl,c=Ul;switch(Hl){case 8:Tu(),o=6;break a;case 3:case 2:case 9:case 6:Qa.current===null&&(t=!0);var l=Hl;if(Hl=0,Ul=null,Ru(e,s,c,l),n&&Gl){o=0;break a}break;default:l=Hl,Hl=0,Ul=null,Ru(e,s,c,l)}}Nu(),o=Jl;break}catch(t){Du(e,t)}while(1);return t&&e.shellSuspendCounter++,Hi=Vi=null,Rl=r,I.H=i,I.A=a,Bl===null&&(zl=null,Vl=0,Yr()),o}function Nu(){for(;Bl!==null;)Iu(Bl)}function Pu(e,t){var n=Rl;Rl|=2;var r=ku(),a=Au();zl!==e||Vl!==t?(ou=null,au=V()+500,Eu(e,t)):Gl=Ue(e,t);a:do try{if(Hl!==0&&Bl!==null){t=Bl;var o=Ul;b:switch(Hl){case 1:Hl=0,Ul=null,Ru(e,t,o,1);break;case 2:case 9:if(xa(o)){Hl=0,Ul=null,Lu(t);break}t=function(){Hl!==2&&Hl!==9||zl!==e||(Hl=7),sd(e)},o.then(t,t);break a;case 3:Hl=7;break a;case 4:Hl=5;break a;case 7:xa(o)?(Hl=0,Ul=null,Lu(t)):(Hl=0,Ul=null,Ru(e,t,o,7));break;case 5:var s=null;switch(Bl.tag){case 26:s=Bl.memoizedState;case 5:case 27:var c=Bl;if(s?Xf(s):c.stateNode.complete){Hl=0,Ul=null;var l=c.sibling;if(l!==null)Bl=l;else{var u=c.return;u===null?Bl=null:(Bl=u,zu(u))}break b}}Hl=0,Ul=null,Ru(e,t,o,5);break;case 6:Hl=0,Ul=null,Ru(e,t,o,6);break;case 8:Tu(),Jl=6;break a;default:throw Error(i(462))}}Fu();break}catch(t){Du(e,t)}while(1);return Hi=Vi=null,I.H=r,I.A=a,Rl=n,Bl===null?(zl=null,Vl=0,Yr(),Jl):0}function Fu(){for(;Bl!==null&&!xe();)Iu(Bl)}function Iu(e){var t=kc(e.alternate,e,ql);e.memoizedProps=e.pendingProps,t===null?zu(e):Bl=t}function Lu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pc(n,t,t.pendingProps,t.type,void 0,Vl);break;case 11:t=pc(n,t,t.pendingProps,t.type.render,t.ref,Vl);break;case 5:To(t);default:Rc(n,t),t=Bl=oi(t,ql),t=kc(n,t,ql)}e.memoizedProps=e.pendingProps,t===null?zu(e):Bl=t}function Ru(e,t,n,r){Hi=Vi=null,To(t),Da=null,Oa=0;var i=t.return;try{if(Qs(e,i,t,n,Vl)){Jl=1,qs(e,W(n,e.current)),Bl=null;return}}catch(t){if(i!==null)throw Bl=i,t;Jl=1,qs(e,W(n,e.current)),Bl=null;return}t.flags&32768?(ki||r===1?e=!0:Gl||Vl&536870912?e=!1:(Wl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Bu(t,e)):zu(t)}function zu(e){var t=e;do{if(t.flags&32768){Bu(t,Wl);return}e=t.return;var n=Ic(t.alternate,t,ql);if(n!==null){Bl=n;return}if(t=t.sibling,t!==null){Bl=t;return}Bl=t=e}while(t!==null);Jl===0&&(Jl=5)}function Bu(e,t){do{var n=Lc(e.alternate,e);if(n!==null){n.flags&=32767,Bl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Bl=e;return}Bl=e=n}while(e!==null);Jl=6,Bl=null}function Vu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Gu();while(cu!==0);if(Rl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Jr,Je(e,n,o,s,c,l),e===zl&&(Bl=zl=null,Vl=0),uu=t,lu=e,du=n,fu=o,pu=a,mu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ed(Ee,function(){return Ku(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=I.T,I.T=null,a=L.p,L.p=2,s=Rl,Rl|=4;try{rl(e,t,n)}finally{Rl=s,L.p=a,I.T=r}}cu=1,Hu(),Uu(),Wu()}}function Hu(){if(cu===1){cu=0;var e=lu,t=uu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Rl;Rl|=4;try{gl(t,e);var a=Gd,o=Sr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&xr(s.ownerDocument.documentElement,s)){if(c!==null&&Cr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=br(s,h),v=br(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}pp=!!Wd,Gd=Wd=null}finally{Rl=i,L.p=r,I.T=n}}e.current=t,cu=2}}function Uu(){if(cu===2){cu=0;var e=lu,t=uu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Rl;Rl|=4;try{il(e,t.alternate,t)}finally{Rl=i,L.p=r,I.T=n}}cu=3}}function Wu(){if(cu===4||cu===3){cu=0,Se();var e=lu,t=uu,n=du,r=mu;t.subtreeFlags&10256||t.flags&10256?cu=5:(cu=0,uu=lu=null,q(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(su=null),$e(n),t=t.stateNode,Me&&typeof Me.onCommitFiberRoot==`function`)try{Me.onCommitFiberRoot(je,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}du&3&&Gu(),sd(e),i=e.pendingLanes,n&261930&&i&42?e===gu?hu++:(hu=0,gu=e):hu=0,cd(0,!1)}}function q(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ia(t)))}function Gu(){return Hu(),Uu(),Wu(),Ku()}function Ku(){if(cu!==5)return!1;var e=lu,t=fu;fu=0;var n=$e(du),r=I.T,a=L.p;try{L.p=32>n?32:n,I.T=null,n=pu,pu=null;var o=lu,s=du;if(cu=0,uu=lu=null,du=0,Rl&6)throw Error(i(331));var c=Rl;if(Rl|=4,Nl(o.current),Tl(o,o.current,s,n),Rl=c,cd(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{L.p=a,I.T=r,q(e,t)}}function qu(e,t,n){t=W(n,t),t=Ys(e.stateNode,t,2),e=za(e,t,2),e!==null&&(qe(e,2),sd(e))}function Ju(e,t,n){if(e.tag===3)qu(e,e,n);else for(;t!==null;){if(t.tag===3){qu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(su===null||!su.has(r))){e=W(n,e),n=Xs(2),r=za(t,n,2),r!==null&&(Zs(n,r,t,e),qe(r,2),sd(r));break}}t=t.return}}function Yu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ll;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Kl=!0,i.add(n),e=Xu.bind(null,e,t,n),t.then(e,e))}function Xu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zl===e&&(Vl&n)===n&&(Jl===4||Jl===3&&(Vl&62914560)===Vl&&300>V()-ru?!(Rl&2)&&Eu(e,0):Zl|=n,$l===Vl&&($l=0)),sd(e)}function Zu(e,t){t===0&&(t=Ge()),e=Qr(e,t),e!==null&&(qe(e,t),sd(e))}function Qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function $u(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Zu(e,n)}function ed(e,t){return ye(e,t)}var td=null,nd=null,rd=!1,id=!1,ad=!1,od=0;function sd(e){e!==nd&&e.next===null&&(nd===null?td=nd=e:nd=nd.next=e),id=!0,rd||(rd=!0,md())}function cd(e,t){if(!ad&&id){ad=!0;do for(var n=!1,r=td;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Pe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,pd(r,a))}else a=Vl,a=He(r,r===zl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,pd(r,a))}r=r.next}while(n);ad=!1}}function ld(){ud()}function ud(){id=rd=!1;var e=0;od!==0&&Zd()&&(e=od);for(var t=V(),n=null,r=td;r!==null;){var i=r.next,a=dd(r,t);a===0?(r.next=null,n===null?td=i:n.next=i,i===null&&(nd=n)):(n=r,(e!==0||a&3)&&(id=!0)),r=i}cu!==0&&cu!==5||cd(e,!1),od!==0&&(od=0)}function dd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Pe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=We(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=zl,n=Vl,n=He(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Hl===2||Hl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ue(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&be(r),$e(n)){case 2:case 8:n=Te;break;case 32:n=Ee;break;case 268435456:n=Oe;break;default:n=Ee}return r=fd.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&be(r),e.callbackPriority=2,e.callbackNode=null,2}function fd(e,t){if(cu!==0&&cu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Gu()&&e.callbackNode!==n)return null;var r=Vl;return r=He(e,e===zl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(bu(e,r,t),dd(e,V()),e.callbackNode!=null&&e.callbackNode===n?fd.bind(null,e):null)}function pd(e,t){if(Gu())return null;bu(e,t,!0)}function md(){tf(function(){Rl&6?ye(we,ld):ud()})}function hd(){if(od===0){var e=sa;e===0&&(e=Re,Re<<=1,!(Re&261888)&&(Re=256)),od=e}return od}function gd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Yt(``+e)}function _d(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function vd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=gd((i[it]||null).action),o=r.submitter;o&&(t=(t=o[it]||null)?gd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new gn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(od!==0){var e=o?_d(i,o):new FormData(i);xs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?_d(i,o):new FormData(i),xs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var yd=0;yd<Ur.length;yd++){var bd=Ur[yd];Wr(bd.toLowerCase(),`on`+(bd[0].toUpperCase()+bd.slice(1)))}Wr(Fr,`onAnimationEnd`),Wr(Ir,`onAnimationIteration`),Wr(Lr,`onAnimationStart`),Wr(`dblclick`,`onDoubleClick`),Wr(`focusin`,`onFocus`),Wr(`focusout`,`onBlur`),Wr(Rr,`onTransitionRun`),Wr(zr,`onTransitionStart`),Wr(Br,`onTransitionCancel`),Wr(Vr,`onTransitionEnd`),bt(`onMouseEnter`,[`mouseout`,`mouseover`]),bt(`onMouseLeave`,[`mouseout`,`mouseover`]),bt(`onPointerEnter`,[`pointerout`,`pointerover`]),bt(`onPointerLeave`,[`pointerout`,`pointerover`]),yt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),yt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),yt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),yt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var xd=`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(` `),Sd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(xd));function Cd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Gr(e)}i.currentTarget=null,a=c}}}}function wd(e,t){var n=t[ot];n===void 0&&(n=t[ot]=new Set);var r=e+`__bubble`;n.has(r)||(Od(t,e,2,!1),n.add(r))}function Td(e,t,n){var r=0;t&&(r|=4),Od(n,e,r,t)}var Ed=`_reactListening`+Math.random().toString(36).slice(2);function Dd(e){if(!e[Ed]){e[Ed]=!0,_t.forEach(function(t){t!==`selectionchange`&&(Sd.has(t)||Td(t,!1,e),Td(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ed]||(t[Ed]=!0,Td(`selectionchange`,!1,t))}}function Od(e,t,n,r){switch(bp(t)){case 2:var i=mp;break;case 8:i=hp;break;default:i=gp}n=i.bind(null,t,n,e),i=void 0,!on||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function kd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ft(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Hr.get(e);if(c!==void 0){var l=gn,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=Pn;break;case`focusin`:u=`focus`,l=Tn;break;case`focusout`:u=`blur`,l=Tn;break;case`beforeblur`:case`afterblur`:l=Tn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Cn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=wn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=In;break;case Fr:case Ir:case Lr:l=En;break;case Vr:l=Ln;break;case`scroll`:case`scrollend`:l=vn;break;case`wheel`:l=Rn;break;case`copy`:case`cut`:case`paste`:l=Dn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Fn;break;case`toggle`:case`beforetoggle`:l=zn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=rn(m,p),g!=null&&d.push(Ad(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==H&&(u=n.relatedTarget||n.fromElement)&&(ft(u)||u[at]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ft(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Cn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Fn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:mt(l),h=u==null?c:mt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ft(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Md,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Nd(s,c,l,d,!1),u!==null&&f!==null&&Nd(s,f,u,d,!0)}}a:{if(c=r?mt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=ar;else if($n(c)){if(or)v=hr;else{v=pr;var y=fr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Kt(r.elementType)&&(v=ar):v=mr;if(v&&=v(e,r)){er(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Rt(c,`number`,c.value)}switch(y=r?mt(r):window,e){case`focusin`:($n(y)||y.contentEditable===`true`)&&(Tr=y,Er=r,Dr=null);break;case`focusout`:Dr=Er=Tr=null;break;case`mousedown`:Or=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Or=!1,kr(s,n,i);break;case`selectionchange`:if(wr)break;case`keydown`:case`keyup`:kr(s,n,i)}var b;if(Vn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Yn?qn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Wn&&n.locale!==`ko`&&(Yn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Yn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Yn=!0)),y=jd(r,x),0<y.length&&(x=new On(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Jn(n),b!==null&&(x.data=b)))),(b=Un?Xn(e,n):Zn(e,n))&&(x=jd(r,`onBeforeInput`),0<x.length&&(y=new On(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),vd(s,e,r,n,i)}Cd(s,t)})}function Ad(e,t,n){return{instance:e,listener:t,currentTarget:n}}function jd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=rn(e,n),i!=null&&r.unshift(Ad(e,i,a)),i=rn(e,t),i!=null&&r.push(Ad(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Md(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Nd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=rn(n,a),l!=null&&o.unshift(Ad(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(Ad(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Pd=/\r\n?/g,Fd=/\u0000|\uFFFD/g;function Id(e){return(typeof e==`string`?e:``+e).replace(Pd,`
|
|
9
|
+
`).replace(Fd,``)}function Ld(e,t){return t=Id(t),Id(e)===t}function Rd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Et(e,`class`,r);break;case`tabIndex`:Et(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Et(e,n,r);break;case`style`:Gt(e,r,o);break;case`data`:if(t!==`object`){Et(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Rd(e,t,`name`,a.name,a,null),Rd(e,t,`formEncType`,a.formEncType,a,null),Rd(e,t,`formMethod`,a.formMethod,a,null),Rd(e,t,`formTarget`,a.formTarget,a,null)):(Rd(e,t,`encType`,a.encType,a,null),Rd(e,t,`method`,a.method,a,null),Rd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`onScroll`:r!=null&&wd(`scroll`,e);break;case`onScrollEnd`:r!=null&&wd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Yt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:wd(`beforetoggle`,e),wd(`toggle`,e),Tt(e,`popover`,r);break;case`xlinkActuate`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Tt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=qt.get(n)||n,Tt(e,n,r))}}function zd(e,t,n,r,a,o){switch(n){case`style`:Gt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&wd(`scroll`,e);break;case`onScrollEnd`:r!=null&&wd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[it]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Tt(e,n,r)}}}function Bd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:wd(`error`,e),wd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,o,s,n,null)}}a&&Rd(e,t,`srcSet`,n.srcSet,n,null),r&&Rd(e,t,`src`,n.src,n,null);return;case`input`:wd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Rd(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in wd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Rd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(s in wd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Rd(e,t,s,c,n,null)}Vt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Rd(e,t,l,r,n,null)}return;case`dialog`:wd(`beforetoggle`,e),wd(`toggle`,e),wd(`cancel`,e),wd(`close`,e);break;case`iframe`:case`object`:wd(`load`,e);break;case`video`:case`audio`:for(r=0;r<xd.length;r++)wd(xd[r],e);break;case`image`:wd(`error`,e),wd(`load`,e);break;case`details`:wd(`toggle`,e);break;case`embed`:case`source`:case`link`:wd(`error`,e),wd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Rd(e,t,u,r,n,null)}return;default:if(Kt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&zd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Rd(e,t,c,r,n,null))}function Vd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Rd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Rd(e,t,p,m,r,f)}}It(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Rd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Rd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Rd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Rd(e,t,s,a,r,o)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Rd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Rd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Rd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Rd(e,t,u,p,r,m)}return;default:if(Kt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&zd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||zd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Rd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Rd(e,t,f,p,r,m)}function Hd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ud(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Hd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Wd=null,Gd=null;function Kd(e){return e.nodeType===9?e:e.ownerDocument}function qd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Jd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Yd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xd=null;function Zd(){var e=window.event;return e&&e.type===`popstate`?e!==Xd&&(Xd=e,!0):(Xd=null,!1)}var Qd=typeof setTimeout==`function`?setTimeout:void 0,$d=typeof clearTimeout==`function`?clearTimeout:void 0,ef=typeof Promise==`function`?Promise:void 0,tf=typeof queueMicrotask==`function`?queueMicrotask:ef===void 0?Qd:function(e){return ef.resolve(null).then(e).catch(nf)};function nf(e){setTimeout(function(){throw e})}function rf(e){return e===`head`}function af(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),zp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)yf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,yf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ut]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&yf(e.ownerDocument.body)}n=i}while(n);zp(t)}function of(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function sf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:sf(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function cf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[ut])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=mf(e.nextSibling),e===null)break}return null}function lf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=mf(e.nextSibling),e===null))return null;return e}function uf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=mf(e.nextSibling),e===null))return null;return e}function df(e){return e.data===`$?`||e.data===`$~`}function ff(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function pf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function mf(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var hf=null;function gf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return mf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function _f(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function vf(e,t,n){switch(t=Kd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function yf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var bf=new Map,xf=new Set;function Sf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Cf=L.d;L.d={f:wf,r:Tf,D:Of,C:kf,L:Af,m:jf,X:Nf,S:Mf,M:Pf};function wf(){var e=Cf.f(),t=wu();return e||t}function Tf(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Cs(t):Cf.r(e)}var Ef=typeof document>`u`?null:document;function Df(e,t,n){var r=Ef;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xf.has(i)||(xf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Of(e){Cf.D(e),Df(`dns-prefetch`,e,null)}function kf(e,t){Cf.C(e,t),Df(`preconnect`,e,t)}function Af(e,t,n){Cf.L(e,t,n);var r=Ef;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=Bf(e)}bf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Bd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function jf(e,t){Cf.m(e,t);var n=Ef;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!bf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),bf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Mf(e,t,n){Cf.S(e,t,n);var r=Ef;if(r&&e){var i=ht(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);gt(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){Cf.X(e,t);var n=Ef;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=f({src:e,async:!0},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){Cf.M(e,t);var n=Ef;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=ae.current)?Sf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=ht(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=ht(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),bf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bf.set(e,n),o||zf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=ht(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+Ft(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),gt(t),e.head.appendChild(t))}function Bf(e){return`[src="`+Ft(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),gt(r),Bd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=Rf(n),(a=bf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,gt(a),a):(r=n,(a=bf.get(o))&&(r=f({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Kf=null;function qf(e,t,n){if(Kf===null){var r=new Map,i=Kf=new Map;i.set(n,r)}else i=Kf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ut]||a[rt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Yf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=Rf(r),(i=bf.get(i))&&Wf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&np(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&np(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Qf===0&&(Qf=62500*Ud());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&np(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)np(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function np(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(rp,e),tp=null,ep.call(e))}function rp(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ep.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var ip={$$typeof:C,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function ap(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function op(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ap(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ri(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ia(a),e}function sp(e){return e?(e=ti,e):ti}function cp(e,t,n,r,i,a){i=sp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ra(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=za(e,r,t),n!==null&&(yu(n,e,t),Ba(n,e,t))}function lp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function up(e,t){lp(e,t),(e=e.alternate)&&lp(e,t)}function dp(e){if(e.tag===13||e.tag===31){var t=Qr(e,67108864);t!==null&&yu(t,e,67108864),up(e,67108864)}}function fp(e){if(e.tag===13||e.tag===31){var t=_u();t=Qe(t);var n=Qr(e,t);n!==null&&yu(n,e,t),up(e,t)}}var pp=!0;function mp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,gp(e,t,n,r)}finally{L.p=a,I.T=i}}function hp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,gp(e,t,n,r)}finally{L.p=a,I.T=i}}function gp(e,t,n,r){if(pp){var i=_p(r);if(i===null)kd(e,t,r,vp,n),kp(e,r);else if(jp(i,e,t,n,r))r.stopPropagation();else if(kp(e,r),t&4&&-1<Op.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ve(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Pe(o);s.entanglements[1]|=c,o&=~c}sd(a),!(Rl&6)&&(au=V()+500,cd(0,!1))}}break;case 31:case 13:s=Qr(a,2),s!==null&&yu(s,a,2),wu(),up(a,2)}if(a=_p(r),a===null&&kd(e,t,r,vp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else kd(e,t,r,null,n)}}function _p(e){return e=Zt(e),yp(e)}var vp=null;function yp(e){if(vp=null,e=ft(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 vp=e,null}function bp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ce()){case we:return 2;case Te:return 8;case Ee:case De:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var xp=!1,Sp=null,Cp=null,wp=null,Tp=new Map,Ep=new Map,Dp=[],Op=`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`.split(` `);function kp(e,t){switch(e){case`focusin`:case`focusout`:Sp=null;break;case`dragenter`:case`dragleave`:Cp=null;break;case`mouseover`:case`mouseout`:wp=null;break;case`pointerover`:case`pointerout`:Tp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ep.delete(t.pointerId)}}function Ap(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=pt(t),t!==null&&dp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function jp(e,t,n,r,i){switch(t){case`focusin`:return Sp=Ap(Sp,e,t,n,r,i),!0;case`dragenter`:return Cp=Ap(Cp,e,t,n,r,i),!0;case`mouseover`:return wp=Ap(wp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Tp.set(a,Ap(Tp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ep.set(a,Ap(Ep.get(a)||null,e,t,n,r,i)),!0}return!1}function Mp(e){var t=ft(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,tt(e.priority,function(){fp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,tt(e.priority,function(){fp(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 Np(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_p(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);H=r,n.target.dispatchEvent(r),H=null}else return t=pt(n),t!==null&&dp(t),e.blockedOn=n,!1;t.shift()}return!0}function Pp(e,t,n){Np(e)&&n.delete(t)}function Fp(){xp=!1,Sp!==null&&Np(Sp)&&(Sp=null),Cp!==null&&Np(Cp)&&(Cp=null),wp!==null&&Np(wp)&&(wp=null),Tp.forEach(Pp),Ep.forEach(Pp)}function Ip(e,n){e.blockedOn===n&&(e.blockedOn=null,xp||(xp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Fp)))}var Lp=null;function Rp(e){Lp!==e&&(Lp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Lp===e&&(Lp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(yp(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,xs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function zp(e){function t(t){return Ip(t,e)}Sp!==null&&Ip(Sp,e),Cp!==null&&Ip(Cp,e),wp!==null&&Ip(wp,e),Tp.forEach(t),Ep.forEach(t);for(var n=0;n<Dp.length;n++){var r=Dp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Dp.length&&(n=Dp[0],n.blockedOn===null);)Mp(n),n.blockedOn===null&&Dp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[it]||null;if(typeof a==`function`)o||Rp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(yp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Rp(n)}}}function Bp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Vp(e){this._internalRoot=e}Hp.prototype.render=Vp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;cp(n,_u(),e,t,null,null)},Hp.prototype.unmount=Vp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cp(e.current,2,null,e,null,null),wu(),t[at]=null}};function Hp(e){this._internalRoot=e}Hp.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Dp.length&&t!==0&&t<Dp[n].priority;n++);Dp.splice(n,0,e),n===0&&Mp(e)}};var Up=n.version;if(Up!==`19.2.8`)throw Error(i(527,Up,`19.2.8`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Wp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Gp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Gp.isDisabled&&Gp.supportsFiber)try{je=Gp.inject(Wp),Me=Gp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ws,s=Gs,c=Ks;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=op(e,1,!1,null,null,n,r,null,o,s,c,Bp),e[at]=t.current,Dd(e),new Vp(t)}})),y=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=v()})),b=u(h(),1),x=y();function S(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(n),s+=i[1]===`?`?`(?:/(.*))?`:`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var C=s((e=>{var t=h();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),w=s(((e,t)=>{t.exports=C()}))(),T=b.useInsertionEffect,E=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?b.useLayoutEffect:b.useEffect,D=T||E,O=e=>{let t=b.useRef([e,(...e)=>t[0](...e)]).current;return D(()=>{t[0]=e}),t[1]},k=`popstate`,A=`pushState`,j=`replaceState`,M=[k,A,j,`hashchange`],N=e=>{for(let t of M)addEventListener(t,e);return()=>{for(let t of M)removeEventListener(t,e)}},P=(e,t)=>(0,w.useSyncExternalStore)(N,e,t),F=()=>location.search,I=({ssrSearch:e=``}={})=>P(F,()=>e),L=()=>location.pathname,ee=({ssrPath:e}={})=>P(L,e?()=>e:L),te=(e,{replace:t=!1,state:n=null}={})=>history[t?j:A](n,``,e),ne=(e={})=>[ee(e),te],R=Symbol.for(`wouter_v3`);if(typeof history<`u`&&window[R]===void 0){for(let e of[A,j]){let t=history[e];history[e]=function(){let n=t.apply(this,arguments),r=new Event(e);return r.arguments=arguments,dispatchEvent(r),n}}Object.defineProperty(window,R,{value:!0})}var z=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?`~`+t:t.slice(e.length)||`/`,B=(e=``)=>e===`/`?``:e,re=(e,t)=>e[0]===`~`?e.slice(1):B(t)+e,ie=(e=``,t)=>z(ae(B(e)),ae(t)),ae=e=>{try{return decodeURI(e)}catch{return e}},oe={hook:ne,searchHook:I,parser:S,base:``,ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},se=(0,b.createContext)(oe),ce=()=>(0,b.useContext)(se),le={},ue=(0,b.createContext)(le),de=()=>(0,b.useContext)(ue),fe=e=>{let[t,n]=e.hook(e);return[ie(e.base,t),O((t,r)=>n(re(t,e.base),r))]},pe=()=>fe(ce()),me=(e,t,n,r)=>{let{pattern:i,keys:a}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||`*`,r),o=i.exec(n)||[],[s,...c]=o;return s===void 0?[!1,null]:[!0,(()=>{let e=a===!1?o.groups:Object.fromEntries(a.map((e,t)=>[e,c[t]])),t={...c};return e&&Object.assign(t,e),t})(),...r?[s]:[]]},he=({children:e,...t})=>{let n=ce(),r=t.hook?oe:n,i=r,[a,o]=t.ssrPath?.split(`?`)??[];o&&(t.ssrSearch=o,t.ssrPath=a),t.hrefs=t.hrefs??t.hook?.hrefs;let s=(0,b.useRef)({}),c=s.current,l=c;for(let e in r){let n=e===`base`?r[e]+(t[e]||``):t[e]||r[e];c===l&&n!==l[e]&&(s.current=l={...l}),l[e]=n,(n!==r[e]||n!==i[e])&&(i=l)}return(0,b.createElement)(se.Provider,{value:i,children:e})},ge=({children:e,component:t},n)=>t?(0,b.createElement)(t,{params:n}):typeof e==`function`?e(n):e,_e=e=>{let t=(0,b.useRef)(le),n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([e,t])=>t!==n[e])?e:n},ve=({path:e,nest:t,match:n,...r})=>{let i=ce(),[a]=fe(i),[o,s,c]=n??me(i.parser,e,a,t),l=_e({...de(),...s});if(!o)return null;let u=c?(0,b.createElement)(he,{base:c},ge(r,l)):ge(r,l);return(0,b.createElement)(ue.Provider,{value:l,children:u})},ye=(0,b.forwardRef)((e,t)=>{let n=ce(),[r,i]=fe(n),{to:a=``,href:o=a,onClick:s,asChild:c,children:l,className:u,replace:d,state:f,...p}=e,m=O(t=>{t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||t.button!==0||(s?.(t),t.defaultPrevented||(t.preventDefault(),i(o,e)))}),h=n.hrefs(o[0]===`~`?o.slice(1):n.base+o,n);return c&&(0,b.isValidElement)(l)?(0,b.cloneElement)(l,{onClick:m,href:h}):(0,b.createElement)(`a`,{...p,onClick:m,href:h,className:u?.call?u(r===o):u,children:l,ref:t})}),be=e=>Array.isArray(e)?e.flatMap(e=>be(e&&e.type===b.Fragment?e.props.children:e)):[e],xe=({children:e,location:t})=>{let n=ce(),[r]=fe(n);for(let i of be(e)){let e=0;if((0,b.isValidElement)(i)&&(e=me(n.parser,i.props.path,t||r,i.props.nest))[0])return(0,b.cloneElement)(i,{match:e})}return null},Se=s((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),V=s(((e,t)=>{t.exports=Se()}))(),Ce=b.createContext(void 0),we=e=>{let t=b.useContext(Ce);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Te=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(Ce.Provider,{value:e,children:t})),Ee={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},De=new class{#e=Ee;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Oe(e){setTimeout(e,0)}var ke=typeof window>`u`||`Deno`in globalThis;function Ae(){}function je(e,t){return typeof e==`function`?e(t):e}function Me(e){return typeof e==`number`&&e>=0&&e!==1/0}function Ne(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pe(e,t){return typeof e==`function`?e(t):e}function Fe(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Le(o,t.options))return!1}else if(!ze(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Ie(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Re(t.options.mutationKey)!==Re(a))return!1}else if(!ze(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Le(e,t){return(t?.queryKeyHashFn||Re)(e)}function Re(e){return JSON.stringify(e,(e,t)=>We(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function ze(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!ze(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!ze(e[r],t[r]))return!1;return!0}return!1}var Be=Object.prototype.hasOwnProperty;function Ve(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ue(e)&&Ue(t);if(!r&&!(We(e)&&We(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Be.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ve(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function He(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n of Object.keys(e))if(!Be.call(t,n)||e[n]!==t[n])return!1;return!0}function Ue(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function We(e){if(!Ge(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!Ge(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function Ge(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ke(e){return new Promise(t=>{De.setTimeout(t,e)})}function qe(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ve(e,t)}function Je(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(-n):r}function Ye(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,n):r}var Xe=Symbol();function Ze(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Xe?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Qe(e,t){return typeof e==`function`?e(...t):!!e}var $e=Symbol();function et(e,t,n,r){let i=!1,a;return Object.defineProperties(e,{[$e]:{value:r},signal:{enumerable:!0,get:()=>(a??=t(),i?a:(i=!0,a.aborted?n():a.addEventListener(`abort`,n,{once:!0}),a))}}),e}var tt=()=>ke,nt=()=>tt(),rt=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(){}},it=new class extends rt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},at=Oe;function ot(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=at,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var st=ot(),ct=new class extends rt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function lt(e){return Math.min(1e3*2**e,3e4)}function ut(e){return(e??`online`)!==`online`||ct.isOnline()}var dt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ft(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(Ae);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new dt(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>it.isFocused()&&(e.networkMode===`always`||ct.isOnline())&&e.canRun(),p=()=>ut(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(nt()?0:3),a=e.retryDelay??lt,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),Ke(o).then(()=>c()||f()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}function pt(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=t,u=e=>{et(e,()=>t.signal,()=>n=!0,l[$e])},d=Ze(t.options,t.fetchOptions),f=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return u(e),e})(),o=await d(a),{maxPages:s}=t.options,c=i?Ye:Je;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?ht:mt,n={pages:a,pageParams:o};s=await f(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]===void 0?r.initialPageParam:o[0]:mt(r,s);if(c>0&&e==null)break;s=await f(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function mt(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ht(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var gt=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Me(this.gcTime)&&(this.#e=De.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nt()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(De.clearTimeout(this.#e),this.#e=void 0)}},_t=class extends gt{#e;#t;#n;#r;#i;#a;#o;#s;#c;constructor(e){super(),this.#c=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=bt(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=bt(this.options);e.data!==void 0&&(this.setState(yt(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=qe(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Ae).catch(Ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Pe(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Xe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data!==void 0&&this.getObserversCount()>0&&this.observers.some(e=>Pe(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Ne(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#c||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a&&this.#o)return this.#a.continueRetry(),this.#o}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperties(e,{[$e]:{value:n.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(this.#c=!0,n.signal)}})},i=()=>{let e=Ze(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#c=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?pt(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=ft({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof dt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}),s=(async()=>{try{let e=await o.promise;if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof dt){if(e.silent){if(this.#a!==o&&this.#o)return this.#o;throw e}if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0,this.#o=void 0),this.scheduleGc()}})();return this.#o=s,o.start(),s}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...vt(t.data,this.options),fetchMeta:e.meta??null};case`success`:{let n={...t,...yt(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n}case`error`:{let n=e.error;return{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:`idle`,status:`error`,isInvalidated:!0}}case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),st.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function vt(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ut(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function yt(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function bt(e){let 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 xt=class extends rt{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ct(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return wt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return wt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Pe(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!He(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Tt(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||Pe(this.options.enabled,this.#t)!==Pe(t.enabled,this.#t)||Pe(this.options.staleTime,this.#t)!==Pe(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Pe(this.options.enabled,this.#t)!==Pe(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return He(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Ae)),t}#h(e){return!nt()&&Pe(this.options.enabled,this.#t)!==!1&&Me(e)}#g(){this.#b();let e=Pe(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=Ne(this.#r.dataUpdatedAt,e)+1;this.#u=De.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return Pe(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=De.setInterval(()=>{(this.options.refetchIntervalInBackground||it.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(De.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(De.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Ct(e,t),o=i&&Tt(e,n,t,r);(a||o)&&(l={...l,...vt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=qe(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=qe(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=i?.error===f?i.errorUpdatedAt:Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Et(e,t),refetch:this.refetch,isEnabled:Pe(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),He(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size||this.options.throwOnError&&this.#r.error!==e.error)return!0;for(let t of n??this.#p)if(this.#r[t]!==e[t])return!0;return!1})();st.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function St(e,t){return Pe(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||Pe(t.retryOnMount,e)!==!1)}function Ct(e,t){return St(e,t)||e.state.data!==void 0&&wt(e,t,t.refetchOnMount)}function wt(e,t,n){if(Pe(t.enabled,e)!==!1&&Pe(t.staleTime,e)!==`static`){let r=Pe(n,e);return r===`always`||r!==!1&&Et(e,t)}return!1}function Tt(e,t,n,r){return(e!==t||Pe(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Et(e,n)}function Et(e,t){return Pe(t.enabled,e)!==!1&&e.isStaleByTime(Pe(t.staleTime,e))}var Dt=class extends gt{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Ot(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=ft({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}this.state.isPaused&&r.canStart()&&t();let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),st.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Ot(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var kt=class extends rt{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Dt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=At(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=At(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=At(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=At(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){st.batch(()=>{let e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(e=>{this.notify({type:`removed`,mutation:e})})})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ie(t,e))}findAll(e={}){return this.getAll().filter(t=>Ie(e,t))}notify(e){st.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return st.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ae))))}};function At(e){return e.options.scope?.id}var jt=class extends rt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),He(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Re(t.mutationKey)!==Re(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Ot();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){st.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Mt=class extends rt{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Le(r,t),a=this.get(i);return a||(a=new _t({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){st.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Fe(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Fe(e,t)):t}notify(e){st.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){st.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){st.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Nt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mt,this.#t=e.mutationCache||new kt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=it.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ct.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Pe(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=je(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return st.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;st.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return st.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=st.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ae).catch(Ae)}invalidateQueries(e,t={}){return st.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=st.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n),r=e.state.fetchStatus===`paused`;return(!n.throwOnError||r)&&(t=t.catch(Ae)),r?Promise.resolve():t}));return Promise.all(r).then(Ae)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Pe(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Pe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ae).catch(Ae)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ae).catch(Ae)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return ct.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Re(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ze(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Re(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ze(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Le(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===Xe&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Pt=b.createContext(!1),Ft=()=>b.useContext(Pt);Pt.Provider;function It(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Lt=b.createContext(It()),Rt=()=>b.useContext(Lt),zt=(e,t,n)=>{let r=n?.state.status===`error`&&typeof e.throwOnError==`function`?Qe(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Bt=e=>{b.useEffect(()=>{e.clearReset()},[e])},Vt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Qe(n,[e.error,r])),Ht=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ut=(e,t)=>e?.suspense&&t.isPending,Wt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Gt(e,t,n){let r=Ft(),i=Rt(),a=we(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Ht(o),zt(o,i,s),Bt(i);let[l]=b.useState(()=>new t(a,o)),u=l.getOptimisticResult(o);b.useEffect(()=>{l.setOptions(o)},[o,l]);let d=!r&&c;if(b.useSyncExternalStore(b.useCallback(e=>{let t=d?l.subscribe(st.batchCalls(e)):Ae;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),Ut(o,u))throw Wt(o,l,i);if(Vt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Kt(e,t){return Gt(e,xt,t)}function qt(e,t){let n=we(t),[r]=b.useState(()=>new jt(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);let i=b.useSyncExternalStore(b.useCallback(e=>r.subscribe(st.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=b.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(Ae)},[r]);if(i.error&&Qe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Jt=class extends Error{status;errorCode;constructor(e,t,n){super(e),this.status=t,this.errorCode=n,this.name=`ApiError`}};function Yt(e){return e instanceof Jt&&(e.errorCode===`GRANT_REQUIRED`||e.errorCode===`DASHBOARD_REQUIRED`)}async function Xt(e){if(e.ok)return;let t=e.statusText,n;try{let r=await e.text();try{let e=JSON.parse(r);t=e.error||e.message||t,n=typeof e.error_code==`string`?e.error_code:void 0}catch{r.trim()&&(t=`${e.status}: ${r}`)}}catch(e){console.warn(`Response body parsing failed:`,e)}throw new Jt(t,e.status,n)}async function H(e,t,n){let r=await fetch(t,{method:e,credentials:`include`,headers:{...n?{"Content-Type":`application/json`}:{}},body:n?JSON.stringify(n):void 0});return await Xt(r),r}var Zt=new Nt({defaultOptions:{queries:{queryFn:(({on401:e})=>async({queryKey:t})=>{let n=t.join(`/`),r=await fetch(n,{credentials:`include`});return e===`returnNull`&&r.status===401?null:(await Xt(r),await r.json())})({on401:`throw`}),refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0,gcTime:6e5,retry:!1},mutations:{retry:!1}}});async function Qt(){let e=new URLSearchParams(window.location.search),t=e.get(`bootstrap`);if(t)try{let e=await fetch(`/api/dashboard-auth/bootstrap/session`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({nonce:t})});e.ok||console.warn(`[agent-deck] Dashboard bootstrap failed:`,e.status)}finally{e.delete(`bootstrap`);let t=`${window.location.pathname}${e.toString()?`?${e}`:``}${window.location.hash}`;window.history.replaceState({},``,t)}}var $t=1,en=1e6,tn=0;function nn(){return tn=(tn+1)%(2**53-1),tn.toString()}var rn=new Map,an=e=>{if(rn.has(e))return;let t=setTimeout(()=>{rn.delete(e),ln({type:`REMOVE_TOAST`,toastId:e})},en);rn.set(e,t)},on=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,$t)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?an(n):e.toasts.forEach(e=>{an(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},sn=[],cn={toasts:[]};function ln(e){cn=on(cn,e),sn.forEach(e=>{e(cn)})}function un({...e}){let t=nn(),n=e=>ln({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>ln({type:`DISMISS_TOAST`,toastId:t});return ln({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function dn(){let[e,t]=b.useState(cn);return b.useEffect(()=>(sn.push(t),()=>{let e=sn.indexOf(t);e>-1&&sn.splice(e,1)}),[e]),{...e,toast:un,dismiss:e=>ln({type:`DISMISS_TOAST`,toastId:e})}}var fn=u(_(),1);typeof window<`u`&&window.document&&window.document.createElement;function U(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function pn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function mn(...e){return t=>{let n=!1,r=e.map(e=>{let r=pn(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():pn(e[t],null)}}}}function hn(...e){return b.useCallback(mn(...e),e)}function gn(e,t){let n=b.createContext(t),r=e=>{let{children:t,...r}=e,i=b.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=b.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function _n(e,t=[]){let n=[];function r(t,r){let i=b.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=b.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=b.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>b.createContext(e));return function(n){let r=n?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,vn(i,...t)]}function vn(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function yn(e){let t=xn(e),n=b.forwardRef((e,n)=>{let{children:r,...i}=e,a=b.Children.toArray(r),o=a.find(wn);if(o){let e=o.props.children,r=a.map(t=>t===o?b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var bn=yn(`Slot`);function xn(e){let t=b.forwardRef((e,t)=>{let{children:n,...r}=e;if(b.isValidElement(n)){let e=En(n),i=Tn(r,n.props);return n.type!==b.Fragment&&(i.ref=t?mn(t,e):e),b.cloneElement(n,i)}return b.Children.count(n)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sn=Symbol(`radix.slottable`);function Cn(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=Sn,t}function wn(e){return b.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Sn}function Tn(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function En(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Dn(e){let t=e+`CollectionProvider`,[n,r]=_n(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=b.useRef(null),a=b.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=yn(s),l=b.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=hn(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=yn(u),p=b.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=b.useRef(null),s=hn(t,o),c=a(u,n);return b.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return b.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var On=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=yn(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function kn(e,t){e&&fn.flushSync(()=>e.dispatchEvent(t))}function An(e){let t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...e)=>t.current?.(...e),[])}function jn(e,t=globalThis?.document){let n=An(e);b.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Mn=`DismissableLayer`,Nn=`dismissableLayer.update`,Pn=`dismissableLayer.pointerDownOutside`,Fn=`dismissableLayer.focusOutside`,In,Ln=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Rn=b.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=b.useContext(Ln),[u,d]=b.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=b.useState({}),m=hn(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,x=v>=_,S=Vn(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));x&&!n&&(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Hn(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return jn(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),b.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(In=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Un(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=In)}},[u,f,n,l]),b.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Un())},[u,l]),b.useEffect(()=>{let e=()=>p({});return document.addEventListener(Nn,e),()=>document.removeEventListener(Nn,e)},[]),(0,V.jsx)(On.div,{...c,ref:m,style:{pointerEvents:y?x?`auto`:`none`:void 0,...e.style},onFocusCapture:U(e.onFocusCapture,C.onFocusCapture),onBlurCapture:U(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:U(e.onPointerDownCapture,S.onPointerDownCapture)})});Rn.displayName=Mn;var zn=`DismissableLayerBranch`,Bn=b.forwardRef((e,t)=>{let n=b.useContext(Ln),r=b.useRef(null),i=hn(t,r);return b.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(On.div,{...e,ref:i})});Bn.displayName=zn;function Vn(e,t=globalThis?.document){let n=An(e),r=b.useRef(!1),i=b.useRef(()=>{});return b.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Wn(Pn,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Hn(e,t=globalThis?.document){let n=An(e),r=b.useRef(!1);return b.useEffect(()=>{let e=e=>{e.target&&!r.current&&Wn(Fn,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Un(){let e=new CustomEvent(Nn);document.dispatchEvent(e)}function Wn(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?kn(i,a):i.dispatchEvent(a)}var Gn=Rn,Kn=Bn,qn=globalThis?.document?b.useLayoutEffect:()=>{},Jn=`Portal`,Yn=b.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=b.useState(!1);qn(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?fn.createPortal((0,V.jsx)(On.div,{...r,ref:t}),o):null});Yn.displayName=Jn;function Xn(e,t){return b.useReducer((e,n)=>t[e][n]??e,e)}var Zn=e=>{let{present:t,children:n}=e,r=Qn(t),i=typeof n==`function`?n({present:r.isPresent}):b.Children.only(n),a=hn(r.ref,er(i));return typeof n==`function`||r.isPresent?b.cloneElement(i,{ref:a}):null};Zn.displayName=`Presence`;function Qn(e){let[t,n]=b.useState(),r=b.useRef(null),i=b.useRef(e),a=b.useRef(`none`),[o,s]=Xn(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return b.useEffect(()=>{let e=$n(r.current);a.current=o===`mounted`?e:`none`},[o]),qn(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=$n(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),qn(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=$n(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=$n(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:b.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function $n(e){return e?.animationName||`none`}function er(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tr=b.useInsertionEffect||qn;function nr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=rr({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=b.useRef(e!==void 0);b.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`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.`),t.current=s},[s,r])}return[c,b.useCallback(t=>{if(s){let n=ir(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function rr({defaultProp:e,onChange:t}){let[n,r]=b.useState(e),i=b.useRef(n),a=b.useRef(t);return tr(()=>{a.current=t},[t]),b.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function ir(e){return typeof e==`function`}var ar=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`}),or=`VisuallyHidden`,sr=b.forwardRef((e,t)=>(0,V.jsx)(On.span,{...e,ref:t,style:{...ar,...e.style}}));sr.displayName=or;var cr=sr,lr=`ToastProvider`,[ur,dr,fr]=Dn(`Toast`),[pr,mr]=_n(`Toast`,[fr]),[hr,gr]=pr(lr),_r=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=b.useState(null),[l,u]=b.useState(0),d=b.useRef(!1),f=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${lr}\`. Expected non-empty \`string\`.`),(0,V.jsx)(ur.Provider,{scope:t,children:(0,V.jsx)(hr,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:b.useCallback(()=>u(e=>e+1),[]),onToastRemove:b.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};_r.displayName=lr;var vr=`ToastViewport`,yr=[`F8`],br=`toast.viewportPause`,xr=`toast.viewportResume`,Sr=b.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=yr,label:i=`Notifications ({hotkey})`,...a}=e,o=gr(vr,n),s=dr(n),c=b.useRef(null),l=b.useRef(null),u=b.useRef(null),d=b.useRef(null),f=hn(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;b.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),b.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(br);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(xr);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=b.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Yr(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return b.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Xr(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,V.jsxs)(Kn,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,V.jsx)(wr,{ref:l,onFocusFromOutsideViewport:()=>{Xr(h({tabbingDirection:`forwards`}))}}),(0,V.jsx)(ur.Slot,{scope:n,children:(0,V.jsx)(On.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,V.jsx)(wr,{ref:u,onFocusFromOutsideViewport:()=>{Xr(h({tabbingDirection:`backwards`}))}})]})});Sr.displayName=vr;var Cr=`ToastFocusProxy`,wr=b.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=gr(Cr,n);return(0,V.jsx)(sr,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});wr.displayName=Cr;var Tr=`Toast`,Er=`toast.swipeStart`,Dr=`toast.swipeMove`,Or=`toast.swipeCancel`,kr=`toast.swipeEnd`,Ar=b.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=nr({prop:r,defaultProp:i??!0,onChange:a,caller:Tr});return(0,V.jsx)(Zn,{present:n||s,children:(0,V.jsx)(Nr,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:An(e.onPause),onResume:An(e.onResume),onSwipeStart:U(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:U(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:U(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:U(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Ar.displayName=Tr;var[jr,Mr]=pr(Tr,{onClose(){}}),Nr=b.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=gr(Tr,n),[g,_]=b.useState(null),v=hn(t,e=>_(e)),y=b.useRef(null),x=b.useRef(null),S=i||h.duration,C=b.useRef(0),w=b.useRef(S),T=b.useRef(0),{onToastAdd:E,onToastRemove:D}=h,O=An(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),k=b.useCallback(e=>{e&&e!==1/0&&(window.clearTimeout(T.current),C.current=new Date().getTime(),T.current=window.setTimeout(O,e))},[O]);b.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{k(w.current),l?.()},n=()=>{let e=new Date().getTime()-C.current;w.current-=e,window.clearTimeout(T.current),c?.()};return e.addEventListener(br,n),e.addEventListener(xr,t),()=>{e.removeEventListener(br,n),e.removeEventListener(xr,t)}}},[h.viewport,S,c,l,k]),b.useEffect(()=>{a&&!h.isClosePausedRef.current&&k(S)},[a,S,h.isClosePausedRef,k]),b.useEffect(()=>(E(),()=>D()),[E,D]);let A=b.useMemo(()=>g?Wr(g):null,[g]);return h.viewport?(0,V.jsxs)(V.Fragment,{children:[A&&(0,V.jsx)(Pr,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:A}),(0,V.jsx)(jr,{scope:n,onClose:O,children:fn.createPortal((0,V.jsx)(ur.ItemSlot,{scope:n,children:(0,V.jsx)(Gn,{asChild:!0,onEscapeKeyDown:U(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||O(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,V.jsx)(On.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:U(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,O()))}),onPointerDown:U(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:U(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!x.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(x.current=l,Gr(Dr,d,f,{discrete:!1})):Kr(l,h.swipeDirection,c)?(x.current=l,Gr(Er,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:U(e.onPointerUp,e=>{let t=x.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),x.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Kr(t,h.swipeDirection,h.swipeThreshold)?Gr(kr,p,r,{discrete:!0}):Gr(Or,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Pr=e=>{let{__scopeToast:t,children:n,...r}=e,i=gr(Tr,t),[a,o]=b.useState(!1),[s,c]=b.useState(!1);return qr(()=>o(!0)),b.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,V.jsx)(Yn,{asChild:!0,children:(0,V.jsx)(sr,{...r,children:a&&(0,V.jsxs)(V.Fragment,{children:[i.label,` `,n]})})})},Fr=`ToastTitle`,Ir=b.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(On.div,{...r,ref:t})});Ir.displayName=Fr;var Lr=`ToastDescription`,Rr=b.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(On.div,{...r,ref:t})});Rr.displayName=Lr;var zr=`ToastAction`,Br=b.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,V.jsx)(Ur,{altText:n,asChild:!0,children:(0,V.jsx)(Hr,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${zr}\`. Expected non-empty \`string\`.`),null)});Br.displayName=zr;var Vr=`ToastClose`,Hr=b.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Mr(Vr,n);return(0,V.jsx)(Ur,{asChild:!0,children:(0,V.jsx)(On.button,{type:`button`,...r,ref:t,onClick:U(e.onClick,i.onClose)})})});Hr.displayName=Vr;var Ur=b.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,V.jsx)(On.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Wr(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Jr(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n){if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Wr(e))}}}),t}function Gr(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?kn(i,a):i.dispatchEvent(a)}var Kr=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function qr(e=()=>{}){let t=An(e);qn(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Jr(e){return e.nodeType===e.ELEMENT_NODE}function Yr(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Xr(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}var Zr=_r,Qr=Sr,$r=Ar,ei=Ir,ti=Rr,ni=Br,ri=Hr;function ii(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ii(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ai(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ii(e))&&(r&&(r+=` `),r+=t);return r}var oi=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,si=ai,ci=(e,t)=>n=>{if(t?.variants==null)return si(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=oi(t)||oi(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return si(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},li=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ui=(...e)=>e.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(` `),di={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`},fi=(0,b.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,b.createElement)(`svg`,{ref:c,...di,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ui(`lucide`,i),...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])),W=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(fi,{ref:i,iconNode:t,className:ui(`lucide-${li(e)}`,n),...r}));return n.displayName=`${e}`,n},pi=W(`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`}]]),mi=W(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),hi=W(`ArrowUpDown`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),gi=W(`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`}]]),_i=W(`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`}]]),vi=W(`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`}]]),yi=W(`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`}]]),bi=W(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),xi=W(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Si=W(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ci=W(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),wi=W(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ti=W(`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`}]]),Ei=W(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Di=W(`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`}]]),Oi=W(`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`}]]),ki=W(`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`}]]),Ai=W(`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`}]]),ji=W(`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`}]]),Mi=W(`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`}]]),Ni=W(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Pi=W(`Filter`,[[`polygon`,{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`,key:`1yg77f`}]]),Fi=W(`FlaskConical`,[[`path`,{d:`M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2`,key:`pzvekw`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}],[`path`,{d:`M7 16h10`,key:`wp8him`}]]),Ii=W(`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`}]]),Li=W(`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`}]]),Ri=W(`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`}]]),zi=W(`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`}]]),Bi=W(`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`}]]),Vi=W(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Hi=W(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ui=W(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Wi=W(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Gi=W(`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`}]]),Ki=W(`ScrollText`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),qi=W(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Ji=W(`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`}]]),Yi=W(`ShieldCheck`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Xi=W(`ShieldOff`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Zi=W(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Qi=W(`Star`,[[`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`,key:`8f66p6`}]]),$i=W(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ea=W(`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`}]]),ta=W(`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`}]]),na=W(`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`}]]),ra=W(`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`}]]),ia=W(`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`}]]),aa=W(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),oa=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},sa=(e,t)=>({classGroupId:e,validator:t}),ca=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),la=`-`,ua=[],da=`arbitrary..`,fa=e=>{let t=ha(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ma(e);let n=e.split(la);return pa(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?oa(i,t):t:i||ua}return n[e]||ua}}},pa=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=pa(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(la):e.slice(t).join(la),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},ma=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?da+r:void 0})(),ha=e=>{let{theme:t,classGroups:n}=e;return ga(n,t)},ga=(e,t)=>{let n=ca();for(let r in e){let i=e[r];_a(i,n,r,t)}return n},_a=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];va(i,t,n,r)}},va=(e,t,n,r)=>{if(typeof e==`string`){ya(e,t,n);return}if(typeof e==`function`){ba(e,t,n,r);return}xa(e,t,n,r)},ya=(e,t,n)=>{let r=e===``?t:Sa(t,e);r.classGroupId=n},ba=(e,t,n,r)=>{if(Ca(e)){_a(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(sa(n,e))},xa=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];_a(o,Sa(t,a),n,r)}},Sa=(e,t)=>{let n=e,r=t.split(la),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=ca(),n.nextPart.set(t,i)),n=i}return n},Ca=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,wa=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ta=`!`,Ea=`:`,Da=[],Oa=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),ka=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let c=e[s];if(n===0&&r===0){if(c===Ea){t.push(e.slice(i,s)),i=s+1;continue}if(c===`/`){a=s;continue}}if(c===`[`)n++;else if(c===`]`)n--;else if(c===`(`)r++;else if(c===`)`)r--;else if(c===`\\`)s++;else if(c===`"`||c===`'`)for(;++s<o;){let t=e[s];if(t===`\\`)s++;else if(t===c)break}}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ta)?(c=s.slice(0,-1),l=!0):s.startsWith(Ta)&&(c=s.slice(1),l=!0);let u=l&&s.startsWith(Ta)?1:0,d=a&&a>i?a-i-u:void 0;return Oa(t,l,c,d)};if(t){let e=t+Ea,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Oa(Da,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Aa=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ja=e=>({cache:wa(e.cacheSize),parseClassName:ka(e),sortModifiers:Aa(e),postfixLookupClassGroupIds:Ma(e),...fa(e)}),Ma=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Na=/\s+/,Pa=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Na),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ta:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Fa=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Ia(n))&&(i&&(i+=` `),i+=r);return i},Ia=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Ia(e[r]))&&(n&&(n+=` `),n+=t);return n},La=(e,...t)=>{let n,r,i,a,o=o=>(n=ja(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Pa(e,n);return i(e,a),a};return a=o,(...e)=>a(Fa(...e))},Ra=[],za=e=>{let t=t=>t[e]||Ra;return t.isThemeGetter=!0,t.themeKey=e,t},Ba=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Va=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ha=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ua=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wa=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|Q|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^--spacing\(.+\)|^0$/,Ga=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark|contrast-color|device-cmyk|--alpha)\(.+\)$/i,Ka=/^(?:_*[+-]?(?:\d|\.\d)|[\w-]+\(|_*(?:inherit|initial|revert(?:-layer)?|unset)_*$)/i,qa=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ja=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ya=e=>Ha.test(e),Xa=e=>!!e&&!Number.isNaN(Number(e)),Za=e=>!!e&&Number.isInteger(Number(e)),Qa=e=>e.endsWith(`%`)&&Xa(e.slice(0,-1)),$a=e=>Ua.test(e),eo=()=>!0,to=e=>Wa.test(e)&&!Ga.test(e),no=e=>Ka.test(e)&&!Ga.test(e),ro=()=>!1,io=e=>qa.test(e),ao=e=>Ja.test(e),oo=e=>!G(e)&&!K(e),so=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),co=e=>Eo(e,Ao,ro),G=e=>Ba.test(e),lo=e=>Eo(e,jo,to),uo=e=>Eo(e,Mo,no),fo=e=>Eo(e,No,Xa),po=e=>Eo(e,Fo,eo),mo=e=>Eo(e,Po,ro),ho=e=>Eo(e,Oo,ro),go=e=>Eo(e,ko,ao),_o=e=>Eo(e,Io,io),K=e=>Va.test(e),vo=e=>Do(e,jo),yo=e=>Do(e,Mo,!0),bo=e=>Do(e,Po),xo=e=>Do(e,Oo),So=e=>Do(e,Ao),Co=e=>Do(e,ko),wo=e=>Do(e,Io,!0),To=e=>Do(e,Fo,!0),Eo=(e,t,n)=>{let r=Ba.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Do=(e,t,n=!1)=>{let r=Va.exec(e);return r?r[1]?t(r[1]):n:!1},Oo=e=>e===`position`||e===`percentage`,ko=e=>e===`image`||e===`url`,Ao=e=>e===`length`||e===`size`||e===`bg-size`,jo=e=>e===`length`,Mo=e=>e!==`color`,No=e=>e===`number`,Po=e=>e===`family-name`,Fo=e=>e===`number`||e===`weight`,Io=e=>e===`shadow`,Lo=()=>{let e=za(`color`),t=za(`font`),n=za(`text`),r=za(`font-weight`),i=za(`tracking`),a=za(`leading`),o=za(`breakpoint`),s=za(`container`),c=za(`spacing`),l=za(`radius`),u=za(`shadow`),d=za(`inset-shadow`),f=za(`text-shadow`),p=za(`drop-shadow`),m=za(`blur`),h=za(`perspective`),g=za(`aspect`),_=za(`ease`),v=za(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),K,G],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[K,G,c],T=()=>[Ya,`full`,`auto`,...w()],E=()=>[Za,`none`,`subgrid`,K,G],D=()=>[`auto`,{span:[`full`,Za,K,G]},Za,K,G],O=()=>[Za,`auto`,K,G],k=()=>[`auto`,`min`,`max`,`fr`,K,G],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Ya,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[s,Ya,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Ya,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,K,G],L=()=>[...b(),xo,ho,{position:[K,G]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],te=()=>[`auto`,`cover`,`contain`,So,co,{size:[K,G]}],ne=()=>[Qa,vo,lo],R=()=>[``,`none`,`full`,l,K,G],z=()=>[``,Xa,vo,lo],B=()=>[`solid`,`dashed`,`dotted`,`double`],re=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ie=()=>[Xa,Qa,yo,uo],ae=()=>[``,`none`,m,K,G],oe=()=>[`none`,Xa,K,G],se=()=>[`none`,Xa,K,G],ce=()=>[Xa,K,G],le=()=>[Ya,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[$a],breakpoint:[$a],color:[eo],container:[$a],"drop-shadow":[$a],ease:[`in`,`out`,`in-out`],font:[oo],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[$a],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[$a],shadow:[$a],spacing:[`px`,Xa],text:[$a],"text-shadow":[$a],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Ya,G,K,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,K,G]}],"container-named":[so],columns:[{columns:[Xa,`auto`,G,K,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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`],sr:[`sr-only`],"not-sr":[`not-sr-only`],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:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Za,`auto`,K,G]}],basis:[{basis:[Ya,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Xa,Ya,`auto`,`initial`,`none`,K,G]}],grow:[{grow:[``,Xa,K,G]}],shrink:[{shrink:[``,Xa,K,G]}],order:[{order:[Za,`first`,`last`,`none`,K,G]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"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":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,`none`,...N()]}],"font-size":[{text:[`base`,n,vo,lo]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,To,po]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Qa,G]}],"font-family":[{font:[bo,mo,t]}],"font-features":[{"font-features":[G]}],"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:[i,K,G]}],"line-clamp":[{"line-clamp":[Xa,`none`,K,G]}],leading:[{leading:[`none`,a,...w()]}],"list-image":[{"list-image":[`none`,K,G]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,K,G]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[Xa,`from-font`,`auto`,vo,xo,lo]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Xa,`auto`,K,G]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Za,K,G]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,K,G]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,K,G]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:te()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Za,K,G],radial:[``,K,G],conic:[``,Za,K,G]},Co,go]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Xa,K,G]}],"outline-w":[{outline:[``,Xa,vo,lo]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`inner`,`none`,u,wo,_o]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,wo,_o]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Xa,lo]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,wo,_o]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Xa,K,G]}],"mix-blend":[{"mix-blend":[...re(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":re()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Xa]}],"mask-image-linear-from-pos":[{"mask-linear-from":ie()}],"mask-image-linear-to-pos":[{"mask-linear-to":ie()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":ie()}],"mask-image-t-to-pos":[{"mask-t-to":ie()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":ie()}],"mask-image-r-to-pos":[{"mask-r-to":ie()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":ie()}],"mask-image-b-to-pos":[{"mask-b-to":ie()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":ie()}],"mask-image-l-to-pos":[{"mask-l-to":ie()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":ie()}],"mask-image-x-to-pos":[{"mask-x-to":ie()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":ie()}],"mask-image-y-to-pos":[{"mask-y-to":ie()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[K,G]}],"mask-image-radial-from-pos":[{"mask-radial-from":ie()}],"mask-image-radial-to-pos":[{"mask-radial-to":ie()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{mask:[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Xa]}],"mask-image-conic-from-pos":[{"mask-conic-from":ie()}],"mask-image-conic-to-pos":[{"mask-conic-to":ie()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,K,G]}],filter:[{filter:[``,`none`,K,G]}],blur:[{blur:ae()}],brightness:[{brightness:[Xa,K,G]}],contrast:[{contrast:[Xa,K,G]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,wo,_o]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Xa,K,G]}],"hue-rotate":[{"hue-rotate":[Xa,K,G]}],invert:[{invert:[``,Xa,K,G]}],saturate:[{saturate:[Xa,K,G]}],sepia:[{sepia:[``,Xa,K,G]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,K,G]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[Xa,K,G]}],"backdrop-contrast":[{"backdrop-contrast":[Xa,K,G]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Xa,K,G]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xa,K,G]}],"backdrop-invert":[{"backdrop-invert":[``,Xa,K,G]}],"backdrop-opacity":[{"backdrop-opacity":[Xa,K,G]}],"backdrop-saturate":[{"backdrop-saturate":[Xa,K,G]}],"backdrop-sepia":[{"backdrop-sepia":[``,Xa,K,G]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,K,G]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Xa,`initial`,K,G]}],ease:[{ease:[`linear`,`initial`,_,K,G]}],delay:[{delay:[Xa,K,G]}],animate:[{animate:[`none`,v,K,G]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,K,G]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":[`scale-3d`],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[K,G,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":[`translate-none`],zoom:[{zoom:[Za,K,G]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],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`,K,G]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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`,K,G]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Xa,vo,lo,fo]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`start`,`end`,`right`,`left`],"inset-y":[`inset-bs`,`inset-be`,`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],"place-content":[`align-content`,`justify-content`],"place-items":[`align-items`,`justify-items`],"place-self":[`align-self`,`justify-self`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`ps`,`pe`,`pr`,`pl`],py:[`pbs`,`pbe`,`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`ms`,`me`,`mr`,`ml`],my:[`mbs`,`mbe`,`mt`,`mb`],size:[`w`,`h`],"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`],sr:`not-sr.position.size.w.h.p.px.py.ps.pe.pbs.pbe.pt.pr.pb.pl.m.mx.my.ms.me.mbs.mbe.mt.mr.mb.ml.overflow.overflow-x.overflow-y.whitespace`.split(`.`),"not-sr":[`sr`],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-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-s`,`border-w-e`,`border-w-r`,`border-w-l`],"border-w-y":[`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-s`,`border-color-e`,`border-color-r`,`border-color-l`],"border-color-y":[`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-b`],"mask-image-x-from-pos":[`mask-image-r-from-pos`,`mask-image-l-from-pos`],"mask-image-x-to-pos":[`mask-image-r-to-pos`,`mask-image-l-to-pos`],"mask-image-x-from-color":[`mask-image-r-from-color`,`mask-image-l-from-color`],"mask-image-x-to-color":[`mask-image-r-to-color`,`mask-image-l-to-color`],"mask-image-y-from-pos":[`mask-image-t-from-pos`,`mask-image-b-from-pos`],"mask-image-y-to-pos":[`mask-image-t-to-pos`,`mask-image-b-to-pos`],"mask-image-y-from-color":[`mask-image-t-from-color`,`mask-image-b-from-color`],"mask-image-y-to-color":[`mask-image-t-to-color`,`mask-image-b-to-color`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-ms`,`scroll-me`,`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-ps`,`scroll-pe`,`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}},Ro=(e,{cacheSize:t,prefix:n,experimentalParseClassName:r,extend:i={},override:a={}})=>(zo(e,`cacheSize`,t),zo(e,`prefix`,n),zo(e,`experimentalParseClassName`,r),Bo(e.theme,a.theme),Bo(e.classGroups,a.classGroups),Bo(e.conflictingClassGroups,a.conflictingClassGroups),Bo(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),zo(e,`postfixLookupClassGroups`,a.postfixLookupClassGroups),zo(e,`orderSensitiveModifiers`,a.orderSensitiveModifiers),Vo(e.theme,i.theme),Vo(e.classGroups,i.classGroups),Vo(e.conflictingClassGroups,i.conflictingClassGroups),Vo(e.conflictingClassGroupModifiers,i.conflictingClassGroupModifiers),Ho(e,i,`postfixLookupClassGroups`),Ho(e,i,`orderSensitiveModifiers`),e),zo=(e,t,n)=>{n!==void 0&&(e[t]=n)},Bo=(e,t)=>{if(t)for(let n in t)zo(e,n,t[n])},Vo=(e,t)=>{if(t)for(let n in t)Ho(e,t,n)},Ho=(e,t,n)=>{let r=t[n];r!==void 0&&(e[n]=e[n]?e[n].concat(r):r)},Uo=((e,...t)=>typeof e==`function`?La(Lo,e,...t):La(()=>Ro(Lo(),e),...t))({extend:{conflictingClassGroups:{"font-size":[`leading`]}}});function Wo(...e){return Uo(ai(e))}var Go=Zr,Ko=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Qr,{ref:n,className:Wo(`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}));Ko.displayName=Qr.displayName;var qo=ci(`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-(--radix-toast-swipe-end-x) data-[swipe=move]:translate-x-(--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 sm:data-[state=open]: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`}}),Jo=b.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)($r,{ref:r,className:Wo(qo({variant:t}),e),...n}));Jo.displayName=$r.displayName;var Yo=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ni,{ref:n,className:Wo(`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-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive`,e),...t}));Yo.displayName=ni.displayName;var Xo=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ri,{ref:n,className:Wo(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,V.jsx)(aa,{className:`h-4 w-4`})}));Xo.displayName=ri.displayName;var Zo=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ei,{ref:n,className:Wo(`text-sm font-semibold`,e),...t}));Zo.displayName=ei.displayName;var Qo=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ti,{ref:n,className:Wo(`text-sm opacity-90`,e),...t}));Qo.displayName=ti.displayName;function $o(){let{toasts:e}=dn();return(0,V.jsxs)(Go,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,V.jsxs)(Jo,{...i,children:[(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,V.jsx)(Zo,{children:t}),n&&(0,V.jsx)(Qo,{children:n})]}),r,(0,V.jsx)(Xo,{})]},e)}),(0,V.jsx)(Ko,{})]})}var es=b.useId||(()=>void 0),ts=0;function ns(e){let[t,n]=b.useState(es());return qn(()=>{e||n(e=>e??String(ts++))},[e]),e||(t?`radix-${t}`:``)}var rs=[`top`,`right`,`bottom`,`left`],is=Math.min,as=Math.max,os=Math.round,ss=Math.floor,cs=e=>({x:e,y:e}),ls={left:`right`,right:`left`,bottom:`top`,top:`bottom`},us={start:`end`,end:`start`};function ds(e,t,n){return as(e,is(t,n))}function fs(e,t){return typeof e==`function`?e(t):e}function ps(e){return e.split(`-`)[0]}function ms(e){return e.split(`-`)[1]}function hs(e){return e===`x`?`y`:`x`}function gs(e){return e===`y`?`height`:`width`}var _s=new Set([`top`,`bottom`]);function vs(e){return _s.has(ps(e))?`y`:`x`}function ys(e){return hs(vs(e))}function bs(e,t,n){n===void 0&&(n=!1);let r=ms(e),i=ys(e),a=gs(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ks(o)),[o,ks(o)]}function xs(e){let t=ks(e);return[Ss(e),t,Ss(t)]}function Ss(e){return e.replace(/start|end/g,e=>us[e])}var Cs=[`left`,`right`],ws=[`right`,`left`],Ts=[`top`,`bottom`],Es=[`bottom`,`top`];function Ds(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ws:Cs:t?Cs:ws;case`left`:case`right`:return t?Ts:Es;default:return[]}}function Os(e,t,n,r){let i=ms(e),a=Ds(ps(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ss)))),a}function ks(e){return e.replace(/left|right|bottom|top/g,e=>ls[e])}function As(e){return{top:0,right:0,bottom:0,left:0,...e}}function js(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:As(e)}function Ms(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ns(e,t,n){let{reference:r,floating:i}=e,a=vs(t),o=ys(t),s=gs(o),c=ps(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ms(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1)}return p}var Ps=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ns(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Ns(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function Fs(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=fs(t,e),p=js(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ms(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Ms(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Is=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=fs(e,t)||{};if(l==null)return{};let d=js(u),f={x:n,y:r},p=ys(i),m=gs(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=is(d[_],T),D=is(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ds(O,A,k),M=!c.arrow&&ms(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ls=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=fs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ps(r),_=vs(o),v=ps(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ks(o)]:xs(o)),x=p!==`none`;!d&&x&&b.push(...Os(o,m,p,y));let S=[o,...b],C=await Fs(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=bs(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===vs(t)||T.every(e=>vs(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=vs(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}};function Rs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zs(e){return rs.some(t=>e[t]>=0)}var Bs=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n}=t,{strategy:r=`referenceHidden`,...i}=fs(e,t);switch(r){case`referenceHidden`:{let e=Rs(await Fs(t,{...i,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:zs(e)}}}case`escaped`:{let e=Rs(await Fs(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:zs(e)}}}default:return{}}}}},Vs=new Set([`left`,`top`]);async function Hs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ps(n),s=ms(n),c=vs(n)===`y`,l=Vs.has(o)?-1:1,u=a&&c?-1:1,d=fs(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Us=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Hs(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ws=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=fs(e,t),l={x:n,y:r},u=await Fs(t,c),d=vs(ps(i)),f=hs(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=ds(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=ds(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},Gs=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=fs(e,t),u={x:n,y:r},d=vs(i),f=hs(d),p=u[f],m=u[d],h=fs(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Vs.has(ps(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ks=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=fs(e,t),u=await Fs(t,l),d=ps(i),f=ms(i),p=vs(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=is(h-u[g],v),x=is(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=as(u.left,0),t=as(u.right,0),n=as(u.top,0),r=as(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:as(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:as(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function qs(){return typeof window<`u`}function Js(e){return Zs(e)?(e.nodeName||``).toLowerCase():`#document`}function Ys(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xs(e){return((Zs(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Zs(e){return qs()?e instanceof Node||e instanceof Ys(e).Node:!1}function Qs(e){return qs()?e instanceof Element||e instanceof Ys(e).Element:!1}function $s(e){return qs()?e instanceof HTMLElement||e instanceof Ys(e).HTMLElement:!1}function ec(e){return!qs()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ys(e).ShadowRoot}var tc=new Set([`inline`,`contents`]);function nc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=hc(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!tc.has(i)}var rc=new Set([`table`,`td`,`th`]);function ic(e){return rc.has(Js(e))}var ac=[`:popover-open`,`:modal`];function oc(e){return ac.some(t=>{try{return e.matches(t)}catch{return!1}})}var sc=[`transform`,`translate`,`scale`,`rotate`,`perspective`],cc=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],lc=[`paint`,`layout`,`strict`,`content`];function uc(e){let t=fc(),n=Qs(e)?hc(e):e;return sc.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||cc.some(e=>(n.willChange||``).includes(e))||lc.some(e=>(n.contain||``).includes(e))}function dc(e){let t=_c(e);for(;$s(t)&&!mc(t);){if(uc(t))return t;if(oc(t))return null;t=_c(t)}return null}function fc(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var pc=new Set([`html`,`body`,`#document`]);function mc(e){return pc.has(Js(e))}function hc(e){return Ys(e).getComputedStyle(e)}function gc(e){return Qs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _c(e){if(Js(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||ec(e)&&e.host||Xs(e);return ec(t)?t.host:t}function vc(e){let t=_c(e);return mc(t)?e.ownerDocument?e.ownerDocument.body:e.body:$s(t)&&nc(t)?t:vc(t)}function yc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=vc(e),i=r===e.ownerDocument?.body,a=Ys(r);if(i){let e=bc(a);return t.concat(a,a.visualViewport||[],nc(r)?r:[],e&&n?yc(e):[])}return t.concat(r,yc(r,[],n))}function bc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xc(e){let t=hc(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=$s(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=os(n)!==a||os(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Sc(e){return Qs(e)?e:e.contextElement}function Cc(e){let t=Sc(e);if(!$s(t))return cs(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=xc(t),o=(a?os(n.width):n.width)/r,s=(a?os(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var wc=cs(0);function Tc(e){let t=Ys(e);return!fc()||!t.visualViewport?wc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ec(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ys(e)?!1:t}function Dc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Sc(e),o=cs(1);t&&(r?Qs(r)&&(o=Cc(r)):o=Cc(e));let s=Ec(a,n,r)?Tc(a):cs(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Ys(a),t=r&&Qs(r)?Ys(r):r,n=e,i=bc(n);for(;i&&r&&t!==n;){let e=Cc(i),t=i.getBoundingClientRect(),r=hc(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ys(i),i=bc(n)}}return Ms({width:u,height:d,x:c,y:l})}function Oc(e,t){let n=gc(e).scrollLeft;return t?t.left+n:Dc(Xs(e)).left+n}function kc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Oc(e,n),y:n.top+t.scrollTop}}function Ac(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Xs(r),s=t?oc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=cs(1),u=cs(0),d=$s(r);if((d||!d&&!a)&&((Js(r)!==`body`||nc(o))&&(c=gc(r)),$s(r))){let e=Dc(r);l=Cc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?kc(o,c):cs(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function jc(e){return Array.from(e.getClientRects())}function Mc(e){let t=Xs(e),n=gc(e),r=e.ownerDocument.body,i=as(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=as(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Oc(e),s=-n.scrollTop;return hc(r).direction===`rtl`&&(o+=as(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Nc=25;function Pc(e,t){let n=Ys(e),r=Xs(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=fc();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Oc(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Nc&&(a-=o)}else l<=Nc&&(a+=l);return{width:a,height:o,x:s,y:c}}var Fc=new Set([`absolute`,`fixed`]);function Ic(e,t){let n=Dc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$s(e)?Cc(e):cs(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Lc(e,t,n){let r;if(t===`viewport`)r=Pc(e,n);else if(t===`document`)r=Mc(Xs(e));else if(Qs(t))r=Ic(t,n);else{let n=Tc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ms(r)}function Rc(e,t){let n=_c(e);return n===t||!Qs(n)||mc(n)?!1:hc(n).position===`fixed`||Rc(n,t)}function zc(e,t){let n=t.get(e);if(n)return n;let r=yc(e,[],!1).filter(e=>Qs(e)&&Js(e)!==`body`),i=null,a=hc(e).position===`fixed`,o=a?_c(e):e;for(;Qs(o)&&!mc(o);){let t=hc(o),n=uc(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Fc.has(i.position)||nc(o)&&!n&&Rc(e,o))?r=r.filter(e=>e!==o):i=t,o=_c(o)}return t.set(e,r),r}function Bc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?oc(t)?[]:zc(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Lc(t,n,i);return e.top=as(r.top,e.top),e.right=is(r.right,e.right),e.bottom=is(r.bottom,e.bottom),e.left=as(r.left,e.left),e},Lc(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Vc(e){let{width:t,height:n}=xc(e);return{width:t,height:n}}function Hc(e,t,n){let r=$s(t),i=Xs(t),a=n===`fixed`,o=Dc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=cs(0);function l(){c.x=Oc(i)}if(r||!r&&!a){if((Js(t)!==`body`||nc(i))&&(s=gc(t)),r){let e=Dc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l()}a&&!r&&i&&l();let u=i&&!r&&!a?kc(i,s):cs(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Uc(e){return hc(e).position===`static`}function Wc(e,t){if(!$s(e)||hc(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Xs(e)===n&&(n=n.ownerDocument.body),n}function Gc(e,t){let n=Ys(e);if(oc(e))return n;if(!$s(e)){let t=_c(e);for(;t&&!mc(t);){if(Qs(t)&&!Uc(t))return t;t=_c(t)}return n}let r=Wc(e,t);for(;r&&ic(r)&&Uc(r);)r=Wc(r,t);return r&&mc(r)&&Uc(r)&&!uc(r)?n:r||dc(e)||n}var Kc=async function(e){let t=this.getOffsetParent||Gc,n=this.getDimensions,r=await n(e.floating);return{reference:Hc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qc(e){return hc(e).direction===`rtl`}var Jc={convertOffsetParentRelativeRectToViewportRelativeRect:Ac,getDocumentElement:Xs,getClippingRect:Bc,getOffsetParent:Gc,getElementRects:Kc,getClientRects:jc,getDimensions:Vc,getScale:Cc,isElement:Qs,isRTL:qc};function Yc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xc(e,t){let n=null,r,i=Xs(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=ss(d),h=ss(i.clientWidth-(u+f)),g=ss(i.clientHeight-(d+p)),_=ss(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:as(0,is(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Yc(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Zc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Sc(e),u=i||a?[...l?yc(l):[],...yc(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Xc(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Dc(e):null;c&&g();function g(){let t=Dc(e);h&&!Yc(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Qc=Us,$c=Ws,el=Ls,tl=Ks,nl=Bs,rl=Is,il=Gs,al=(e,t,n)=>{let r=new Map,i={platform:Jc,...n},a={...i.platform,_c:r};return Ps(e,t,{...i,platform:a})},ol=typeof document<`u`?b.useLayoutEffect:function(){};function sl(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,i;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(!sl(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!sl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function cl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ll(e,t){let n=cl(e);return Math.round(t*n)/n}function ul(e){let t=b.useRef(e);return ol(()=>{t.current=e}),t}function dl(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);sl(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=ul(c),O=ul(i),k=ul(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),al(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!sl(T.current,t)&&(T.current=t,fn.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);ol(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);ol(()=>(j.current=!0,()=>{j.current=!1}),[]),ol(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=ll(N.floating,u.x),r=ll(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...cl(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var fl=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:rl({element:r.current,padding:i}).fn(n):r?rl({element:r,padding:i}).fn(n):{}}}},pl=(e,t)=>({...Qc(e),options:[e,t]}),ml=(e,t)=>({...$c(e),options:[e,t]}),hl=(e,t)=>({...il(e),options:[e,t]}),gl=(e,t)=>({...el(e),options:[e,t]}),_l=(e,t)=>({...tl(e),options:[e,t]}),vl=(e,t)=>({...nl(e),options:[e,t]}),yl=(e,t)=>({...fl(e),options:[e,t]}),bl=`Arrow`,xl=b.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(On.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});xl.displayName=bl;var Sl=xl;function Cl(e){let[t,n]=b.useState(void 0);return qn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}var wl=`Popper`,[Tl,El]=_n(wl),[Dl,Ol]=Tl(wl),kl=e=>{let{__scopePopper:t,children:n}=e,[r,i]=b.useState(null);return(0,V.jsx)(Dl,{scope:t,anchor:r,onAnchorChange:i,children:n})};kl.displayName=wl;var Al=`PopperAnchor`,jl=b.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Ol(Al,n),o=b.useRef(null),s=hn(t,o),c=b.useRef(null);return b.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,V.jsx)(On.div,{...i,ref:s})});jl.displayName=Al;var Ml=`PopperContent`,[Nl,Pl]=Tl(Ml),Fl=b.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Ol(Ml,n),[_,v]=b.useState(null),y=hn(t,e=>v(e)),[x,S]=b.useState(null),C=Cl(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(zl),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=dl({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>Zc(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[pl({mainAxis:i+T,alignmentAxis:o}),c&&ml({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?hl():void 0,...A}),c&&gl({...A}),_l({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&yl({element:x,padding:s}),Bl({arrowWidth:w,arrowHeight:T}),f&&vl({strategy:`referenceHidden`,...A})]}),[I,L]=Vl(N),ee=An(m);qn(()=>{P&&ee?.()},[P,ee]);let te=F.arrow?.x,ne=F.arrow?.y,R=F.arrow?.centerOffset!==0,[z,B]=b.useState();return qn(()=>{_&&B(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:z,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(Nl,{scope:n,placedSide:I,onArrowChange:S,arrowX:te,arrowY:ne,shouldHideArrow:R,children:(0,V.jsx)(On.div,{"data-side":I,"data-align":L,...h,ref:y,style:{...h.style,animation:P?void 0:`none`}})})})});Fl.displayName=Ml;var Il=`PopperArrow`,Ll={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Rl=b.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Pl(Il,n),a=Ll[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(Sl,{...r,ref:t,style:{...r.style,display:`block`}})})});Rl.displayName=Il;function zl(e){return e!==null}var Bl=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Vl(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Vl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Hl=kl,Ul=jl,Wl=Fl,Gl=Rl,[Kl,ql]=_n(`Tooltip`,[El]),Jl=El(),Yl=`TooltipProvider`,Xl=700,Zl=`tooltip.open`,[Ql,$l]=Kl(Yl),eu=e=>{let{__scopeTooltip:t,delayDuration:n=Xl,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(Ql,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};eu.displayName=Yl;var tu=`Tooltip`,[nu,ru]=Kl(tu),iu=`TooltipTrigger`,au=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=ru(iu,n),a=$l(iu,n),o=Jl(n),s=hn(t,b.useRef(null),i.onTriggerChange),c=b.useRef(!1),l=b.useRef(!1),u=b.useCallback(()=>c.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(Ul,{asChild:!0,...o,children:(0,V.jsx)(On.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:U(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:U(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:U(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:U(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:U(e.onBlur,i.onClose),onClick:U(e.onClick,i.onClose)})})});au.displayName=iu;var[ou,su]=Kl(`TooltipPortal`,{forceMount:void 0}),cu=`TooltipContent`,lu=b.forwardRef((e,t)=>{let n=su(cu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=ru(cu,e.__scopeTooltip);return(0,V.jsx)(Zn,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(mu,{side:i,...a,ref:t}):(0,V.jsx)(uu,{side:i,...a,ref:t})})}),uu=b.forwardRef((e,t)=>{let n=ru(cu,e.__scopeTooltip),r=$l(cu,e.__scopeTooltip),i=b.useRef(null),a=hn(t,i),[o,s]=b.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=b.useCallback(()=>{s(null),d(!1)},[d]),p=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=vu(r,_u(r,n.getBoundingClientRect())),a=yu(t.getBoundingClientRect()),o=xu([...i,...a]);s(o),d(!0)},[d]);return b.useEffect(()=>()=>f(),[f]),b.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!bu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(mu,{...e,ref:a})}),[du,fu]=Kl(tu,{isInside:!1}),pu=Cn(`TooltipContent`),mu=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=ru(cu,n),l=Jl(n),{onClose:u}=c;return b.useEffect(()=>(document.addEventListener(Zl,u),()=>document.removeEventListener(Zl,u)),[u]),b.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(Rn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(Wl,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.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:[(0,V.jsx)(pu,{children:r}),(0,V.jsx)(du,{scope:n,isInside:!0,children:(0,V.jsx)(cr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});lu.displayName=cu;var hu=`TooltipArrow`,gu=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Jl(n);return fu(hu,n).isInside?null:(0,V.jsx)(Gl,{...i,...r,ref:t})});gu.displayName=hu;function _u(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function vu(e,t,n=5){let 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})}return r}function yu(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function bu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function xu(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Su(t)}function Su(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}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 Cu=eu,wu=lu,Tu=Cu,Eu=b.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(wu,{ref:r,sideOffset:t,className:Wo(`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}));Eu.displayName=wu.displayName;var Du={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 Ou(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))}:Du}var ku=[`/api/usage/cards`],Au=864e5;function ju(){return Kt({queryKey:[...ku],staleTime:6e4})}function Mu(e,t){return`${e}:${t}`}function Nu(e){let t=new Map;for(let n of e??[])t.set(Mu(n.cardType,n.cardId),n);return t}function Pu(e,t){let n=Date.parse(e.windowEnd);if(Number.isNaN(n))return null;let r=[];if(t!==void 0){let e=Date.parse(t);Number.isNaN(e)||r.push(Math.floor((n-e)/Au))}if(e.observedSince!==null){let t=Date.parse(e.observedSince);Number.isNaN(t)||r.push(Math.floor((n-t)/Au))}return r.length===0?null:Math.max(Math.min(...r),0)}function Fu(e,t){switch(e.category){case`popular`:return`Popular · ${e.usageCount} uses in 30 days`;case`used`:return`Used · ${e.usageCount} uses in 30 days`;case`unused`:return`Unused · 0 uses in 30 days`;case`new`:{let n=Pu(e,t);return n===null?`New`:`New · tracking for ${n} days`}}}function Iu(e,t,n){if(t==="default"||!n)return[...e];let r=t===`most-used`;return e.map((e,t)=>({item:e,index:t})).sort((e,t)=>{let n=e.item.usageCount,i=t.item.usageCount;return typeof n==`number`&&typeof i==`number`?n===i?e.index-t.index:r?i-n:n-i:typeof n==`number`?-1:typeof i==`number`?1:e.index-t.index}).map(({item:e})=>e)}function Lu(e,t){let n=t.searchQuery.toLowerCase(),{typeFilter:r,warningsOnly:i,warnings:a}=t,o=(e,t)=>i?e===`service`?a.serviceWarnings.has(t):e===`credential`?a.credentialWarnings.has(t):a.playbookWarnings.has(t):!0,s=[];for(let i of e.playbooks)o(`playbook`,i.id)&&(r&&r!==`all`&&r!==`playbook`||(i.title.toLowerCase().includes(n)||i.body.toLowerCase().includes(n))&&s.push({kind:`playbook`,id:i.id,usageCount:t.getUsageCount(`playbook`,i.id)}));for(let i of e.credentials)o(`credential`,i.id)&&(r&&r!==`all`&&r!==`api-key`||i.label.toLowerCase().includes(n)&&s.push({kind:`credential`,id:i.id,usageCount:t.getUsageCount(`credential`,i.id)}));for(let i of e.services){if(!o(`service`,i.id)||r===`api-key`||r===`playbook`)continue;let e=i.name.toLowerCase().includes(n)||(i.description?.toLowerCase().includes(n)??!1),a=!r||r===`all`||i.type===r;e&&a&&s.push({kind:`service`,id:i.id,usageCount:t.getUsageCount(`service`,i.id)})}return s}var Ru=`#92E4DD`,zu=`#F9386D`,Bu=`#FFFFFF`,Vu=`bg-linear-to-b from-gray-900 via-gray-800 to-gray-900`;function Hu(e){return Ru}function Uu(e){return{borderColor:e,color:e,boxShadow:`0 0 20px ${e}20`}}var Wu=ci(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden 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`}}),q=b.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,V.jsx)(r?bn:`button`,{className:Wo(Wu({variant:t,size:n,className:e})),ref:a,...i}));q.displayName=`Button`;function Gu({warnings:e}){if(!e?.length)return null;let t=e.find(e=>e.severity===`error`)??e[0],n=t.severity===`error`;return(0,V.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(e=>e.message).join(` · `),"data-testid":`card-warning-badge`,children:[(0,V.jsx)(ta,{className:`h-2.5 w-2.5 shrink-0`}),(0,V.jsx)(`span`,{className:`max-w-[72px] truncate`,children:t.message})]})}var Ku=`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 qu(e){return e.iconUrl?e.iconUrl:null}function Ju({service:e}){let t=Hu(e),n=qu(e),[r,i]=(0,b.useState)(!1);return n&&!r?(0,V.jsx)(`img`,{src:n,alt:``,className:`w-7 h-7 object-contain rounded-sm`,draggable:!1,onError:()=>i(!0)}):(0,V.jsx)(`div`,{style:{width:28,height:28,backgroundColor:t,WebkitMask:`url(${Ku}) no-repeat center / contain`,mask:`url(${Ku}) no-repeat center / contain`},"aria-hidden":!0})}function Yu({usage:e,createdAt:t,color:n}){if(!e)return null;let r=Fu(e,t);if(e.category===`new`)return(0,V.jsx)(`span`,{role:`img`,"aria-label":r,title:r,"data-testid":`card-usage-mark`,"data-category":`new`,className:`text-[7px] font-semibold uppercase leading-none tracking-wide opacity-60`,style:{color:n},children:`New`});let i=e.category===`popular`?3:1,a=e.category===`unused`;return(0,V.jsx)(`span`,{role:`img`,"aria-label":r,title:r,"data-testid":`card-usage-mark`,"data-category":e.category,className:`inline-flex items-center gap-px opacity-60`,style:{color:n,transform:`scale(0.75)`,transformOrigin:`top right`},children:Array.from({length:i}).map((e,t)=>(0,V.jsx)(Qi,{"aria-hidden":!0,className:`h-2 w-2 shrink-0`,fill:a?`none`:`currentColor`,strokeWidth:a?2.5:2},t))})}function Xu({usage:e,createdAt:t,color:n,onDelete:r,deleteTitle:i}){let a=e?Fu(e,t):null,o=a?`${a} · ${i}`:i;return(0,V.jsxs)(`div`,{"data-testid":`card-action-area`,className:`absolute top-1 right-1 z-10 flex h-5 min-w-5 items-start justify-end group/action`,children:[e?(0,V.jsx)(`span`,{"data-testid":`card-usage-slot`,className:`transition-opacity duration-200 group-hover/action:opacity-0 group-focus-within/action:opacity-0 group-hover/action:pointer-events-none`,children:(0,V.jsx)(Yu,{usage:e,createdAt:t,color:n})}):null,(0,V.jsx)(`span`,{"data-testid":`card-delete-slot`,className:`absolute right-0 top-0 opacity-0 pointer-events-none transition-opacity duration-200 group-hover/action:opacity-100 group-hover/action:pointer-events-auto group-focus-within/action:opacity-100 group-focus-within/action:pointer-events-auto focus-within:opacity-100 focus-within:pointer-events-auto`,children:(0,V.jsx)(q,{size:`sm`,variant:`destructive`,className:`h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400`,onClick:r,title:o,"aria-label":o,children:(0,V.jsx)(ea,{className:`w-3 h-3`})})})]})}function Zu(e){return e?`ring-2 ring-inset ring-yellow-400/90 shadow-[0_0_10px_rgba(250,204,21,0.2)]`:``}function Qu(){return(0,V.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-sm`,children:`In deck`})}function $u({service:e,onDragStart:t,onDragEnd:n,isInActiveDeck:r,onCardClick:i,isInCollection:a=!1,onMouseEnter:o,onMouseLeave:s,activeDeck:c,warnings:l,usage:u}){let d=we(),{toast:f}=dn(),p=Hu(e),m=qt({mutationFn:async()=>{if(!c)throw Error(`No active deck found`);return H(`POST`,`/api/decks/${c.id}/services`,{serviceId:e.id,position:0})},onSuccess:()=>{d.invalidateQueries({queryKey:[`/api/decks`]}),f({title:`Service added to deck`,description:`${e.name} has been added to your active deck.`})},onError:e=>{f({title:`Failed to add service`,description:e.message,variant:`destructive`})}}),h=qt({mutationFn:async()=>H(`DELETE`,`/api/services/${e.id}`,{}),onSuccess:()=>{d.invalidateQueries({queryKey:[`/api/services`]}),d.invalidateQueries({queryKey:[`/api/collection/warnings`]}),d.invalidateQueries({queryKey:[...ku]}),d.invalidateQueries({queryKey:[`/api/decks`]}),f({title:`Service deleted`,description:`${e.name} has been deleted successfully.`})},onError:e=>{f({title:`Failed to delete service`,description:e.message,variant:`destructive`})}});return(0,V.jsx)(`div`,{className:`relative group cursor-pointer`,draggable:!r,onDragStart:n=>t(n,e),onDragEnd:n,onClick:()=>i?.(e),"data-testid":`card-${e.id}`,onMouseEnter:o,onMouseLeave:s,children:(0,V.jsxs)(`div`,{className:`
|
|
10
|
+
w-32 h-48 aspect-2/3 rounded-lg border-2 p-3
|
|
11
|
+
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
12
|
+
bg-linear-to-b from-gray-900 via-gray-800 to-gray-900
|
|
13
|
+
relative overflow-hidden
|
|
14
|
+
${Zu(r)}
|
|
15
|
+
${a?`hover:scale-110 hover:rotate-0`:`hover:scale-105`}
|
|
16
|
+
`,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[(0,V.jsx)(Gu,{warnings:l}),r&&(0,V.jsx)(Qu,{}),(0,V.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:p},children:e.type===`mcp`?`RM`:e.type===`local-mcp`?`LM`:`A`})}),(0,V.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:p},children:e.type===`mcp`?`RM`:e.type===`local-mcp`?`LM`:`A`})}),(0,V.jsx)(Xu,{usage:u,createdAt:e.registeredAt,color:p,onDelete:t=>{t.stopPropagation(),window.confirm(`Are you sure you want to delete ${e.name}? This action cannot be undone.`)&&h.mutate()},deleteTitle:`Delete ${e.name}`}),(0,V.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`mb-2`,style:{color:p},children:(0,V.jsx)(Ju,{service:e})}),(0,V.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}),(0,V.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`})]}),(0,V.jsx)(`div`,{className:`absolute bottom-6 inset-x-1`,children:(0,V.jsx)(q,{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:e=>{e.stopPropagation(),m.mutate()},disabled:r||m.isPending,"data-testid":`button-add-to-deck-${e.id}`,children:r?`IN DECK`:`ADD`})}),(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-lg bg-linear-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none`})]})})}var ed=(0,b.memo)($u);function td(e){return e.iconUrl?e.iconUrl:null}function nd({credential:e,color:t}){let n=td(e);return n?(0,V.jsx)(`img`,{src:n,alt:``,className:`h-7 w-7 object-contain rounded-sm`,draggable:!1}):(0,V.jsx)(Li,{className:`h-7 w-7`,strokeWidth:2.25,style:{color:t}})}function rd({credential:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:i,onDragEnd:a,onMouseEnter:o,onMouseLeave:s,onCardClick:c,warnings:l,usage:u}){let d=we(),{toast:f}=dn(),p=zu,m=qt({mutationFn:async()=>{if(!n)throw Error(`No active deck found`);return H(`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:e=>{f({title:`Failed to add to deck`,description:e.message,variant:`destructive`})}}),h=qt({mutationFn:async()=>H(`DELETE`,`/api/credentials/${e.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:[`/api/credentials/vault`]}),d.invalidateQueries({queryKey:[...ku]}),d.invalidateQueries({queryKey:[`/api/decks`]}),d.invalidateQueries({queryKey:[`/api/decks`]}),f({title:`API key removed`,description:`${e.label} was deleted from your vault.`})},onError:e=>{f({title:`Failed to remove API key`,description:e.message,variant:`destructive`})}});return(0,V.jsx)(`div`,{className:`relative group cursor-pointer`,draggable:!t&&!!i,onDragStart:i?t=>i(t,e):void 0,onDragEnd:a,onClick:()=>c?.(e),"data-testid":`card-${e.id}`,onMouseEnter:o,onMouseLeave:s,children:(0,V.jsxs)(`div`,{className:`
|
|
17
|
+
w-32 h-48 aspect-2/3 rounded-lg border-2 p-3
|
|
18
|
+
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
19
|
+
bg-linear-to-b from-gray-900 via-gray-800 to-gray-900
|
|
20
|
+
relative overflow-hidden
|
|
21
|
+
${Zu(t)}
|
|
22
|
+
${r?`hover:scale-110 hover:rotate-0`:`hover:scale-105`}
|
|
23
|
+
`,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[(0,V.jsx)(Gu,{warnings:l}),t&&(0,V.jsx)(Qu,{}),(0,V.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:p},children:`AK`})}),(0,V.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:p},children:`AK`})}),(0,V.jsx)(Xu,{usage:u,createdAt:e.createdAt,color:p,onDelete:t=>{t.stopPropagation(),window.confirm(`Remove ${e.label} from your vault?`)&&h.mutate()},deleteTitle:`Remove ${e.label}`}),(0,V.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`mb-2`,style:{color:p},children:(0,V.jsx)(nd,{credential:e,color:p})}),(0,V.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}),(0,V.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`})]}),(0,V.jsx)(`div`,{className:`absolute bottom-6 inset-x-1`,children:(0,V.jsx)(q,{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:e=>{e.stopPropagation(),m.mutate()},disabled:t||m.isPending||!n,"data-testid":`button-add-to-deck-${e.id}`,children:t?`IN DECK`:`ADD`})}),(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-lg bg-linear-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none`})]})})}var id=(0,b.memo)(rd);function ad({playbook:e,isInActiveDeck:t,activeDeck:n,isInCollection:r=!0,onDragStart:i,onDragEnd:a,onMouseEnter:o,onMouseLeave:s,onCardClick:c,warnings:l,usage:u}){let d=we(),{toast:f}=dn(),p=Bu,m=e.dependsOnCredentialIds.length+e.dependsOnServiceIds.length,h=qt({mutationFn:async()=>{if(!n)throw Error(`No deck selected`);return H(`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:e=>{f({title:`Failed to add playbook`,description:e.message,variant:`destructive`})}}),g=qt({mutationFn:async()=>H(`DELETE`,`/api/playbooks/${e.id}`),onSuccess:()=>{d.invalidateQueries({queryKey:[`/api/playbooks/vault`]}),d.invalidateQueries({queryKey:[...ku]}),d.invalidateQueries({queryKey:[`/api/decks`]}),f({title:`Playbook deleted`,description:`${e.title} was removed from your collection.`})},onError:e=>{f({title:`Failed to delete playbook`,description:e.message,variant:`destructive`})}});return(0,V.jsx)(`div`,{className:`relative group cursor-pointer`,draggable:!t&&!!i,onDragStart:i?t=>i(t,e):void 0,onDragEnd:a,onClick:()=>c?.(e),"data-testid":`card-${e.id}`,onMouseEnter:o,onMouseLeave:s,children:(0,V.jsxs)(`div`,{className:`
|
|
24
|
+
w-32 h-48 aspect-2/3 rounded-lg border-2 p-3
|
|
25
|
+
transform transition-all duration-300 shadow-lg hover:shadow-2xl
|
|
26
|
+
bg-linear-to-b from-gray-900 via-gray-800 to-gray-900
|
|
27
|
+
relative overflow-hidden
|
|
28
|
+
${Zu(t)}
|
|
29
|
+
${r?`hover:scale-110 hover:rotate-0`:`hover:scale-105`}
|
|
30
|
+
`,style:{borderColor:p,boxShadow:`0 0 20px ${p}20`},children:[(0,V.jsx)(Gu,{warnings:l}),t&&(0,V.jsx)(Qu,{}),(0,V.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:p},children:`PB`})}),(0,V.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:p},children:`PB`})}),(0,V.jsx)(Xu,{usage:u,createdAt:e.createdAt,color:p,onDelete:t=>{t.stopPropagation(),window.confirm(`Delete playbook "${e.title}"?`)&&g.mutate()},deleteTitle:`Delete ${e.title}`}),(0,V.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`mb-2`,style:{color:p},children:(0,V.jsx)(_i,{className:`h-7 w-7`,strokeWidth:2.25})}),(0,V.jsx)(`h3`,{className:`font-bold text-xs mb-1 line-clamp-2`,style:{color:p},children:e.title}),(0,V.jsxs)(`div`,{className:`text-[8px] px-1 py-0.5 rounded border opacity-70`,style:{color:p,borderColor:p},children:[`Playbook`,m>0?` · ${m} deps`:``]})]}),(0,V.jsx)(`div`,{className:`absolute bottom-6 inset-x-1`,children:(0,V.jsx)(q,{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:e=>{e.stopPropagation(),h.mutate()},disabled:t||h.isPending||!n,children:t?`IN DECK`:`ADD`})}),(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-lg bg-linear-to-br from-transparent via-white/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none`})]})})}var od=(0,b.memo)(ad),sd=64,cd=4,ld=12,ud=1.08;function dd(e=ld,t=ud){let n=e*Math.PI/180,r=128*Math.sin(n)+192*Math.cos(n);return Math.ceil(r*t)+8}var fd=dd();function pd(e,t=48){return e===0?0:128+Math.max(0,e-1)*(128-t)}function md(e=10,t=48,n=12){return pd(e,t)+2*n}function hd(e,t=48){return pd(e,t)+24}var gd=md();function _d(e,t,n,r=ld){let i=t+n/2,a=n/2;if(a<=0)return 0;let o=(e-i)/a;return Math.max(-r,Math.min(r,o*r))}function vd(e){return{flexShrink:0,marginLeft:e===0?0:`-48px`}}function yd(e,t,n){return n===e?999999:t-e}function bd({cardCount:e,children:t}){let n=(0,b.useRef)(null),r=(0,b.useRef)([]),i=(0,b.useRef)(0),a=(0,b.useRef)(void 0),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),g=(0,b.useRef)(!1),_=(0,b.useRef)(!1),[v,y]=(0,b.useState)(null),x=(0,b.useRef)(null);x.current=v;let S=(0,b.useCallback)(()=>{let t=n.current;if(!t)return;let i=t.getBoundingClientRect(),a=x.current;r.current.forEach((t,n)=>{if(!t)return;let r=t.getBoundingClientRect(),o=r.left+r.width/2,s=a===n?0:_d(o,i.left,i.width),c=a===n?ud:1;t.style.transform=`rotate(${s}deg) scale(${c})`,t.style.transformOrigin=`center center`,t.style.zIndex=String(yd(n,e,a))})},[e]),C=(0,b.useCallback)(e=>{let t=n.current;t&&t.scrollBy({left:e===`left`?-80:80,behavior:`smooth`})},[]),w=(0,b.useCallback)(()=>{let t=n.current;if(!t)return;let r=hd(e,48)>t.clientWidth+2;s(r),l(r&&t.scrollLeft>4),d(r&&t.scrollLeft+t.clientWidth<t.scrollWidth-4),S()},[e,S]);(0,b.useLayoutEffect)(()=>{let e=n.current;if(!e)return;w();let t=new ResizeObserver(w);return t.observe(e),e.addEventListener(`scroll`,w,{passive:!0}),()=>{t.disconnect(),e.removeEventListener(`scroll`,w)}},[e,w]),(0,b.useEffect)(()=>{let e=()=>{let t=n.current,r=i.current;if(t&&r!==0){t.scrollLeft+=r,S();let e=t.scrollLeft>4,n=t.scrollLeft+t.clientWidth<t.scrollWidth-4;l(e),d(n)}let o=r<0,s=r>0;o!==g.current&&(g.current=o,p(o)),s!==_.current&&(_.current=s,h(s)),a.current=requestAnimationFrame(e)};return a.current=requestAnimationFrame(e),()=>{a.current!==void 0&&cancelAnimationFrame(a.current)}},[S]);let T=e=>{let t=n.current;if(!t||!o){i.current=0;return}let r=t.getBoundingClientRect(),a=e.clientX-r.left;if(a<sd&&c){let e=1-a/sd;i.current=-(cd+e*10)}else if(a>r.width-sd&&u){let e=1-(r.width-a)/sd;i.current=cd+e*10}else i.current=0;S()},E=()=>{i.current=0,g.current=!1,_.current=!1,p(!1),h(!1)};if((0,b.useLayoutEffect)(()=>{r.current.length=e,S()},[e,v,S]),e===0)return(0,V.jsx)(V.Fragment,{children:t});let D=(e,t)=>`absolute ${e===`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 ${t?`scale-110`:`scale-100`}`;return(0,V.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:T,onMouseLeave:E,children:[o&&c&&(0,V.jsx)(`button`,{type:`button`,className:D(`left`,f),"aria-label":`Scroll deck left`,"data-testid":`deck-scroll-left`,onClick:()=>C(`left`),children:(0,V.jsx)(Si,{className:`h-6 w-6`,strokeWidth:2.5})}),o&&u&&(0,V.jsx)(`button`,{type:`button`,className:D(`right`,m),"aria-label":`Scroll deck right`,"data-testid":`deck-scroll-right`,onClick:()=>C(`right`),children:(0,V.jsx)(Ci,{className:`h-6 w-6`,strokeWidth:2.5})}),(0,V.jsx)(`div`,{ref:n,className:`max-w-full overflow-x-auto overflow-y-visible [-ms-overflow-style:none] scrollbar-none [&::-webkit-scrollbar]:hidden`,style:{width:gd,maxWidth:`100%`},children:(0,V.jsx)(`div`,{className:`flex items-center justify-start isolate group/fan`,style:{minHeight:fd,paddingLeft:12,paddingRight:12},children:b.Children.map(t,(e,t)=>(0,V.jsx)(`div`,{ref:e=>{r.current[t]=e},className:`relative flex items-center justify-center transition-[transform,box-shadow] duration-500 will-change-transform`,style:{...vd(t),minHeight:fd},onMouseEnter:()=>y(t),onMouseLeave:()=>y(null),children:e},e&&typeof e==`object`&&`key`in e?e.key:t))})})]})}var xd=b.forwardRef(({className:e,type:t,...n},r)=>(0,V.jsx)(`input`,{type:t,className:Wo(`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-hidden 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}));xd.displayName=`Input`;var Sd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getParsedType=e.ZodParsedType=e.objectUtil=e.util=void 0;var t;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(t||(e.util=t={}));var n;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(n||(e.objectUtil=n={})),e.ZodParsedType=t.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),e.getParsedType=t=>{switch(typeof t){case`undefined`:return e.ZodParsedType.undefined;case`string`:return e.ZodParsedType.string;case`number`:return Number.isNaN(t)?e.ZodParsedType.nan:e.ZodParsedType.number;case`boolean`:return e.ZodParsedType.boolean;case`function`:return e.ZodParsedType.function;case`bigint`:return e.ZodParsedType.bigint;case`symbol`:return e.ZodParsedType.symbol;case`object`:return Array.isArray(t)?e.ZodParsedType.array:t===null?e.ZodParsedType.null:t.then&&typeof t.then==`function`&&t.catch&&typeof t.catch==`function`?e.ZodParsedType.promise:typeof Map<`u`&&t instanceof Map?e.ZodParsedType.map:typeof Set<`u`&&t instanceof Set?e.ZodParsedType.set:typeof Date<`u`&&t instanceof Date?e.ZodParsedType.date:e.ZodParsedType.object;default:return e.ZodParsedType.unknown}}})),Cd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ZodError=e.quotelessJson=e.ZodIssueCode=void 0;var t=Sd();e.ZodIssueCode=t.util.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),e.quotelessJson=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var n=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};e.ZodError=n,n.create=e=>new n(e)})),wd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Cd(),n=Sd();e.default=(e,r)=>{let i;switch(e.code){case t.ZodIssueCode.invalid_type:i=e.received===n.ZodParsedType.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case t.ZodIssueCode.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,n.util.jsonStringifyReplacer)}`;break;case t.ZodIssueCode.unrecognized_keys:i=`Unrecognized key(s) in object: ${n.util.joinValues(e.keys,`, `)}`;break;case t.ZodIssueCode.invalid_union:i=`Invalid input`;break;case t.ZodIssueCode.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${n.util.joinValues(e.options)}`;break;case t.ZodIssueCode.invalid_enum_value:i=`Invalid enum value. Expected ${n.util.joinValues(e.options)}, received '${e.received}'`;break;case t.ZodIssueCode.invalid_arguments:i=`Invalid function arguments`;break;case t.ZodIssueCode.invalid_return_type:i=`Invalid function return type`;break;case t.ZodIssueCode.invalid_date:i=`Invalid date`;break;case t.ZodIssueCode.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:n.util.assertNever(e.validation):i=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case t.ZodIssueCode.too_small:i=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case t.ZodIssueCode.too_big:i=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case t.ZodIssueCode.custom:i=`Invalid input`;break;case t.ZodIssueCode.invalid_intersection_types:i=`Intersection results could not be merged`;break;case t.ZodIssueCode.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case t.ZodIssueCode.not_finite:i=`Number must be finite`;break;default:i=r.defaultError,n.util.assertNever(e)}return{message:i}}})),Td=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.defaultErrorMap=void 0,e.setErrorMap=i,e.getErrorMap=a;var n=t(wd());e.defaultErrorMap=n.default;var r=n.default;function i(e){r=e}function a(){return r}})),Ed=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAsync=e.isValid=e.isDirty=e.isAborted=e.OK=e.DIRTY=e.INVALID=e.ParseStatus=e.EMPTY_PATH=e.makeIssue=void 0,e.addIssueToContext=i;var n=Td(),r=t(wd());e.makeIssue=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},e.EMPTY_PATH=[];function i(t,i){let a=(0,n.getErrorMap)(),o=(0,e.makeIssue)({issueData:i,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,a,a===r.default?void 0:r.default].filter(e=>!!e)});t.common.issues.push(o)}e.ParseStatus=class t{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(t,n){let r=[];for(let i of n){if(i.status===`aborted`)return e.INVALID;i.status===`dirty`&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return t.mergeObjectSync(e,r)}static mergeObjectSync(t,n){let r={};for(let i of n){let{key:n,value:a}=i;if(n.status===`aborted`||a.status===`aborted`)return e.INVALID;n.status===`dirty`&&t.dirty(),a.status===`dirty`&&t.dirty(),n.value!==`__proto__`&&(a.value!==void 0||i.alwaysSet)&&(r[n.value]=a.value)}return{status:t.value,value:r}}},e.INVALID=Object.freeze({status:`aborted`}),e.DIRTY=e=>({status:`dirty`,value:e}),e.OK=e=>({status:`valid`,value:e}),e.isAborted=e=>e.status===`aborted`,e.isDirty=e=>e.status===`dirty`,e.isValid=e=>e.status===`valid`,e.isAsync=e=>typeof Promise<`u`&&e instanceof Promise})),Dd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),Od=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.errorUtil=void 0;var t;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(t||(e.errorUtil=t={}))})),kd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.discriminatedUnion=e.date=e.boolean=e.bigint=e.array=e.any=e.coerce=e.ZodFirstPartyTypeKind=e.late=e.ZodSchema=e.Schema=e.ZodReadonly=e.ZodPipeline=e.ZodBranded=e.BRAND=e.ZodNaN=e.ZodCatch=e.ZodDefault=e.ZodNullable=e.ZodOptional=e.ZodTransformer=e.ZodEffects=e.ZodPromise=e.ZodNativeEnum=e.ZodEnum=e.ZodLiteral=e.ZodLazy=e.ZodFunction=e.ZodSet=e.ZodMap=e.ZodRecord=e.ZodTuple=e.ZodIntersection=e.ZodDiscriminatedUnion=e.ZodUnion=e.ZodObject=e.ZodArray=e.ZodVoid=e.ZodNever=e.ZodUnknown=e.ZodAny=e.ZodNull=e.ZodUndefined=e.ZodSymbol=e.ZodDate=e.ZodBoolean=e.ZodBigInt=e.ZodNumber=e.ZodString=e.ZodType=void 0,e.NEVER=e.void=e.unknown=e.union=e.undefined=e.tuple=e.transformer=e.symbol=e.string=e.strictObject=e.set=e.record=e.promise=e.preprocess=e.pipeline=e.ostring=e.optional=e.onumber=e.oboolean=e.object=e.number=e.nullable=e.null=e.never=e.nativeEnum=e.nan=e.map=e.literal=e.lazy=e.intersection=e.instanceof=e.function=e.enum=e.effect=void 0,e.datetimeRegex=A,e.custom=Pe;var t=Cd(),n=Td(),r=Od(),i=Ed(),a=Sd(),o=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},s=(e,n)=>{if((0,i.isValid)(n))return{success:!0,data:n.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let n=new t.ZodError(e.common.issues);return this._error=n,this._error}}};function c(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var l=class{get description(){return this._def.description}_getType(e){return(0,a.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,a.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new i.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,a.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,i.isAsync)(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,a.getParsedType)(e)};return s(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,a.getParsedType)(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return(0,i.isValid)(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>(0,i.isValid)(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,a.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n});return s(n,await((0,i.isAsync)(r)?r:Promise.resolve(r)))}refine(e,n){let r=e=>typeof n==`string`||n===void 0?{message:n}:typeof n==`function`?n(e):n;return this._refinement((n,i)=>{let a=e(n),o=()=>i.addIssue({code:t.ZodIssueCode.custom,...r(n)});return typeof Promise<`u`&&a instanceof Promise?a.then(e=>e?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new we({schema:this,typeName:Fe.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return Te.create(this,this._def)}nullable(){return Ee.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oe.create(this)}promise(){return Ce.create(this,this._def)}or(e){return le.create([this,e],this._def)}and(e){return pe.create(this,e,this._def)}transform(e){return new we({...c(this._def),schema:this,typeName:Fe.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new De({...c(this._def),innerType:this,defaultValue:t,typeName:Fe.ZodDefault})}brand(){return new Ae({typeName:Fe.ZodBranded,type:this,...c(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Oe({...c(this._def),innerType:this,catchValue:t,typeName:Fe.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return je.create(this,e)}readonly(){return Me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};e.ZodType=l,e.Schema=l,e.ZodSchema=l;var u=/^c[^\s-]{8,}$/i,d=/^[0-9a-z]+$/,f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,p=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,m=/^[a-z0-9_-]{21}$/i,h=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,g=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,v=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,y,b=/^(?:(?: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])$/,x=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,S=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,C=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,w=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,T=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,E=`((\\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])))`,D=RegExp(`^${E}$`);function O(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function k(e){return RegExp(`^${O(e)}$`)}function A(e){let t=`${E}T${O(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function j(e,t){return!((t!==`v4`&&t||!b.test(e))&&(t!==`v6`&&t||!S.test(e)))}function M(e,t){if(!h.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function N(e,t){return!((t!==`v4`&&t||!x.test(e))&&(t!==`v6`&&t||!C.test(e)))}var P=class e extends l{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==a.ZodParsedType.string){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.string,received:n.parsedType}),i.INVALID}let n=new i.ParseStatus,r;for(let o of this._def.checks)if(o.kind===`min`)e.data.length<o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:o.value,type:`string`,inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind===`max`)e.data.length>o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:o.value,type:`string`,inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind===`length`){let a=e.data.length>o.value,s=e.data.length<o.value;(a||s)&&(r=this._getOrReturnCtx(e,r),a?(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:o.value,type:`string`,inclusive:!0,exact:!0,message:o.message}):s&&(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:o.value,type:`string`,inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind===`email`)_.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`email`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`emoji`)y||=new RegExp(v,`u`),y.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`emoji`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`uuid`)p.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`uuid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`nanoid`)m.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`nanoid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`cuid`)u.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`cuid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`cuid2`)d.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`cuid2`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`ulid`)f.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`ulid`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind===`url`)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`url`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()}else o.kind===`regex`?(o.regex.lastIndex=0,o.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`regex`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty())):o.kind===`trim`?e.data=e.data.trim():o.kind===`includes`?e.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind===`toLowerCase`?e.data=e.data.toLowerCase():o.kind===`toUpperCase`?e.data=e.data.toUpperCase():o.kind===`startsWith`?e.data.startsWith(o.value)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind===`endsWith`?e.data.endsWith(o.value)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind===`datetime`?A(o).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:`datetime`,message:o.message}),n.dirty()):o.kind===`date`?D.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:`date`,message:o.message}),n.dirty()):o.kind===`time`?k(o).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_string,validation:`time`,message:o.message}),n.dirty()):o.kind===`duration`?g.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`duration`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`ip`?j(e.data,o.version)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`ip`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`jwt`?M(e.data,o.alg)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`jwt`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`cidr`?N(e.data,o.version)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`cidr`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`base64`?w.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`base64`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind===`base64url`?T.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{validation:`base64url`,code:t.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):a.util.assertNever(o);return{status:n.value,value:e.data}}_regex(e,n,i){return this.refinement(t=>e.test(t),{validation:n,code:t.ZodIssueCode.invalid_string,...r.errorUtil.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...r.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...r.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...r.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...r.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...r.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...r.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...r.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...r.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...r.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...r.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...r.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...r.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...r.errorUtil.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...r.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...r.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...r.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...r.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...r.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...r.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...r.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...r.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...r.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...r.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,r.errorUtil.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};e.ZodString=P,P.create=e=>new P({checks:[],typeName:Fe.ZodString,coerce:e?.coerce??!1,...c(e)});function F(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var I=class e extends l{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==a.ZodParsedType.number){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.number,received:n.parsedType}),i.INVALID}let n,r=new i.ParseStatus;for(let o of this._def.checks)o.kind===`int`?a.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:`integer`,received:`float`,message:o.message}),r.dirty()):o.kind===`min`?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_small,minimum:o.value,type:`number`,inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind===`max`?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_big,maximum:o.value,type:`number`,inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind===`multipleOf`?F(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind===`finite`?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.not_finite,message:o.message}),r.dirty()):a.util.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,r.errorUtil.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,r.errorUtil.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,r.errorUtil.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,r.errorUtil.toString(t))}setLimit(t,n,i,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:r.errorUtil.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:r.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:r.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:r.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:r.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:r.errorUtil.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:r.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&a.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};e.ZodNumber=I,I.create=e=>new I({checks:[],typeName:Fe.ZodNumber,coerce:e?.coerce||!1,...c(e)});var L=class e extends l{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==a.ZodParsedType.bigint)return this._getInvalidInput(e);let n,r=new i.ParseStatus;for(let o of this._def.checks)o.kind===`min`?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_small,type:`bigint`,minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind===`max`?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_big,type:`bigint`,maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind===`multipleOf`?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):a.util.assertNever(o);return{status:r.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.bigint,received:n.parsedType}),i.INVALID}gte(e,t){return this.setLimit(`min`,e,!0,r.errorUtil.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,r.errorUtil.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,r.errorUtil.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,r.errorUtil.toString(t))}setLimit(t,n,i,a){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:r.errorUtil.toString(a)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:r.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:r.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:r.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:r.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:r.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};e.ZodBigInt=L,L.create=e=>new L({checks:[],typeName:Fe.ZodBigInt,coerce:e?.coerce??!1,...c(e)});var ee=class extends l{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==a.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.boolean,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodBoolean=ee,ee.create=e=>new ee({typeName:Fe.ZodBoolean,coerce:e?.coerce||!1,...c(e)});var te=class e extends l{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==a.ZodParsedType.date){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.date,received:n.parsedType}),i.INVALID}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_date}),i.INVALID}let n=new i.ParseStatus,r;for(let o of this._def.checks)o.kind===`min`?e.data.getTime()<o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:`date`}),n.dirty()):o.kind===`max`?e.data.getTime()>o.value&&(r=this._getOrReturnCtx(e,r),(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:`date`}),n.dirty()):a.util.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:r.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:r.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};e.ZodDate=te,te.create=e=>new te({checks:[],coerce:e?.coerce||!1,typeName:Fe.ZodDate,...c(e)});var ne=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.symbol,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodSymbol=ne,ne.create=e=>new ne({typeName:Fe.ZodSymbol,...c(e)});var R=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.undefined,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodUndefined=R,R.create=e=>new R({typeName:Fe.ZodUndefined,...c(e)});var z=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.null,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodNull=z,z.create=e=>new z({typeName:Fe.ZodNull,...c(e)});var B=class extends l{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,i.OK)(e.data)}};e.ZodAny=B,B.create=e=>new B({typeName:Fe.ZodAny,...c(e)});var re=class extends l{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,i.OK)(e.data)}};e.ZodUnknown=re,re.create=e=>new re({typeName:Fe.ZodUnknown,...c(e)});var ie=class extends l{_parse(e){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.never,received:n.parsedType}),i.INVALID}};e.ZodNever=ie,ie.create=e=>new ie({typeName:Fe.ZodNever,...c(e)});var ae=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.void,received:n.parsedType}),i.INVALID}return(0,i.OK)(e.data)}};e.ZodVoid=ae,ae.create=e=>new ae({typeName:Fe.ZodVoid,...c(e)});var oe=class e extends l{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==a.ZodParsedType.array)return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.array,received:n.parsedType}),i.INVALID;if(s.exactLength!==null){let e=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(e||a)&&((0,i.addIssueToContext)(n,{code:e?t.ZodIssueCode.too_big:t.ZodIssueCode.too_small,minimum:a?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&((0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_small,minimum:s.minLength.value,type:`array`,inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&((0,i.addIssueToContext)(n,{code:t.ZodIssueCode.too_big,maximum:s.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((e,t)=>s.type._parseAsync(new o(n,e,n.path,t)))).then(e=>i.ParseStatus.mergeArray(r,e));let c=[...n.data].map((e,t)=>s.type._parseSync(new o(n,e,n.path,t)));return i.ParseStatus.mergeArray(r,c)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:r.errorUtil.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:r.errorUtil.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:r.errorUtil.toString(n)}})}nonempty(e){return this.min(1,e)}};e.ZodArray=oe,oe.create=(e,t)=>new oe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Fe.ZodArray,...c(t)});function se(e){if(e instanceof ce){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=Te.create(se(r))}return new ce({...e._def,shape:()=>t})}return e instanceof oe?new oe({...e._def,type:se(e.element)}):e instanceof Te?Te.create(se(e.unwrap())):e instanceof Ee?Ee.create(se(e.unwrap())):e instanceof me?me.create(e.items.map(e=>se(e))):e}var ce=class e extends l{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=a.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==a.ZodParsedType.object){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.object,received:n.parsedType}),i.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof ie&&this._def.unknownKeys===`strip`))for(let e in r.data)c.includes(e)||l.push(e);let u=[];for(let e of c){let t=s[e],n=r.data[e];u.push({key:{status:`valid`,value:e},value:t._parse(new o(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof ie){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of l)u.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)l.length>0&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.unrecognized_keys,keys:l}),n.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of l){let n=r.data[t];u.push({key:{status:`valid`,value:t},value:e._parse(new o(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of u){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>i.ParseStatus.mergeObjectSync(n,e)):i.ParseStatus.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return r.errorUtil.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let i=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:r.errorUtil.errToObj(t).message??i}:{message:i}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Fe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of a.util.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of a.util.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return se(this)}partial(t){let n={};for(let e of a.util.objectKeys(this.shape)){let r=this.shape[e];n[e]=t&&!t[e]?r:r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of a.util.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Te;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return xe(a.util.objectKeys(this.shape))}};e.ZodObject=ce,ce.create=(e,t)=>new ce({shape:()=>e,unknownKeys:`strip`,catchall:ie.create(),typeName:Fe.ZodObject,...c(t)}),ce.strictCreate=(e,t)=>new ce({shape:()=>e,unknownKeys:`strict`,catchall:ie.create(),typeName:Fe.ZodObject,...c(t)}),ce.lazycreate=(e,t)=>new ce({shape:e,unknownKeys:`strip`,catchall:ie.create(),typeName:Fe.ZodObject,...c(t)});var le=class extends l{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function a(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let t of e)if(t.result.status===`dirty`)return n.common.issues.push(...t.ctx.common.issues),t.result;let r=e.map(e=>new t.ZodError(e.ctx.common.issues));return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_union,unionErrors:r}),i.INVALID}if(n.common.async)return Promise.all(r.map(async e=>{let t={...n,common:{...n.common,issues:[]},parent:null};return{result:await e._parseAsync({data:n.data,path:n.path,parent:t}),ctx:t}})).then(a);{let e,a=[];for(let t of r){let r={...n,common:{...n.common,issues:[]},parent:null},i=t._parseSync({data:n.data,path:n.path,parent:r});if(i.status===`valid`)return i;i.status===`dirty`&&!e&&(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return n.common.issues.push(...e.ctx.common.issues),e.result;let o=a.map(e=>new t.ZodError(e));return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_union,unionErrors:o}),i.INVALID}}get options(){return this._def.options}};e.ZodUnion=le,le.create=(e,t)=>new le({options:e,typeName:Fe.ZodUnion,...c(t)});var ue=e=>e instanceof ye?ue(e.schema):e instanceof we?ue(e.innerType()):e instanceof be?[e.value]:e instanceof Se?e.options:e instanceof V?a.util.objectValues(e.enum):e instanceof De?ue(e._def.innerType):e instanceof R?[void 0]:e instanceof z?[null]:e instanceof Te?[void 0,...ue(e.unwrap())]:e instanceof Ee?[null,...ue(e.unwrap())]:e instanceof Ae||e instanceof Me?ue(e.unwrap()):e instanceof Oe?ue(e._def.innerType):[],de=class e extends l{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==a.ZodParsedType.object)return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.object,received:n.parsedType}),i.INVALID;let r=this.discriminator,o=n.data[r],s=this.optionsMap.get(o);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):((0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),i.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=ue(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:Fe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...c(r)})}};e.ZodDiscriminatedUnion=de;function fe(e,t){let n=(0,a.getParsedType)(e),r=(0,a.getParsedType)(t);if(e===t)return{valid:!0,data:e};if(n===a.ZodParsedType.object&&r===a.ZodParsedType.object){let n=a.util.objectKeys(t),r=a.util.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=fe(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}if(n===a.ZodParsedType.array&&r===a.ZodParsedType.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fe(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===a.ZodParsedType.date&&r===a.ZodParsedType.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var pe=class extends l{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),a=(e,a)=>{if((0,i.isAborted)(e)||(0,i.isAborted)(a))return i.INVALID;let o=fe(e.value,a.value);return o.valid?(((0,i.isDirty)(e)||(0,i.isDirty)(a))&&n.dirty(),{status:n.value,value:o.data}):((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_intersection_types}),i.INVALID)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};e.ZodIntersection=pe,pe.create=(e,t,n)=>new pe({left:e,right:t,typeName:Fe.ZodIntersection,...c(n)});var me=class e extends l{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.array)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.array,received:r.parsedType}),i.INVALID;if(r.data.length<this._def.items.length)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),i.INVALID;!this._def.rest&&r.data.length>this._def.items.length&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),n.dirty());let s=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new o(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(s).then(e=>i.ParseStatus.mergeArray(n,e)):i.ParseStatus.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};e.ZodTuple=me,me.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new me({items:e,typeName:Fe.ZodTuple,rest:null,...c(t)})};var he=class e extends l{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.object)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.object,received:r.parsedType}),i.INVALID;let s=[],c=this._def.keyType,l=this._def.valueType;for(let e in r.data)s.push({key:c._parse(new o(r,e,r.path,e)),value:l._parse(new o(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?i.ParseStatus.mergeObjectAsync(n,s):i.ParseStatus.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof l?new e({keyType:t,valueType:n,typeName:Fe.ZodRecord,...c(r)}):new e({keyType:P.create(),valueType:t,typeName:Fe.ZodRecord,...c(n)})}};e.ZodRecord=he;var ge=class extends l{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.map)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.map,received:r.parsedType}),i.INVALID;let s=this._def.keyType,c=this._def.valueType,l=[...r.data.entries()].map(([e,t],n)=>({key:s._parse(new o(r,e,r.path,[n,`key`])),value:c._parse(new o(r,t,r.path,[n,`value`]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let t of l){let r=await t.key,a=await t.value;if(r.status===`aborted`||a.status===`aborted`)return i.INVALID;(r.status===`dirty`||a.status===`dirty`)&&n.dirty(),e.set(r.value,a.value)}return{status:n.value,value:e}})}{let e=new Map;for(let t of l){let r=t.key,a=t.value;if(r.status===`aborted`||a.status===`aborted`)return i.INVALID;(r.status===`dirty`||a.status===`dirty`)&&n.dirty(),e.set(r.value,a.value)}return{status:n.value,value:e}}}};e.ZodMap=ge,ge.create=(e,t,n)=>new ge({valueType:t,keyType:e,typeName:Fe.ZodMap,...c(n)});var _e=class e extends l{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.set)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.set,received:r.parsedType}),i.INVALID;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_small,minimum:s.minSize.value,type:`set`,inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&((0,i.addIssueToContext)(r,{code:t.ZodIssueCode.too_big,maximum:s.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let c=this._def.valueType;function l(e){let t=new Set;for(let r of e){if(r.status===`aborted`)return i.INVALID;r.status===`dirty`&&n.dirty(),t.add(r.value)}return{status:n.value,value:t}}let u=[...r.data.values()].map((e,t)=>c._parse(new o(r,e,r.path,t)));return r.common.async?Promise.all(u).then(e=>l(e)):l(u)}min(t,n){return new e({...this._def,minSize:{value:t,message:r.errorUtil.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:r.errorUtil.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};e.ZodSet=_e,_e.create=(e,t)=>new _e({valueType:e,minSize:null,maxSize:null,typeName:Fe.ZodSet,...c(t)});var ve=class e extends l{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==a.ZodParsedType.function)return(0,i.addIssueToContext)(r,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.function,received:r.parsedType}),i.INVALID;function o(e,a){return(0,i.makeIssue)({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,n.getErrorMap)(),n.defaultErrorMap].filter(e=>!!e),issueData:{code:t.ZodIssueCode.invalid_arguments,argumentsError:a}})}function s(e,a){return(0,i.makeIssue)({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,n.getErrorMap)(),n.defaultErrorMap].filter(e=>!!e),issueData:{code:t.ZodIssueCode.invalid_return_type,returnTypeError:a}})}let c={errorMap:r.common.contextualErrorMap},l=r.data;if(this._def.returns instanceof Ce){let e=this;return(0,i.OK)(async function(...n){let r=new t.ZodError([]),i=await e._def.args.parseAsync(n,c).catch(e=>{throw r.addIssue(o(n,e)),r}),a=await Reflect.apply(l,this,i);return await e._def.returns._def.type.parseAsync(a,c).catch(e=>{throw r.addIssue(s(a,e)),r})})}{let e=this;return(0,i.OK)(function(...n){let r=e._def.args.safeParse(n,c);if(!r.success)throw new t.ZodError([o(n,r.error)]);let i=Reflect.apply(l,this,r.data),a=e._def.returns.safeParse(i,c);if(!a.success)throw new t.ZodError([s(i,a.error)]);return a.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:me.create(t).rest(re.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||me.create([]).rest(re.create()),returns:n||re.create(),typeName:Fe.ZodFunction,...c(r)})}};e.ZodFunction=ve;var ye=class extends l{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};e.ZodLazy=ye,ye.create=(e,t)=>new ye({getter:e,typeName:Fe.ZodLazy,...c(t)});var be=class extends l{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{received:n.data,code:t.ZodIssueCode.invalid_literal,expected:this._def.value}),i.INVALID}return{status:`valid`,value:e.data}}get value(){return this._def.value}};e.ZodLiteral=be,be.create=(e,t)=>new be({value:e,typeName:Fe.ZodLiteral,...c(t)});function xe(e,t){return new Se({values:e,typeName:Fe.ZodEnum,...c(t)})}var Se=class e extends l{_parse(e){if(typeof e.data!=`string`){let n=this._getOrReturnCtx(e),r=this._def.values;return(0,i.addIssueToContext)(n,{expected:a.util.joinValues(r),received:n.parsedType,code:t.ZodIssueCode.invalid_type}),i.INVALID}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return(0,i.addIssueToContext)(n,{received:n.data,code:t.ZodIssueCode.invalid_enum_value,options:r}),i.INVALID}return(0,i.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};e.ZodEnum=Se,Se.create=xe;var V=class extends l{_parse(e){let n=a.util.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==a.ZodParsedType.string&&r.parsedType!==a.ZodParsedType.number){let e=a.util.objectValues(n);return(0,i.addIssueToContext)(r,{expected:a.util.joinValues(e),received:r.parsedType,code:t.ZodIssueCode.invalid_type}),i.INVALID}if(this._cache||=new Set(a.util.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=a.util.objectValues(n);return(0,i.addIssueToContext)(r,{received:r.data,code:t.ZodIssueCode.invalid_enum_value,options:e}),i.INVALID}return(0,i.OK)(e.data)}get enum(){return this._def.values}};e.ZodNativeEnum=V,V.create=(e,t)=>new V({values:e,typeName:Fe.ZodNativeEnum,...c(t)});var Ce=class extends l{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==a.ZodParsedType.promise&&n.common.async===!1)return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.promise,received:n.parsedType}),i.INVALID;let r=n.parsedType===a.ZodParsedType.promise?n.data:Promise.resolve(n.data);return(0,i.OK)(r.then(e=>this._def.type.parseAsync(e,{path:n.path,errorMap:n.common.contextualErrorMap})))}};e.ZodPromise=Ce,Ce.create=(e,t)=>new Ce({type:e,typeName:Fe.ZodPromise,...c(t)});var we=class extends l{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:e=>{(0,i.addIssueToContext)(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),r.type===`preprocess`){let e=r.transform(n.data,o);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return i.INVALID;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?i.INVALID:r.status===`dirty`||t.value===`dirty`?(0,i.DIRTY)(r.value):r});{if(t.value===`aborted`)return i.INVALID;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?i.INVALID:r.status===`dirty`||t.value===`dirty`?(0,i.DIRTY)(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,o);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?i.INVALID:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?i.INVALID:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`){if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,i.isValid)(e))return i.INVALID;let a=r.transform(e.value,o);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>(0,i.isValid)(e)?Promise.resolve(r.transform(e.value,o)).then(e=>({status:t.value,value:e})):i.INVALID)}a.util.assertNever(r)}};e.ZodEffects=we,e.ZodTransformer=we,we.create=(e,t,n)=>new we({schema:e,typeName:Fe.ZodEffects,effect:t,...c(n)}),we.createWithPreprocess=(e,t,n)=>new we({schema:t,effect:{type:`preprocess`,transform:e},typeName:Fe.ZodEffects,...c(n)});var Te=class extends l{_parse(e){return this._getType(e)===a.ZodParsedType.undefined?(0,i.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodOptional=Te,Te.create=(e,t)=>new Te({innerType:e,typeName:Fe.ZodOptional,...c(t)});var Ee=class extends l{_parse(e){return this._getType(e)===a.ZodParsedType.null?(0,i.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};e.ZodNullable=Ee,Ee.create=(e,t)=>new Ee({innerType:e,typeName:Fe.ZodNullable,...c(t)});var De=class extends l{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===a.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};e.ZodDefault=De,De.create=(e,t)=>new De({innerType:e,typeName:Fe.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...c(t)});var Oe=class extends l{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return(0,i.isAsync)(a)?a.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new t.ZodError(r.common.issues)},input:r.data})})):{status:`valid`,value:a.status===`valid`?a.value:this._def.catchValue({get error(){return new t.ZodError(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};e.ZodCatch=Oe,Oe.create=(e,t)=>new Oe({innerType:e,typeName:Fe.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...c(t)});var ke=class extends l{_parse(e){if(this._getType(e)!==a.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,i.addIssueToContext)(n,{code:t.ZodIssueCode.invalid_type,expected:a.ZodParsedType.nan,received:n.parsedType}),i.INVALID}return{status:`valid`,value:e.data}}};e.ZodNaN=ke,ke.create=e=>new ke({typeName:Fe.ZodNaN,...c(e)}),e.BRAND=Symbol(`zod_brand`);var Ae=class extends l{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};e.ZodBranded=Ae;var je=class e extends l{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?i.INVALID:e.status===`dirty`?(t.dirty(),(0,i.DIRTY)(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?i.INVALID:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Fe.ZodPipeline})}};e.ZodPipeline=je;var Me=class extends l{_parse(e){let t=this._def.innerType._parse(e),n=e=>((0,i.isValid)(e)&&(e.value=Object.freeze(e.value)),e);return(0,i.isAsync)(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};e.ZodReadonly=Me,Me.create=(e,t)=>new Me({innerType:e,typeName:Fe.ZodReadonly,...c(t)});function Ne(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function Pe(e,t={},n){return e?B.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Ne(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Ne(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):B.create()}e.late={object:ce.lazycreate};var Fe;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})(Fe||(e.ZodFirstPartyTypeKind=Fe={})),e.instanceof=(e,t={message:`Input not instance of ${e.name}`})=>Pe(t=>t instanceof e,t);var Ie=P.create;e.string=Ie;var Le=I.create;e.number=Le,e.nan=ke.create,e.bigint=L.create;var Re=ee.create;e.boolean=Re,e.date=te.create,e.symbol=ne.create,e.undefined=R.create,e.null=z.create,e.any=B.create,e.unknown=re.create,e.never=ie.create,e.void=ae.create,e.array=oe.create,e.object=ce.create,e.strictObject=ce.strictCreate,e.union=le.create,e.discriminatedUnion=de.create,e.intersection=pe.create,e.tuple=me.create,e.record=he.create,e.map=ge.create,e.set=_e.create,e.function=ve.create,e.lazy=ye.create,e.literal=be.create,e.enum=Se.create,e.nativeEnum=V.create,e.promise=Ce.create;var ze=we.create;e.effect=ze,e.transformer=ze,e.optional=Te.create,e.nullable=Ee.create,e.preprocess=we.createWithPreprocess,e.pipeline=je.create,e.ostring=()=>Ie().optional(),e.onumber=()=>Le().optional(),e.oboolean=()=>Re().optional(),e.coerce={string:(e=>P.create({...e,coerce:!0})),number:(e=>I.create({...e,coerce:!0})),boolean:(e=>ee.create({...e,coerce:!0})),bigint:(e=>L.create({...e,coerce:!0})),date:(e=>te.create({...e,coerce:!0}))},e.NEVER=i.INVALID})),Ad=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Td(),e),n(Ed(),e),n(Dd(),e),n(Sd(),e),n(kd(),e),n(Cd(),e)})),jd=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.z=void 0;var a=r(Ad());e.z=a,i(Ad(),e),e.default=a})),Md=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LocalMCPServerProcessSchema=e.MCPServersManifestSchema=e.LocalMCPServerConfigSchema=e.ServiceCallResultSchema=e.ServiceToolErrorDetailsSchema=e.UpdateServiceToolSettingsSchema=e.ServiceToolSchema=e.ServiceCallSchema=e.UpdateServiceSchema=e.CreateServiceSchema=e.ServiceSchema=void 0;var t=jd();e.ServiceSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1,`Name is required`),type:t.z.enum([`mcp`,`a2a`,`local-mcp`]),url:t.z.string().url(`Valid URL is required`),health:t.z.enum([`unknown`,`healthy`,`unhealthy`]).default(`unknown`),description:t.z.string().optional(),cardColor:t.z.string().regex(/^#[0-9A-F]{6}$/i,`Valid hex color required`).default(`#92E4DD`),iconUrl:t.z.string().optional(),disabledToolNames:t.z.array(t.z.string()).default([]),isConnected:t.z.boolean().default(!1),lastPing:t.z.string().datetime().optional(),registeredAt:t.z.string().datetime(),updatedAt:t.z.string().datetime(),headers:t.z.record(t.z.string()).optional(),credentialId:t.z.string().optional(),oauthClientId:t.z.string().optional(),oauthClientSecret:t.z.string().optional(),oauthAuthorizationUrl:t.z.string().url().optional(),oauthTokenUrl:t.z.string().url().optional(),oauthRedirectUri:t.z.string().url().optional(),oauthScope:t.z.string().optional(),oauthAccessToken:t.z.string().optional(),oauthRefreshToken:t.z.string().optional(),oauthTokenExpiresAt:t.z.string().datetime().optional(),oauthHasToken:t.z.boolean().optional(),oauthState:t.z.string().optional(),localCommand:t.z.string().optional(),localArgs:t.z.array(t.z.string()).optional(),localWorkingDir:t.z.string().optional(),localEnv:t.z.record(t.z.string()).optional()}),e.CreateServiceSchema=e.ServiceSchema.omit({id:!0,health:!0,isConnected:!0,lastPing:!0,registeredAt:!0,updatedAt:!0,oauthAccessToken:!0,oauthRefreshToken:!0,oauthTokenExpiresAt:!0,oauthState:!0,disabledToolNames:!0}),e.UpdateServiceSchema=e.CreateServiceSchema.partial(),e.ServiceCallSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),toolName:t.z.string().min(1,`Tool name is required`),arguments:t.z.record(t.z.any()).optional()}),e.ServiceToolSchema=t.z.object({name:t.z.string().min(1,`Tool name is required`),title:t.z.string().optional(),description:t.z.string().min(1,`Tool description is required`),inputSchema:t.z.record(t.z.any()),enabled:t.z.boolean().optional()}),e.UpdateServiceToolSettingsSchema=t.z.object({disabledTools:t.z.array(t.z.string())}),e.ServiceToolErrorDetailsSchema=t.z.object({service_id:t.z.string(),service_name:t.z.string(),remote_url:t.z.string(),tool_name:t.z.string().optional(),cause:t.z.string(),phase:t.z.enum([`connect`,`discoverTools`,`callTool`]),hint:t.z.string().optional()}),e.ServiceCallResultSchema=t.z.object({success:t.z.boolean(),result:t.z.any().optional(),error:t.z.string().optional(),error_code:t.z.enum([`MCP_TRANSPORT_ERROR`,`MCP_AUTH_ERROR`,`MCP_TOOL_ERROR`,`MCP_CONNECTION_ERROR`]).optional(),details:e.ServiceToolErrorDetailsSchema.optional(),serviceName:t.z.string().optional(),toolName:t.z.string().optional()}),e.LocalMCPServerConfigSchema=t.z.object({command:t.z.string().min(1,`Command is required`),args:t.z.array(t.z.string()).optional().default([]),workingDir:t.z.string().optional(),env:t.z.record(t.z.string()).optional()}),e.MCPServersManifestSchema=t.z.object({mcpServers:t.z.record(t.z.string(),e.LocalMCPServerConfigSchema)}),e.LocalMCPServerProcessSchema=t.z.object({id:t.z.string(),serviceId:t.z.string(),process:t.z.any(),isRunning:t.z.boolean(),startTime:t.z.date(),lastActivity:t.z.date(),capabilities:t.z.object({tools:t.z.array(e.ServiceToolSchema),resources:t.z.array(t.z.any()),prompts:t.z.array(t.z.string())}).optional()})})),Nd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExecRunSchema=e.RemoveCredentialFromDeckSchema=e.AddCredentialToDeckSchema=e.DeckCredentialSchema=e.RotateCredentialSchema=e.UpdateCredentialSchema=e.CreateCredentialSimpleSchema=e.CreateCredentialSchema=e.CredentialSchema=e.CredentialSchemeSchema=e.CredentialIdSchema=void 0;var t=jd();e.CredentialIdSchema=t.z.string().regex(/^cred_[a-z0-9_]+$/,`Credential id must match cred_<slug> (lowercase letters, numbers, underscores)`),e.CredentialSchemeSchema=t.z.enum([`bearer`,`header`,`http_basic_user`]),e.CredentialSchema=t.z.object({id:e.CredentialIdSchema,label:t.z.string().min(1,`Label is required`),scheme:e.CredentialSchemeSchema,headerName:t.z.string().optional(),envName:t.z.string().regex(/^[A-Z_][A-Z0-9_]*$/,`env_name must be a valid environment variable name`),keychainAccount:t.z.string().min(1),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().url().optional(),iconUrl:t.z.string().optional(),hasSecret:t.z.boolean().default(!1),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreateCredentialSchema=t.z.object({id:e.CredentialIdSchema,label:t.z.string().min(1,`Label is required`),scheme:e.CredentialSchemeSchema.default(`bearer`),headerName:t.z.string().optional(),envName:t.z.string().regex(/^[A-Z_][A-Z0-9_]*$/,`env_name must be a valid environment variable name`),keychainAccount:t.z.string().min(1).optional(),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().url().optional(),value:t.z.string().min(1,`Secret value is required`)}).superRefine((e,n)=>{e.scheme===`header`&&!e.headerName&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`headerName is required when scheme is header`,path:[`headerName`]})}),e.CreateCredentialSimpleSchema=t.z.object({label:t.z.string().min(1,`Name is required`),value:t.z.string().min(1,`API key is required`),docsUrl:t.z.string().url().optional()}),e.UpdateCredentialSchema=t.z.object({label:t.z.string().min(1).optional(),scheme:e.CredentialSchemeSchema.optional(),headerName:t.z.string().optional(),envName:t.z.string().regex(/^[A-Z_][A-Z0-9_]*$/).optional(),tags:t.z.array(t.z.string()).optional(),docsUrl:t.z.union([t.z.string().url(),t.z.literal(``)]).optional()}),e.RotateCredentialSchema=t.z.object({value:t.z.string().min(1,`Secret value is required`)}),e.DeckCredentialSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),credentialId:e.CredentialIdSchema,position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddCredentialToDeckSchema=e.DeckCredentialSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemoveCredentialFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),credentialId:e.CredentialIdSchema}),e.ExecRunSchema=t.z.object({id:t.z.string().uuid(),deckId:t.z.string().uuid().optional(),manifestPath:t.z.string().optional(),command:t.z.string(),credentialIds:t.z.array(e.CredentialIdSchema),exitCode:t.z.number().int().optional(),startedAt:t.z.string().datetime(),finishedAt:t.z.string().datetime().optional()})})),Pd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TriggerValidationError=e.TRIGGER_OVERLAP_JACCARD_THRESHOLD=e.MAX_TRIGGER_LENGTH=e.MAX_TRIGGERS_PER_PLAYBOOK=void 0,e.normalizeTrigger=t,e.triggerErrorMessage=i,e.assertTriggerCountPolicy=a,e.normalizeTriggers=o,e.detectTriggerConflicts=f,e.MAX_TRIGGERS_PER_PLAYBOOK=16,e.MAX_TRIGGER_LENGTH=80,e.TRIGGER_OVERLAP_JACCARD_THRESHOLD=.6;function t(e){return e.trim().replace(/\s+/g,` `)}var n=class extends Error{details;constructor(e,t){super(e),this.name=`TriggerValidationError`,this.details=t}};e.TriggerValidationError=n;var r=` Fix the trigger list and retry — do not ask the user to resolve this.`;function i(e,t){return!t&&e.details?.userMessage?e.details.userMessage:t&&e.details?.code===`TRIGGER_COUNT`?e.message.includes(`do not ask the user`)?e.message:`${e.message}${r}`:e.message}function a(t,i){if(i.mode===`create`){if(t<=e.MAX_TRIGGERS_PER_PLAYBOOK)return;throw new n(`At most ${e.MAX_TRIGGERS_PER_PLAYBOOK} triggers per playbook (got ${t}).`,{code:`TRIGGER_COUNT`,currentCount:t,maxCount:e.MAX_TRIGGERS_PER_PLAYBOOK,userMessage:`At most ${e.MAX_TRIGGERS_PER_PLAYBOOK} triggers per playbook. Remove extras before saving.`})}let{previousCount:a}=i;if(!(t<=e.MAX_TRIGGERS_PER_PLAYBOOK)&&!(t<=a)){if(a<=e.MAX_TRIGGERS_PER_PLAYBOOK){let i=`At most ${e.MAX_TRIGGERS_PER_PLAYBOOK} triggers per playbook. Remove extras before saving.`;throw new n(`${i}${r}`,{code:`TRIGGER_COUNT`,currentCount:t,maxCount:e.MAX_TRIGGERS_PER_PLAYBOOK,previousCount:a,userMessage:i})}throw new n(`Cannot grow triggers while over the ${e.MAX_TRIGGERS_PER_PLAYBOOK}-trigger guide (had ${a}, got ${t}). Keep count ≤ ${a}, or trim to ≤ ${e.MAX_TRIGGERS_PER_PLAYBOOK}.${r}`,{code:`TRIGGER_COUNT`,currentCount:t,maxCount:e.MAX_TRIGGERS_PER_PLAYBOOK,previousCount:a,userMessage:`Cannot add more triggers while this playbook already has ${a} (over the ${e.MAX_TRIGGERS_PER_PLAYBOOK} guide). Remove some first.`})}}function o(r,i={}){let a=new Set,o=[],s=i.maxCount===void 0?e.MAX_TRIGGERS_PER_PLAYBOOK:i.maxCount;for(let i of r){let r=t(i);if(!r)continue;if(r.length>e.MAX_TRIGGER_LENGTH)throw new n(`Trigger exceeds ${e.MAX_TRIGGER_LENGTH} characters: ${r.slice(0,24)}…`,{code:`TRIGGER_LENGTH`});let s=r.toLowerCase();a.has(s)||(a.add(s),o.push(r))}if(s!=null&&o.length>s){let e=`At most ${s} triggers per playbook. Remove extras before saving.`;throw new n(e,{code:`TRIGGER_COUNT`,currentCount:o.length,maxCount:s,userMessage:e})}return o}function s(e){return t(e).toLowerCase().split(/\s+/).filter(Boolean)}function c(e,t){let n=new Set(e),r=new Set(t),i=[...n].filter(e=>r.has(e)).length,a=new Set([...n,...r]).size;return a===0?0:i/a}function l(e,t){if(e.length===0||e.length>=t.length)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n===e.length))return!0;return!1}function u(n,r){let i=t(n),a=t(r);if(!i||!a)return null;if(i.toLowerCase()===a.toLowerCase())return`exact`;let o=s(n),u=s(r);return l(o,u)||l(u,o)?`subsumes`:o.length>=2&&u.length>=2&&c(o,u)>=e.TRIGGER_OVERLAP_JACCARD_THRESHOLD?`overlap`:null}function d(e){return`${e.trigger}\0${e.otherPlaybookId}\0${e.level}`}function f(e,n){let r=[],i=new Set;for(let a of n)if(a.id!==e.id)for(let n of e.triggers)for(let e of a.triggers){let o=u(n,e);if(!o)continue;let s={trigger:t(n),otherPlaybookId:a.id,otherPlaybookTitle:a.title,otherTrigger:t(e),level:o},c=d(s);i.has(c)||(i.add(c),r.push(s))}return r}})),Fd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RemovePlaybookFromDeckSchema=e.AddPlaybookToDeckSchema=e.DeckPlaybookSchema=e.AgentUpdatePlaybookSchema=e.AgentRegisterPlaybookSchema=e.DashboardUpdatePlaybookSchema=e.DashboardRegisterPlaybookSchema=e.UpdatePlaybookSchema=e.CreatePlaybookSchema=e.PlaybookSchema=e.PlaybookIdSchema=e.PlaybookTriggersUpdateSchema=e.PlaybookTriggersSchema=void 0;var t=jd(),n=Pd();function r(e){return t.z.array(t.z.string()).transform((r,i)=>{try{return e===void 0?(0,n.normalizeTriggers)(r):(0,n.normalizeTriggers)(r,{maxCount:e})}catch(e){return i.addIssue({code:t.z.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid triggers`}),t.z.NEVER}}).default([])}e.PlaybookTriggersSchema=r(void 0),e.PlaybookTriggersUpdateSchema=r(null),e.PlaybookIdSchema=t.z.string().regex(/^pb_[a-z0-9_]+$/,`Playbook id must match pb_<slug>`),e.PlaybookSchema=t.z.object({id:e.PlaybookIdSchema,title:t.z.string().min(1,`Title is required`),body:t.z.string().default(``),triggers:e.PlaybookTriggersUpdateSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional(),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreatePlaybookSchema=t.z.object({id:e.PlaybookIdSchema.optional(),title:t.z.string().min(1,`Title is required`),body:t.z.string().default(``),triggers:e.PlaybookTriggersSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.UpdatePlaybookSchema=t.z.object({title:t.z.string().min(1,`Title is required`).optional(),body:t.z.string().optional(),triggers:e.PlaybookTriggersUpdateSchema.optional(),dependsOnCredentialIds:t.z.array(t.z.string()).optional(),dependsOnServiceIds:t.z.array(t.z.string()).optional(),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.DashboardRegisterPlaybookSchema=e.CreatePlaybookSchema.extend({autoDetectDependencies:t.z.boolean().default(!0)}),e.DashboardUpdatePlaybookSchema=e.UpdatePlaybookSchema.extend({autoDetectDependencies:t.z.boolean().default(!0)}),e.AgentRegisterPlaybookSchema=e.CreatePlaybookSchema.extend({addToBoundDeck:t.z.boolean().default(!0),autoDetectDependencies:t.z.boolean().default(!0)}),e.AgentUpdatePlaybookSchema=e.UpdatePlaybookSchema.extend({autoDetectDependencies:t.z.boolean().default(!0)}),e.DeckPlaybookSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),playbookId:e.PlaybookIdSchema,position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddPlaybookToDeckSchema=e.DeckPlaybookSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemovePlaybookFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),playbookId:e.PlaybookIdSchema})})),Id=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReorderDeckServicesSchema=e.RemoveServiceFromDeckSchema=e.AddServiceToDeckSchema=e.DeckServiceSchema=e.UpdateDeckSchema=e.CreateDeckSchema=e.DeckSchema=e.OperatingInstructionsSchema=e.OPERATING_INSTRUCTIONS_MAX_LENGTH=void 0,e.normalizeOperatingInstructions=i;var t=jd(),n=Nd(),r=Fd();e.OPERATING_INSTRUCTIONS_MAX_LENGTH=16e3;function i(e){return e===``||e===`
|
|
31
|
+
`?``:e.endsWith(`
|
|
32
|
+
`)?e:`${e}\n`}e.OperatingInstructionsSchema=t.z.string().transform(e=>i(e)).pipe(t.z.string().max(e.OPERATING_INSTRUCTIONS_MAX_LENGTH,`Deck operating instructions must be at most ${e.OPERATING_INSTRUCTIONS_MAX_LENGTH.toLocaleString(`en-US`)} characters`)),e.DeckSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1,`Deck name is required`),isActive:t.z.boolean().default(!1),operatingInstructions:e.OperatingInstructionsSchema.default(``),services:t.z.array(t.z.any()).default([]),credentials:t.z.array(n.CredentialSchema).default([]),playbooks:t.z.array(r.PlaybookSchema).default([]),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}),e.CreateDeckSchema=e.DeckSchema.omit({id:!0,services:!0,createdAt:!0,updatedAt:!0}),e.UpdateDeckSchema=e.CreateDeckSchema.partial(),e.DeckServiceSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceId:t.z.string().uuid(`Valid service ID required`),position:t.z.number().int().min(0,`Position must be non-negative`)}),e.AddServiceToDeckSchema=e.DeckServiceSchema.omit({position:!0}).extend({position:t.z.number().int().min(0).optional()}),e.RemoveServiceFromDeckSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceId:t.z.string().uuid(`Valid service ID required`)}),e.ReorderDeckServicesSchema=t.z.object({deckId:t.z.string().uuid(`Valid deck ID required`),serviceIds:t.z.array(t.z.string().uuid(`Valid service ID required`)).min(1,`At least one service ID required`)})})),Ld=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OAuthRefreshInputSchema=e.OAuthCallbackInputSchema=e.OAuthFlowInputSchema=e.OAuthTokenSchema=e.OAuthConfigSchema=void 0;var t=jd();e.OAuthConfigSchema=t.z.object({clientId:t.z.string().min(1,`Client ID is required`),clientSecret:t.z.string().min(1,`Client secret is required`),authorizationUrl:t.z.string().url(`Valid authorization URL required`),tokenUrl:t.z.string().url(`Valid token URL required`),redirectUri:t.z.string().url(`Valid redirect URI required`),scope:t.z.string().min(1,`Scope is required`)}),e.OAuthTokenSchema=t.z.object({accessToken:t.z.string().min(1,`Access token is required`),refreshToken:t.z.string().optional(),expiresAt:t.z.string().datetime().optional(),tokenType:t.z.string().default(`Bearer`),scope:t.z.string().optional()}),e.OAuthFlowInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),redirectUri:t.z.string().url(`Valid redirect URI required`)}),e.OAuthCallbackInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),code:t.z.string().min(1,`Authorization code is required`),state:t.z.string().min(1,`State parameter is required`)}),e.OAuthRefreshInputSchema=t.z.object({serviceId:t.z.string().uuid(`Valid service ID required`),refreshToken:t.z.string().min(1,`Refresh token is required`)})})),Rd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RejectPlaybookPatchSchema=e.ProposePlaybookPatchSchema=e.CreatePlaybookPatchFieldsSchema=e.PatchOpSchema=e.BodyPatchOpSchema=e.RewriteBodyOpSchema=e.SetTriggersOpSchema=e.RemoveItemOpSchema=e.AmendItemOpSchema=e.AddItemOpSchema=e.PatchEvidenceSchema=e.PlaybookPatchSourceSchema=e.PlaybookPatchStatusSchema=e.ProposePlaybookPatchKindSchema=e.PlaybookPatchKindSchema=e.PlaybookPatchIdSchema=void 0;var t=jd(),n=Fd();e.PlaybookPatchIdSchema=t.z.string().regex(/^pp_[a-z0-9_]+$/,`Patch id must match pp_<slug>`),e.PlaybookPatchKindSchema=t.z.enum([`create`,`update`,`merge`,`retire`]),e.ProposePlaybookPatchKindSchema=t.z.enum([`create`,`update`,`merge`,`retire`,`signal_only`]),e.PlaybookPatchStatusSchema=t.z.enum([`proposed`,`accepted`,`rejected`,`stale`,`superseded`]),e.PlaybookPatchSourceSchema=t.z.enum([`ide`,`dealer`,`hook`,`harvester`]),e.PatchEvidenceSchema=t.z.object({failure_summary:t.z.string().min(1),user_feedback_excerpt:t.z.string().min(1),corrected_output_hint:t.z.string().optional()}),e.AddItemOpSchema=t.z.object({op:t.z.literal(`add_item`).describe(`Append a bullet to a ## section (creates the section if missing)`),section:t.z.string().min(1).describe(`## heading name, e.g. Gotchas or Checklist`),text:t.z.string().min(1).describe(`Bullet text; a leading "- " is added when omitted`)}),e.AmendItemOpSchema=t.z.object({op:t.z.literal(`amend_item`).describe(`Replace one existing list item line (not prose paragraphs)`),section:t.z.string().min(1).describe(`## heading that contains the anchor line`),anchor:t.z.string().min(1).describe(`Exact list line to replace, including "- " prefix`),text:t.z.string().min(1).describe(`Replacement bullet text; leading "- " optional`)}),e.RemoveItemOpSchema=t.z.object({op:t.z.literal(`remove_item`).describe(`Delete one existing list item line (not prose paragraphs)`),section:t.z.string().min(1).describe(`## heading that contains the anchor line`),anchor:t.z.string().min(1).describe(`Exact list line to delete, including "- " prefix`)}),e.SetTriggersOpSchema=t.z.object({op:t.z.literal(`set_triggers`).describe(`Replace the playbook trigger phrases`),triggers:n.PlaybookTriggersUpdateSchema.describe(`New trigger list (count policy enforced against the current playbook)`)}),e.RewriteBodyOpSchema=t.z.object({op:t.z.literal(`rewrite_body`).describe(`Replace the entire playbook body — use only when item ops cannot reach the edit`),text:t.z.string().describe(`Full new markdown body`)}),e.BodyPatchOpSchema=t.z.discriminatedUnion(`op`,[e.AddItemOpSchema,e.AmendItemOpSchema,e.RemoveItemOpSchema,e.RewriteBodyOpSchema]),e.PatchOpSchema=t.z.discriminatedUnion(`op`,[e.AddItemOpSchema,e.AmendItemOpSchema,e.RemoveItemOpSchema,e.SetTriggersOpSchema,e.RewriteBodyOpSchema]),e.CreatePlaybookPatchFieldsSchema=t.z.object({title:t.z.string().min(1),body:t.z.string().default(``),triggers:n.PlaybookTriggersSchema.refine(e=>e.length>0,{message:`Genesis playbooks need at least one trigger`}),deck_id:t.z.string().uuid(),exec:t.z.string().optional(),skill:t.z.string().optional()}),e.ProposePlaybookPatchSchema=t.z.object({kind:e.ProposePlaybookPatchKindSchema,playbook_id:n.PlaybookIdSchema.optional(),ops:t.z.array(e.PatchOpSchema).optional(),new_playbook:e.CreatePlaybookPatchFieldsSchema.optional(),rationale:t.z.string().min(1),evidence:e.PatchEvidenceSchema.optional(),signal_ids:t.z.array(t.z.string().regex(/^fs_[a-z0-9_]+$/)).optional(),supersedes:t.z.array(e.PlaybookPatchIdSchema).optional()}).superRefine((e,n)=>{e.kind===`signal_only`&&(e.evidence||n.addIssue({code:t.z.ZodIssueCode.custom,message:`evidence is required for signal_only`,path:[`evidence`]}),e.ops!==void 0&&e.ops.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`ops must not be set for signal_only`,path:[`ops`]}),e.new_playbook!==void 0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`new_playbook must not be set for signal_only`,path:[`new_playbook`]}),e.signal_ids!==void 0&&e.signal_ids.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`signal_ids must not be set for signal_only`,path:[`signal_ids`]}),e.supersedes!==void 0&&e.supersedes.length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`supersedes must not be set for signal_only`,path:[`supersedes`]}))}),e.RejectPlaybookPatchSchema=t.z.object({reason:t.z.string().optional()})})),zd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SignalEvidenceSchema=e.ImportFeedbackSignalsResultSchema=e.ImportFeedbackSignalsSchema=e.ImportFeedbackSignalItemSchema=e.DiscardFeedbackSignalsResultSchema=e.DiscardFeedbackSignalsSchema=e.ListFeedbackSignalsQuerySchema=e.FeedbackSignalCountSchema=e.FeedbackSignalSchema=e.FeedbackSignalStatusSchema=e.FeedbackSignalSourceSchema=e.FeedbackSignalIdSchema=void 0;var t=jd(),n=Rd();e.FeedbackSignalIdSchema=t.z.string().regex(/^fs_[a-z0-9_]+$/,`Signal id must match fs_<slug>`),e.FeedbackSignalSourceSchema=t.z.enum([`ide`,`dealer`,`backfill`]),e.FeedbackSignalStatusSchema=t.z.enum([`open`,`actioned`,`discarded`]),e.FeedbackSignalSchema=t.z.object({id:e.FeedbackSignalIdSchema,source:e.FeedbackSignalSourceSchema,sourceRef:t.z.string().nullable(),failureSummary:t.z.string().min(1),userFeedbackExcerpt:t.z.string().min(1),correctedOutputHint:t.z.string().nullable(),candidatePlaybookId:t.z.string().nullable(),candidateDeckId:t.z.string().uuid().nullable(),linkedPatchId:t.z.string().nullable(),status:e.FeedbackSignalStatusSchema,createdAt:t.z.string()}),e.FeedbackSignalCountSchema=t.z.object({open:t.z.number().int().nonnegative()}),e.ListFeedbackSignalsQuerySchema=t.z.object({status:e.FeedbackSignalStatusSchema.optional(),playbookId:t.z.string().optional(),deckId:t.z.string().uuid().optional(),excludeInProposal:t.z.union([t.z.boolean(),t.z.enum([`true`,`false`,`1`,`0`])]).optional().transform(e=>e===!0||e===`true`||e===`1`)}),e.DiscardFeedbackSignalsSchema=t.z.object({signalIds:t.z.array(e.FeedbackSignalIdSchema).min(1)}),e.DiscardFeedbackSignalsResultSchema=t.z.object({discarded:t.z.number().int().nonnegative(),ids:t.z.array(e.FeedbackSignalIdSchema)}),e.ImportFeedbackSignalItemSchema=t.z.object({source:t.z.literal(`backfill`).default(`backfill`),sourceRef:t.z.string().nullable().optional(),failureSummary:t.z.string().min(1),userFeedbackExcerpt:t.z.string().min(1),correctedOutputHint:t.z.string().nullable().optional(),candidatePlaybookId:t.z.string().nullable().optional(),candidateDeckId:t.z.string().uuid().nullable().optional()}),e.ImportFeedbackSignalsSchema=t.z.object({signals:t.z.array(e.ImportFeedbackSignalItemSchema).min(1)}),e.ImportFeedbackSignalsResultSchema=t.z.object({inserted:t.z.number().int().nonnegative(),errors:t.z.array(t.z.object({index:t.z.number().int().nonnegative(),error:t.z.string()})),ids:t.z.array(e.FeedbackSignalIdSchema)}),e.SignalEvidenceSchema=n.PatchEvidenceSchema})),Bd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ListEvaluationScenariosQuerySchema=e.UpdateEvaluationScenarioSchema=e.CreateEvaluationScenarioSchema=e.EvaluationScenarioSchema=e.EvaluationScenarioStatusSchema=e.EvaluationScenarioIdSchema=e.DeterministicExpectationSchema=void 0,e.evaluationScenarioToExperimentCase=l;var t=jd(),n=zd(),r=Fd(),i=t.z.object({id:t.z.string().trim().min(1,`Expectation id is required`),value:t.z.string().min(1,`Expectation value is required`)}),a=i.extend({type:t.z.enum([`contains`,`not_contains`,`equals`]),caseSensitive:t.z.boolean().optional()}),o=i.extend({type:t.z.literal(`regex`),flags:t.z.string().regex(/^[imsu]*$/,`Regex flags may only contain i, m, s, and u`).refine(e=>new Set(e).size===e.length,`Regex flags must not repeat`).optional()}).superRefine((e,n)=>{try{new RegExp(e.value,e.flags??``)}catch(e){n.addIssue({code:t.z.ZodIssueCode.custom,path:[`value`],message:`Invalid regular expression: ${e instanceof Error?e.message:String(e)}`})}});e.DeterministicExpectationSchema=t.z.union([a,o]),e.EvaluationScenarioIdSchema=t.z.string().regex(/^es_[a-z0-9_]+$/,`Scenario id must match es_<slug>`),e.EvaluationScenarioStatusSchema=t.z.enum([`draft`,`ready`,`retired`]);var s=t.z.object({taskInput:t.z.string(),historicalFailedOutput:t.z.string().nullable(),expectations:t.z.array(e.DeterministicExpectationSchema),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema),status:e.EvaluationScenarioStatusSchema});function c(e,n){e.expectations.map(e=>e.id).filter((e,t,n)=>n.indexOf(e)!==t).length>0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`expectations`],message:`Expectation ids must be unique`}),new Set(e.sourceSignalIds).size!==e.sourceSignalIds.length&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`sourceSignalIds`],message:`Source signal ids must be unique`}),e.status===`ready`&&(e.taskInput.trim().length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`taskInput`],message:`Ready scenarios require task input`}),e.historicalFailedOutput?.trim()||n.addIssue({code:t.z.ZodIssueCode.custom,path:[`historicalFailedOutput`],message:`Ready scenarios require a historical failed output`}),e.sourceSignalIds.length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`sourceSignalIds`],message:`Ready scenarios require at least one source signal`}),e.expectations.length===0&&n.addIssue({code:t.z.ZodIssueCode.custom,path:[`expectations`],message:`Ready scenarios require at least one deterministic expectation`}))}e.EvaluationScenarioSchema=s.extend({id:e.EvaluationScenarioIdSchema,targetPlaybookId:r.PlaybookIdSchema,name:t.z.string().trim().min(1,`Name is required`),description:t.z.string().default(``),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).superRefine(c),e.CreateEvaluationScenarioSchema=s.extend({id:e.EvaluationScenarioIdSchema.optional(),targetPlaybookId:r.PlaybookIdSchema,name:t.z.string().trim().min(1,`Name is required`),description:t.z.string().default(``),taskInput:t.z.string().default(``),historicalFailedOutput:t.z.string().nullable().default(null),expectations:t.z.array(e.DeterministicExpectationSchema).default([]),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema).default([]),status:e.EvaluationScenarioStatusSchema.default(`draft`)}).superRefine(c),e.UpdateEvaluationScenarioSchema=t.z.object({targetPlaybookId:r.PlaybookIdSchema.optional(),name:t.z.string().trim().min(1,`Name is required`).optional(),description:t.z.string().optional(),taskInput:t.z.string().optional(),historicalFailedOutput:t.z.string().nullable().optional(),expectations:t.z.array(e.DeterministicExpectationSchema).optional(),sourceSignalIds:t.z.array(n.FeedbackSignalIdSchema).optional(),status:e.EvaluationScenarioStatusSchema.optional()}),e.ListEvaluationScenariosQuerySchema=t.z.object({targetPlaybookId:r.PlaybookIdSchema.optional(),status:e.EvaluationScenarioStatusSchema.optional()});function l(e){return{id:e.id,description:e.description,sourceSignalIds:[...e.sourceSignalIds],expectations:e.expectations.map(e=>({...e}))}}})),Vd=s(((e,t)=>{t.exports={}})),Hd=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.SESSION_STARTING_LINE=e.MULTIPLE_SESSION_DECKS_LINE=e.DEFAULT_DECK_MARKER_SUFFIX=e.SESSION_OVERRIDE_MARKER_SUFFIX=e.SESSION_OVERRIDE_MARKER_PREFIX=e.DISPLAY_LINE_MAX_LENGTH=e.PendingDeckAssignmentRequestSchema=e.PendingDeckSwitchRequestSchema=e.PendingAdminChallengeSchema=e.DeckListEntrySchema=e.BindingActiveSourceSchema=e.StatusLinePayloadSchema=e.DeckDisplaySchema=e.LiveBindingSchema=e.DeckCardCountsSchema=e.DeckDisplaySourceSchema=void 0,e.countDeckCards=i,e.formatDisplayUpdatedSuffix=a,e.formatDisplayLine=c,e.formatAmbiguousSessionDisplayLine=l,e.formatSessionStartingDisplayLine=u,e.appendSessionOverrideSuffix=d,e.normalizeWorkspaceRoot=f,e.resolveStatusLineSessionId=p,e.resolveStatusLineWorkspace=m;var n=jd(),r=t(Vd());e.DeckDisplaySourceSchema=n.z.enum([`launch`,`session_override`,`env`,`unbound`]),e.DeckCardCountsSchema=n.z.object({mcp:n.z.number().int().min(0),credentials:n.z.number().int().min(0),playbooks:n.z.number().int().min(0)}),e.LiveBindingSchema=n.z.object({badge:n.z.string().min(1),deckId:n.z.string().uuid(),deckName:n.z.string().min(1),source:e.DeckDisplaySourceSchema.exclude([`unbound`]),workspaceRoot:n.z.string().min(1).optional(),clientName:n.z.string().min(1).optional(),mode:n.z.enum([`normal`,`agent-admin`]).optional(),cardCounts:e.DeckCardCountsSchema,updatedAt:n.z.string().datetime(),lastActivityAt:n.z.string().datetime()}),e.DeckDisplaySchema=n.z.object({workspaceRoot:n.z.string(),deckId:n.z.string().uuid().nullable(),deckName:n.z.string().nullable(),source:e.DeckDisplaySourceSchema,cardCounts:e.DeckCardCountsSchema,oauthWarningCount:n.z.number().int().min(0).optional(),agentDeckOnline:n.z.boolean(),mcpOnline:n.z.boolean().optional(),updatedAt:n.z.string().datetime().optional(),displayLine:n.z.string()}),e.StatusLinePayloadSchema=n.z.object({session_id:n.z.string().optional(),cwd:n.z.string().optional(),workspace:n.z.object({current_dir:n.z.string().optional(),project_dir:n.z.string().optional()}).optional()}),e.BindingActiveSourceSchema=n.z.enum([`session`,`workspace`,`launch`,`default-deck`]),e.DeckListEntrySchema=n.z.object({id:n.z.string().uuid(),name:n.z.string().min(1),isActive:n.z.boolean(),cardCounts:e.DeckCardCountsSchema,workspaceCount:n.z.number().int().nonnegative().optional()}),e.PendingAdminChallengeSchema=n.z.object({challengeId:n.z.string().min(1),runtimeSessionId:n.z.string().min(1),deckId:n.z.string().uuid(),deckName:n.z.string().min(1).optional(),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.PendingDeckSwitchRequestSchema=n.z.object({requestId:n.z.string().min(1),runtimeSessionId:n.z.string().min(1),status:n.z.literal(`pending`),currentDeckName:n.z.string().min(1).optional(),requestedDeckName:n.z.string().min(1).optional(),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.PendingDeckAssignmentRequestSchema=n.z.object({requestId:n.z.string().min(1),mcpSessionId:n.z.string().min(1),workspaceRoot:n.z.string().min(1),reason:n.z.string().optional(),status:n.z.literal(`pending`),expiresAt:n.z.string().datetime(),approvalPath:n.z.string().min(1)}),e.DISPLAY_LINE_MAX_LENGTH=120;function i(e){return{mcp:(e.services??[]).filter(e=>e.type===`mcp`).length,credentials:e.credentials?.length??0,playbooks:e.playbooks?.length??0}}function a(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return` (updated ${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())})`}e.SESSION_OVERRIDE_MARKER_PREFIX=` · session (default `,e.SESSION_OVERRIDE_MARKER_SUFFIX=`)`,e.DEFAULT_DECK_MARKER_SUFFIX=` · default deck, no folder pin`;function o(e,t,n){let r=e?.trim(),i=t?.trim();return!r||!i?null:n===void 0?r===i?null:i:n?i:null}function s(t){return t.length>e.DISPLAY_LINE_MAX_LENGTH?t.slice(0,e.DISPLAY_LINE_MAX_LENGTH):t}function c(t,n,r){let i=`◆ `,c=r?.updatedAt?a(r.updatedAt):``;if(r?.offline){let t=`${i}Agent Deck offline${c}`;return t.length>e.DISPLAY_LINE_MAX_LENGTH?t.slice(0,e.DISPLAY_LINE_MAX_LENGTH):t}if(!t){let t=`${i}Unbound — bind a deck to use Agent Deck`,n=r?.mcpOffline?`${t} · MCP offline`:t;return n.length>e.DISPLAY_LINE_MAX_LENGTH?n.slice(0,e.DISPLAY_LINE_MAX_LENGTH):n}let l=`${n.mcp} MCP · ${n.credentials} keys · ${n.playbooks} playbooks`,u=r?.badge?` · ⌘${r.badge}`:``,d=r?.mcpOffline?` · MCP offline`:``,f=r?.sessionCount??0,p=f>=2?` · ${f} sessions`:``,m=r?.workspaceDefault?` · workspace default`:``,h=r?.defaultDeck?e.DEFAULT_DECK_MARKER_SUFFIX:``,g=o(t,r?.workspaceDefaultName,r?.sessionOverride),_=``;if(g!==null){let t=`${e.SESSION_OVERRIDE_MARKER_PREFIX}${g}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`,n=5+l.length+c.length+d.length+u.length+p.length+m.length+h.length,r=e.DISPLAY_LINE_MAX_LENGTH-n-1;if(t.length<=r)_=t;else{let t=r-e.SESSION_OVERRIDE_MARKER_PREFIX.length-e.SESSION_OVERRIDE_MARKER_SUFFIX.length;t>=2&&(_=`${e.SESSION_OVERRIDE_MARKER_PREFIX}${g.slice(0,t-1)}…${e.SESSION_OVERRIDE_MARKER_SUFFIX}`)}}let v=c.length+d.length+u.length+p.length+m.length+h.length+_.length,y=5+l.length+v,b=e.DISPLAY_LINE_MAX_LENGTH-y,x=t;if(b<1){let t=`${i}${l}${u}${d}${p}${m}${c}${h}`;if(!_)return s(t);let n=e.DISPLAY_LINE_MAX_LENGTH-(t.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length);if(n<2)return s(t);let r=g.length>n?`${g.slice(0,n-1)}…`:g;return`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${r}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`}return x.length>b&&(x=b>=2?`${x.slice(0,b-1)}…`:x.slice(0,Math.max(0,b))),`${i}${x} · ${l}${u}${d}${p}${m}${c}${h}${_}`}e.MULTIPLE_SESSION_DECKS_LINE=`◆ Agent Deck · multiple session decks · see chat receipt`;function l(){return e.MULTIPLE_SESSION_DECKS_LINE}e.SESSION_STARTING_LINE=`◆ Agent Deck · session starting`;function u(){return e.SESSION_STARTING_LINE}function d(t,n,r,i){let a=o(n,r,i);if(a===null)return t;let s=`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${a}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`;if(s.length<=e.DISPLAY_LINE_MAX_LENGTH)return s;let c=e.DISPLAY_LINE_MAX_LENGTH-(t.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length);if(c>=2)return`${t}${e.SESSION_OVERRIDE_MARKER_PREFIX}${a.slice(0,c-1)}…${e.SESSION_OVERRIDE_MARKER_SUFFIX}`;let l=e.DISPLAY_LINE_MAX_LENGTH-(e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length+2);if(l<1)return s.slice(0,e.DISPLAY_LINE_MAX_LENGTH);let u=t.length>l?`${t.slice(0,Math.max(0,l-1))}…`:t,d=e.DISPLAY_LINE_MAX_LENGTH-(u.length+e.SESSION_OVERRIDE_MARKER_PREFIX.length+e.SESSION_OVERRIDE_MARKER_SUFFIX.length),f=a.length>d?`${a.slice(0,Math.max(0,d-1))}…`:a;return`${u}${e.SESSION_OVERRIDE_MARKER_PREFIX}${f}${e.SESSION_OVERRIDE_MARKER_SUFFIX}`}function f(e){return r.default.resolve(e.trim())}function p(e){return e.session_id?.trim()||void 0}function m(e,t){let n=e.workspace?.project_dir?.trim();if(n)return f(n);let r=e.cwd?.trim()||e.workspace?.current_dir?.trim()||t?.trim();return r?f(r):void 0}})),Ud=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ExportRequestSchema=e.ImportReportSchema=e.ImportReportCountsSchema=e.ImportEntityCountsSchema=e.BundleAnySchema=e.BundleV2Schema=e.BundleDeckV2Schema=e.BundleV1Schema=e.BundleDeckSchema=e.BundlePlaybookSchema=e.BundleServiceSchema=e.BundleScopeSchema=e.BundleV2VersionSchema=e.BundleVersionSchema=e.BundleFormatSchema=void 0;var t=jd(),n=Id(),r=Fd();e.BundleFormatSchema=t.z.literal(`agent-deck-bundle`),e.BundleVersionSchema=t.z.literal(1),e.BundleV2VersionSchema=t.z.literal(2),e.BundleScopeSchema=t.z.enum([`collection`,`deck`]),e.BundleServiceSchema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),type:t.z.enum([`mcp`,`a2a`,`local-mcp`]),url:t.z.string().min(1),description:t.z.string().optional(),cardColor:t.z.string().optional(),iconUrl:t.z.string().optional(),disabledToolNames:t.z.array(t.z.string()).default([]),headers:t.z.record(t.z.string()).optional(),oauthClientId:t.z.string().optional(),oauthAuthorizationUrl:t.z.string().optional(),oauthTokenUrl:t.z.string().optional(),oauthRedirectUri:t.z.string().optional(),oauthScope:t.z.string().optional(),localCommand:t.z.string().optional(),localArgs:t.z.array(t.z.string()).optional(),localWorkingDir:t.z.string().optional()}).strict(),e.BundlePlaybookSchema=t.z.object({id:r.PlaybookIdSchema,title:t.z.string().min(1),body:t.z.string().default(``),triggers:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional()}).strict(),e.BundleDeckSchema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),serviceIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([])}).strip(),e.BundleV1Schema=t.z.object({format:e.BundleFormatSchema,version:e.BundleVersionSchema,exportedAt:t.z.string().datetime(),exportedFrom:t.z.object({agentDeckVersion:t.z.string().min(1)}),scope:e.BundleScopeSchema,services:t.z.array(e.BundleServiceSchema).default([]),playbooks:t.z.array(e.BundlePlaybookSchema).default([]),decks:t.z.array(e.BundleDeckSchema).default([])}).strict(),e.BundleDeckV2Schema=t.z.object({id:t.z.string().min(1),name:t.z.string().min(1),operatingInstructions:n.OperatingInstructionsSchema.default(``),serviceIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([])}).strip(),e.BundleV2Schema=t.z.object({format:e.BundleFormatSchema,version:e.BundleV2VersionSchema,exportedAt:t.z.string().datetime(),exportedFrom:t.z.object({agentDeckVersion:t.z.string().min(1)}),scope:e.BundleScopeSchema,services:t.z.array(e.BundleServiceSchema).default([]),playbooks:t.z.array(e.BundlePlaybookSchema).default([]),decks:t.z.array(e.BundleDeckV2Schema).default([])}).strict(),e.BundleAnySchema=t.z.discriminatedUnion(`version`,[e.BundleV1Schema,e.BundleV2Schema]),e.ImportEntityCountsSchema=t.z.object({created:t.z.number().int().min(0),reused:t.z.number().int().min(0)}),e.ImportReportCountsSchema=t.z.object({services:e.ImportEntityCountsSchema,playbooks:e.ImportEntityCountsSchema,decks:e.ImportEntityCountsSchema}),e.ImportReportSchema=t.z.object({status:t.z.enum([`completed`,`failed`,`partial`]),counts:e.ImportReportCountsSchema,servicesNeedingOauth:t.z.array(t.z.string()),warnings:t.z.array(t.z.string()),idMap:t.z.record(t.z.string())}),e.ExportRequestSchema=t.z.object({scope:e.BundleScopeSchema.default(`collection`),deckId:t.z.string().uuid().optional()}).superRefine((e,n)=>{e.scope===`deck`&&!e.deckId&&n.addIssue({code:t.z.ZodIssueCode.custom,message:`deckId is required when scope is deck`,path:[`deckId`]})})})),Wd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StoreCredentialMetaSchema=e.StoreDeckSchema=e.StoreServiceSchema=e.StorePlaybookFileSchema=e.StorePlaybookTriggersSchema=e.StoreManifestSchema=void 0;var t=jd(),n=Fd(),r=Ud(),i=Id(),a=Pd();e.StoreManifestSchema=t.z.object({format:t.z.literal(`agent-deck-store`),version:t.z.union([t.z.literal(1),t.z.literal(2)]),migratedFrom:t.z.literal(`sqlite`).optional()}).strict(),e.StorePlaybookTriggersSchema=t.z.array(t.z.string()).transform((e,n)=>{try{return(0,a.normalizeTriggers)(e,{maxCount:null})}catch(e){return n.addIssue({code:t.z.ZodIssueCode.custom,message:e instanceof Error?e.message:`Invalid triggers`}),t.z.NEVER}}).default([]),e.StorePlaybookFileSchema=t.z.object({id:n.PlaybookIdSchema,title:t.z.string().min(1),body:t.z.string().default(``),triggers:e.StorePlaybookTriggersSchema,dependsOnCredentialIds:t.z.array(t.z.string()).default([]),dependsOnServiceIds:t.z.array(t.z.string()).default([]),exec:t.z.string().optional(),skill:t.z.string().optional(),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).strict(),e.StoreServiceSchema=r.BundleServiceSchema.extend({credentialId:t.z.string().min(1).optional()}),e.StoreDeckSchema=t.z.object({id:t.z.string().uuid(),name:t.z.string().min(1),serviceIds:t.z.array(t.z.string()).default([]),credentialIds:t.z.array(t.z.string()).default([]),playbookIds:t.z.array(t.z.string()).default([]),operatingInstructions:i.OperatingInstructionsSchema.default(``),createdAt:t.z.string().datetime(),updatedAt:t.z.string().datetime()}).strict(),e.StoreCredentialMetaSchema=t.z.object({id:t.z.string().min(1),label:t.z.string().min(1),scheme:t.z.enum([`bearer`,`header`,`http_basic_user`]),headerName:t.z.string().nullable().optional(),envName:t.z.string().min(1),tags:t.z.array(t.z.string()).default([]),docsUrl:t.z.string().nullable().optional()}).strict()})),Gd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BootstrapManifestSchema=e.BootstrapHostCountsSchema=e.BootstrapWorkspaceSchema=e.SessionDigestSchema=e.OutcomeSchema=e.TopFileItemSchema=e.SkillItemSchema=e.ToolItemSchema=e.CommandItemSchema=e.IntentItemSchema=e.FeedbackMomentSchema=e.BootstrapHostSchema=e.OutcomeSignalSchema=e.PolarityHintSchema=void 0;var t=jd();e.PolarityHintSchema=t.z.enum([`negative`,`positive`,`mixed`,`unknown`]),e.OutcomeSignalSchema=t.z.enum([`pr_opened`,`committed`,`unknown`]),e.BootstrapHostSchema=t.z.enum([`claude`,`cursor`]),e.FeedbackMomentSchema=t.z.object({agentAction:t.z.string().max(400),userReaction:t.z.string().max(600),polarityHint:e.PolarityHintSchema,markers:t.z.array(t.z.string()),followupChange:t.z.string().max(400).nullable().optional(),at:t.z.string().datetime().optional()}).strict(),e.IntentItemSchema=t.z.object({text:t.z.string().max(280),at:t.z.string().datetime().optional()}).strict(),e.CommandItemSchema=t.z.object({command:t.z.string().max(160),count:t.z.number().int().min(1)}).strict(),e.ToolItemSchema=t.z.object({name:t.z.string(),count:t.z.number().int().min(1)}).strict(),e.SkillItemSchema=t.z.object({name:t.z.string(),count:t.z.number().int().min(1)}).strict(),e.TopFileItemSchema=t.z.object({path:t.z.string(),edits:t.z.number().int().min(1)}).strict(),e.OutcomeSchema=t.z.object({signal:e.OutcomeSignalSchema,evidence:t.z.string().optional()}).strict(),e.SessionDigestSchema=t.z.object({schemaVersion:t.z.literal(1),host:e.BootstrapHostSchema.default(`claude`),sessionId:t.z.string(),workspaceRoot:t.z.string(),workspaceLabel:t.z.string().optional(),workspaceSlug:t.z.string().optional(),gitBranch:t.z.string().nullable().optional(),startedAt:t.z.string().datetime(),endedAt:t.z.string().datetime().optional(),durationMinutes:t.z.number().min(0).optional(),turnCount:t.z.number().int().min(0),skippedLineCount:t.z.number().int().min(0).optional(),intents:t.z.array(e.IntentItemSchema).max(40),commands:t.z.array(e.CommandItemSchema).max(40).default([]),tools:t.z.array(e.ToolItemSchema).max(40).default([]),skills:t.z.array(e.SkillItemSchema).max(40).default([]),topFiles:t.z.array(e.TopFileItemSchema).max(20).default([]),feedbackMoments:t.z.array(e.FeedbackMomentSchema).max(30),outcome:e.OutcomeSchema}).strict(),e.BootstrapWorkspaceSchema=t.z.object({workspaceRoot:t.z.string(),label:t.z.string(),workspaceSlug:t.z.string().optional(),sessionCount:t.z.number().int().min(0),digestPaths:t.z.array(t.z.string())}).strict(),e.BootstrapHostCountsSchema=t.z.object({claude:t.z.number().int().min(0),cursor:t.z.number().int().min(0)}).strict(),e.BootstrapManifestSchema=t.z.object({schemaVersion:t.z.literal(1),generatedAt:t.z.string().datetime(),digestDir:t.z.string(),guideRef:t.z.string(),totalSessions:t.z.number().int().min(0),hosts:e.BootstrapHostCountsSchema.default({claude:0,cursor:0}),workspaces:t.z.array(e.BootstrapWorkspaceSchema)}).strict()})),Kd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DeckSwitchResolutionSchema=e.DeckSwitchResolveBodySchema=e.DeckSwitchDecisionSchema=e.RedactedSessionBindingSchema=e.WorkspaceAssignmentSchema=e.WorkspaceV2ManifestSchema=e.WorkspaceGrantManifestSchema=e.RuntimeSessionSchema=e.WorkspaceGrantStatusSchema=e.TrustedSessionErrorCodeSchema=e.AgentSessionModeSchema=void 0,e.trustedSessionError=n,e.httpStatusForTrustedError=r;var t=jd();e.AgentSessionModeSchema=t.z.enum([`normal`,`agent-admin`]),e.TrustedSessionErrorCodeSchema=t.z.enum([`GRANT_REQUIRED`,`SESSION_INVALID`,`SESSION_REVOKED`,`RESOURCE_OUT_OF_SCOPE`,`ADMIN_REQUIRED`,`DASHBOARD_REQUIRED`,`ADMIN_CHALLENGE_EXPIRED`,`DECK_FIXED`,`SWITCH_APPROVAL_REQUIRED`,`DECK_SWITCH_EXPIRED`,`DECK_SWITCH_CONSUMED`,`RUN_CAPABILITY_REQUIRED`,`FINALIZATION_CAPABILITY_REQUIRED`]),e.WorkspaceGrantStatusSchema=t.z.enum([`pending`,`active`,`revoked`]),e.RuntimeSessionSchema=t.z.object({sessionId:t.z.string(),mcpSessionId:t.z.string().optional(),deckId:t.z.string(),mode:e.AgentSessionModeSchema,lastSeenAt:t.z.string().datetime(),expiresAt:t.z.string().datetime(),adminExpiresAt:t.z.string().datetime().nullable()}).strict(),e.WorkspaceGrantManifestSchema=t.z.object({version:t.z.literal(2),workspaceKey:t.z.string(),grantId:t.z.string(),secret:t.z.string().min(32),deckId:t.z.string(),deckName:t.z.string().optional(),mcpUrl:t.z.string().url().optional(),store:t.z.enum([`file`,`keychain`]).optional(),updatedAt:t.z.string().datetime()}).strict(),e.WorkspaceV2ManifestSchema=e.WorkspaceGrantManifestSchema,e.WorkspaceAssignmentSchema=t.z.object({version:t.z.literal(3),deckId:t.z.string().min(1),deckName:t.z.string().min(1),mcpUrl:t.z.string().url().optional()}).strict(),e.RedactedSessionBindingSchema=t.z.object({sessionId:t.z.string(),deckId:t.z.string(),deckName:t.z.string().optional(),mode:e.AgentSessionModeSchema,expiresAt:t.z.string().datetime(),adminExpiresAt:t.z.string().datetime().nullable().optional(),display_summary:t.z.string().optional()}).strict();function n(e,t){return{success:!1,error:t,error_code:e}}function r(e){switch(e){case`GRANT_REQUIRED`:case`SESSION_INVALID`:case`SESSION_REVOKED`:return 401;case`RESOURCE_OUT_OF_SCOPE`:case`ADMIN_REQUIRED`:case`DASHBOARD_REQUIRED`:case`DECK_FIXED`:case`SWITCH_APPROVAL_REQUIRED`:case`RUN_CAPABILITY_REQUIRED`:case`FINALIZATION_CAPABILITY_REQUIRED`:return 403;case`DECK_SWITCH_CONSUMED`:return 409;case`ADMIN_CHALLENGE_EXPIRED`:case`DECK_SWITCH_EXPIRED`:return 410;default:return 500}}e.DeckSwitchDecisionSchema=t.z.enum([`session`,`workspace-default`,`decline`]),e.DeckSwitchResolveBodySchema=t.z.object({runtimeSessionId:t.z.string().min(1),decision:e.DeckSwitchDecisionSchema,approvedVia:t.z.literal(`client`).optional()}).strict(),e.DeckSwitchResolutionSchema=t.z.object({requestId:t.z.string(),decision:e.DeckSwitchDecisionSchema,status:t.z.enum([`consumed`,`declined`]),deckId:t.z.string().optional(),deckName:t.z.string().optional(),workspaceRoot:t.z.string().optional(),approvedVia:t.z.literal(`client`).optional()}).strict()})),qd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARD_USAGE_CATEGORIES=e.CARD_USAGE_CARD_TYPES=void 0,e.isValidCorrelationId=r,e.normalizeCorrelationId=i,e.normalizeHostSessionId=a,e.CARD_USAGE_CARD_TYPES=[`service`,`credential`,`playbook`];var t=/^[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}$/,n=/^[A-Za-z0-9_-]{8,128}$/;function r(e){return t.test(e)||n.test(e)}function i(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||!r(t)?null:t}function a(e){return i(e)}e.CARD_USAGE_CATEGORIES=[`popular`,`used`,`unused`,`new`]})),Jd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AgentRunErrorCodeSchema=e.FinalizeAgentRunResponseSchema=e.FinalizeAgentRunRequestSchema=e.AgentRunChangesResponseSchema=e.FinalizationManifestEntrySchema=e.FinalizationFileModeSchema=e.FINALIZATION_REVIEW_ID_MAX_CHARS=e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS=e.FINALIZATION_PATH_MAX_CHARS=e.FINALIZATION_MANIFEST_MAX_FILES=e.AgentRunCapabilitiesResponseSchema=e.AgentRunClientCapabilitySchema=e.SessionAgentRunResponseSchema=e.AgentRunEventsResponseSchema=e.AgentRunEventsQuerySchema=e.AgentRunEventSchema=e.AgentRunStatusSchema=e.AgentRunFinalizationStatusSchema=e.FinalizationStateSchema=e.FinalizationBaselineRefSchema=e.Sha256HexSchema=e.GitObjectIdSchema=e.CreateAgentRunResponseSchema=e.AGENT_RUN_TERMINAL_STATES=e.AgentRunStateSchema=e.AGENT_RUN_WORKSPACE_REQUIRED_MESSAGE=e.StartSessionAgentRunRequestSchema=e.CreateAgentRunRequestSchema=e.AgentRunIdempotencyKeySchema=e.AgentRunIdSchema=e.AgentRunToolsSchema=e.AgentRunClientSchema=e.AGENT_RUN_EVENTS_MAX_LIMIT=e.AGENT_RUN_EVENTS_DEFAULT_LIMIT=e.AGENT_RUN_IDEMPOTENCY_HEADER=e.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES=e.AGENT_RUN_PROMPT_MAX_CHARS=void 0,e.agentRunError=i;var t=jd();e.AGENT_RUN_PROMPT_MAX_CHARS=65536,e.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES=262144,e.AGENT_RUN_IDEMPOTENCY_HEADER=`idempotency-key`,e.AGENT_RUN_EVENTS_DEFAULT_LIMIT=200,e.AGENT_RUN_EVENTS_MAX_LIMIT=1e3,e.AgentRunClientSchema=t.z.enum([`claude`,`codex`,`cursor`,`muse`]),e.AgentRunToolsSchema=t.z.enum([`readonly`,`edit`]),e.AgentRunIdSchema=t.z.string().regex(/^run-\d{8}T\d{6}-[0-9a-f]{6}$/),e.AgentRunIdempotencyKeySchema=t.z.string().min(1).max(200).regex(/^[\x21-\x7e]+$/,`Idempotency-Key must be printable ASCII without spaces`);function n(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}e.CreateAgentRunRequestSchema=t.z.object({deckId:t.z.string().min(1).max(200),client:e.AgentRunClientSchema,cwd:t.z.string().min(1).max(4096).refine(n,`cwd must be an absolute path on the Agent Deck host`),prompt:t.z.string().max(e.AGENT_RUN_PROMPT_MAX_CHARS).refine(e=>e.trim().length>0,`prompt must not be empty`),tools:e.AgentRunToolsSchema.default(`readonly`),resumeSessionId:t.z.string().min(1).max(512).optional(),prepareFinalization:t.z.boolean().default(!1)}).strict(),e.StartSessionAgentRunRequestSchema=t.z.object({client:e.AgentRunClientSchema,prompt:t.z.string().max(e.AGENT_RUN_PROMPT_MAX_CHARS).refine(e=>e.trim().length>0,`prompt must not be empty`),tools:e.AgentRunToolsSchema.default(`readonly`),resumeSessionId:t.z.string().min(1).max(512).optional(),prepareFinalization:t.z.boolean().default(!1),playbookVersion:t.z.object({playbookId:t.z.string().min(1).max(200),versionId:t.z.string().min(1).max(200)}).strict().optional()}).strict(),e.AGENT_RUN_WORKSPACE_REQUIRED_MESSAGE=`This MCP session was launched without a host execution workspace, so start_run has nowhere to run and the agent cannot choose one. The launcher that started this session (for example Agent Dealer) must provide its workspace when it launches the session.`,e.AgentRunStateSchema=t.z.enum([`starting`,`running`,`ended`,`error`,`died`,`canceled`]),e.AGENT_RUN_TERMINAL_STATES=[`ended`,`error`,`died`,`canceled`],e.CreateAgentRunResponseSchema=t.z.object({runId:e.AgentRunIdSchema,state:e.AgentRunStateSchema}).strict(),e.GitObjectIdSchema=t.z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),e.Sha256HexSchema=t.z.string().regex(/^[0-9a-f]{64}$/),e.FinalizationBaselineRefSchema=t.z.string().regex(/^bl_[0-9a-f]{24}$/),e.FinalizationStateSchema=t.z.enum([`prepared`,`finalizing`,`finalized`]),e.AgentRunFinalizationStatusSchema=t.z.object({baselineRef:e.FinalizationBaselineRefSchema,baselineDigest:e.Sha256HexSchema,state:e.FinalizationStateSchema,commit:e.GitObjectIdSchema.nullable()}).strict(),e.AgentRunStatusSchema=t.z.object({runId:e.AgentRunIdSchema,deckId:t.z.string(),client:e.AgentRunClientSchema,tools:e.AgentRunToolsSchema,state:e.AgentRunStateSchema,sessionId:t.z.string().nullable(),startedAt:t.z.string(),lastEventAt:t.z.string().nullable(),finalization:e.AgentRunFinalizationStatusSchema.nullable()}).strict();var r={seq:t.z.number().int().positive(),ts:t.z.string()};e.AgentRunEventSchema=t.z.discriminatedUnion(`type`,[t.z.object({...r,type:t.z.literal(`text`),text:t.z.string()}).strict(),t.z.object({...r,type:t.z.literal(`tool`),name:t.z.string()}).strict(),t.z.object({...r,type:t.z.literal(`notice`),message:t.z.string(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`result`),subtype:t.z.string(),result:t.z.unknown(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`end`),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`error`),message:t.z.string(),sessionId:t.z.string().nullable()}).strict(),t.z.object({...r,type:t.z.literal(`canceled`),sessionId:t.z.string().nullable()}).strict()]),e.AgentRunEventsQuerySchema=t.z.object({after:t.z.string().regex(/^\d+$/).optional(),limit:t.z.coerce.number().int().min(1).max(e.AGENT_RUN_EVENTS_MAX_LIMIT).optional()}).strict(),e.AgentRunEventsResponseSchema=t.z.object({runId:e.AgentRunIdSchema,state:e.AgentRunStateSchema,events:t.z.array(e.AgentRunEventSchema),nextCursor:t.z.string()}).strict(),e.SessionAgentRunResponseSchema=e.AgentRunStatusSchema.extend({events:t.z.array(e.AgentRunEventSchema),nextCursor:t.z.string()}).strict(),e.AgentRunClientCapabilitySchema=t.z.object({client:e.AgentRunClientSchema,start:t.z.array(e.AgentRunToolsSchema),resume:t.z.array(e.AgentRunToolsSchema),resumeRequires:t.z.enum([`none`,`same_profile_provenance`])}).strict(),e.AgentRunCapabilitiesResponseSchema=t.z.object({host:t.z.literal(`same-host`),clients:t.z.array(e.AgentRunClientCapabilitySchema)}).strict(),e.FINALIZATION_MANIFEST_MAX_FILES=1e3,e.FINALIZATION_PATH_MAX_CHARS=1024,e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS=8192,e.FINALIZATION_REVIEW_ID_MAX_CHARS=200,e.FinalizationFileModeSchema=t.z.enum([`100644`,`100755`]),e.FinalizationManifestEntrySchema=t.z.object({path:t.z.string().min(1).max(e.FINALIZATION_PATH_MAX_CHARS),sha256:e.Sha256HexSchema.nullable(),mode:e.FinalizationFileModeSchema.nullable()}).strict().refine(e=>e.sha256===null==(e.mode===null),{message:`sha256 and mode are both null (deleted) or both set`}),e.AgentRunChangesResponseSchema=t.z.object({runId:e.AgentRunIdSchema,baselineRef:e.FinalizationBaselineRefSchema,baselineDigest:e.Sha256HexSchema,baseCommit:e.GitObjectIdSchema,files:t.z.array(e.FinalizationManifestEntrySchema),manifestDigest:e.Sha256HexSchema}).strict(),e.FinalizeAgentRunRequestSchema=t.z.object({baselineDigest:e.Sha256HexSchema,expectedBaseCommit:e.GitObjectIdSchema,reviewId:t.z.string().min(1).max(e.FINALIZATION_REVIEW_ID_MAX_CHARS).regex(/^[\x21-\x7e]+$/,`reviewId must be printable ASCII without spaces`),commitMessage:t.z.string().max(e.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS).refine(e=>e.trim().length>0,`commitMessage must not be empty`).refine(e=>!e.includes(`\0`),`commitMessage must not contain NUL`),files:t.z.array(e.FinalizationManifestEntrySchema).min(1).max(e.FINALIZATION_MANIFEST_MAX_FILES)}).strict(),e.FinalizeAgentRunResponseSchema=t.z.object({runId:e.AgentRunIdSchema,finalizationState:t.z.literal(`finalized`),commit:e.GitObjectIdSchema,tree:e.GitObjectIdSchema,parent:e.GitObjectIdSchema,manifestDigest:e.Sha256HexSchema,fileCount:t.z.number().int().positive(),reviewId:t.z.string()}).strict(),e.AgentRunErrorCodeSchema=t.z.enum(`INVALID_REQUEST.REQUEST_TOO_LARGE.IDEMPOTENCY_KEY_REQUIRED.IDEMPOTENCY_CONFLICT.DECK_NOT_FOUND.WORKSPACE_INVALID.WORKSPACE_MISMATCH.WORKSPACE_REQUIRED.CLIENT_UNAVAILABLE.PROFILE_UNSUPPORTED.RESUME_UNVERIFIED.RUN_NOT_FOUND.RUN_NOT_CANCELABLE.FINALIZATION_INVALID.FINALIZATION_NOT_PREPARED.RUN_NOT_TERMINAL.BASE_MISMATCH.INDEX_DIRTY.BASELINE_MISMATCH.PATH_INVALID.PATH_UNEXPECTED.DIGEST_MISMATCH.GIT_LOCK_CONFLICT.REF_RACE.FINALIZATION_CANCELED.FINALIZATION_FAILED`.split(`.`));function i(e,t){return{success:!1,error:t,error_code:e}}})),Yd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateId=n,e.generateShortId=r,e.isValidUUID=i;var t=Vd();function n(){return(0,t.randomUUID)()}function r(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function i(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}})),Xd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.normalizePlaybookPin=r,e.formatPlaybookPin=i;var t=Yd(),n=/^pb_[a-z0-9_]+$/;function r(e){if(typeof e!=`string`)return null;let r=e.trim();if(!r)return null;let i=r.indexOf(`=`);if(i===-1||r.indexOf(`=`,i+1)!==-1)return null;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();return!n.test(a)||!(0,t.isValidUUID)(o)?null:{playbookId:a,versionId:o}}function i(e){return`${e.playbookId}=${e.versionId}`}})),Zd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),Qd=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatZodError=t,e.isValidUrl=n,e.isValidHexColor=r,e.sanitizeHeaders=i;function t(e){return e.errors.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `)}function n(e){try{return new URL(e),!0}catch{return!1}}function r(e){return/^#[0-9A-F]{6}$/i.test(e)}function i(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&r.trim()&&(t[n.trim()]=r.trim());return t}})),$d=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.toSnakeCase=t,e.toCamelCase=n,e.convertToSnakeCase=r,e.convertToCamelCase=i,e.serializeForDatabase=a,e.deserializeFromDatabase=o;function t(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function n(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function r(e){let n={};for(let[r,i]of Object.entries(e)){let e=t(r);n[e]=i}return n}function i(e){let t={};for(let[r,i]of Object.entries(e)){let e=n(r);t[e]=i}return t}function a(e){let n={};for(let[r,i]of Object.entries(e))i!=null&&(typeof i==`object`&&!Array.isArray(i)?n[t(r)]=JSON.stringify(i):n[t(r)]=i);return n}function o(e){let t={};for(let[r,i]of Object.entries(e)){let e=n(r);if(typeof i==`string`&&(i.startsWith(`{`)||i.startsWith(`[`)))try{t[e]=JSON.parse(i)}catch{t[e]=i}else t[e]=i}return t}})),ef=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.slugifyCredentialLabel=t,e.deriveEnvNameFromLabel=n,e.deriveCredentialIdFromLabel=r,e.deriveCredentialDefaults=i;function t(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`connection`}function n(e){let n=t(e).toUpperCase();return n.endsWith(`_API_KEY`)?n:(n.endsWith(`_API`)&&(n=n.slice(0,-4)),`${n}_API_KEY`)}function r(e){return`cred_${t(e)}`}function i(e,t){let i=e.trim();return{id:t?.id??r(i),label:i,scheme:t?.scheme??`bearer`,envName:t?.envName??n(i),tags:t?.tags??[]}}})),tf=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.slugifyPlaybookTitle=t,e.derivePlaybookIdFromTitle=n,e.derivePlaybookDefaults=r;function t(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/_+/g,`_`).slice(0,48)}function n(e){return`pb_${t(e)||`playbook`}`}function r(e,t){let r=e.trim();return{title:r,id:t?.id??n(r)}}})),nf=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.buildPlaybookSearchText=o,e.detectPlaybookDependencies=s;var t=/\bcred_[a-z0-9_]+\b/g,n=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,r=/--connections(?:=|\s+)([^\s]+)/g;function i(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function a(e,t){let n=t.trim();return n?RegExp(`\\b${i(n)}\\b`,`i`).test(e):!1}function o(e){return[e.title??``,e.body??``,e.exec??``,e.skill??``,...e.triggers??[]].join(`
|
|
33
|
+
`)}function s(e,i,o={}){let s=new Set(o.credentialIds??[]),c=new Set(o.serviceIds??[]),l=new Set(i.credentials.map(e=>e.id)),u=new Map(i.services.map(e=>[e.id.toLowerCase(),e.id]));for(let n of e.matchAll(t)){let e=n[0];l.has(e)&&s.add(e)}for(let t of e.matchAll(r))for(let e of t[1].split(`,`)){let t=e.trim();l.has(t)&&s.add(t)}for(let t of i.credentials)t.envName&&e.includes(t.envName)&&s.add(t.id),a(e,t.label)&&s.add(t.id);for(let t of e.matchAll(n)){let e=u.get(t[0].toLowerCase());e&&c.add(e)}for(let t of i.services)a(e,t.name)&&c.add(t.id);return{dependsOnCredentialIds:[...s].sort(),dependsOnServiceIds:[...c].sort()}}})),rf=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serviceHasOAuthToken=n,e.isOAuthSessionValid=r,e.isOAuthAccessTokenExpired=i;var t=af();function n(e){return!!(e.oauthHasToken||e.oauthAccessToken)}function r(e){return n(e)?!(0,t.isOAuthTokenExpiringSoon)(e.oauthTokenExpiresAt):!1}function i(e,t=3e5){return n(e)?e.oauthTokenExpiresAt?new Date(e.oauthTokenExpiresAt).getTime()<=Date.now()+t:!1:!0}})),af=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isOAuthTokenExpiringSoon=r,e.getServiceWarnings=o,e.getCredentialWarnings=s,e.getPlaybookWarnings=c,e.buildCollectionCatalog=l,e.summarizeCollectionWarnings=u,e.primaryCollectionWarning=d;var t=rf(),n=3e5;function r(e){return e?new Date(e).getTime()<=Date.now()+n:!1}function i(e){return!!(e.oauthClientId||e.oauthAuthorizationUrl||e.oauthTokenUrl)}function a(e){return(0,t.isOAuthSessionValid)(e)}function o(e,n={}){let r=[];if(e.health===`unhealthy`){let t=e.type===`mcp`&&a(e);r.push({kind:`service_unhealthy`,message:t?`OAuth OK but MCP unreachable — for Slack, enable MCP under Agents & AI Apps in your app settings`:`Service reported unhealthy`,severity:`warning`})}if(e.type!==`mcp`||a(e)||!(n.oauthRequired===!0||i(e)))return r;if(!(e.oauthHasToken||e.oauthAccessToken))return r.push({kind:`oauth_required`,message:`OAuth authentication required`,severity:`error`}),r;if(!(0,t.isOAuthSessionValid)(e)){if(n.hasRefreshToken)return r;r.push({kind:`oauth_expired`,message:`OAuth token expired — re-authenticate`,severity:`error`})}return r}function s(e){return e.hasSecret?[]:[{kind:`credential_missing_secret`,message:`Key missing from vault — open to add or rotate`,severity:`error`}]}function c(e,t){let n=e.dependsOnCredentialIds.filter(e=>!t.credentialIds.has(e)),r=e.dependsOnServiceIds.filter(e=>!t.serviceIds.has(e)),i=n.length+r.length;return i===0?[]:[{kind:`playbook_missing_deps`,message:`${i} missing dependency reference${i===1?``:`s`}`,severity:`warning`}]}function l(e,t){return{credentialIds:new Set(e.map(e=>e.id)),serviceIds:new Set(t.map(e=>e.id))}}function u(e,t,n,r={}){let i=l(t,e),a=new Map,u=new Map,d=new Map,f={oauth_required:0,oauth_expired:0,service_unhealthy:0,credential_missing_secret:0,playbook_missing_deps:0};for(let t of e){let e=o(t,r[t.id]);if(e.length>0){a.set(t.id,e);for(let t of e)f[t.kind]+=1}}for(let e of t){let t=s(e);if(t.length>0){u.set(e.id,t);for(let e of t)f[e.kind]+=1}}for(let e of n){let t=c(e,i);if(t.length>0){d.set(e.id,t);for(let e of t)f[e.kind]+=1}}return{total:a.size+u.size+d.size,byKind:f,serviceWarnings:a,credentialWarnings:u,playbookWarnings:d}}function d(e){if(e?.length)return e.find(e=>e.severity===`error`)??e[0]}})),of=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stripJsonMarkdownFences=i,e.normalizeLocalMcpManifestInput=a,e.parseLocalMcpManifestJson=o;function t(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function n(e){return t(e)&&typeof e.command==`string`}function r(e){return!t(e)||Object.keys(e).length===0?!1:Object.values(e).every(n)}function i(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,``).replace(/\n?```\s*$/,``).trim():t}function a(e){if(!t(e))throw Error(`Configuration must be a JSON object`);if(t(e.config)&&r(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(r(e.mcpServers))return{mcpServers:e.mcpServers};if(t(e)&&typeof e.command==`string`){let t=typeof e.name==`string`&&e.name.trim()?e.name.trim():`local-server`,{name:r,...i}=e;if(!n(i))throw Error(`Missing or invalid command`);return{mcpServers:{[t]:i}}}if(r(e))return{mcpServers:e};throw Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"google-drive": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": ["-y", "@piotr-agier/google-drive-mcp"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}`)}function o(e){let t;try{t=JSON.parse(i(e))}catch(e){throw Error(`Failed to parse JSON: ${e instanceof Error?e.message:`Unknown error`}`)}return a(t)}})),sf=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.isAgentDeckDevMode=o,e.realAgentDeckHome=s,e.isUnderStoreRoot=d,e.resolveAgentDeckHome=m;var n=t(Vd()),r=t(Vd()),i=t(Vd()),a=`AGENT_DECK_ALLOW_REAL_HOME_IN_TESTS`;function o(){let e={}.AGENT_DECK_DEV?.trim().toLowerCase();return e===`1`||e===`true`||e===`yes`}function s(){return i.default.join(r.default.homedir(),`.agent-deck`)}function c(){let e={}.VITEST?.trim().toLowerCase();return e===`1`||e===`true`||!1}function l(e,t){return t===e||t.startsWith(`${e}${i.default.sep}`)}function u(e){try{return n.default.realpathSync(e)}catch{return e}}function d(e,t){return l(t,e)?!0:l(u(t),u(e))}function f(e){return d(e,s())}function p(){if({}.AGENT_DECK_HOME?.trim())return i.default.resolve({}.AGENT_DECK_HOME.trim());let e=s();return o()?i.default.join(e,`dev`):e}function m(){let e=p();if(c()&&{}[a]?.trim()!==`1`&&f(e))throw Error(`Refusing to use the real Agent Deck store (${e}) from a test process. Set AGENT_DECK_HOME to a temp dir for this test — each package vitest config already points the whole run at one. If the test only asserts default path resolution and writes nothing, set ${a}=1.`);return e}})),cf=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultDeckFileSchema=e.DEFAULT_DECK_FILE_VERSION=e.DEFAULT_DECK_FILENAME=void 0,e.resolveDefaultDeckPath=o,e.readDefaultDeckState=s,e.readDefaultDeck=c,e.writeDefaultDeck=l,e.clearDefaultDeck=u;var n=t(Vd()),r=t(Vd()),i=jd(),a=sf();e.DEFAULT_DECK_FILENAME=`default-deck.json`,e.DEFAULT_DECK_FILE_VERSION=1,e.DefaultDeckFileSchema=i.z.object({version:i.z.literal(e.DEFAULT_DECK_FILE_VERSION),deckId:i.z.string().min(1),deckName:i.z.string().min(1),updatedAt:i.z.string().min(1)});function o(){return r.default.join((0,a.resolveAgentDeckHome)(),e.DEFAULT_DECK_FILENAME)}function s(){let t=o(),r;try{r=n.default.readFileSync(t,`utf8`)}catch(e){return e?.code===`ENOENT`?{status:`none`}:{status:`unreadable`,path:t}}let i;try{i=JSON.parse(r)}catch{return{status:`unreadable`,path:t}}let a=e.DefaultDeckFileSchema.safeParse(i);if(!a.success)return{status:`unreadable`,path:t};let s=a.data.deckId.trim(),c=a.data.deckName.trim();return!s||!c?{status:`unreadable`,path:t}:{status:`ok`,deck:{...a.data,deckId:s,deckName:c}}}function c(){let e=s();return e.status===`ok`?e.deck:null}function l(t){let i={version:e.DEFAULT_DECK_FILE_VERSION,deckId:t.deckId.trim(),deckName:t.deckName.trim(),updatedAt:new Date().toISOString()},a=o();return n.default.mkdirSync(r.default.dirname(a),{recursive:!0}),n.default.writeFileSync(a,`${JSON.stringify(i,null,2)}\n`,`utf8`),a}function u(){try{return n.default.unlinkSync(o()),!0}catch{return!1}}})),lf=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.canonicalizeWorkspacePath=a,e.digestCanonicalWorkspacePath=o,e.prefixTrustedId=s;var n=Vd(),r=t(Vd()),i=t(Vd());function a(e){let t=i.default.resolve(e),n=t;try{n=r.default.realpathSync.native(t)}catch{n=i.default.normalize(t)}return process.platform===`win32`?(n=n.replace(/^([A-Za-z]):/,(e,t)=>`${t.toLowerCase()}:`),n=n.replace(/\//g,`\\`)):n=n.replace(/\\/g,`/`),n=i.default.normalize(n),!(n===`/`||process.platform===`win32`&&/^[a-z]:\\?$/i.test(n))&&(n.endsWith(`/`)||n.endsWith(`\\`))&&(n=n.replace(/[\\/]+$/,``)),n.normalize(`NFC`)}function o(e){return(0,n.createHash)(`sha256`).update(e,`utf8`).digest(`hex`)}function s(e,t){return`${e}_${t.replace(/-/g,``)}`}})),uf=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.AGENT_DECK_GIT_EXCLUDE_PATTERNS=void 0,e.ensureGitExcluded=a;var n=Vd(),r=t(Vd()),i=t(Vd());e.AGENT_DECK_GIT_EXCLUDE_PATTERNS=[`/.agent-deck/`,`/.cursor/rules/agent-deck-stubs/`,`/.claude/skills/agent-deck-*/`];function a(t,a=e.AGENT_DECK_GIT_EXCLUDE_PATTERNS){if(a.length===0)return;let o;try{o=(0,n.execFileSync)(`git`,[`-C`,t,`rev-parse`,`--git-path`,`info/exclude`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim()}catch{return}if(!o)return;let s=i.default.isAbsolute(o)?o:i.default.resolve(t,o);r.default.mkdirSync(i.default.dirname(s),{recursive:!0});let c=``;try{c=r.default.readFileSync(s,`utf8`)}catch(e){if(e.code!==`ENOENT`)throw e}let l=new Set(c.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))),u=a.filter(e=>!l.has(e));if(u.length===0)return;let d=c.length===0||c.endsWith(`
|
|
42
|
+
`)?``:`
|
|
43
|
+
`;r.default.writeFileSync(s,`${d}${u.join(`
|
|
44
|
+
`)}\n`,`utf8`)}})),df=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stripAnsi=t,e.sanitizeJsonText=n;function t(e){return e.replace(/\u001b\[[0-9;]*[ -/]*[@-~]/g,``).replace(/\u001b\][^\u0007]*(?:\u0007|\u001b\\)/g,``).replace(/\u001b[@-_]/g,``)}function n(e){let n=t(e),r=``;for(let e of n){let t=e.charCodeAt(0);(t===9||t===10||t===13||t>=32)&&(r+=e)}return r}})),ff=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.MUSE_SCHEMA_VERSION=e.CURSOR_MCP_RECOVERY_HINT=void 0,e.buildMcpUrl=o,e.resolveMuseGlobalConfigDir=s,e.resolveConfigPath=c,e.buildCodexAgentDeckEntry=l,e.buildGlobalFallbackHttpEntry=u,e.buildAgentDeckEntry=d,e.isHttpAgentDeckEntry=f,e.readHttpWorkspaceHeader=p,e.isLegacyBareHttpAgentDeckEntry=m,e.isMcpLaunchEntry=h,e.isLegacyClaudeLaunchEntry=g,e.isLegacyMuseLaunchEntry=_,e.readJsonFile=v,e.mergeMuseServerConfig=y,e.mergeMcpServerConfig=b,e.writeJsonFile=x,e.readTextFile=S,e.writeTextFile=C,e.escapeTomlBasicString=k,e.formatCodexMcpSection=A,e.formatCodexGlobalFallbackSection=j,e.codexTomlHasAgentDeckEntry=M,e.codexTomlHasLauncherEntry=N,e.mergeCodexTomlConfig=P,e.writePerFolderMcpEntries=F;var n=t(Vd()),r=t(Vd()),i=t(Vd()),a=df();e.CURSOR_MCP_RECOVERY_HINT="If Agent Deck tools are missing in Cursor, run `agent-deck setup --client cursor`, approve the project agent-deck server, run `agent-deck use <deck>` in the folder, then reload MCP.",e.MUSE_SCHEMA_VERSION=1;function o({host:e,mcpPort:t}){return`http://${e}:${t}/mcp`}function s(e=r.default.homedir()){return{}.XDG_CONFIG_HOME?.trim()||i.default.join(e,`.config`)}function c(e,t,n=process.cwd()){let a=r.default.homedir();switch(e){case`cursor`:return t===`project`?i.default.join(n,`.cursor`,`mcp.json`):i.default.join(a,`.cursor`,`mcp.json`);case`claude`:return t===`project`?i.default.join(n,`.mcp.json`):i.default.join(a,`.claude.json`);case`claude-desktop`:return process.platform===`darwin`?i.default.join(a,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`):process.platform===`win32`?i.default.join({}.APPDATA??a,`Claude`,`claude_desktop_config.json`):i.default.join(a,`.config`,`Claude`,`claude_desktop_config.json`);case`muse`:return t===`project`?i.default.join(n,`.mcp.json`):i.default.join(s(a),`muse`,`settings.json`);case`codex`:return t===`project`?i.default.join(n,`.codex`,`config.toml`):i.default.join(a,`.codex`,`config.toml`);default:throw Error(`Unsupported client: ${e}`)}}function l(e,t){return{url:o(e),http_headers:{"x-agent-deck-workspace":i.default.resolve(t.workspaceRoot)}}}function u(e){return{type:`http`,url:o(e)}}function d(e,t,n){if(e===`codex`){if(!n?.workspaceRoot)throw Error(`buildAgentDeckEntry(codex) requires options.workspaceRoot for the x-agent-deck-workspace header`);return l(t,{workspaceRoot:n.workspaceRoot})}if(e===`claude-desktop`)return{command:`agent-deck`,args:[`mcp-launch`]};if(e===`muse`||e===`claude`)return n?.workspaceRoot?{type:`http`,url:o(t),headers:{"x-agent-deck-workspace":i.default.resolve(n.workspaceRoot)}}:u(t);if(e===`cursor`)return n?.workspaceRoot?{url:o(t),headers:{"x-agent-deck-workspace":i.default.resolve(n.workspaceRoot)}}:{url:o(t)};throw Error(`Unsupported client: ${e}`)}function f(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.url==`string`&&typeof t.command!=`string`}function p(e){if(!f(e))return;let t=e.headers;if(!t||typeof t!=`object`||Array.isArray(t))return;let n=t[`x-agent-deck-workspace`];return typeof n==`string`&&n.length>0?n:void 0}function m(e){return f(e)}function h(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(typeof t.command!=`string`)return!1;let n=t.command.replaceAll(`\\`,`/`).split(`/`).pop();if(n!==`agent-deck`&&n!==`agent-deck.cmd`)return!1;let r=t.args;return Array.isArray(r)&&r.length===1&&r[0]===`mcp-launch`}function g(e){if(!h(e))return!1;let t=e;if(t.type===`stdio`)return!0;let n=t.env;if(!n||typeof n!=`object`||Array.isArray(n))return!1;let r=n.AGENT_DECK_WORKSPACE;return typeof r==`string`&&r.length>0}function _(e){return h(e)&&!g(e)}function v(e){if(!n.default.existsSync(e))return{};let t=(0,a.sanitizeJsonText)(n.default.readFileSync(e,`utf8`).trim());if(!t)return{};let r=JSON.parse(t);if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`Expected JSON object in ${e}`);return r}function y(t,n,r){let i=t.schema_version;if(i!==void 0&&i!==e.MUSE_SCHEMA_VERSION)throw Error(`Unsupported schema_version in ${r}: expected ${e.MUSE_SCHEMA_VERSION}, found ${JSON.stringify(i)}. Update Muse or fix the file manually, then re-run setup.`);return{...b(t,n),schema_version:e.MUSE_SCHEMA_VERSION}}function b(e,t){let n=e.mcpServers,r=n&&typeof n==`object`&&!Array.isArray(n)?{...n}:{};return r[`agent-deck`]=t,{...e,mcpServers:r}}function x(e,t){n.default.mkdirSync(i.default.dirname(e),{recursive:!0}),n.default.writeFileSync(e,`${JSON.stringify(t,null,2)}\n`,`utf8`)}function S(e){return n.default.existsSync(e)?n.default.readFileSync(e,`utf8`):``}function C(e,t){n.default.mkdirSync(i.default.dirname(e),{recursive:!0}),n.default.writeFileSync(e,t,`utf8`)}var w=/^\s*\[\s*mcp_servers\s*\.\s*("agent-deck"|'agent-deck'|agent-deck)\s*(\.\s*[^\]#]+)?\]\s*(?:#.*)?$/,T=/^\s*\[\s*("mcp_servers"|'mcp_servers'|mcp_servers)\s*\]\s*(?:#.*)?$/,E=/^\s*("agent-deck"|'agent-deck'|agent-deck)\s*(?=[.=])/;function D(e){return e.trimStart().startsWith(`[`)}function O(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===`"`){for(n+=1;n<e.length&&e[n]!==`"`;)n+=e[n]===`\\`?2:1;n+=1}else if(r===`'`){for(n+=1;n<e.length&&e[n]!==`'`;)n+=1;n+=1}else if(r===`#`)break;else t+=r,n+=1}let r=0;for(let e of t)e===`{`||e===`[`?r+=1:(e===`}`||e===`]`)&&--r;return r}function k(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`).replaceAll(`
|
|
45
|
+
`,`\\n`).replaceAll(`\r`,`\\r`).replaceAll(` `,`\\t`)}function A(e){let t=Object.entries(e.http_headers).map(([e,t])=>`"${k(e)}" = "${k(t)}"`).join(`, `);return[`[mcp_servers.agent-deck]`,`url = "${k(e.url)}"`,`http_headers = { ${t} }`].join(`
|
|
46
|
+
`)}function j(e){return[`[mcp_servers.agent-deck]`,`url = "${k(o(e))}"`].join(`
|
|
47
|
+
`)}function M(e){if(!e.includes(`agent-deck`))return!1;let t=e.split(`
|
|
48
|
+
`),n=new Map;for(let[e,r]of t.entries())if(D(r)){if(w.test(r))return!0;T.test(r)?n.set(e,`servers`):n.set(e,`other`)}let r=[...n.keys()],i=e=>{for(let t of r)if(t>e)return t;return t.length};for(let[e,r]of n){if(r!==`servers`)continue;let n=i(e),a=0,o=e+1;for(;o<n;){let e=t[o];if(a===0&&E.test(e))return!0;a+=O(e),a<0&&(a=0),o+=1}}return!1}function N(e){if(!e.includes(`mcp-launch`))return!1;let t=e.split(`
|
|
49
|
+
`),n=new Map;for(let[e,r]of t.entries())D(r)&&(w.test(r)?n.set(e,`managed`):T.test(r)?n.set(e,`servers`):n.set(e,`other`));let r=[...n.keys()],i=e=>{for(let t of r)if(t>e)return t;return t.length};for(let[e,r]of n){let n=i(e);if(r===`managed`){for(let r=e+1;r<n;r+=1)if(t[r].includes(`mcp-launch`))return!0;continue}if(r!==`servers`)continue;let a=0,o=e+1;for(;o<n;){let e=t[o];if(a===0&&E.test(e)){let r=e;for(a+=O(e),o+=1;a>0&&o<n;)r+=`\n${t[o]}`,a+=O(t[o]),o+=1;if(a=0,r.includes(`mcp-launch`))return!0;continue}a+=O(e),a<0&&(a=0),o+=1}}return!1}function P(e,t){let n=e.split(`
|
|
50
|
+
`),r=new Map;for(let[e,t]of n.entries())D(t)&&(w.test(t)?r.set(e,`managed`):T.test(t)?r.set(e,`servers`):r.set(e,`other`));let i=[...r.keys()],a=e=>{for(let t of i)if(t>e)return t;return n.length},o=new Set;for(let[e,t]of r){if(t!==`servers`)continue;let r=a(e),i=0,s=e+1;for(;s<r;){let e=n[s];if(i===0&&E.test(e)){for(i+=O(e),o.add(s),s+=1;i>0&&s<r;)i+=O(n[s]),o.add(s),s+=1;i=0;continue}i+=O(e),i<0&&(i=0),s+=1}for(let t=e+1;t<r;t+=1){if(!o.has(t)||t>e+1&&o.has(t-1))continue;let i=t;for(;i+1<r&&o.has(i+1);)i+=1;let a=i+1,s=t===e+1||n[t-1].trim()===``;a<r&&!o.has(a)&&n[a].trim()===``&&s&&o.add(a),t=i}}let s=i.filter(e=>r.get(e)===`managed`),c=e=>{let n=e;return n!==``&&!n.endsWith(`
|
|
51
|
+
`)&&(n+=`
|
|
52
|
+
`),n!==``&&!n.endsWith(`
|
|
53
|
+
|
|
54
|
+
`)&&(n+=`
|
|
55
|
+
`),`${n}${t}\n`};if(s.length===0)return o.size===0?c(e):c(n.filter((e,t)=>!o.has(t)).join(`
|
|
56
|
+
`));for(let e of s){let t=a(e);for(let n=e;n<t;n+=1)o.add(n)}let l=s[0],u=a(l),d=u;for(;d<n.length&&o.has(d);)d+=1;let f=!1;for(let e=u-1;e>l&&n[e].trim()===``;--e)f=!0;if(!f){for(let e=u;e<d;e+=1)if(n[e].trim()===``){f=!0;break}}let p=[];for(let e=0;e<l;e+=1)o.has(e)||p.push(n[e]);p.push(...t.split(`
|
|
57
|
+
`));let m=[];for(let e=d;e<n.length;e+=1)o.has(e)||m.push(n[e]);f&&m.some(e=>e.trim()!==``)&&p.push(``),p.push(...m);let h=p.join(`
|
|
58
|
+
`);return h.endsWith(`
|
|
59
|
+
`)?h:`${h}\n`}function F(e,t,n){let r=[],a=i.default.resolve(e);for(let e of n){if(e===`claude-desktop`)continue;let n=c(e,`project`,a),o=i.default.resolve(n);if(o!==a&&!o.startsWith(`${a}${i.default.sep}`))throw Error(`Refusing to write MCP config outside the workspace: ${n}`);if(e===`codex`){let i=A(l(t,{workspaceRoot:a}));C(n,P(S(n),i)),r.push({client:e,path:n});continue}let s=d(e,t,{workspaceRoot:a});x(n,b(v(n),s)),r.push({client:e,path:n})}return r}})),pf=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Yd(),e),n(Qd(),e),n($d(),e),n(ef(),e),n(tf(),e),n(nf(),e),n(af(),e),n(rf(),e),n(of(),e),n(sf(),e),n(cf(),e),n(Pd(),e),n(lf(),e),n(uf(),e),n(df(),e),n(ff(),e)})),mf=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AGENT_DECK_HOST_SESSION_ID_HEADER=e.AGENT_DECK_PLAYBOOK_PIN_HEADER=e.AGENT_DECK_BRIDGE_LIVENESS_V1=e.AGENT_DECK_BRIDGE_LIVENESS_HEADER=e.AGENT_DECK_RECOVERED_SESSION_HEADER=e.AGENT_DECK_CORRELATION_HEADER=e.AGENT_DECK_DECK_ID_HEADER=e.AGENT_DECK_WORKSPACE_HEADER=e.AGENT_DECK_AGENT_CLIENT=e.AGENT_DECK_DASHBOARD_CLIENT=e.AGENT_DECK_CLIENT_HEADER=void 0,e.AGENT_DECK_CLIENT_HEADER=`x-agent-deck-client`,e.AGENT_DECK_DASHBOARD_CLIENT=`dashboard`,e.AGENT_DECK_AGENT_CLIENT=`agent`,e.AGENT_DECK_WORKSPACE_HEADER=`x-agent-deck-workspace`,e.AGENT_DECK_DECK_ID_HEADER=`x-agent-deck-deck-id`,e.AGENT_DECK_CORRELATION_HEADER=`x-agent-deck-correlation-id`,e.AGENT_DECK_RECOVERED_SESSION_HEADER=`x-agent-deck-recovered-session`,e.AGENT_DECK_BRIDGE_LIVENESS_HEADER=`x-agent-deck-bridge-liveness`,e.AGENT_DECK_BRIDGE_LIVENESS_V1=`1`,e.AGENT_DECK_PLAYBOOK_PIN_HEADER=`x-agent-deck-playbook-pin`,e.AGENT_DECK_HOST_SESSION_ID_HEADER=`x-agent-deck-host-session-id`})),hf=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DASHBOARD_COOKIE_MAX_AGE_MS=e.DASHBOARD_SESSION_LEASE_MS=e.DASHBOARD_NONCE_TTL_MS=e.ADMIN_CHALLENGE_TTL_MS=e.ADMIN_MODE_LEASE_MS=e.RUNTIME_SESSION_LEASE_MS=e.AGENT_DECK_DASHBOARD_COOKIE=e.AGENT_DECK_SESSION_HEADER=void 0,e.AGENT_DECK_SESSION_HEADER=`x-agent-deck-session-id`,e.AGENT_DECK_DASHBOARD_COOKIE=`agent_deck_dashboard`,e.RUNTIME_SESSION_LEASE_MS=864e5,e.ADMIN_MODE_LEASE_MS=18e5,e.ADMIN_CHALLENGE_TTL_MS=3e5,e.DASHBOARD_NONCE_TTL_MS=12e4,e.DASHBOARD_SESSION_LEASE_MS=864e5,e.DASHBOARD_COOKIE_MAX_AGE_MS=2592e6})),gf=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PLAYBOOK_CARD_COLOR=e.API_KEY_CARD_COLOR=e.MCP_CARD_COLOR=void 0,e.getServiceCardColor=t,e.MCP_CARD_COLOR=`#92E4DD`,e.API_KEY_CARD_COLOR=`#F9386D`,e.PLAYBOOK_CARD_COLOR=`#FFFFFF`;function t(t){return t.cardColor,e.MCP_CARD_COLOR}})),_f=s((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.getServiceCardColor=e.PLAYBOOK_CARD_COLOR=e.API_KEY_CARD_COLOR=e.MCP_CARD_COLOR=e.DASHBOARD_COOKIE_MAX_AGE_MS=e.DASHBOARD_SESSION_LEASE_MS=e.DASHBOARD_NONCE_TTL_MS=e.ADMIN_CHALLENGE_TTL_MS=e.ADMIN_MODE_LEASE_MS=e.RUNTIME_SESSION_LEASE_MS=e.AGENT_DECK_DASHBOARD_COOKIE=e.AGENT_DECK_SESSION_HEADER=e.AGENT_DECK_PLAYBOOK_PIN_HEADER=e.AGENT_DECK_HOST_SESSION_ID_HEADER=e.AGENT_DECK_BRIDGE_LIVENESS_V1=e.AGENT_DECK_BRIDGE_LIVENESS_HEADER=e.AGENT_DECK_RECOVERED_SESSION_HEADER=e.AGENT_DECK_CORRELATION_HEADER=e.AGENT_DECK_DECK_ID_HEADER=e.AGENT_DECK_WORKSPACE_HEADER=e.AGENT_DECK_AGENT_CLIENT=e.AGENT_DECK_DASHBOARD_CLIENT=e.AGENT_DECK_CLIENT_HEADER=e.stripJsonMarkdownFences=e.parseLocalMcpManifestJson=e.normalizeLocalMcpManifestInput=e.primaryCollectionWarning=e.getPlaybookWarnings=e.getCredentialWarnings=e.getServiceWarnings=e.summarizeCollectionWarnings=void 0,n(Md(),e),n(Id(),e),n(Nd(),e),n(Ld(),e),n(Fd(),e),n(Rd(),e),n(zd(),e),n(Bd(),e),n(Hd(),e),n(Ud(),e),n(Wd(),e),n(Gd(),e),n(Kd(),e),n(qd(),e),n(Jd(),e),n(Xd(),e),n(Zd(),e),n(pf(),e);var r=af();Object.defineProperty(e,"summarizeCollectionWarnings",{enumerable:!0,get:function(){return r.summarizeCollectionWarnings}}),Object.defineProperty(e,"getServiceWarnings",{enumerable:!0,get:function(){return r.getServiceWarnings}}),Object.defineProperty(e,"getCredentialWarnings",{enumerable:!0,get:function(){return r.getCredentialWarnings}}),Object.defineProperty(e,"getPlaybookWarnings",{enumerable:!0,get:function(){return r.getPlaybookWarnings}}),Object.defineProperty(e,"primaryCollectionWarning",{enumerable:!0,get:function(){return r.primaryCollectionWarning}});var i=of();Object.defineProperty(e,"normalizeLocalMcpManifestInput",{enumerable:!0,get:function(){return i.normalizeLocalMcpManifestInput}}),Object.defineProperty(e,"parseLocalMcpManifestJson",{enumerable:!0,get:function(){return i.parseLocalMcpManifestJson}}),Object.defineProperty(e,"stripJsonMarkdownFences",{enumerable:!0,get:function(){return i.stripJsonMarkdownFences}});var a=mf();Object.defineProperty(e,"AGENT_DECK_CLIENT_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_CLIENT_HEADER}}),Object.defineProperty(e,"AGENT_DECK_DASHBOARD_CLIENT",{enumerable:!0,get:function(){return a.AGENT_DECK_DASHBOARD_CLIENT}}),Object.defineProperty(e,"AGENT_DECK_AGENT_CLIENT",{enumerable:!0,get:function(){return a.AGENT_DECK_AGENT_CLIENT}}),Object.defineProperty(e,"AGENT_DECK_WORKSPACE_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_WORKSPACE_HEADER}}),Object.defineProperty(e,"AGENT_DECK_DECK_ID_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_DECK_ID_HEADER}}),Object.defineProperty(e,"AGENT_DECK_CORRELATION_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_CORRELATION_HEADER}}),Object.defineProperty(e,"AGENT_DECK_RECOVERED_SESSION_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_RECOVERED_SESSION_HEADER}}),Object.defineProperty(e,"AGENT_DECK_BRIDGE_LIVENESS_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_BRIDGE_LIVENESS_HEADER}}),Object.defineProperty(e,"AGENT_DECK_BRIDGE_LIVENESS_V1",{enumerable:!0,get:function(){return a.AGENT_DECK_BRIDGE_LIVENESS_V1}}),Object.defineProperty(e,"AGENT_DECK_HOST_SESSION_ID_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_HOST_SESSION_ID_HEADER}}),Object.defineProperty(e,"AGENT_DECK_PLAYBOOK_PIN_HEADER",{enumerable:!0,get:function(){return a.AGENT_DECK_PLAYBOOK_PIN_HEADER}});var o=hf();Object.defineProperty(e,"AGENT_DECK_SESSION_HEADER",{enumerable:!0,get:function(){return o.AGENT_DECK_SESSION_HEADER}}),Object.defineProperty(e,"AGENT_DECK_DASHBOARD_COOKIE",{enumerable:!0,get:function(){return o.AGENT_DECK_DASHBOARD_COOKIE}}),Object.defineProperty(e,"RUNTIME_SESSION_LEASE_MS",{enumerable:!0,get:function(){return o.RUNTIME_SESSION_LEASE_MS}}),Object.defineProperty(e,"ADMIN_MODE_LEASE_MS",{enumerable:!0,get:function(){return o.ADMIN_MODE_LEASE_MS}}),Object.defineProperty(e,"ADMIN_CHALLENGE_TTL_MS",{enumerable:!0,get:function(){return o.ADMIN_CHALLENGE_TTL_MS}}),Object.defineProperty(e,"DASHBOARD_NONCE_TTL_MS",{enumerable:!0,get:function(){return o.DASHBOARD_NONCE_TTL_MS}}),Object.defineProperty(e,"DASHBOARD_SESSION_LEASE_MS",{enumerable:!0,get:function(){return o.DASHBOARD_SESSION_LEASE_MS}}),Object.defineProperty(e,"DASHBOARD_COOKIE_MAX_AGE_MS",{enumerable:!0,get:function(){return o.DASHBOARD_COOKIE_MAX_AGE_MS}});var s=gf();Object.defineProperty(e,"MCP_CARD_COLOR",{enumerable:!0,get:function(){return s.MCP_CARD_COLOR}}),Object.defineProperty(e,"API_KEY_CARD_COLOR",{enumerable:!0,get:function(){return s.API_KEY_CARD_COLOR}}),Object.defineProperty(e,"PLAYBOOK_CARD_COLOR",{enumerable:!0,get:function(){return s.PLAYBOOK_CARD_COLOR}}),Object.defineProperty(e,"getServiceCardColor",{enumerable:!0,get:function(){return s.getServiceCardColor}})}))(),vf=`focusScope.autoFocusOnMount`,yf=`focusScope.autoFocusOnUnmount`,bf={bubbles:!1,cancelable:!0},xf=`FocusScope`,Sf=b.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=b.useState(null),l=An(i),u=An(a),d=b.useRef(null),f=hn(t,e=>c(e)),p=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:kf(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||kf(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&kf(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),b.useEffect(()=>{if(s){Af.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(vf,bf);s.addEventListener(vf,l),s.dispatchEvent(t),t.defaultPrevented||(Cf(Nf(Tf(s)),{select:!0}),document.activeElement===e&&kf(s))}return()=>{s.removeEventListener(vf,l),setTimeout(()=>{let t=new CustomEvent(yf,bf);s.addEventListener(yf,u),s.dispatchEvent(t),t.defaultPrevented||kf(e??document.body,{select:!0}),s.removeEventListener(yf,u),Af.remove(p)},0)}}},[s,l,u,p]);let m=b.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=wf(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&kf(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&kf(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(On.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Sf.displayName=xf;function Cf(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(kf(r,{select:t}),document.activeElement!==n)return}function wf(e){let t=Tf(e);return[Ef(t,e),Ef(t.reverse(),e)]}function Tf(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ef(e,t){for(let n of e)if(!Df(n,{upTo:t}))return n}function Df(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 Of(e){return e instanceof HTMLInputElement&&`select`in e}function kf(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Of(e)&&t&&e.select()}}var Af=jf();function jf(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Mf(e,t),e.unshift(t)},remove(t){e=Mf(e,t),e[0]?.resume()}}}function Mf(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Nf(e){return e.filter(e=>e.tagName!==`A`)}var Pf=0;function Ff(){b.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??If()),document.body.insertAdjacentElement(`beforeend`,e[1]??If()),Pf++,()=>{Pf===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Pf--}},[])}function If(){let 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 Lf=function(){return Lf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Lf.apply(this,arguments)};function Rf(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 i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function zf(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Bf=`right-scroll-bar-position`,Vf=`width-before-scroll-bar`,Hf=`with-scroll-bars-hidden`,Uf=`--removed-body-scroll-bar-size`;function Wf(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Gf(e,t){var n=(0,b.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Kf=typeof window<`u`?b.useLayoutEffect:b.useEffect,qf=new WeakMap;function Jf(e,t){var n=Gf(t||null,function(t){return e.forEach(function(e){return Wf(e,t)})});return Kf(function(){var t=qf.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Wf(e,null)}),i.forEach(function(e){r.has(e)||Wf(e,a)})}qf.set(n,e)},[e]),n}function Yf(e){return e}function Xf(e,t){t===void 0&&(t=Yf);var n=[],r=!1;return{read:function(){if(r)throw 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(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Zf(e){e===void 0&&(e={});var t=Xf(null);return t.options=Lf({async:!0,ssr:!1},e),t}var Qf=function(e){var t=e.sideCar,n=Rf(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return b.createElement(r,Lf({},n))};Qf.isSideCarExport=!0;function $f(e,t){return e.useMedium(t),Qf}var ep=Zf(),tp=function(){},np=b.forwardRef(function(e,t){var n=b.useRef(null),r=b.useState({onScrollCapture:tp,onWheelCapture:tp,onTouchMoveCapture:tp}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,x=Rf(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),S=f,C=Jf([n,t]),w=Lf(Lf({},x),i);return b.createElement(b.Fragment,null,u&&b.createElement(S,{sideCar:ep,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?b.cloneElement(b.Children.only(s),Lf(Lf({},w),{ref:C})):b.createElement(v,Lf({},w,{className:c,ref:C}),s))});np.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},np.classNames={fullWidth:Vf,zeroRight:Bf};var rp=function(){if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function ip(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=rp();return t&&e.setAttribute(`nonce`,t),e}function ap(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function op(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var sp=function(){var e=0,t=null;return{add:function(n){e==0&&(t=ip())&&(ap(t,n),op(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cp=function(){var e=sp();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lp=function(){var e=cp();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},up={left:0,top:0,right:0,gap:0},dp=function(e){return parseInt(e||``,10)||0},fp=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[dp(n),dp(r),dp(i)]},pp=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return up;var t=fp(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])}},mp=lp(),hp=`data-scroll-locked`,gp=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
60
|
+
.${Hf} {
|
|
61
|
+
overflow: hidden ${r};
|
|
62
|
+
padding-right: ${s}px ${r};
|
|
63
|
+
}
|
|
64
|
+
body[${hp}] {
|
|
65
|
+
overflow: hidden ${r};
|
|
66
|
+
overscroll-behavior: contain;
|
|
67
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
68
|
+
padding-left: ${i}px;
|
|
69
|
+
padding-top: ${a}px;
|
|
70
|
+
padding-right: ${o}px;
|
|
71
|
+
margin-left:0;
|
|
72
|
+
margin-top:0;
|
|
73
|
+
margin-right: ${s}px ${r};
|
|
74
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.${Bf} {
|
|
78
|
+
right: ${s}px ${r};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.${Vf} {
|
|
82
|
+
margin-right: ${s}px ${r};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.${Bf} .${Bf} {
|
|
86
|
+
right: 0 ${r};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.${Vf} .${Vf} {
|
|
90
|
+
margin-right: 0 ${r};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
body[${hp}] {
|
|
94
|
+
${Uf}: ${s}px;
|
|
95
|
+
}
|
|
96
|
+
`},_p=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},vp=function(){b.useEffect(function(){return document.body.setAttribute(hp,(_p()+1).toString()),function(){var e=_p()-1;e<=0?document.body.removeAttribute(hp):document.body.setAttribute(hp,e.toString())}},[])},yp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;vp();var a=b.useMemo(function(){return pp(i)},[i]);return b.createElement(mp,{styles:gp(a,!t,i,n?``:`!important`)})},bp=!1;if(typeof window<`u`)try{var xp=Object.defineProperty({},"passive",{get:function(){return bp=!0,!0}});window.addEventListener(`test`,xp,xp),window.removeEventListener(`test`,xp,xp)}catch{bp=!1}var Sp=bp?{passive:!1}:!1,Cp=function(e){return e.tagName===`TEXTAREA`},wp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Cp(e)&&n[t]===`visible`)},Tp=function(e){return wp(e,`overflowY`)},Ep=function(e){return wp(e,`overflowX`)},Dp=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Ap(e,r)){var i=jp(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Op=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},kp=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Ap=function(e,t){return e===`v`?Tp(t):Ep(t)},jp=function(e,t){return e===`v`?Op(t):kp(t)},Mp=function(e,t){return e===`h`&&t===`rtl`?-1:1},Np=function(e,t,n,r,i){var a=Mp(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=jp(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Ap(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Pp=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Fp=function(e){return[e.deltaX,e.deltaY]},Ip=function(e){return e&&`current`in e?e.current:e},Lp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Rp=function(e){return`
|
|
97
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
98
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
99
|
+
`},zp=0,Bp=[];function Vp(e){var t=b.useRef([]),n=b.useRef([0,0]),r=b.useRef(),i=b.useState(zp++)[0],a=b.useState(lp)[0],o=b.useRef(e);b.useEffect(function(){o.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=zf([e.lockRef.current],(e.shards||[]).map(Ip),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=b.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Pp(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=Dp(d,u);if(!f)return!0;if(f?l=d:(l=d===`v`?`h`:`v`,f=Dp(d,u)),!f)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var p=r.current||l;return Np(p,t,e,p===`h`?s:c,!0)},[]),c=b.useCallback(function(e){var n=e;if(Bp.length&&Bp[Bp.length-1]===a){var r=`deltaY`in n?Fp(n):Pp(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Lp(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Ip).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=b.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Hp(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=b.useCallback(function(e){n.current=Pp(e),r.current=void 0},[]),d=b.useCallback(function(t){l(t.type,Fp(t),t.target,s(t,e.lockRef.current))},[]),f=b.useCallback(function(t){l(t.type,Pp(t),t.target,s(t,e.lockRef.current))},[]);b.useEffect(function(){return Bp.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Sp),document.addEventListener(`touchmove`,c,Sp),document.addEventListener(`touchstart`,u,Sp),function(){Bp=Bp.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Sp),document.removeEventListener(`touchmove`,c,Sp),document.removeEventListener(`touchstart`,u,Sp)}},[]);var p=e.removeScrollBar,m=e.inert;return b.createElement(b.Fragment,null,m?b.createElement(a,{styles:Rp(i)}):null,p?b.createElement(yp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Hp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Up=$f(ep,Vp),Wp=b.forwardRef(function(e,t){return b.createElement(np,Lf({},e,{ref:t,sideCar:Up}))});Wp.classNames=np.classNames;var Gp=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Kp=new WeakMap,qp=new WeakMap,Jp={},Yp=0,Xp=function(e){return e&&(e.host||Xp(e.parentNode))},Zp=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Xp(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Qp=function(e,t,n,r){var i=Zp(t,Array.isArray(e)?e:[e]);Jp[n]||(Jp[n]=new WeakMap);var a=Jp[n],o=[],s=new Set,c=new Set(i),l=function(e){e&&!s.has(e)&&(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){e&&!c.has(e)&&Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Kp.get(e)||0)+1,l=(a.get(e)||0)+1;Kp.set(e,c),a.set(e,l),o.push(e),c===1&&i&&qp.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Yp++,function(){o.forEach(function(e){var t=Kp.get(e)-1,i=a.get(e)-1;Kp.set(e,t),a.set(e,i),t||(qp.has(e)||e.removeAttribute(r),qp.delete(e)),i||e.removeAttribute(n)}),Yp--,Yp||(Kp=new WeakMap,Kp=new WeakMap,qp=new WeakMap,Jp={})}},$p=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Gp(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Qp(r,i,n,`aria-hidden`)):function(){return null}},em=`Dialog`,[tm,nm]=_n(em),[rm,im]=tm(em),am=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=b.useRef(null),c=b.useRef(null),[l,u]=nr({prop:r,defaultProp:i??!1,onChange:a,caller:em});return(0,V.jsx)(rm,{scope:t,triggerRef:s,contentRef:c,contentId:ns(),titleId:ns(),descriptionId:ns(),open:l,onOpenChange:u,onOpenToggle:b.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};am.displayName=em;var om=`DialogTrigger`,sm=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=im(om,n),a=hn(t,i.triggerRef);return(0,V.jsx)(On.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Dm(i.open),...r,ref:a,onClick:U(e.onClick,i.onOpenToggle)})});sm.displayName=om;var cm=`DialogPortal`,[lm,um]=tm(cm,{forceMount:void 0}),dm=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=im(cm,t);return(0,V.jsx)(lm,{scope:t,forceMount:n,children:b.Children.map(r,e=>(0,V.jsx)(Zn,{present:n||a.open,children:(0,V.jsx)(Yn,{asChild:!0,container:i,children:e})}))})};dm.displayName=cm;var fm=`DialogOverlay`,pm=b.forwardRef((e,t)=>{let n=um(fm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=im(fm,e.__scopeDialog);return a.modal?(0,V.jsx)(Zn,{present:r||a.open,children:(0,V.jsx)(hm,{...i,ref:t})}):null});pm.displayName=fm;var mm=yn(`DialogOverlay.RemoveScroll`),hm=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=im(fm,n);return(0,V.jsx)(Wp,{as:mm,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(On.div,{"data-state":Dm(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),gm=`DialogContent`,_m=b.forwardRef((e,t)=>{let n=um(gm,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=im(gm,e.__scopeDialog);return(0,V.jsx)(Zn,{present:r||a.open,children:a.modal?(0,V.jsx)(vm,{...i,ref:t}):(0,V.jsx)(ym,{...i,ref:t})})});_m.displayName=gm;var vm=b.forwardRef((e,t)=>{let n=im(gm,e.__scopeDialog),r=b.useRef(null),i=hn(t,n.contentRef,r);return b.useEffect(()=>{let e=r.current;if(e)return $p(e)},[]),(0,V.jsx)(bm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:U(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault())})}),ym=b.forwardRef((e,t)=>{let n=im(gm,e.__scopeDialog),r=b.useRef(!1),i=b.useRef(!1);return(0,V.jsx)(bm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),bm=b.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=im(gm,n),c=b.useRef(null),l=hn(t,c);return Ff(),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Sf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Rn,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Dm(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(jm,{titleId:s.titleId}),(0,V.jsx)(Nm,{contentRef:c,descriptionId:s.descriptionId})]})]})}),xm=`DialogTitle`,Sm=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=im(xm,n);return(0,V.jsx)(On.h2,{id:i.titleId,...r,ref:t})});Sm.displayName=xm;var Cm=`DialogDescription`,wm=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=im(Cm,n);return(0,V.jsx)(On.p,{id:i.descriptionId,...r,ref:t})});wm.displayName=Cm;var Tm=`DialogClose`,Em=b.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=im(Tm,n);return(0,V.jsx)(On.button,{type:`button`,...r,ref:t,onClick:U(e.onClick,()=>i.onOpenChange(!1))})});Em.displayName=Tm;function Dm(e){return e?`open`:`closed`}var Om=`DialogTitleWarning`,[km,Am]=gn(Om,{contentName:gm,titleName:xm,docsSlug:`dialog`}),jm=({titleId:e})=>{let t=Am(Om),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
100
|
+
|
|
101
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
102
|
+
|
|
103
|
+
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},Mm=`DialogDescriptionWarning`,Nm=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Am(Mm).contentName}}.`;return b.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Pm=am,Fm=dm,Im=pm,Lm=_m,Rm=Sm,zm=wm,Bm=Em,Vm=Pm,Hm=Fm,Um=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Im,{ref:n,className:Wo(`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}));Um.displayName=Im.displayName;var Wm=b.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(Hm,{children:[(0,V.jsx)(Um,{}),(0,V.jsxs)(Lm,{ref:r,className:Wo(`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,(0,V.jsxs)(Bm,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden 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:[(0,V.jsx)(aa,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Wm.displayName=Lm.displayName;var Gm=({className:e,...t})=>(0,V.jsx)(`div`,{className:Wo(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Gm.displayName=`DialogHeader`;var Km=({className:e,...t})=>(0,V.jsx)(`div`,{className:Wo(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Km.displayName=`DialogFooter`;var qm=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Rm,{ref:n,className:Wo(`text-lg font-semibold leading-none tracking-tight`,e),...t}));qm.displayName=Rm.displayName;var Jm=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(zm,{ref:n,className:Wo(`text-sm text-muted-foreground`,e),...t}));Jm.displayName=zm.displayName;var Ym=`Label`,Xm=b.forwardRef((e,t)=>(0,V.jsx)(On.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Xm.displayName=Ym;var Zm=Xm,Qm=ci(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),$m=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Zm,{ref:n,className:Wo(Qm(),e),...t}));$m.displayName=Zm.displayName;var eh=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`textarea`,{className:Wo(`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-hidden 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}));eh.displayName=`Textarea`;function th({deck:e,open:t,onOpenChange:n,onDirtyChange:r}){let i=e.operatingInstructions??``,[a,o]=(0,b.useState)(i),s=we(),{toast:c}=dn();(0,b.useEffect)(()=>{t&&o(e.operatingInstructions??``)},[t,e.id]);let l=t&&a!==i,u=(0,_f.normalizeOperatingInstructions)(a).length,d=u>_f.OPERATING_INSTRUCTIONS_MAX_LENGTH;(0,b.useEffect)(()=>(r?.(l),()=>{r?.(!1)}),[l,r]);let f=qt({mutationFn:async t=>(await H(`PUT`,`/api/decks/${e.id}`,{operatingInstructions:t})).json(),onSuccess:async(t,r)=>{if(!t.success){c({title:`Could not save deck instructions`,description:t.error||`Save failed`,variant:`destructive`});return}o(t.data?.operatingInstructions??r),await s.invalidateQueries({queryKey:[`/api/decks`]}).catch(()=>{}),c({title:`Deck instructions saved`,description:`New sessions using ${e.name} will receive the updated instructions.`}),n(!1)},onError:e=>{c({title:`Could not save deck instructions`,description:e.message,variant:`destructive`})}}),p=()=>{(a===i||window.confirm(`You have unsaved deck instructions. Discard them?`))&&(o(i),n(!1))},m=_f.OPERATING_INSTRUCTIONS_MAX_LENGTH.toLocaleString(`en-US`);return(0,V.jsx)(Vm,{open:t,onOpenChange:e=>{e||p()},children:(0,V.jsxs)(Wm,{className:`max-h-[90vh] overflow-y-auto border-white/10 bg-[#161612] text-[#E8F6F4] sm:max-w-2xl`,"data-testid":`deck-instructions-modal`,children:[(0,V.jsxs)(Gm,{children:[(0,V.jsx)(qm,{children:`Deck instructions`}),(0,V.jsxs)(Jm,{className:`text-[#A8C4C0]`,children:[`Markdown instructions for agent sessions using `,e.name,`. They are stored in this deck's Git-synced deck file and cannot override host safety or authorization policy.`]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,V.jsx)($m,{htmlFor:`deck-instructions`,children:`Instructions (Markdown)`}),(0,V.jsxs)(`span`,{className:`shrink-0 text-xs tabular-nums ${d?`font-semibold text-red-400`:`text-gray-400`}`,"data-testid":`deck-instructions-count`,children:[u.toLocaleString(`en-US`),` / `,m]})]}),(0,V.jsx)(eh,{id:`deck-instructions`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g. Prefer pnpm. Never push without asking.
|
|
104
|
+
|
|
105
|
+
Leave empty for no deck instructions.`,rows:12,"aria-label":`Deck instructions (Markdown)`,"data-testid":`input-deck-instructions`,className:`min-h-48 border-white/15 bg-[#0F0F0C] font-mono text-sm text-[#E8F6F4] placeholder:text-[#A8C4C0]/60`}),d&&(0,V.jsxs)(`p`,{className:`text-sm text-red-400`,"data-testid":`deck-instructions-over-limit`,children:[`Instructions exceed the `,m,`-character limit and cannot be saved. Non-empty instructions are stored with a trailing newline, which counts toward the limit.`]}),(0,V.jsx)(`p`,{className:`text-xs text-gray-400`,children:`Saving does not rewrite active host system prompts. New sessions — and existing sessions on their next supported session-context refresh — receive the saved value.`})]}),(0,V.jsxs)(Km,{className:`gap-2`,children:[(0,V.jsx)(q,{type:`button`,variant:`outline`,onClick:p,"data-testid":`button-cancel-deck-instructions`,className:`rounded-full border-white/20 text-[#E8F6F4] hover:bg-white/10`,children:`Cancel`}),(0,V.jsx)(q,{type:`button`,onClick:()=>f.mutate(a),disabled:a===i||d||f.isPending,"data-testid":`button-save-deck-instructions`,className:`rounded-full border border-[#C4B643] bg-[#C4B643] px-6 text-sm font-semibold text-black hover:opacity-90 disabled:border-white/15 disabled:bg-white/10 disabled:text-white/40 disabled:opacity-100`,children:f.isPending?`Saving…`:`Save instructions`})]})]})})}function nh({deck:e,services:t,credentials:n=[],playbooks:r=[],collectionWarnings:i,onDrop:a,onDragStart:o,onCredentialDragStart:s,onPlaybookDragStart:c,onDragEnd:l,onCardClick:u,onPlaybookClick:d,onCredentialClick:f,onInstructionsDirtyChange:p}){let[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(e.name),[v,y]=(0,b.useState)(!1),x=(0,b.useRef)(null),S=we(),{toast:C}=dn();(0,b.useEffect)(()=>{_(e.name),h(!1)},[e.id,e.name]),(0,b.useEffect)(()=>{m&&(x.current?.focus(),x.current?.select())},[m]);let w=qt({mutationFn:async t=>(await H(`PUT`,`/api/decks/${e.id}`,{name:t})).json(),onSuccess:e=>{if(!e.success)throw Error(e.error||`Rename failed`);S.invalidateQueries({queryKey:[`/api/decks`]}),h(!1)},onError:t=>{_(e.name),h(!1),C({title:`Could not rename deck`,description:t.message,variant:`destructive`})}}),T=()=>{let t=g.trim();if(!t||t===e.name){_(e.name),h(!1);return}w.mutate(t)},E=e=>{e.preventDefault(),a(e)},D=e=>{e.preventDefault()},O=t.length+n.length+r.length;return(0,V.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,V.jsxs)(`h3`,{className:`mb-4 flex min-w-0 shrink-0 items-center text-lg font-bold`,children:[(0,V.jsx)(`i`,{className:`fas fa-layer-group mr-2 text-blue-400`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Deck`}),m?(0,V.jsx)(xd,{ref:x,value:g,disabled:w.isPending,onChange:e=>_(e.target.value),onBlur:T,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),T()):t.key===`Escape`&&(t.preventDefault(),_(e.name),h(!1))},className:`ml-2 h-7 max-w-48 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`}):(0,V.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:()=>h(!0),"data-testid":`button-rename-deck`,children:e.name}),(0,V.jsxs)(`span`,{className:`ml-2 shrink-0 text-sm font-normal text-gray-400`,children:[`(`,O,` cards)`]}),(0,V.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>y(!0),"data-testid":`button-deck-instructions`,title:`Edit deck instructions`,className:`ml-2 h-7 shrink-0 px-2 text-xs font-normal text-gray-400 hover:text-white`,children:[(0,V.jsx)(Ni,{}),`Instructions`]})]}),(0,V.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:E,onDragOver:D,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:(0,V.jsx)(`div`,{className:`relative flex min-h-0 flex-1 items-center justify-center overflow-hidden min-w-0`,children:O===0?(0,V.jsx)(`div`,{className:`flex items-center justify-center`,style:{minHeight:fd},children:(0,V.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:128,height:192},"data-testid":`deck-empty-placeholder`,children:(0,V.jsx)(Wi,{className:`h-8 w-8 text-gray-500`})})}):(0,V.jsxs)(bd,{cardCount:O,children:[n.map((e,t)=>(0,V.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-linear-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer`,style:{borderColor:zu,boxShadow:`0 0 20px ${zu}20`},draggable:!0,onDragStart:t=>s(t,e,!0),onDragEnd:l,onClick:()=>f?.(e),"data-testid":`deck-card-${e.id}`,children:[(0,V.jsx)(Gu,{warnings:i?.credentialWarnings.get(e.id)}),(0,V.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:zu},children:`AK`})}),(0,V.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:zu},children:`AK`})}),(0,V.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`mb-2`,style:{color:zu},children:(0,V.jsx)(nd,{credential:e,color:zu})}),(0,V.jsx)(`h3`,{className:`font-bold text-xs mb-1 line-clamp-2`,style:{color:zu},children:e.label}),(0,V.jsx)(`div`,{className:`text-[8px] px-1 py-0.5 rounded border opacity-70`,style:{color:zu,borderColor:zu},children:e.hasSecret?`API Key`:`Missing key`})]})]},e.id)),r.map((e,t)=>(0,V.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-linear-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer`,style:{borderColor:Bu,boxShadow:`0 0 20px ${Bu}20`},draggable:!0,onDragStart:t=>c(t,e,!0),onDragEnd:l,onClick:()=>d?.(e),"data-testid":`deck-card-${e.id}`,children:[(0,V.jsx)(Gu,{warnings:i?.playbookWarnings.get(e.id)}),(0,V.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:Bu},children:`PB`})}),(0,V.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:Bu},children:`PB`})}),(0,V.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`mb-2`,style:{color:Bu},children:(0,V.jsx)(_i,{className:`h-7 w-7`,strokeWidth:2.25})}),(0,V.jsx)(`h3`,{className:`font-bold text-xs mb-1 line-clamp-2`,style:{color:Bu},children:e.title}),(0,V.jsx)(`div`,{className:`text-[8px] px-1 py-0.5 rounded border opacity-70`,style:{color:Bu,borderColor:Bu},children:`Playbook`})]})]},e.id)),t.map(e=>(0,V.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-linear-to-b from-gray-900 via-gray-800 to-gray-900 relative overflow-hidden cursor-pointer`,style:{borderColor:Hu(e),boxShadow:`0 0 20px ${Hu(e)}20`},draggable:!0,onDragStart:t=>o(t,e,!0),onDragEnd:l,onClick:()=>u?.(e),"data-testid":`deck-card-${e.id}`,children:[(0,V.jsx)(Gu,{warnings:i?.serviceWarnings.get(e.id)}),(0,V.jsx)(`div`,{className:`absolute top-1 left-1 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:Hu(e)},children:e.type===`mcp`?`RM`:e.type===`local-mcp`?`LM`:`A`})}),(0,V.jsx)(`div`,{className:`absolute bottom-1 right-1 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`leading-none`,style:{color:Hu(e)},children:e.type===`mcp`?`RM`:e.type===`local-mcp`?`LM`:`A`})}),(0,V.jsxs)(`div`,{className:`absolute inset-x-2 top-6 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`mb-2`,style:{color:Hu(e)},children:(0,V.jsx)(Ju,{service:e})}),(0,V.jsx)(`h3`,{className:`font-bold text-xs mb-1 line-clamp-2`,style:{color:Hu(e)},children:e.name}),(0,V.jsx)(`div`,{className:`text-[8px] px-1 py-0.5 rounded border opacity-70`,style:{color:Hu(e),borderColor:Hu(e)},children:e.type===`mcp`?`Remote MCP`:e.type===`local-mcp`?`Local MCP`:`A2A`})]})]},e.id))]})})}),(0,V.jsx)(th,{deck:e,open:v,onOpenChange:y,onDirtyChange:p})]})}var rh=`Popover`,[ih,ah]=_n(rh,[El]),oh=El(),[sh,ch]=ih(rh),lh=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=oh(t),c=b.useRef(null),[l,u]=b.useState(!1),[d,f]=nr({prop:r,defaultProp:i??!1,onChange:a,caller:rh});return(0,V.jsx)(Hl,{...s,children:(0,V.jsx)(sh,{scope:t,contentId:ns(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:b.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:b.useCallback(()=>u(!0),[]),onCustomAnchorRemove:b.useCallback(()=>u(!1),[]),modal:o,children:n})})};lh.displayName=rh;var uh=`PopoverAnchor`,dh=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ch(uh,n),a=oh(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return b.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(Ul,{...a,...r,ref:t})});dh.displayName=uh;var fh=`PopoverTrigger`,ph=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ch(fh,n),a=oh(n),o=hn(t,i.triggerRef),s=(0,V.jsx)(On.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Oh(i.open),...r,ref:o,onClick:U(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(Ul,{asChild:!0,...a,children:s})});ph.displayName=fh;var mh=`PopoverPortal`,[hh,gh]=ih(mh,{forceMount:void 0}),_h=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=ch(mh,t);return(0,V.jsx)(hh,{scope:t,forceMount:n,children:(0,V.jsx)(Zn,{present:n||a.open,children:(0,V.jsx)(Yn,{asChild:!0,container:i,children:r})})})};_h.displayName=mh;var vh=`PopoverContent`,yh=b.forwardRef((e,t)=>{let n=gh(vh,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=ch(vh,e.__scopePopover);return(0,V.jsx)(Zn,{present:r||a.open,children:a.modal?(0,V.jsx)(xh,{...i,ref:t}):(0,V.jsx)(Sh,{...i,ref:t})})});yh.displayName=vh;var bh=yn(`PopoverContent.RemoveScroll`),xh=b.forwardRef((e,t)=>{let n=ch(vh,e.__scopePopover),r=b.useRef(null),i=hn(t,r),a=b.useRef(!1);return b.useEffect(()=>{let e=r.current;if(e)return $p(e)},[]),(0,V.jsx)(Wp,{as:bh,allowPinchZoom:!0,children:(0,V.jsx)(Ch,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:U(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:U(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:U(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Sh=b.forwardRef((e,t)=>{let n=ch(vh,e.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return(0,V.jsx)(Ch,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Ch=b.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=ch(vh,n),p=oh(n);return Ff(),(0,V.jsx)(Sf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Rn,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,V.jsx)(Wl,{"data-state":Oh(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.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)`}})})})}),wh=`PopoverClose`,Th=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=ch(wh,n);return(0,V.jsx)(On.button,{type:`button`,...r,ref:t,onClick:U(e.onClick,()=>i.onOpenChange(!1))})});Th.displayName=wh;var Eh=`PopoverArrow`,Dh=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=oh(n);return(0,V.jsx)(Gl,{...i,...r,ref:t})});Dh.displayName=Eh;function Oh(e){return e?`open`:`closed`}var kh=lh,Ah=ph,jh=_h,Mh=yh,Nh=kh,Ph=Ah,Fh=b.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,V.jsx)(jh,{children:(0,V.jsx)(Mh,{ref:i,align:t,sideOffset:n,className:Wo(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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})}));Fh.displayName=Mh.displayName;function Ih(e,t){let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=Math.max(0,Math.floor((t.getTime()-n)/1e3));if(r<60)return`${r}s`;let i=Math.floor(r/60);if(i<60)return`${i}m`;let a=Math.floor(i/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function Lh(e,t=24){return e.length>t?`${e.slice(0,t-1)}…`:e}function Rh(e){let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(n+1):t}function zh(e){let t=new Map;for(let n of e)t.set(n.deckId,(t.get(n.deckId)??0)+1);return t}function Bh(e,t){let n=e>0?`${e} cards`:`Empty`;return t<=0?n:`${n}, ${t===1?`1 session`:`${t} sessions`}`}function Vh(e){return e===`agent-admin`?`admin`:e===`normal`?`normal`:`unknown`}function Hh(e){return e===`agent-admin`?`bg-amber-500/20 text-amber-200 ring-1 ring-amber-400/40`:e===`normal`?`bg-white/10 text-gray-300 ring-1 ring-white/10`:`bg-white/10 text-gray-300`}function Uh(e){let t=new Map,n=[],r=new Map;for(let r of e){if(r.workspaceRoot){let e=r.workspaceRoot,n=`${Rh(r.workspaceRoot)}/`,i=t.get(e)??{label:n,rows:[],deckIds:new Set};i.rows.push(r),i.deckIds.add(r.deckId),t.set(e,i);continue}n.push(r)}for(let e of n){let n=!1;for(let r of t.values())if(r.deckIds.has(e.deckId)){r.rows.push(e),n=!0;break}if(n)continue;let i=`deck:${e.deckId}`,a=`◆ ${Lh(e.deckName)}`,o=r.get(i)??{label:a,rows:[]};o.rows.push(e),r.set(i,o)}return[...[...t.entries()].map(([e,{label:t,rows:n}])=>({key:e,label:t,isWorkspaceGroup:!0,rows:[...n].sort((e,t)=>e.lastActivityAt<t.lastActivityAt?1:-1)})),...[...r.entries()].map(([e,{label:t,rows:n}])=>({key:e,label:t,isWorkspaceGroup:!1,rows:[...n].sort((e,t)=>e.lastActivityAt<t.lastActivityAt?1:-1)}))].sort((e,t)=>e.label.localeCompare(t.label))}function Wh(e,t){let{isWorkspaceGroup:n,highlighted:r,clientMeta:i}=t;return!e.workspaceRoot&&n?`no folder · ${i}`:n&&r?i:n?`${Lh(e.deckName)} · ${i}`:i}var Gh=`w-[min(22rem,calc(100vw-2rem))]`;function Kh({bindings:e,now:t=new Date,highlightDeckId:n,showContainmentNote:r=!1,scrollClassName:i=`max-h-64 overflow-y-auto`}){let a=n?e.filter(e=>e.deckId===n).length:0,o=(0,b.useMemo)(()=>Uh(e),[e]);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-b border-white/10 px-3 py-2.5`,children:(0,V.jsxs)(`p`,{className:`text-sm font-semibold leading-snug`,style:{color:Ru},children:[`Live sessions`,(0,V.jsx)(`span`,{className:`ml-1 font-normal text-gray-400`,children:`· match ⌘badge to chat opener`})]})}),r?(0,V.jsx)(`div`,{className:`border-b border-white/10 px-3 py-2 text-xs text-gray-400`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(Zi,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-gray-400`,"aria-hidden":!0}),(0,V.jsxs)(`p`,{children:[`Agents are bound to one deck per workspace. Cross-deck service calls return`,` `,(0,V.jsx)(`span`,{className:`font-mono text-gray-300`,children:`RESOURCE_OUT_OF_SCOPE`}),`.`]})]})}):null,n&&a>1?(0,V.jsxs)(`div`,{className:`border-b border-[#92E4DD]/20 bg-[#92E4DD]/5 px-3 py-1.5 text-xs text-gray-300`,children:[a,` sessions on this deck`]}):null,(0,V.jsx)(`div`,{className:Wo(i,`p-2`),children:o.map(({key:e,label:r,isWorkspaceGroup:i,rows:a})=>(0,V.jsxs)(`div`,{className:`mb-2 last:mb-0`,children:[(0,V.jsx)(`p`,{className:`px-1 pb-1 text-[10px] uppercase tracking-wide text-gray-500`,children:r}),(0,V.jsx)(`ul`,{className:`space-y-1`,children:a.map(e=>{let r=e.clientName??`agent`,a=Ih(e.lastActivityAt,t),o=a?`${r} · ${a}`:r,s=n===e.deckId,c=Wh(e,{isWorkspaceGroup:i,highlighted:s,clientMeta:o});return(0,V.jsxs)(`li`,{className:Wo(`rounded-md border-l-2 py-1.5 pl-2 pr-2 font-mono text-xs`,s?`border-[#92E4DD] bg-[#92E4DD]/5`:`border-transparent bg-white/5`),"data-testid":`live-session-row-${e.badge}`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,V.jsxs)(`span`,{style:{color:Ru},children:[`⌘`,e.badge]}),(0,V.jsx)(`span`,{className:Wo(`rounded px-1.5 py-0.5 font-sans text-[10px] uppercase tracking-wide`,Hh(e.mode)),children:Vh(e.mode)})]}),(0,V.jsx)(`span`,{className:`mt-0.5 block font-sans text-[10px] text-gray-400`,children:c})]},e.badge)})})]},e))})]})}function qh({highlightDeckId:e}){let{data:t}=Kt({queryKey:[`/api/scope/bindings`],refetchInterval:3e3}),n=t?.data??[];if(n.length===0)return null;let r=e?n.filter(t=>t.deckId===e).length:0;return(0,V.jsxs)(Nh,{children:[(0,V.jsx)(Ph,{asChild:!0,children:(0,V.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`h-9 shrink-0 whitespace-nowrap 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:[(0,V.jsx)(Gi,{className:`mr-1 h-3 w-3`,style:{color:Ru},"aria-hidden":!0}),(0,V.jsxs)(`span`,{className:`font-mono`,children:[`⌘`,n.length]}),r>0&&r<n.length?(0,V.jsxs)(`span`,{className:`ml-1 text-gray-400`,children:[`(`,r,` here)`]}):null]})}),(0,V.jsx)(Fh,{align:`end`,className:Wo(Gh,`border-white/10 bg-gray-950/95 p-0 text-gray-100`),"data-testid":`live-session-badges-panel`,children:(0,V.jsx)(Kh,{bindings:n,highlightDeckId:e})})]})}var Jh=b.createContext(void 0);function Yh(e){let t=b.useContext(Jh);return e||t||`ltr`}var Xh=`rovingFocusGroup.onEntryFocus`,Zh={bubbles:!1,cancelable:!0},Qh=`RovingFocusGroup`,[$h,eg,tg]=Dn(Qh),[ng,rg]=_n(Qh,[tg]),[ig,ag]=ng(Qh),og=b.forwardRef((e,t)=>(0,V.jsx)($h.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)($h.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(sg,{...e,ref:t})})}));og.displayName=Qh;var sg=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=b.useRef(null),p=hn(t,f),m=Yh(a),[h,g]=nr({prop:o,defaultProp:s??null,onChange:c,caller:Qh}),[_,v]=b.useState(!1),y=An(l),x=eg(n),S=b.useRef(!1),[C,w]=b.useState(0);return b.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Xh,y),()=>e.removeEventListener(Xh,y)},[y]),(0,V.jsx)(ig,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>v(!0),[]),onFocusableItemAdd:b.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>w(e=>e-1),[]),children:(0,V.jsx)(On.div,{tabIndex:_||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:U(e.onMouseDown,()=>{S.current=!0}),onFocus:U(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Xh,Zh);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);pg([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:U(e.onBlur,()=>v(!1))})})}),cg=`RovingFocusGroupItem`,lg=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ns(),l=a||c,u=ag(cg,n),d=u.currentTabStopId===l,f=eg(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return b.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)($h.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(On.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:U(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:U(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:U(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=fg(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?mg(n,r+1):n.slice(r+1)}setTimeout(()=>pg(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});lg.displayName=cg;var ug={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function dg(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function fg(e,t,n){let r=dg(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return ug[r]}function pg(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function mg(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hg=og,gg=lg,_g=`Tabs`,[vg,yg]=_n(_g,[rg]),bg=rg(),[xg,Sg]=vg(_g),Cg=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Yh(s),[d,f]=nr({prop:r,onChange:i,defaultProp:a??``,caller:_g});return(0,V.jsx)(xg,{scope:n,baseId:ns(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,V.jsx)(On.div,{dir:u,"data-orientation":o,...l,ref:t})})});Cg.displayName=_g;var wg=`TabsList`,Tg=b.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Sg(wg,n),o=bg(n);return(0,V.jsx)(hg,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,V.jsx)(On.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Tg.displayName=wg;var Eg=`TabsTrigger`,Dg=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Sg(Eg,n),s=bg(n),c=Ag(o.baseId,r),l=jg(o.baseId,r),u=r===o.value;return(0,V.jsx)(gg,{asChild:!0,...s,focusable:!i,active:u,children:(0,V.jsx)(On.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:U(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:U(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:U(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Dg.displayName=Eg;var Og=`TabsContent`,kg=b.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Sg(Og,n),c=Ag(s.baseId,r),l=jg(s.baseId,r),u=r===s.value,d=b.useRef(u);return b.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,V.jsx)(Zn,{present:i||u,children:({present:n})=>(0,V.jsx)(On.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});kg.displayName=Og;function Ag(e,t){return`${e}-trigger-${t}`}function jg(e,t){return`${e}-content-${t}`}var Mg=Cg,Ng=Tg,Pg=Dg,Fg=kg,Ig=Mg,Lg=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Ng,{ref:n,className:Wo(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,e),...t}));Lg.displayName=Ng.displayName;var Rg=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Pg,{ref:n,className:Wo(`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-hidden 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-xs`,e),...t}));Rg.displayName=Pg.displayName;var zg=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Fg,{ref:n,className:Wo(`mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,e),...t}));zg.displayName=Fg.displayName;function Bg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vg(e){return Bg(e)&&typeof e.command==`string`}function Hg(e){return!Bg(e)||Object.keys(e).length===0?!1:Object.values(e).every(Vg)}function Ug(e){let t=e.trim();return t.startsWith("```")?t.replace(/^```(?:json)?\s*\n?/i,``).replace(/\n?```\s*$/,``).trim():t}function Wg(e){if(!Bg(e))throw Error(`Configuration must be a JSON object`);if(Bg(e.config)&&Hg(e.config.mcpServers))return{mcpServers:e.config.mcpServers};if(Hg(e.mcpServers))return{mcpServers:e.mcpServers};if(Bg(e)&&typeof e.command==`string`){let t=typeof e.name==`string`&&e.name.trim()?e.name.trim():`local-server`,{name:n,...r}=e;if(!Vg(r))throw Error(`Missing or invalid command`);return{mcpServers:{[t]:r}}}if(Hg(e))return{mcpServers:e};throw Error(`Invalid configuration: expected a top-level "mcpServers" object. Example:
|
|
106
|
+
{
|
|
107
|
+
"mcpServers": {
|
|
108
|
+
"google-drive": {
|
|
109
|
+
"command": "npx",
|
|
110
|
+
"args": ["-y", "@piotr-agier/google-drive-mcp"]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}`)}function Gg(e){let t;try{t=JSON.parse(Ug(e))}catch(e){throw Error(`Failed to parse JSON: ${e instanceof Error?e.message:`Unknown error`}`)}return Wg(t)}function Kg({type:e,open:t,onOpenChange:n}){let[r,i]=(0,b.useState)(`remote`),[a,o]=(0,b.useState)(`json`),[s,c]=(0,b.useState)(`{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"memory": {
|
|
116
|
+
"command": "npx",
|
|
117
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
118
|
+
"env": {
|
|
119
|
+
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}`),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)({name:``,type:`mcp`,url:`http://localhost:8000/mcp`,description:``,headers_enabled:!1,headers:{},cardColor:Ru}),[_,v]=(0,b.useState)(`{
|
|
124
|
+
|
|
125
|
+
}`),[y,x]=(0,b.useState)(null),[S,C]=(0,b.useState)({name:``,type:`local-mcp`,command:``,args:[``],env:{},description:``,cardColor:Ru}),[w,T]=(0,b.useState)({name:``,type:`a2a`,manifest_url:`http://localhost:8001/.well-known/a2a/manifest.json`,description:``,cardColor:Ru}),E=we(),{toast:D}=dn(),O=()=>{try{f(null);let e=Gg(s),t=Object.entries(e.mcpServers);if(t.length===0)throw Error(`No MCP servers found in configuration`);if(t.length>1)throw Error(`Multiple servers not supported. Please configure one server at a time.`);let[n,r]=t[0],{command:i,args:a,env:c,description:l}=r;if(!i||typeof i!=`string`)throw Error(`Missing or invalid command`);if(!a||!Array.isArray(a))throw Error(`Missing or invalid args array`);let d={name:n,command:i,args:a.map(String),env:c&&typeof c==`object`?c:void 0,description:l&&typeof l==`string`?l:void 0};u(d),o(`review`),C({name:d.name,type:`local-mcp`,command:d.command,args:d.args,env:d.env||{},description:d.description||``,cardColor:Ru}),k(n)}catch(e){f(e instanceof Error?e.message:`Failed to parse JSON`),u(null)}},k=async e=>{try{((await H(`GET`,`/api/services`)).data||[]).find(t=>t.name===e)?m(e):m(null)}catch(e){console.error(`Failed to check name conflict:`,e)}},A=async e=>{await k(e)},j=qt({mutationFn:async t=>{if(e===`mcp`&&r===`local`){let e={mcpServers:{[t.name]:{command:t.command,args:t.args.filter(e=>e.trim()!==``),...Object.keys(t.env).length>0&&{env:t.env}}}};return console.log(`Importing local MCP server:`,e),H(`POST`,`/api/local-mcp/import`,{config:JSON.stringify(e)})}{let n={name:t.name,type:e,url:e===`mcp`?t.url:t.manifest_url,description:t.description,cardColor:t.cardColor,...t.headers_enabled&&{headers:t.headers}};return console.log(`Sending service data:`,n),H(`POST`,`/api/services`,n)}},onSuccess:()=>{E.invalidateQueries({queryKey:[`/api/services`]}),E.invalidateQueries({queryKey:[`/api/collection/warnings`]}),D({title:`Service registered successfully!`,description:`${(e===`mcp`?r===`remote`?h:S:w).name} has been added to your collection.`}),N()},onError:e=>{console.error(`Registration failed:`,e),console.error(`Error details:`,{message:e?.message,name:e?.name,stack:e?.stack,toString:e?.toString(),constructor:e?.constructor?.name}),D({title:`Registration failed`,description:e?.message||`Failed to register service. Please try again.`,variant:`destructive`})}}),M=async()=>{if(e===`mcp`&&r===`local`){if(a===`json`)O();else if(a===`review`){if(await A(S.name),p){D({title:`Name Conflict`,description:`A service with the name "${S.name}" already exists. Please choose a different name.`,variant:`destructive`});return}j.mutate(S)}}else{let t=e===`mcp`?r===`remote`?h:S:w;if(await A(t.name),p){D({title:`Name Conflict`,description:`A service with the name "${t.name}" already exists. Please choose a different name.`,variant:`destructive`});return}if(e===`mcp`&&r===`remote`&&h.headers_enabled){let e=I();if(e===null)return;j.mutate({...h,headers:e});return}j.mutate(t)}},N=()=>{o(`json`),c(`{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"memory": {
|
|
128
|
+
"command": "npx",
|
|
129
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
130
|
+
"env": {
|
|
131
|
+
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}`),u(null),f(null),m(null),g({name:``,type:`mcp`,url:`http://localhost:8000/mcp`,description:``,headers_enabled:!1,headers:{},cardColor:Ru}),v(`{
|
|
136
|
+
|
|
137
|
+
}`),x(null),C({name:``,type:`local-mcp`,command:``,args:[``],env:{},description:``,cardColor:Ru}),T({name:``,type:`a2a`,manifest_url:`http://localhost:8001/.well-known/a2a/manifest.json`,description:``,cardColor:Ru}),n(!1)},P=(e,t)=>{g(n=>({...n,[e]:t}))},F=e=>{P(`headers_enabled`,e),e&&_.trim()===`{
|
|
138
|
+
|
|
139
|
+
}`&&v(`{
|
|
140
|
+
"Authorization": "Bearer "
|
|
141
|
+
}`),e||x(null)},I=()=>{let e=_.trim();if(!e||e===`{}`)return{};try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))return x(`Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})`),null;for(let[e,n]of Object.entries(t))if(typeof n!=`string`)return x(`Header "${e}" must be a string value`),null;return x(null),t}catch{return x(`Invalid JSON — fix syntax before registering`),null}},L=(e,t)=>{C(n=>({...n,[e]:t}))},ee=(e,t)=>{T(n=>({...n,[e]:t}))},te=()=>{if(e===`mcp`&&r===`local`){if(a===`json`)return`Parse Configuration`;if(a===`review`)return p?`Register Anyway`:`Register Service`}return`Register Service`},ne=()=>{if(e===`mcp`&&r===`local`){if(a===`json`)return!s.trim();if(a===`review`)return!S.name.trim()||!S.command.trim()}else{let t=e===`mcp`?r===`remote`?h:S:w;return!t.name.trim()||e===`mcp`&&r===`remote`&&!t.url?.trim()||e===`a2a`&&!t.manifest_url?.trim()}return!1};return(0,V.jsx)(Vm,{open:t,onOpenChange:n,children:(0,V.jsxs)(Wm,{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:[(0,V.jsxs)(Gm,{children:[(0,V.jsxs)(qm,{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`?(0,V.jsx)(Ji,{className:`w-6 h-6 mr-3`,style:{color:`#92E4DD`}}):(0,V.jsx)(vi,{className:`w-6 h-6 mr-3`,style:{color:`#92E4DD`}}),`Register `,e===`mcp`?`MCP Server`:`A2A Agent`]}),(0,V.jsx)(Jm,{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`?(0,V.jsxs)(Ig,{value:r,onValueChange:e=>i(e),className:`w-full`,children:[(0,V.jsxs)(Lg,{className:`grid w-full grid-cols-2 bg-white/10 border border-white/20`,children:[(0,V.jsxs)(Rg,{value:`remote`,className:`data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400`,children:[(0,V.jsx)(Ji,{className:`w-4 h-4 mr-2`}),`Remote MCP`]}),(0,V.jsxs)(Rg,{value:`local`,className:`data-[state=active]:bg-white/20 data-[state=active]:text-white text-gray-400`,children:[(0,V.jsx)($i,{className:`w-4 h-4 mr-2`}),`Local MCP`]})]}),(0,V.jsxs)(zg,{value:`remote`,className:`space-y-4 mt-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`name`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Server Name`}),(0,V.jsx)(xd,{id:`name`,placeholder:`e.g., Database Tools`,value:h.name,onChange:e=>{P(`name`,e.target.value),e.target.value.trim()?A(e.target.value):m(null)},className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,required:!0,"data-testid":`input-service-name`}),p&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-red-400 text-sm`,children:[(0,V.jsx)(ta,{className:`w-4 h-4`}),(0,V.jsx)(`span`,{children:`A service with this name already exists`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`url`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`MCP URL`}),(0,V.jsx)(xd,{id:`url`,type:`url`,placeholder:`http://localhost:8080/mcp or https://mcp.notion.com/mcp`,value:h.url,onChange:e=>P(`url`,e.target.value),className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,required:!0,"data-testid":`input-mcp-url`}),(0,V.jsxs)(`div`,{className:`mt-1 text-xs text-gray-400`,children:[(0,V.jsx)(`p`,{children:`Supported formats:`}),(0,V.jsxs)(`ul`,{className:`list-disc list-inside ml-2 space-y-1`,children:[(0,V.jsxs)(`li`,{children:[`HTTP MCP: `,(0,V.jsx)(`code`,{children:`http://localhost:8080/mcp`})]}),(0,V.jsxs)(`li`,{children:[`SSE MCP: `,(0,V.jsx)(`code`,{children:`https://be.omnimcp.ai/api/v1/mcp/.../sse`})]}),(0,V.jsxs)(`li`,{children:[`Notion MCP: `,(0,V.jsx)(`code`,{children:`https://mcp.notion.com/mcp`})]})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`description`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Description`}),(0,V.jsx)(eh,{id:`description`,placeholder:`Brief description of capabilities...`,value:h.description,onChange:e=>P(`description`,e.target.value),rows:3,className:`bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none`,"data-testid":`textarea-description`})]})]}),(0,V.jsxs)(zg,{value:`local`,className:`space-y-4 mt-4`,children:[a===`json`&&(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`local-json`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Local MCP Configuration (JSON)`}),(0,V.jsx)(eh,{id:`local-json`,placeholder:`{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"memory": {
|
|
144
|
+
"command": "npx",
|
|
145
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}`,value:s,onChange:e=>c(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`}),(0,V.jsxs)(`div`,{className:`mt-2 text-xs text-gray-400`,children:[(0,V.jsx)(`p`,{children:`Enter your local MCP server configuration in JSON format.`}),(0,V.jsx)(`p`,{children:`Example:`}),(0,V.jsx)(`pre`,{className:`bg-white/10 p-2 rounded-md text-xs text-gray-300`,children:`{
|
|
149
|
+
"mcpServers": {
|
|
150
|
+
"memory": {
|
|
151
|
+
"command": "npx",
|
|
152
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
153
|
+
"env": {
|
|
154
|
+
"MEMORY_FILE_PATH": "/path/to/custom/memory.json"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}`})]})]}),(0,V.jsxs)(q,{type:`button`,className:`flex-1 border`,style:{background:`linear-gradient(135deg, #C4B643, #D4C760)`,borderColor:`#C4B643`,color:`#0A0A07`},onClick:O,disabled:!s.trim()||s.trim().length<10,"data-testid":`button-parse-json`,children:[(0,V.jsx)(Ei,{className:`w-4 h-4 mr-2`,style:{color:`#0A0A07`}}),`Parse Configuration`]})]}),a===`review`&&(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`local-name`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Server Name`}),(0,V.jsx)(xd,{id:`local-name`,placeholder:`e.g., Memory Server`,value:S.name,onChange:e=>{L(`name`,e.target.value),e.target.value.trim()?A(e.target.value):m(null)},className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,required:!0,"data-testid":`input-local-service-name`}),p&&(0,V.jsxs)(`div`,{className:`mt-2 text-xs text-red-400 flex items-center`,children:[(0,V.jsx)(ta,{className:`w-4 h-4 mr-1`}),`A service with the name "`,p,`" already exists.`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`command`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Command`}),(0,V.jsx)(xd,{id:`command`,placeholder:`e.g., npx, python, node`,value:S.command,onChange:e=>L(`command`,e.target.value),className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,required:!0,"data-testid":`input-command`}),(0,V.jsx)(`div`,{className:`mt-1 text-xs text-gray-400`,children:`The command to execute (e.g., npx, python, node)`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Arguments`}),S.args.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex gap-2 mb-2`,children:[(0,V.jsx)(xd,{placeholder:`Argument ${t+1}`,value:e,onChange:e=>{let n=[...S.args];n[t]=e.target.value,L(`args`,n)},className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,"data-testid":`input-arg-${t}`}),t===S.args.length-1&&(0,V.jsx)(q,{type:`button`,size:`sm`,onClick:()=>L(`args`,[...S.args,``]),className:`bg-white/20 hover:bg-white/30 text-white`,children:(0,V.jsx)(Wi,{className:`w-4 h-4`})}),S.args.length>1&&(0,V.jsx)(q,{type:`button`,size:`sm`,variant:`destructive`,onClick:()=>{let e=S.args.filter((e,n)=>n!==t);L(`args`,e)},className:`bg-red-500/80 hover:bg-red-500 text-white`,children:(0,V.jsx)(aa,{className:`w-4 h-4`})})]},t)),(0,V.jsx)(`div`,{className:`mt-1 text-xs text-gray-400`,children:`Command arguments (e.g., -y, @modelcontextprotocol/server-memory)`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Environment Variables`}),Object.entries(S.env).length===0?(0,V.jsx)(`div`,{className:`text-gray-400 text-sm italic`,children:`No environment variables configured`}):(0,V.jsx)(`div`,{className:`space-y-2`,children:Object.entries(S.env).map(([e,t],n)=>(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(xd,{placeholder:`Variable name`,value:e,onChange:n=>{let r={...S.env};delete r[e],r[n.target.value]=t,L(`env`,r)},className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,"data-testid":`input-env-key-${n}`}),(0,V.jsx)(xd,{placeholder:`Value`,value:t,onChange:t=>{let n={...S.env};n[e]=t.target.value,L(`env`,n)},className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,"data-testid":`input-env-value-${n}`}),(0,V.jsx)(q,{type:`button`,size:`sm`,variant:`destructive`,onClick:()=>{let t={...S.env};delete t[e],L(`env`,t)},className:`bg-red-500/80 hover:bg-red-500 text-white`,children:(0,V.jsx)(aa,{className:`w-4 h-4`})})]},n))}),(0,V.jsxs)(q,{type:`button`,size:`sm`,onClick:()=>{let e={...S.env};e[``]=``,L(`env`,e)},className:`mt-2 bg-white/20 hover:bg-white/30 text-white`,children:[(0,V.jsx)(Wi,{className:`w-4 h-4 mr-2`}),`Add Environment Variable`]}),(0,V.jsx)(`div`,{className:`mt-1 text-xs text-gray-400`,children:`Environment variables for the MCP server process`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`local-description`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Description`}),(0,V.jsx)(eh,{id:`local-description`,placeholder:`Brief description of capabilities...`,value:S.description,onChange:e=>L(`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`})]}),(0,V.jsxs)(`div`,{className:`flex gap-3`,children:[(0,V.jsx)(q,{type:`button`,variant:`outline`,className:`flex-1 border-white/20 text-white hover:bg-white/10`,onClick:()=>o(`json`),"data-testid":`button-back-to-json`,children:`← Back to JSON`}),(0,V.jsxs)(q,{type:`button`,variant:`ghost`,className:`flex-1 border-2 hover:opacity-90 bg-linear-to-b from-gray-900 via-gray-800 to-gray-900`,style:Uu(`#92E4DD`),onClick:M,disabled:ne(),"data-testid":`button-register`,children:[(0,V.jsx)(Wi,{className:`w-4 h-4 mr-2`}),j.isPending?`Registering...`:te()]})]})]}),a===`complete`&&(0,V.jsxs)(`div`,{className:`text-center py-8`,children:[(0,V.jsx)(Ei,{className:`w-16 h-16 text-green-500 mx-auto mb-4`}),(0,V.jsx)(`h3`,{className:`text-xl font-bold mb-2`,style:{color:`#92E4DD`},children:`Local MCP Registered!`}),(0,V.jsx)(`p`,{className:`text-gray-400 mb-4`,children:`Your local MCP server has been successfully registered.`}),(0,V.jsx)(q,{type:`button`,className:`flex-1 border`,style:{background:`linear-gradient(135deg, #C4B643, #D4C760)`,borderColor:`#C4B643`,color:`#0A0A07`},onClick:N,"data-testid":`button-close`,children:`Close`})]})]})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`name`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Agent Name`}),(0,V.jsx)(xd,{id:`name`,placeholder:`e.g., Code Assistant`,value:w.name,onChange:e=>{ee(`name`,e.target.value),e.target.value.trim()?A(e.target.value):m(null)},className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,required:!0,"data-testid":`input-service-name`}),p&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-red-400 text-sm`,children:[(0,V.jsx)(ta,{className:`w-4 h-4`}),(0,V.jsx)(`span`,{children:`A service with this name already exists`})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`manifest_url`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Manifest URL`}),(0,V.jsx)(xd,{id:`manifest_url`,type:`url`,placeholder:`http://localhost:8001/.well-known/a2a/manifest.json`,value:w.manifest_url,onChange:e=>ee(`manifest_url`,e.target.value),className:`bg-white/10 border-white/20 text-white placeholder-gray-400`,required:!0,"data-testid":`input-manifest-url`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`description`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`Description`}),(0,V.jsx)(eh,{id:`description`,placeholder:`Brief description of capabilities...`,value:w.description,onChange:e=>ee(`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`&&(0,V.jsxs)(`div`,{className:`space-y-4 border border-white/10 rounded-lg p-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(`input`,{type:`checkbox`,id:`headers_enabled`,checked:h.headers_enabled,onChange:e=>F(e.target.checked),className:`rounded border-white/20 bg-white/10`}),(0,V.jsx)($m,{htmlFor:`headers_enabled`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`🔐 Authentication Required`})]}),(0,V.jsx)(`div`,{className:`text-xs text-gray-400`,children:(0,V.jsx)(`p`,{children:`Enable this if your MCP server requires authentication (API keys, tokens, etc.).`})}),h.headers_enabled&&(0,V.jsxs)(`div`,{className:`space-y-3 pl-6`,children:[(0,V.jsxs)(`div`,{className:`text-xs text-gray-400 mb-2`,children:[(0,V.jsx)(`p`,{children:`Configure HTTP headers for authentication. Common examples:`}),(0,V.jsxs)(`ul`,{className:`list-disc list-inside ml-2 mt-1 space-y-1`,children:[(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`code`,{children:`Authorization: Bearer YOUR_TOKEN`}),` - For API tokens`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`code`,{children:`X-API-Key: YOUR_API_KEY`}),` - For API keys`]}),(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`code`,{children:`X-Custom-Header: value`}),` - For custom headers`]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)($m,{htmlFor:`headers`,className:`text-sm font-semibold`,style:{color:`#92E4DD`},children:`HTTP Headers (JSON)`}),(0,V.jsx)(eh,{id:`headers`,placeholder:`{
|
|
159
|
+
"Authorization": "Bearer YOUR_TOKEN_HERE",
|
|
160
|
+
"X-API-Key": "YOUR_API_KEY_HERE"
|
|
161
|
+
}`,value:_,onChange:e=>{v(e.target.value),y&&x(null)},onBlur:()=>{_.trim()&&I()},rows:6,className:`bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs`,"data-testid":`textarea-headers`}),y&&(0,V.jsxs)(`p`,{className:`text-red-400 text-xs mt-1 flex items-center gap-1`,children:[(0,V.jsx)(ta,{className:`w-3 h-3 shrink-0`}),y]}),(0,V.jsx)(`div`,{className:`text-xs text-gray-400 mt-1`,children:(0,V.jsx)(`p`,{children:`Enter headers as JSON. Keys are header names, values are header values.`})})]})]})]}),d&&(0,V.jsxs)(`div`,{className:`text-red-400 text-sm mt-2`,children:[(0,V.jsx)(ta,{className:`w-4 h-4 mr-1`}),d]}),p&&(0,V.jsxs)(`div`,{className:`text-red-400 text-sm mt-2`,children:[(0,V.jsx)(ta,{className:`w-4 h-4 mr-1`}),`A service with the name "`,p,`" already exists. You can register it anyway, but it might overwrite the existing one.`]}),(0,V.jsxs)(`div`,{className:`flex space-x-3 pt-4`,children:[(0,V.jsx)(q,{type:`button`,variant:`secondary`,className:`flex-1 border text-white`,style:{background:`#ad095e`,borderColor:`#ad095e`},onClick:N,"data-testid":`button-cancel`,children:`Cancel`}),(e!==`mcp`||r!==`local`)&&(0,V.jsxs)(q,{type:`button`,variant:`ghost`,className:`flex-1 border-2 hover:opacity-90 bg-linear-to-b from-gray-900 via-gray-800 to-gray-900`,style:Uu(`#92E4DD`),disabled:j.isPending||ne(),"data-testid":`button-register`,onClick:M,children:[(0,V.jsx)(Wi,{className:`w-4 h-4 mr-2`}),j.isPending?`Registering...`:`Register Service`]})]})]})})}function qg(e){let t=e.message||`Unknown error`;if(/already exists/i.test(t))return{title:`Deck name already exists`,description:`Choose a different name — a deck with that name already exists.`};if(e instanceof Jt){if(e.errorCode===`GRANT_REQUIRED`||e.errorCode===`DASHBOARD_REQUIRED`)return{title:`Dashboard session required`,description:`Your dashboard session is missing or expired. Run agent-deck open and try again.`};if(e.errorCode===`ADMIN_REQUIRED`)return{title:`Admin elevation required`,description:`Deck-admin elevation is required for this agent session.`}}return/file store/i.test(t)?{title:`Could not save deck`,description:t}:{title:`Failed to create deck`,description:t}}async function Jg(e){return(await(await H(`POST`,`/api/export`,{scope:e.scope??`collection`,...e.deckId?{deckId:e.deckId}:{}})).json()).data}async function Yg(e){return(await(await H(`POST`,`/api/import`,e)).json()).data}function Xg(e,t){let n=new Blob([`${JSON.stringify(e,null,2)}\n`],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}function Zg(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)||`deck`}function Qg(e){let{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 $g({decks:e,editingDeckId:t,onSelectDeck:n,isLoading:r}){let[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(``),c=we(),{toast:l}=dn(),{data:u}=Kt({queryKey:[`/api/scope/bindings`],refetchInterval:3e3}),d=(0,b.useMemo)(()=>zh(u?.data??[]),[u]),{data:f}=Kt({queryKey:[`/api/default-deck`]}),p=f?.data?.deckId??null,m=qt({mutationFn:async e=>H(`PUT`,`/api/default-deck`,{deckId:e.id}),onSuccess:async(e,t)=>{await c.invalidateQueries({queryKey:[`/api/default-deck`]}),l({title:`Default deck set`,description:`${t.name} is now the default deck for headerless sessions.`})},onError:e=>{l({title:`Failed to set default deck`,description:e.message,variant:`destructive`})}}),h=qt({mutationFn:async()=>H(`DELETE`,`/api/default-deck`,{}),onSuccess:async()=>{await c.invalidateQueries({queryKey:[`/api/default-deck`]}),l({title:`Default deck cleared`,description:`Headerless sessions return to the explain-only session.`})},onError:e=>{l({title:`Failed to clear default deck`,description:e.message,variant:`destructive`})}}),g=(e,t)=>{e.stopPropagation(),m.mutate(t)},_=e=>{e.stopPropagation(),h.mutate()},v=qt({mutationFn:async e=>H(`POST`,`/api/decks`,{name:e,isActive:!1}),onSuccess:async(e,t)=>{let r=await e.json();await c.invalidateQueries({queryKey:[`/api/decks`]}),r.data?.id&&n(r.data.id),l({title:`Deck created`,description:`${t} has been created successfully.`}),a(!1),s(``)},onError:e=>{let{title:t,description:n}=qg(e);l({title:t,description:n,variant:`destructive`})}}),y=qt({mutationFn:async e=>{let t=await Jg({scope:`deck`,deckId:e.id});return Xg(t,`${Zg(e.name)}.agent-deck.json`),t},onSuccess:(e,t)=>{l({title:`Deck exported`,description:`${t.name}: ${e.services.length} services, ${e.playbooks.length} playbooks`})},onError:e=>{l({title:`Export failed`,description:e.message,variant:`destructive`})}}),x=(e,t)=>{e.stopPropagation(),y.mutate(t)},S=qt({mutationFn:async e=>H(`DELETE`,`/api/decks/${e}`,{}),onSuccess:()=>{c.invalidateQueries({queryKey:[`/api/decks`]}),l({title:`Deck deleted`,description:`Your deck has been deleted successfully.`})},onError:e=>{e.message.includes(`Cannot delete the last deck`)?l({title:`Cannot delete deck`,description:`You cannot delete the last deck. Please create another deck first.`,variant:`destructive`}):l({title:`Failed to delete deck`,description:e.message,variant:`destructive`})}}),C=async(e,t)=>{e.stopPropagation();try{await navigator.clipboard.writeText(t.id),l({title:`Copied deck id`,description:`Use with bind_workspace({ workspaceRoot, deckId }) in your agent.`})}catch(e){l({title:`Failed to copy deck id`,description:e instanceof Error?e.message:`Unknown error`,variant:`destructive`})}},w=(e,t)=>{e.stopPropagation(),window.confirm(`Are you sure you want to delete this deck? This action cannot be undone.`)&&S.mutate(t)},T=e=>{e.preventDefault();let t=o.trim();t&&v.mutate(t)},E=e=>(e.services?.length??0)+(e.credentials?.length??0)+(e.playbooks?.length??0);return r?(0,V.jsx)(`div`,{className:`bg-black/40 backdrop-blur-md rounded-2xl border border-white/10 p-6 shadow-2xl`,children:(0,V.jsxs)(`div`,{className:`animate-pulse space-y-4`,children:[(0,V.jsx)(`div`,{className:`h-6 bg-white/10 rounded`}),(0,V.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,V.jsx)(`div`,{className:`h-16 bg-white/5 rounded-lg`},t))})]})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`h-full flex flex-col`,"data-testid":`deck-management-panel`,children:[(0,V.jsxs)(`h2`,{className:`text-lg font-bold mb-3 flex items-center`,children:[(0,V.jsx)(zi,{className:`w-4 h-4 mr-2`,style:{color:`#92E4DD`}}),(0,V.jsx)(`span`,{className:`font-ui-display`,style:{color:`#92E4DD`},children:`My Decks`})]}),(0,V.jsx)(`div`,{className:`mb-3`,children:(0,V.jsxs)(q,{onClick:()=>a(!0),className:`w-full border text-sm py-2`,style:{background:`#C4B643`,borderColor:`#C4B643`,color:`black`},"data-testid":`create-deck-button`,children:[(0,V.jsx)(Wi,{className:`w-3 h-3 mr-2`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Add Deck`})]})}),(0,V.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2 rounded-lg border border-white/10 bg-white/5 px-2 py-1.5`,"data-testid":`default-deck-row`,children:[(0,V.jsxs)(`p`,{className:`truncate text-xs text-gray-400`,children:[`Default deck:`,` `,(0,V.jsx)(`span`,{className:`text-white`,children:f?.data?f.data.deckName:`none`})]}),f?.data&&(0,V.jsxs)(q,{size:`sm`,variant:`ghost`,className:`h-5 px-1 text-xs text-gray-400 hover:text-white`,onClick:_,title:`Clear the default deck`,"data-testid":`clear-default-deck`,children:[(0,V.jsx)(aa,{className:`w-3 h-3 mr-1`}),`Clear`]})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,V.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>{let r=e.id===t,i=Bh(E(e),d.get(e.id)??0);return(0,V.jsxs)(`div`,{className:`p-2 rounded-lg border cursor-pointer transition-all relative group ${r?`bg-linear-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(e.id),"data-testid":`deck-item-${e.id}`,children:[(0,V.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200`,children:[e.id!==p&&(0,V.jsx)(q,{size:`sm`,variant:`secondary`,className:`h-5 w-5 p-0`,onClick:t=>g(t,e),title:`Set as default deck`,"data-testid":`set-default-deck-${e.id}`,children:(0,V.jsx)(Qi,{className:`w-2 h-2`})}),(0,V.jsx)(q,{size:`sm`,variant:`secondary`,className:`h-5 w-5 p-0`,onClick:t=>x(t,e),title:`Export this deck`,"data-testid":`export-deck-${e.id}`,children:(0,V.jsx)(ji,{className:`w-2 h-2`})}),(0,V.jsx)(q,{size:`sm`,variant:`secondary`,className:`h-5 w-5 p-0`,onClick:t=>C(t,e),title:`Copy deck id for bind_workspace`,children:(0,V.jsx)(ki,{className:`w-2 h-2`})}),(0,V.jsx)(q,{size:`sm`,variant:`destructive`,className:`h-5 w-5 p-0 bg-red-500/80 hover:bg-red-500 border-red-400`,onClick:t=>w(t,e.id),title:`Delete deck`,children:(0,V.jsx)(ea,{className:`w-2 h-2`})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm pr-16 ${r?`text-yellow-300`:`text-white`}`,children:[e.name,e.id===p&&(0,V.jsx)(`span`,{className:`ml-2 rounded-full border border-yellow-500/40 bg-yellow-500/10 px-1.5 py-px text-[10px] font-normal text-yellow-300`,children:`Default`})]}),(0,V.jsx)(`p`,{className:`text-xs text-gray-400 select-none pointer-events-none`,children:i})]})]},e.id)})})})]}),(0,V.jsx)(Vm,{open:i,onOpenChange:a,children:(0,V.jsxs)(Wm,{className:`sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]`,children:[(0,V.jsx)(Gm,{children:(0,V.jsxs)(qm,{className:`flex items-center text-xl font-bold`,children:[(0,V.jsx)(zi,{className:`mr-2 h-5 w-5`,style:{color:`#92E4DD`}}),`Create New Deck`]})}),(0,V.jsxs)(`form`,{onSubmit:T,className:`space-y-4`,"data-testid":`form-create-deck`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`deckName`,children:`Deck Name`}),(0,V.jsx)(xd,{id:`deckName`,placeholder:`e.g., Hiring stack`,value:o,onChange:e=>s(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#A8C4C0]/60`,required:!0,"data-testid":`input-deck-name`})]}),(0,V.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,V.jsx)(q,{type:`button`,variant:`outline`,className:`flex-1 rounded-full border-white/20 text-[#E8F6F4] hover:bg-white/10`,onClick:()=>a(!1),"data-testid":`button-cancel-create`,children:`Cancel`}),(0,V.jsx)(q,{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:v.isPending,"data-testid":`button-submit-create`,children:v.isPending?`Creating…`:`Create Deck`})]})]})]})})]})}function e_({open:e,onOpenChange:t}){let[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),o=we(),{toast:s}=dn(),c=qt({mutationFn:async()=>H(`POST`,`/api/credentials`,{label:n.trim(),value:i}),onSuccess:()=>{o.invalidateQueries({queryKey:[`/api/credentials/vault`]}),o.invalidateQueries({queryKey:[`/api/decks`]}),s({title:`API key saved`,description:`${n.trim()} is stored securely. Your agent can use it from the active deck.`}),t(!1),r(``),a(``)},onError:e=>{s({title:`Could not save API key`,description:e.message,variant:`destructive`})}}),l=n.trim().length>0&&i.trim().length>0;return(0,V.jsx)(Vm,{open:e,onOpenChange:t,children:(0,V.jsxs)(Wm,{className:`sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]`,children:[(0,V.jsxs)(Gm,{children:[(0,V.jsx)(qm,{className:`text-[#E8F6F4]`,children:`Register API key`}),(0,V.jsx)(Jm,{className:`text-[#A8C4C0]`,children:`Name the service and paste the key. Agent Deck handles the rest — stored in your vault, never shown again.`})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`credential-name`,className:`text-[#CFEAE6]`,children:`Service name`}),(0,V.jsx)(xd,{id:`credential-name`,placeholder:`OpenAI, Linear, Slack…`,value:n,onChange:e=>r(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`credential-value`,className:`text-[#CFEAE6]`,children:`API key`}),(0,V.jsx)(xd,{id:`credential-value`,type:`password`,placeholder:`Paste key from the service dashboard`,value:i,onChange:e=>a(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]`})]}),(0,V.jsx)(q,{variant:`ghost`,className:`w-full border-2 hover:opacity-90 ${Vu}`,style:Uu(zu),onClick:()=>c.mutate(),disabled:!l||c.isPending,children:`Save to vault`})]})]})})}function t_({open:e,onOpenChange:t}){let[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(``),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)([]),[m,h]=(0,b.useState)([]),g=we(),{toast:_}=dn(),{data:v}=Kt({queryKey:[`/api/credentials/vault`],enabled:e}),{data:y}=Kt({queryKey:[`/api/services`],enabled:e}),x=v?.data??[],S=y?.data??[],C=qt({mutationFn:async()=>H(`POST`,`/api/playbooks`,{title:n.trim(),body:i,triggers:o.split(`,`).map(e=>e.trim()).filter(Boolean),dependsOnCredentialIds:f,dependsOnServiceIds:m,exec:c.trim()||void 0,skill:u.trim()||void 0,autoDetectDependencies:!0}),onSuccess:()=>{g.invalidateQueries({queryKey:[`/api/playbooks/vault`]}),_({title:`Playbook saved`,description:`${n.trim()} is in your collection.`}),t(!1),r(``),a(``),s(``),l(``),d(``),p([]),h([])},onError:e=>{_({title:`Could not save playbook`,description:e.message,variant:`destructive`})}}),w=(e,t,n)=>{n(e.includes(t)?e.filter(e=>e!==t):[...e,t])},T=n.trim().length>0&&i.trim().length>0;return(0,V.jsx)(Vm,{open:e,onOpenChange:t,children:(0,V.jsxs)(Wm,{className:`sm:max-w-2xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]`,children:[(0,V.jsxs)(Gm,{children:[(0,V.jsx)(qm,{children:`Register Playbook`}),(0,V.jsxs)(Jm,{className:`text-[#A8C4C0]`,children:[`Prefer`,` `,(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:`register_playbook`}),` /`,` `,(0,V.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.`]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`playbook-title`,children:`Title`}),(0,V.jsx)(xd,{id:`playbook-title`,placeholder:`Hiring inbox, Ashby API guide…`,value:n,onChange:e=>r(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4]`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`playbook-triggers`,children:`Triggers (comma-separated, max 16)`}),(0,V.jsx)(xd,{id:`playbook-triggers`,placeholder:`check inbox, review applicants`,value:o,onChange:e=>s(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4]`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`playbook-body`,children:`Instructions (markdown)`}),(0,V.jsx)(eh,{id:`playbook-body`,rows:8,placeholder:`# Steps
|
|
162
|
+
1. …
|
|
163
|
+
2. …`,value:i,onChange:e=>a(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-sm`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{children:`Extra API key deps (optional)`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Merged with auto-detected refs from content.`}),(0,V.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1`,children:x.length===0?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`No API keys registered yet.`}):x.map(e=>(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:f.includes(e.id),onChange:()=>w(f,e.id,p)}),e.label]},e.id))})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{children:`Extra MCP deps (optional)`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Merged with auto-detected refs from content.`}),(0,V.jsx)(`div`,{className:`max-h-28 overflow-y-auto rounded border border-white/10 p-2 space-y-1`,children:S.length===0?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`No MCP services registered yet.`}):S.map(e=>(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:m.includes(e.id),onChange:()=>w(m,e.id,h)}),e.name]},e.id))})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`playbook-exec`,children:`Suggested exec (optional)`}),(0,V.jsx)(xd,{id:`playbook-exec`,placeholder:`agent-deck exec --connections … -- uv run …`,value:c,onChange:e=>l(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`playbook-skill`,children:`Skill path hint (optional)`}),(0,V.jsx)(xd,{id:`playbook-skill`,placeholder:`.cursor/skills/…/SKILL.md`,value:u,onChange:e=>d(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] font-mono text-xs`})]}),(0,V.jsx)(q,{variant:`ghost`,className:`w-full border-2 hover:opacity-90 ${Vu}`,style:Uu(Bu),onClick:()=>C.mutate(),disabled:!T||C.isPending,children:`Save to collection`})]})]})})}async function n_(e){let t=await e.json();if(!t.success)throw Error(t.error??`Request failed`);return t.data}function r_(e){return e.length===0?null:e.length<=3?e.join(`, `):`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}async function i_(e){return n_(await H(`GET`,`/api/playbook-patches${e?`?status=${encodeURIComponent(e)}`:``}`))}async function a_(e){return n_(await H(`GET`,`/api/playbook-patches/${e}/preview`))}async function o_(e){return n_(await H(`POST`,`/api/playbook-patches/${e}/accept`))}async function s_(e,t){let n=t?.trim();return n_(await H(`POST`,`/api/playbook-patches/${e}/reject`,n?{reason:n}:{}))}async function c_(e){return n_(await H(`GET`,`/api/playbooks/${e}/events/count`))}async function l_(e){let t=await e.json();if(!t.success)throw Error(t.error??`Request failed`);return t.data}async function u_(e){let t=new URLSearchParams({available:`1`});return e&&t.set(`playbookId`,e),(await l_(await H(`GET`,`/api/feedback-signals/count?${t.toString()}`))).open}async function d_(e){let t=new URLSearchParams;return e?.status&&t.set(`status`,e.status),e?.playbookId&&t.set(`playbookId`,e.playbookId),e?.deckId&&t.set(`deckId`,e.deckId),e?.excludeInProposal!==void 0&&t.set(`excludeInProposal`,e.excludeInProposal?`true`:`false`),l_(await H(`GET`,`/api/feedback-signals${t.toString()?`?${t.toString()}`:``}`))}async function f_(e){return l_(await H(`POST`,`/api/feedback-signals/discard`,{signalIds:e}))}function p_(e){return!!e.linkedPatchId&&e.status===`open`}function m_(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\n`)}"`}function h_(e){return e==null||e===``?`null`:m_(e)}function g_(e){return`Propose playbook updates from these Agent Deck feedback signals (copied from the Feedback table).
|
|
164
|
+
|
|
165
|
+
For each coherent pattern:
|
|
166
|
+
1. Call \`propose_playbook_patch\` with consolidated item ops (prefer \`add_item\`) — or kind \`create\` when there is no playbook.
|
|
167
|
+
2. Pass **every** consumed row \`id\` in \`signal_ids\` so we can track which feedback is parked / solved.
|
|
168
|
+
3. Do not invent a list-feedback MCP tool. Discard noise in the dashboard.
|
|
169
|
+
|
|
170
|
+
Signals (\`id\` required for tracking):
|
|
171
|
+
|
|
172
|
+
\`\`\`yaml
|
|
173
|
+
${e.map(e=>{let t=[`- id: ${e.id}`,` playbook: ${h_(e.candidatePlaybookId)}`,` feedback: ${m_(e.userFeedbackExcerpt)}`,` failure: ${m_(e.failureSummary)}`];return e.correctedOutputHint&&t.push(` hint: ${m_(e.correctedOutputHint)}`),e.candidateDeckId&&t.push(` deck: ${e.candidateDeckId}`),t.join(`
|
|
174
|
+
`)}).join(`
|
|
175
|
+
`)}
|
|
176
|
+
\`\`\``}function __({playbookId:e,open:t,onOpenChange:n}){let{data:r,isLoading:i}=Kt({queryKey:e?[`/api/playbooks/${e}`]:[`playbook-detail-disabled`],enabled:t&&!!e}),{data:a}=Kt({queryKey:[`/api/playbooks/${e}/events/count`],queryFn:()=>c_(e),enabled:t&&!!e}),{data:o}=Kt({queryKey:[`/api/feedback-signals/count`,`available`,e],queryFn:()=>u_(e),enabled:t&&!!e}),s=r?.data,c=(s?.dependencies.missingCredentialIds.length??0)+(s?.dependencies.missingServiceIds.length??0);return(0,V.jsx)(Vm,{open:t,onOpenChange:n,children:(0,V.jsxs)(Wm,{className:`sm:max-w-6xl max-h-[90vh] overflow-y-auto border-border bg-[#161612] text-[#E8F6F4]`,children:[(0,V.jsxs)(Gm,{children:[(0,V.jsx)(qm,{children:s?.title??`Playbook`}),(0,V.jsx)(Jm,{className:`text-[#A8C4C0]`,children:s?.id??e})]}),i||!s?(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Loading…`}):(0,V.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,V.jsxs)(`p`,{className:`rounded-md border border-white/10 bg-white/5 px-3 py-2 text-[#A8C4C0]`,children:[`Agent corrections file as`,` `,(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:`propose_playbook_patch`}),` proposals — review in the queue. Direct`,` `,(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:`update_playbook`}),` is for explicit edits only.`]}),typeof a==`number`&&(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Fetched `,a,` time`,a===1?``:`s`,` (undertriggering signal)`,typeof o==`number`&&o>0?` · ${o} open feedback signal${o===1?``:`s`}`:null]}),typeof a!=`number`&&typeof o==`number`&&o>0&&(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[o,` open feedback signal`,o===1?``:`s`]}),s.triggers.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`font-semibold text-amber-200 mb-1`,children:`Triggers`}),(0,V.jsx)(`p`,{className:`text-gray-300`,children:s.triggers.join(`, `)})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`font-semibold text-amber-200 mb-1`,children:`Dependencies`}),s.dependencies.credentials.length===0&&s.dependencies.services.length===0&&c===0?(0,V.jsx)(`p`,{className:`text-gray-400`,children:`None declared.`}):(0,V.jsxs)(`ul`,{className:`space-y-1 text-gray-300`,children:[s.dependencies.credentials.map(e=>(0,V.jsxs)(`li`,{children:[`API key: `,e.label]},e.id)),s.dependencies.services.map(e=>(0,V.jsxs)(`li`,{children:[`MCP: `,e.label]},e.id)),s.dependencies.missingCredentialIds.map(e=>(0,V.jsxs)(`li`,{className:`text-amber-300 flex items-center gap-1`,children:[(0,V.jsx)(ta,{className:`w-3 h-3`}),` Missing API key: `,e]},e)),s.dependencies.missingServiceIds.map(e=>(0,V.jsxs)(`li`,{className:`text-amber-300 flex items-center gap-1`,children:[(0,V.jsx)(ta,{className:`w-3 h-3`}),` Missing MCP: `,e]},e))]})]}),s.exec&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`font-semibold text-amber-200 mb-1`,children:`Suggested exec`}),(0,V.jsx)(`pre`,{className:`rounded bg-black/40 p-2 text-xs overflow-x-auto`,children:s.exec})]}),s.skill&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`font-semibold text-amber-200 mb-1`,children:`Skill hint`}),(0,V.jsx)(`p`,{className:`font-mono text-xs text-gray-300`,children:s.skill})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`font-semibold text-amber-200 mb-1`,children:`Instructions`}),(0,V.jsx)(`div`,{className:`rounded bg-black/30 p-3 whitespace-pre-wrap text-gray-200`,children:s.body})]})]})]})})}function v_({credentialId:e,open:t,onOpenChange:n}){let r=we(),{toast:i}=dn(),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)(``),{data:d,isLoading:f}=Kt({queryKey:e?[`/api/credentials/${e}`]:[`credential-detail-disabled`],enabled:t&&!!e}),p=d?.data;(0,b.useEffect)(()=>{p&&(o(p.label),c(p.docsUrl??``),u(``))},[p?.id,p?.label,p?.docsUrl]);let m=qt({mutationFn:async()=>{if(!e)throw Error(`No credential selected`);let t=a.trim();if(!t)throw Error(`Name is required`);let n=s.trim();if(n)try{new URL(n)}catch{throw Error(`Documentation link must be a valid URL`)}await H(`PUT`,`/api/credentials/${e}`,{label:t,docsUrl:n}),l.trim()&&await H(`POST`,`/api/credentials/${e}/rotate`,{value:l.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`]}),i({title:l.trim()?`API key updated`:`API key saved`,description:l.trim()?`Name, docs link, and key value were updated.`:`Name and docs link were updated.`}),u(``),n(!1)},onError:e=>{i({title:`Could not save API key`,description:e.message,variant:`destructive`})}}),h=a.trim().length>0&&(a.trim()!==p?.label||s.trim()!==(p?.docsUrl??``)||l.trim().length>0);return(0,V.jsx)(Vm,{open:t,onOpenChange:n,children:(0,V.jsxs)(Wm,{className:`sm:max-w-md border-border bg-[#161612] text-[#E8F6F4]`,children:[(0,V.jsxs)(Gm,{children:[(0,V.jsx)(qm,{className:`text-[#E8F6F4]`,children:p?.label??`API key`}),(0,V.jsx)(Jm,{className:`font-mono text-xs text-[#A8C4C0]`,children:p?.id??e})]}),f||!p?(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Loading…`}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[!p.hasSecret&&(0,V.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:[(0,V.jsx)(ta,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,V.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.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`credential-detail-name`,className:`text-[#CFEAE6]`,children:`Name`}),(0,V.jsx)(xd,{id:`credential-detail-name`,value:a,onChange:e=>o(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`credential-detail-key`,className:`text-[#CFEAE6]`,children:p.hasSecret?`Rotate API key`:`API key`}),(0,V.jsx)(xd,{id:`credential-detail-key`,type:`password`,placeholder:p.hasSecret?`Leave blank to keep current key`:`Paste key from the service dashboard`,value:l,onChange:e=>u(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]`}),p.hasSecret&&(0,V.jsx)(`p`,{className:`text-xs text-[#6B8581]`,children:`Stored securely in Keychain. Enter a new value only when rotating.`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`credential-detail-docs`,className:`text-[#CFEAE6]`,children:`Documentation link`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(xd,{id:`credential-detail-docs`,type:`url`,placeholder:`https://…`,value:s,onChange:e=>c(e.target.value),className:`border-white/15 bg-[#0F0F0C] text-[#E8F6F4] placeholder:text-[#6B8581]`}),s.trim()&&(0,V.jsx)(q,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0 border-white/15 bg-[#0F0F0C] text-[#A8C4C0] hover:bg-white/5`,onClick:()=>window.open(s.trim(),`_blank`,`noopener,noreferrer`),title:`Open documentation`,children:(0,V.jsx)(Mi,{className:`h-4 w-4`})})]})]}),(0,V.jsx)(q,{variant:`ghost`,className:`w-full border-2 hover:opacity-90 ${Vu}`,style:Uu(zu),onClick:()=>m.mutate(),disabled:!h||m.isPending,children:m.isPending?`Saving…`:`Save changes`})]})]})})}var y_=ci(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden 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 b_({className:e,variant:t,...n}){return(0,V.jsx)(`div`,{className:Wo(y_({variant:t}),e),...n})}function x_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function S_(...e){return t=>{let n=!1,r=e.map(e=>{let r=x_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():x_(e[t],null)}}}}function C_(...e){return b.useCallback(S_(...e),e)}function w_(e,t=[]){let n=[];function r(t,r){let i=b.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=b.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=b.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>b.createContext(e));return function(n){let r=n?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,T_(i,...t)]}function T_(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}typeof window<`u`&&window.document&&window.document.createElement;function E_(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}var D_=globalThis?.document?b.useLayoutEffect:()=>{},O_=b.useInsertionEffect||D_;function k_({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=A_({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=b.useRef(e!==void 0);b.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`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.`),t.current=s},[s,r])}return[c,b.useCallback(t=>{if(s){let n=j_(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function A_({defaultProp:e,onChange:t}){let[n,r]=b.useState(e),i=b.useRef(n),a=b.useRef(t);return O_(()=>{a.current=t},[t]),b.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function j_(e){return typeof e==`function`}function M_(e){let 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])}function N_(e){let[t,n]=b.useState(void 0);return D_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}function P_(e,t){return b.useReducer((e,n)=>t[e][n]??e,e)}var F_=e=>{let{present:t,children:n}=e,r=I_(t),i=typeof n==`function`?n({present:r.isPresent}):b.Children.only(n),a=R_(r.ref,B_(i));return typeof n==`function`||r.isPresent?b.cloneElement(i,{ref:a}):null};F_.displayName=`Presence`;function I_(e){let[t,n]=b.useState(),r=b.useRef(null),i=b.useRef(e),a=b.useRef(`none`),o=b.useRef(void 0),[s,c]=P_(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return b.useEffect(()=>{s===`mounted`?(a.current=o.current??z_(r.current),o.current=void 0):a.current=`none`},[s]),D_(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=z_(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),D_(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=z_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=z_(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:b.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=z_(t)}else r.current=null;n(e)},[])}}function L_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function R_(...e){let t=b.useRef(e);return t.current=e,b.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=L_(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():L_(n[e],null)}}},[])}function z_(e){return e?.animationName||`none`}function B_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function V_(e){let t=b.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];J_(r)&&typeof Q_==`function`&&(r=Q_(r._payload)),b.Children.forEach(r,e=>{if(K_(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;J_(n)&&typeof Q_==`function`&&(n=Q_(n._payload)),a=U_(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=b.cloneElement(a,void 0,s):!o&&b.Children.count(r)===1&&b.isValidElement(r)&&(a=r);let c=a?G_(a):void 0,l=C_(n,c);if(!a){if(r||r===0)throw Error(o?Z_(e):X_(e));return r}let u=W_(i,a.props??{});return a.type!==b.Fragment&&(u.ref=n?l:c),b.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var H_=Symbol.for(`radix.slottable`),U_=(e,t)=>{if(`child`in e.props){let t=e.props.child;return b.isValidElement(t)?b.cloneElement(t,void 0,e.props.children(t.props.children)):null}return b.isValidElement(t)?t:null};function W_(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function G_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function K_(e){return b.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===H_}var q_=Symbol.for(`react.lazy`);function J_(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===q_&&`_payload`in e&&Y_(e._payload)}function Y_(e){return typeof e==`object`&&!!e&&`then`in e}var X_=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Z_=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Q_=b.use,$_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=V_(`Primitive.${t}`),r=b.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ev=`Checkbox`,[tv,nv]=w_(ev),[rv,iv]=tv(ev);function av(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=k_({prop:n,defaultProp:i??!1,onChange:c,caller:ev}),[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useRef(!1),y=!m||!!o||!!m.closest(`form`),x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:!mv(i)&&i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,V.jsx)(rv,{scope:t,...x,children:pv(d)?d(x):r})}var ov=`CheckboxTrigger`,sv=b.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=iv(ov,e),h=C_(i,u),g=b.useRef(c);return b.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)($_.button,{type:`button`,role:`checkbox`,"aria-checked":mv(c)?`mixed`:c,"aria-required":l,"data-state":hv(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:E_(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:E_(n,e=>{d(e=>mv(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});sv.displayName=ov;var cv=b.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(av,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(sv,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(fv,{__scopeCheckbox:n})]})})});cv.displayName=ev;var lv=`CheckboxIndicator`,uv=b.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=iv(lv,n);return(0,V.jsx)(F_,{present:r||mv(a.checked)||a.checked===!0,children:(0,V.jsx)($_.span,{"data-state":hv(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});uv.displayName=lv;var dv=`CheckboxBubbleInput`,fv=b.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=iv(dv,e),m=C_(n,p),h=M_(a),g=N_(r);b.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=mv(a),n.call(e,!mv(a)&&a),e.dispatchEvent(t)}},[f,h,a,i]);let _=b.useRef(!mv(a)&&a);return(0,V.jsx)($_.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});fv.displayName=dv;function pv(e){return typeof e==`function`}function mv(e){return e===`indeterminate`}function hv(e){return mv(e)?`indeterminate`:e?`checked`:`unchecked`}var gv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(cv,{ref:n,className:Wo(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden 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:(0,V.jsx)(uv,{className:Wo(`flex items-center justify-center text-current`),children:(0,V.jsx)(bi,{className:`h-4 w-4`})})}));gv.displayName=cv.displayName;var _v=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,V.jsx)(`table`,{ref:n,className:Wo(`w-full caption-bottom text-sm`,e),...t})}));_v.displayName=`Table`;var vv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`thead`,{ref:n,className:Wo(`[&_tr]:border-b`,e),...t}));vv.displayName=`TableHeader`;var yv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`tbody`,{ref:n,className:Wo(`[&_tr:last-child]:border-0`,e),...t}));yv.displayName=`TableBody`;var bv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`tfoot`,{ref:n,className:Wo(`border-t bg-muted/50 font-medium last:[&>tr]:border-b-0`,e),...t}));bv.displayName=`TableFooter`;var xv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`tr`,{ref:n,className:Wo(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,e),...t}));xv.displayName=`TableRow`;var Sv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`th`,{ref:n,className:Wo(`h-12 px-4 text-left align-middle font-medium text-muted-foreground has-[[role=checkbox]]:pr-0`,e),...t}));Sv.displayName=`TableHead`;var Cv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`td`,{ref:n,className:Wo(`p-4 align-middle has-[[role=checkbox]]:pr-0`,e),...t}));Cv.displayName=`TableCell`;var wv=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`caption`,{ref:n,className:Wo(`mt-4 text-sm text-muted-foreground`,e),...t}));wv.displayName=`TableCaption`;function Tv(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ev=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dv=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ov={};function kv(e,t){return((t||Ov).jsx?Dv:Ev).test(e)}var Av=/[ \t\n\f\r]/g;function jv(e){return typeof e==`object`?e.type===`text`&&Mv(e.value):Mv(e)}function Mv(e){return e.replace(Av,``)===``}var Nv=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Nv.prototype.normal={},Nv.prototype.property={},Nv.prototype.space=void 0;function Pv(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Nv(n,r,t)}function Fv(e){return e.toLowerCase()}var Iv=class{constructor(e,t){this.attribute=t,this.property=e}};Iv.prototype.attribute=``,Iv.prototype.booleanish=!1,Iv.prototype.boolean=!1,Iv.prototype.commaOrSpaceSeparated=!1,Iv.prototype.commaSeparated=!1,Iv.prototype.defined=!1,Iv.prototype.mustUseProperty=!1,Iv.prototype.number=!1,Iv.prototype.overloadedBoolean=!1,Iv.prototype.property=``,Iv.prototype.spaceSeparated=!1,Iv.prototype.space=void 0;var Lv=c({boolean:()=>zv,booleanish:()=>Bv,commaOrSpaceSeparated:()=>Wv,commaSeparated:()=>Uv,number:()=>J,overloadedBoolean:()=>Vv,spaceSeparated:()=>Hv}),Rv=0,zv=Gv(),Bv=Gv(),Vv=Gv(),J=Gv(),Hv=Gv(),Uv=Gv(),Wv=Gv();function Gv(){return 2**++Rv}var Kv=Object.keys(Lv),qv=class extends Iv{constructor(e,t,n,r){let i=-1;if(super(e,t),Jv(this,`space`,r),typeof n==`number`)for(;++i<Kv.length;){let e=Kv[i];Jv(this,Kv[i],(n&Lv[e])===Lv[e])}}};qv.prototype.defined=!0;function Jv(e,t,n){n&&(e[t]=n)}function Yv(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new qv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Fv(r)]=r,n[Fv(a.attribute)]=r}return new Nv(t,n,e.space)}var Xv=Yv({properties:{ariaActiveDescendant:null,ariaAtomic:Bv,ariaAutoComplete:null,ariaBusy:Bv,ariaChecked:Bv,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:Hv,ariaCurrent:null,ariaDescribedBy:Hv,ariaDetails:null,ariaDisabled:Bv,ariaDropEffect:Hv,ariaErrorMessage:null,ariaExpanded:Bv,ariaFlowTo:Hv,ariaGrabbed:Bv,ariaHasPopup:null,ariaHidden:Bv,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Hv,ariaLevel:J,ariaLive:null,ariaModal:Bv,ariaMultiLine:Bv,ariaMultiSelectable:Bv,ariaOrientation:null,ariaOwns:Hv,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:Bv,ariaReadOnly:Bv,ariaRelevant:null,ariaRequired:Bv,ariaRoleDescription:Hv,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:Bv,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Zv(e,t){return t in e?e[t]:t}function Qv(e,t){return Zv(e,t.toLowerCase())}var $v=Yv({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Uv,acceptCharset:Hv,accessKey:Hv,action:null,allow:null,allowFullScreen:zv,allowPaymentRequest:zv,allowUserMedia:zv,alpha:zv,alt:null,as:null,async:zv,autoCapitalize:null,autoComplete:Hv,autoFocus:zv,autoPlay:zv,blocking:Hv,capture:null,charSet:null,checked:zv,cite:null,className:Hv,closedBy:null,colorSpace:null,cols:J,colSpan:J,command:null,commandFor:null,content:null,contentEditable:Bv,controls:zv,controlsList:Hv,coords:J|Uv,crossOrigin:null,data:null,dateTime:null,decoding:null,default:zv,defer:zv,dir:null,dirName:null,disabled:zv,download:Vv,draggable:Bv,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:zv,formTarget:null,headers:Hv,height:J,hidden:Vv,high:J,href:null,hrefLang:null,htmlFor:Hv,httpEquiv:Hv,id:null,imageSizes:null,imageSrcSet:null,inert:zv,inputMode:null,integrity:null,is:null,isMap:zv,itemId:null,itemProp:Hv,itemRef:Hv,itemScope:zv,itemType:Hv,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:zv,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:zv,muted:zv,name:null,nonce:null,noModule:zv,noValidate:zv,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:zv,optimum:J,pattern:null,ping:Hv,placeholder:null,playsInline:zv,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:zv,referrerPolicy:null,rel:Hv,required:zv,reversed:zv,rows:J,rowSpan:J,sandbox:Hv,scope:null,scoped:zv,seamless:zv,selected:zv,shadowRootClonable:zv,shadowRootCustomElementRegistry:zv,shadowRootDelegatesFocus:zv,shadowRootMode:null,shadowRootSerializable:zv,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:Bv,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:zv,useMap:null,value:Bv,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Hv,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:zv,declare:zv,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:zv,noHref:zv,noShade:zv,noWrap:zv,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:Bv,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:zv,disablePictureInPicture:zv,disableRemotePlayback:zv,exportParts:Uv,part:Hv,prefix:null,property:null,results:J,security:null,unselectable:null},space:`html`,transform:Qv}),ey=Yv({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:Wv,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:Hv,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:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:zv,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,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:Uv,g2:Uv,glyphName:Uv,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:Wv,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,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:J,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:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Hv,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Wv,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Wv,rev:Wv,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Wv,requiredFeatures:Wv,requiredFonts:Wv,requiredFormats:Wv,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:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:Wv,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Wv,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Wv,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Zv}),ty=Yv({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()}}),ny=Yv({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Qv}),ry=Yv({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),iy={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`},ay=/[A-Z]/g,oy=/-[a-z]/g,sy=/^data[-\w.:]+$/i;function cy(e,t){let n=Fv(t),r=t,i=Iv;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&sy.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(oy,uy);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!oy.test(e)){let n=e.replace(ay,ly);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=qv}return new i(r,t)}function ly(e){return`-`+e.toLowerCase()}function uy(e){return e.charAt(1).toUpperCase()}var dy=Pv([Xv,$v,ty,ny,ry],`html`),fy=Pv([Xv,ey,ty,ny,ry],`svg`);function py(e){return e.join(` `).trim()}var my=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
177
|
+
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),hy=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(my());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),gy=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),_y=s(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(hy()),r=gy();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),vy=by(`end`),yy=by(`start`);function by(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function xy(e){let t=yy(e),n=vy(e);if(t&&n)return{start:t,end:n}}function Sy(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?wy(e.position):`start`in e||`end`in e?wy(e):`line`in e||`column`in e?Cy(e):``}function Cy(e){return Ty(e&&e.line)+`:`+Ty(e&&e.column)}function wy(e){return Cy(e&&e.start)+`-`+Cy(e&&e.end)}function Ty(e){return e&&typeof e==`number`?e:1}var Ey=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Sy(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Ey.prototype.file=``,Ey.prototype.name=``,Ey.prototype.reason=``,Ey.prototype.message=``,Ey.prototype.stack=``,Ey.prototype.column=void 0,Ey.prototype.line=void 0,Ey.prototype.ancestors=void 0,Ey.prototype.cause=void 0,Ey.prototype.fatal=void 0,Ey.prototype.place=void 0,Ey.prototype.ruleId=void 0,Ey.prototype.source=void 0;var Dy=u(_y(),1),Oy={}.hasOwnProperty,ky=new Map,Ay=/[A-Z]/g,jy=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),My=new Set([`td`,`th`]),Ny=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Py(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Gy(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Wy(n,t.jsx,t.jsxs)}let i={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`?fy:dy,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Fy(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Fy(e,t,n){if(t.type===`element`)return Iy(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ly(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return zy(e,t,n);if(t.type===`mdxjsEsm`)return Ry(e,t);if(t.type===`root`)return By(e,t,n);if(t.type===`text`)return Vy(e,t)}function Iy(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=fy,e.schema=i),e.ancestors.push(t);let a=Zy(e,t.tagName,!1),o=Ky(e,t),s=Jy(e,t);return jy.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!jv(e)})),Hy(e,o,a,t),Uy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ly(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Qy(e,t.position)}function Ry(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qy(e,t.position)}function zy(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=fy,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Zy(e,t.name,!0),o=qy(e,t),s=Jy(e,t);return Hy(e,o,a,t),Uy(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function By(e,t,n){let r={};return Uy(r,Jy(e,t)),e.create(t,e.Fragment,r,n)}function Vy(e,t){return t.value}function Hy(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Uy(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Wy(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Gy(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=yy(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Ky(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Oy.call(t.properties,i)){let a=Yy(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&My.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function qy(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Qy(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Qy(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Jy(e,t){let n=[],r=-1,i=e.passKeys?new Map:ky;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Fy(e,a,o);s!==void 0&&n.push(s)}return n}function Yy(e,t,n){let r=cy(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Tv(n):py(n)),r.property===`style`){let t=typeof n==`object`?n:Xy(e,String(n));return e.stylePropertyNameCase===`css`&&(t=$y(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?iy[r.property]||r.property:r.attribute,n]}}function Xy(e,t){try{return(0,Dy.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Ey("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Ny+`#cannot-parse-style-attribute`,r}}function Zy(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=kv(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=kv(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Oy.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Qy(e)}function Qy(e,t){let n=new Ey("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=Ny+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function $y(e){let t={},n;for(n in e)Oy.call(e,n)&&(t[eb(n)]=e[n]);return t}function eb(e){let t=e.replace(Ay,tb);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function tb(e){return`-`+e.toLowerCase()}var nb={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`]},rb={};function ib(e,t){let n=t||rb;return ab(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function ab(e,t,n){if(sb(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 ob(e.children,t,n)}return Array.isArray(e)?ob(e,t,n):``}function ob(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ab(e[i],t,n);return r.join(``)}function sb(e){return!!(e&&typeof e==`object`)}var cb=document.createElement(`i`);function lb(e){let t=`&`+e+`;`;cb.innerHTML=t;let n=cb.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function ub(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function db(e,t){return e.length>0?(ub(e,e.length,0,t),e):t}var fb={}.hasOwnProperty;function pb(e){let t={},n=-1;for(;++n<e.length;)mb(t,e[n]);return t}function mb(e,t){let n;for(n in t){let r=(fb.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){fb.call(r,a)||(r[a]=[]);let e=i[a];hb(r[a],Array.isArray(e)?e:e?[e]:[])}}}function hb(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ub(e,0,0,r)}function gb(e,t){let 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 _b(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var vb=Ab(/[A-Za-z]/),yb=Ab(/[\dA-Za-z]/),bb=Ab(/[#-'*+\--9=?A-Z^-~]/);function xb(e){return e!==null&&(e<32||e===127)}var Sb=Ab(/\d/),Cb=Ab(/[\dA-Fa-f]/),wb=Ab(/[!-/:-@[-`{-~]/);function Tb(e){return e!==null&&e<-2}function Eb(e){return e!==null&&(e<0||e===32)}function Db(e){return e===-2||e===-1||e===32}var Ob=Ab(/\p{P}|\p{S}/u),kb=Ab(/\s/);function Ab(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function jb(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&yb(e.charCodeAt(n+1))&&yb(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Mb(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Db(r)?(e.enter(n),s(r)):t(r)}function s(r){return Db(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Nb={tokenize:Pb};function Pb(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Mb(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Tb(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Fb={tokenize:Lb},Ib={tokenize:Rb};function Lb(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return ub(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ib,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Ib,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Tb(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;ub(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Rb(e,t,n){return Mb(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function zb(e){if(e===null||Eb(e)||kb(e))return 1;if(Ob(e))return 2}function Bb(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Vb={name:`attention`,resolveAll:Hb,tokenize:Ub};function Hb(e,t){let n=-1,r,i,a,o,s,c,l,u;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;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Wb(d,-c),Wb(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=db(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=db(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=db(l,Bb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=db(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=db(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ub(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Ub(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=zb(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=zb(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Wb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Gb={name:`autolink`,tokenize:Kb};function Kb(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return vb(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||yb(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||yb(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||xb(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):bb(t)?(e.consume(t),l):n(t)}function u(e){return yb(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||yb(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var qb={partial:!0,tokenize:Jb};function Jb(e,t,n){return r;function r(t){return Db(t)?Mb(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Tb(e)?t(e):n(e)}}var Yb={continuation:{tokenize:Zb},exit:Qb,name:`blockQuote`,tokenize:Xb};function Xb(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Db(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Zb(e,t,n){let r=this;return i;function i(t){return Db(t)?Mb(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Yb,t,n)(r)}}function Qb(e){e.exit(`blockQuote`)}var $b={name:`characterEscape`,tokenize:ex};function ex(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return wb(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var tx={name:`characterReference`,tokenize:nx};function nx(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=yb,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Cb,u):(e.enter(`characterReferenceValue`),a=7,o=Sb,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===yb&&!lb(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var rx={partial:!0,tokenize:ox},ix={concrete:!0,name:`codeFenced`,tokenize:ax};function ax(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Db(t)?Mb(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Tb(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(rx,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Tb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Db(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Mb(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Tb(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Tb(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Db(t)?Mb(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Tb(t)?e.check(rx,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Tb(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Db(t)?Mb(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Db(t)?Mb(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Tb(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function ox(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var sx={name:`codeIndented`,tokenize:lx},cx={partial:!0,tokenize:ux};function lx(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Mb(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Tb(t)?e.attempt(cx,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Tb(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function ux(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Tb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Mb(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Tb(e)?i(e):n(e)}}var dx={name:`codeText`,previous:px,resolve:fx,tokenize:mx};function fx(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function px(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function mx(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Tb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Tb(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var hx=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&gx(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),gx(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),gx(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);gx(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);gx(this.left,t.reverse())}}}};function gx(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 _x(e){let t={},n=-1,r,i,a,o,s,c,l,u=new hx(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,vx(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ub(e,0,1/0,u.slice(0)),!l}function vx(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var yx={resolve:xx,tokenize:Sx},bx={partial:!0,tokenize:Cx};function xx(e){return _x(e),e}function Sx(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Tb(t)?e.check(bx,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Cx(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Mb(e,a,`linePrefix`)}function a(i){if(i===null||Tb(i))return n(i);let 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 wx(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||xb(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Tb(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Eb(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||xb(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Tx(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Tb(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Tb(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Db(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Ex(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Tb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Mb(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Tb(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Dx(e,t){let n;return r;function r(i){return Tb(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Db(i)?Mb(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ox={name:`definition`,tokenize:Ax},kx={partial:!0,tokenize:jx};function Ax(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Tx.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=_b(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Eb(t)?Dx(e,l)(t):l(t)}function l(t){return wx(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(kx,d,d)(t)}function d(t){return Db(t)?Mb(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Tb(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function jx(e,t,n){return r;function r(t){return Eb(t)?Dx(e,i)(t):n(t)}function i(t){return Ex(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Db(t)?Mb(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Tb(e)?t(e):n(e)}}var Mx={name:`hardBreakEscape`,tokenize:Nx};function Nx(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Tb(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Px={name:`headingAtx`,resolve:Fx,tokenize:Ix};function Fx(e,t){let n=e.length-2,r=3,i,a;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&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},ub(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Ix(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Eb(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Tb(n)?(e.exit(`atxHeading`),t(n)):Db(n)?Mb(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Eb(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Lx=`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`.split(`.`),Rx=[`pre`,`script`,`style`,`textarea`],zx={concrete:!0,name:`htmlFlow`,resolveTo:Hx,tokenize:Ux},Bx={partial:!0,tokenize:Gx},Vx={partial:!0,tokenize:Wx};function Hx(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 Ux(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):vb(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):vb(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return vb(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Eb(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Rx.includes(l)?(i=1,r.interrupt?t(s):O(s)):Lx.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||yb(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Db(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||vb(t)?(e.consume(t),b):Db(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||yb(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Db(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Db(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Tb(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Eb(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Db(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Tb(t)?O(t):Db(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Tb(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Bx,ee,k)(t)):t===null||Tb(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Vx,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Tb(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Rx.includes(n)?(e.consume(t),L):O(t)}return vb(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Tb(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function Wx(e,t,n){let r=this;return i;function i(t){return Tb(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Gx(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(qb,t,n)}}var Kx={name:`htmlText`,tokenize:qx};function qx(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):vb(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):vb(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Tb(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Tb(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Tb(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Tb(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return vb(t)?(e.consume(t),S):n(t)}function S(t){return t===45||yb(t)?(e.consume(t),S):C(t)}function C(t){return Tb(t)?(o=C,N(t)):Db(t)?(e.consume(t),C):M(t)}function w(t){return t===45||yb(t)?(e.consume(t),w):t===47||t===62||Eb(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||vb(t)?(e.consume(t),E):Tb(t)?(o=T,N(t)):Db(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||yb(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Tb(t)?(o=D,N(t)):Db(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Tb(t)?(o=O,N(t)):Db(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Tb(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Eb(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Eb(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Db(t)?Mb(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var Jx={name:`labelEnd`,resolveAll:Qx,resolveTo:$x,tokenize:eS},Yx={tokenize:tS},Xx={tokenize:nS},Zx={tokenize:rS};function Qx(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ub(e,0,e.length,n),e}function $x(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=db(s,e.slice(a+1,a+r+3)),s=db(s,[[`enter`,u,t]]),s=db(s,Bb(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=db(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=db(s,e.slice(o+1)),s=db(s,[[`exit`,c,t]]),ub(e,a,e.length,s),e}function eS(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(_b(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Yx,u,o?u:d)(t):t===91?e.attempt(Xx,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Zx,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function tS(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Eb(t)?Dx(e,a)(t):a(t)}function a(t){return t===41?u(t):wx(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Eb(t)?Dx(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Ex(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Eb(t)?Dx(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function nS(e,t,n){let r=this;return i;function i(t){return Tx.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(_b(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function rS(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var iS={name:`labelStartImage`,resolveAll:Jx.resolveAll,tokenize:aS};function aS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var oS={name:`labelStartLink`,resolveAll:Jx.resolveAll,tokenize:sS};function sS(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var cS={name:`lineEnding`,tokenize:lS};function lS(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Mb(e,t,`linePrefix`)}}var uS={name:`thematicBreak`,tokenize:dS};function dS(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Tb(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Db(t)?Mb(e,s,`whitespace`)(t):s(t))}}var fS={continuation:{tokenize:gS},exit:vS,name:`list`,tokenize:hS},pS={partial:!0,tokenize:yS},mS={partial:!0,tokenize:_S};function hS(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Sb(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(uS,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Sb(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(qb,r.interrupt?n:u,e.attempt(pS,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Db(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function gS(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(qb,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Mb(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Db(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mS,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Mb(e,e.attempt(fS,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function _S(e,t,n){let r=this;return Mb(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function vS(e){e.exit(this.containerState.type)}function yS(e,t,n){let r=this;return Mb(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Db(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var bS={name:`setextUnderline`,resolveTo:xS,tokenize:SS};function xS(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function SS(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Db(t)?Mb(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Tb(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var CS={tokenize:wS};function wS(e){let t=this,n=e.attempt(qb,r,e.attempt(this.parser.constructs.flowInitial,i,Mb(e,e.attempt(this.parser.constructs.flow,i,e.attempt(yx,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var TS={resolveAll:kS()},ES=OS(`string`),DS=OS(`text`);function OS(e){return{resolveAll:kS(e===`text`?AS:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function kS(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function AS(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var jS=c({attentionMarkers:()=>zS,contentInitial:()=>NS,disable:()=>BS,document:()=>MS,flow:()=>FS,flowInitial:()=>PS,insideSpan:()=>RS,string:()=>IS,text:()=>LS}),MS={42:fS,43:fS,45:fS,48:fS,49:fS,50:fS,51:fS,52:fS,53:fS,54:fS,55:fS,56:fS,57:fS,62:Yb},NS={91:Ox},PS={[-2]:sx,[-1]:sx,32:sx},FS={35:Px,42:uS,45:[bS,uS],60:zx,61:bS,95:uS,96:ix,126:ix},IS={38:tx,92:$b},LS={[-5]:cS,[-4]:cS,[-3]:cS,33:iS,38:tx,42:Vb,60:[Gb,Kx],91:oS,92:[Mx,$b],93:Jx,95:Vb,96:dx},RS={null:[Vb,TS]},zS={null:[42,95]},BS={null:[]};function VS(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=db(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Bb(a,l.events,l),l.events):[]}function f(e,t){return US(p(e),t)}function p(e){return HS(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Tb(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ub(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function HS(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function US(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
178
|
+
`;break;case-3:o=`\r
|
|
179
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function WS(e){let t={constructs:pb([jS,...(e||{}).extensions||[]]),content:n(Nb),defined:[],document:n(Fb),flow:n(CS),lazy:{},string:n(ES),text:n(DS)};return t;function n(e){return n;function n(n){return VS(t,e,n)}}}function GS(e){for(;!_x(e););return e}var KS=/[\0\t\n\r]/g;function qS(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(KS.lastIndex=u,c=KS.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var JS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YS(e){return e.replace(JS,XS)}function XS(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return gb(n.slice(t?2:1),t?16:10)}return lb(n)||e}var ZS={}.hasOwnProperty;function QS(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),$S(n)(GS(WS(n).document().write(qS()(e,t,!0))))}function $S(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(me),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ue),blockQuote:a(ae),characterEscape:T,characterReference:T,codeFenced:a(oe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(oe,o),codeText:a(se,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ce),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(le),hardBreakEscape:a(de),hardBreakTrailing:a(de),htmlFlow:a(fe,o),htmlFlowData:T,htmlText:a(fe,o),htmlTextData:T,image:a(pe),label:o,link:a(me),listItem:a(ge),listItemValue:f,listOrdered:a(he,d),listUnordered:a(he),paragraph:a(_e),reference:te,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ue),strong:a(ve),thematicBreak:a(be)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ie,autolinkProtocol:re,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:z,characterReference:B,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ne,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};tC(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];ZS.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||rC).call(a,void 0,e[0])}for(r.position={start:eC(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:eC(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:eC(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||rC).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+Sy({start:e.start,end:e.end})+`): it’s not open`);n.position.end=eC(e.end)}function u(){return ib(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=_b(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=ye(),n.position={start:eC(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=eC(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=eC(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=YS(t),n.identifier=_b(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function te(){this.data.referenceType=`collapsed`}function ne(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=_b(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function R(e){this.data.characterReferenceType=e.type}function z(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=gb(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=lb(t);let i=this.stack[this.stack.length-1];i.value+=r}function B(e){let t=this.stack.pop();t.position.end=eC(e.end)}function re(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ie(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ae(){return{type:`blockquote`,children:[]}}function oe(){return{type:`code`,lang:null,meta:null,value:``}}function se(){return{type:`inlineCode`,value:``}}function ce(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function le(){return{type:`emphasis`,children:[]}}function ue(){return{type:`heading`,depth:0,children:[]}}function de(){return{type:`break`}}function fe(){return{type:`html`,value:``}}function pe(){return{type:`image`,title:null,url:``,alt:null}}function me(){return{type:`link`,title:null,url:``,children:[]}}function he(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function ge(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function _e(){return{type:`paragraph`,children:[]}}function ve(){return{type:`strong`,children:[]}}function ye(){return{type:`text`,value:``}}function be(){return{type:`thematicBreak`}}}function eC(e){return{line:e.line,column:e.column,offset:e.offset}}function tC(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?tC(e,r):nC(e,r)}}function nC(e,t){let n;for(n in t)if(ZS.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function rC(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+Sy({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Sy({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+Sy({start:t.start,end:t.end})+`) is still open`)}function iC(e){let t=this;t.parser=n;function n(n){return QS(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function aC(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function oC(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
180
|
+
`}]}function sC(e,t){let n=t.value?t.value+`
|
|
181
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function cC(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lC(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uC(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=jb(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function dC(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fC(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function pC(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function mC(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return pC(e,t);let i={src:jb(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function hC(e,t){let n={src:jb(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function gC(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function _C(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return pC(e,t);let i={href:jb(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function vC(e,t){let n={href:jb(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function yC(e,t,n){let r=e.all(t),i=n?bC(n):xC(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
182
|
+
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
183
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function bC(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=xC(n[r])}return t}function xC(e){return e.spread??e.children.length>1}function SC(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function CC(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wC(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function TC(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EC(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=yy(t.children[1]),o=vy(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function DC(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function OC(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var kC=9,AC=32;function jC(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(MC(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(MC(t.slice(i),i>0,!1)),a.join(``)}function MC(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===kC||t===AC;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===kC||t===AC;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function NC(e,t){let n={type:`text`,value:jC(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function PC(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var FC={blockquote:aC,break:oC,code:sC,delete:cC,emphasis:lC,footnoteReference:uC,heading:dC,html:fC,imageReference:mC,image:hC,inlineCode:gC,linkReference:_C,link:vC,listItem:yC,list:SC,paragraph:CC,root:wC,strong:TC,table:EC,tableCell:OC,tableRow:DC,text:NC,thematicBreak:PC,toml:IC,yaml:IC,definition:IC,footnoteDefinition:IC};function IC(){}var LC=typeof self==`object`?self:globalThis,RC=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new LC[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new LC[a](o),i)};return r},zC=e=>RC(new Map,e)(0),BC=``,{toString:VC}={},{keys:HC}=Object,UC=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=VC.call(e).slice(8,-1);switch(n){case`Array`:return[1,BC];case`Object`:return[2,BC];case`Date`:return[3,BC];case`RegExp`:return[4,BC];case`Map`:return[5,BC];case`Set`:return[6,BC];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},WC=([e,t])=>e===0&&(t===`function`||t===`symbol`),GC=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=UC(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of HC(r))(e||!WC(UC(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(WC(UC(n))||WC(UC(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!WC(UC(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},KC=(e,{json:t,lossy:n}={})=>{let r=[];return GC(!(t||n),!!t,new Map,r)(e),r},qC=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?zC(KC(e,t)):structuredClone(e):(e,t)=>zC(KC(e,t));function JC(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function YC(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function XC(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||JC,r=e.options.footnoteBackLabel||YC,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=jb(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...qC(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
184
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
185
|
+
`}]}}var ZC=(function(e){if(e==null)return nw;if(typeof e==`function`)return tw(e);if(typeof e==`object`)return Array.isArray(e)?QC(e):$C(e);if(typeof e==`string`)return ew(e);throw Error(`Expected function, string, or object as test`)});function QC(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ZC(e[n]);return tw(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function $C(e){let t=e;return tw(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ew(e){return tw(t);function t(t){return t&&t.type===e}}function tw(e){return t;function t(t,n,r){return!!(rw(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function nw(){return!0}function rw(e){return typeof e==`object`&&!!e&&`type`in e}function iw(e){return e}var aw=[];function ow(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=ZC(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+iw(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=aw,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=sw(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function sw(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?aw:[e]}function cw(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),ow(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var lw={}.hasOwnProperty,uw={};function dw(e,t){let n=t||uw,r=new Map,i=new Map,a={all:s,applyData:pw,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...FC,...n.handlers},one:o,options:n,patch:fw,wrap:hw};return cw(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(lw.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=qC(n);return r.children=a.all(e),r}return qC(e)}return(a.options.unknownHandler||mw)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=gw(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=gw(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function fw(e,t){e.position&&(t.position=xy(e))}function pw(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,qC(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function mw(e,t){let n=t.data||{},r=`value`in t&&!(lw.call(n,`hProperties`)||lw.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 hw(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
186
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
187
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
188
|
+
`}),n}function gw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _w(e,t){let n=dw(e,t),r=n.one(e,void 0),i=XC(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
189
|
+
`},i)),a}function vw(e,t){return e&&`run`in e?async function(n,r){let i=_w(n,{file:r,...t});await e.run(i,r)}:function(n,r){return _w(n,{file:r,...e||t})}}function yw(e){if(e)throw e}var bw=s(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function xw(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Sw(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Cw(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Cw(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var ww={basename:Tw,dirname:Ew,extname:Dw,join:Ow,sep:`/`};function Tw(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);jw(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Ew(e){if(jw(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||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Dw(e){jw(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Ow(...e){let t=-1,n;for(;++t<e.length;)jw(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:kw(n)}function kw(e){jw(e);let t=e.codePointAt(0)===47,n=Aw(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Aw(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function jw(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Mw={cwd:Nw};function Nw(){return`/`}function Pw(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Fw(e){if(typeof e==`string`)e=new URL(e);else if(!Pw(e)){let t=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:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return Iw(e)}function Iw(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Lw=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Rw=class{constructor(e){let t;t=e?Pw(e)?{path:e}:typeof e==`string`||Hw(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Mw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Lw.length;){let e=Lw[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Lw.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?ww.basename(this.path):void 0}set basename(e){Bw(e,`basename`),zw(e,`basename`),this.path=ww.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?ww.dirname(this.path):void 0}set dirname(e){Vw(this.basename,`dirname`),this.path=ww.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?ww.extname(this.path):void 0}set extname(e){if(zw(e,`extname`),Vw(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=ww.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Pw(e)&&(e=Fw(e)),Bw(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?ww.basename(this.path,this.extname):void 0}set stem(e){Bw(e,`stem`),zw(e,`stem`),this.path=ww.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new Ey(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function zw(e,t){if(e&&e.includes(ww.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+ww.sep+"`")}function Bw(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Vw(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Hw(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Uw=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Ww=u(bw(),1),Gw={}.hasOwnProperty,Kw=new class e extends Uw{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=Sw()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Ww.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Yw(`data`,this.frozen),this.namespace[e]=t,this):Gw.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Yw(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Qw(e),n=this.parser||this.Parser;return qw(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),qw(`process`,this.parser||this.Parser),Jw(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Qw(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);eT(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),qw(`processSync`,this.parser||this.Parser),Jw(`processSync`,this.compiler||this.Compiler),this.process(e,r),Zw(`processSync`,`process`,t),n;function r(e,r){t=!0,yw(e),n=r}}run(e,t,n){Xw(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Qw(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Zw(`runSync`,`run`,n),r;function i(e,t){yw(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Qw(t),r=this.compiler||this.Compiler;return Jw(`stringify`,r),Xw(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Yw(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw 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");o(e.plugins),e.settings&&(r.settings=(0,Ww.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];xw(o)&&xw(r)&&(r=(0,Ww.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function qw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Jw(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Yw(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Xw(e){if(!xw(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Zw(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qw(e){return $w(e)?e:new Rw(e)}function $w(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function eT(e){return typeof e==`string`||tT(e)}function tT(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var nT=[],rT={allowDangerousHtml:!0},iT=/^(https?|ircs?|mailto|xmpp)$/i,aT=[{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 oT(e){let t=sT(e),n=cT(e);return lT(t.runSync(t.parse(n),n),e)}function sT(e){let t=e.rehypePlugins||nT,n=e.remarkPlugins||nT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...rT}:rT;return Kw().use(iC).use(n).use(vw,r).use(t)}function cT(e){let t=e.children||``,n=new Rw;return typeof t==`string`?n.value=t:``+t,n}function lT(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||uT;for(let e of aT)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return cw(e,l),Py(e,{Fragment:V.Fragment,components:i,ignoreInvalidStyle:!0,jsx:V.jsx,jsxs:V.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in nb)if(Object.hasOwn(nb,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=nb[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function uT(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||iT.test(e.slice(0,t))?e:``}function dT(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function fT(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function pT(e,t,n){let r=ZC((n||{}).ignore||[]),i=mT(t),a=-1;for(;++a<i.length;)ow(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function mT(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([hT(e[0]),gT(e[1])])}return t}function hT(e){return typeof e==`string`?new RegExp(fT(e),`g`):e}function gT(e){return typeof e==`function`?e:function(){return e}}var _T=`phrasing`,vT=[`autolink`,`link`,`image`,`label`];function yT(){return{transforms:[DT],enter:{literalAutolink:xT,literalAutolinkEmail:ST,literalAutolinkHttp:ST,literalAutolinkWww:ST},exit:{literalAutolink:ET,literalAutolinkEmail:TT,literalAutolinkHttp:CT,literalAutolinkWww:wT}}}function bT(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:_T,notInConstruct:vT},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:_T,notInConstruct:vT},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:_T,notInConstruct:vT}]}}function xT(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function ST(e){this.config.enter.autolinkProtocol.call(this,e)}function CT(e){this.config.exit.autolinkProtocol.call(this,e)}function wT(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function TT(e){this.config.exit.autolinkEmail.call(this,e)}function ET(e){this.exit(e)}function DT(e){pT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,OT],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,kT]],{ignore:[`link`,`linkReference`]})}function OT(e,t,n,r,i){let a=``;if(!MT(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!AT(n)))return!1;let o=jT(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function kT(e,t,n,r){return!MT(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function AT(e){let 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 jT(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=dT(e,`(`),a=dT(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function MT(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||kb(n)||Ob(n))&&(!t||n!==47)}HT.peek=VT;function NT(){this.buffer()}function PT(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function FT(){this.buffer()}function IT(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function LT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_b(this.sliceSerialize(e)).toLowerCase(),n.label=t}function RT(e){this.exit(e)}function zT(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=_b(this.sliceSerialize(e)).toLowerCase(),n.label=t}function BT(e){this.exit(e)}function VT(){return`[`}function HT(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function UT(){return{enter:{gfmFootnoteCallString:NT,gfmFootnoteCall:PT,gfmFootnoteDefinitionLabelString:FT,gfmFootnoteDefinition:IT},exit:{gfmFootnoteCallString:LT,gfmFootnoteCall:RT,gfmFootnoteDefinitionLabelString:zT,gfmFootnoteDefinition:BT}}}function WT(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:HT},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
190
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?KT:GT))),s(),o}}function GT(e,t,n){return t===0?e:KT(e,t,n)}function KT(e,t,n){return(n?``:` `)+e}var qT=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];QT.peek=$T;function JT(){return{canContainEols:[`delete`],enter:{strikethrough:XT},exit:{strikethrough:ZT}}}function YT(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:qT}],handlers:{delete:QT}}}function XT(e){this.enter({type:`delete`,children:[]},e)}function ZT(e){this.exit(e)}function QT(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function $T(){return`~`}function eE(e){return e.length}function tE(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||eE,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=nE(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=rE(r[d]);else{let e=rE(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
191
|
+
`)}function nE(e){return e==null?``:String(e)}function rE(e){let 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 iE(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),aE);return i(),o}function aE(e,t,n){return`>`+(n?``:` `)+e}function oE(e,t){return sE(e,t.inConstruct,!0)&&!sE(e,t.notInConstruct,!1)}function sE(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 cE(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
192
|
+
`&&oE(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
193
|
+
`}function lE(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function uE(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 dE(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function fE(e,t,n,r){let i=dE(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(uE(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,pE);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(lE(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
194
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
195
|
+
`),a&&(u+=s.move(a+`
|
|
196
|
+
`)),u+=s.move(c),l(),u}function pE(e,t,n){return(n?``:` `)+e}function mE(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function hE(e,t,n,r){let i=mE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
197
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function gE(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function _E(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function vE(e,t,n){let r=zb(e),i=zb(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}yE.peek=bE;function yE(e,t,n,r){let i=gE(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=vE(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=_E(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=vE(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+_E(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function bE(e,t,n){return n.options.emphasis||`*`}function xE(e,t){let n=!1;return cw(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&ib(e)&&(t.options.setext||n))}function SE(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(xE(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
198
|
+
`,after:`
|
|
199
|
+
`});return r(),t(),o+`
|
|
200
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
201
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
202
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=_E(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}CE.peek=wE;function CE(e){return e.value||``}function wE(){return`<`}TE.peek=EE;function TE(e,t,n,r){let i=mE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function EE(){return`!`}DE.peek=OE;function DE(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function OE(){return`!`}kE.peek=AE;function kE(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function AE(){return"`"}function jE(e,t){let n=ib(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))}ME.peek=NE;function ME(e,t,n,r){let i=mE(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(jE(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function NE(e,t,n){return jE(e,n)?`<`:`[`}PE.peek=FE;function PE(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function FE(){return`[`}function IE(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function LE(e){let t=IE(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function RE(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function zE(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function BE(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?RE(n):IE(n),s=e.ordered?o===`.`?`)`:`.`:LE(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.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&&(c=!0),zE(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function VE(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function HE(e,t,n,r){let i=VE(n),a=n.bulletCurrent||IE(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function UE(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var WE=ZC([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function GE(e,t,n,r){return(e.children.some(function(e){return WE(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function KE(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}qE.peek=JE;function qE(e,t,n,r){let i=KE(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=vE(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=_E(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=vE(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+_E(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function JE(e,t,n){return n.options.strong||`*`}function YE(e,t,n,r){return n.safe(e.value,r)}function XE(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function ZE(e,t,n){let r=(zE(n)+(n.options.ruleSpaces?` `:``)).repeat(XE(n));return n.options.ruleSpaces?r.slice(0,-1):r}var QE={blockquote:iE,break:cE,code:fE,definition:hE,emphasis:yE,hardBreak:cE,heading:SE,html:CE,image:TE,imageReference:DE,inlineCode:kE,link:ME,linkReference:PE,list:BE,listItem:HE,paragraph:UE,root:GE,strong:qE,text:YE,thematicBreak:ZE};function $E(){return{enter:{table:eD,tableData:iD,tableHeader:iD,tableRow:nD},exit:{codeText:aD,table:tD,tableData:rD,tableHeader:rD,tableRow:rD}}}function eD(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function tD(e){this.exit(e),this.data.inTable=void 0}function nD(e){this.enter({type:`tableRow`,children:[]},e)}function rD(e){this.exit(e)}function iD(e){this.enter({type:`tableCell`,children:[]},e)}function aD(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,oD));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function oD(e,t){return t===`|`?t:e}function sD(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
203
|
+
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
204
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return tE(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=QE.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function cD(){return{exit:{taskListCheckValueChecked:uD,taskListCheckValueUnchecked:uD,paragraph:dD}}}function lD(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:fD}}}function uD(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function dD(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function fD(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=QE.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function pD(){return[yT(),UT(),JT(),$E(),cD()]}function mD(e){return{extensions:[bT(),WT(e),YT(),sD(e),lD()]}}var hD={tokenize:kD,partial:!0},gD={tokenize:AD,partial:!0},_D={tokenize:jD,partial:!0},vD={tokenize:MD,partial:!0},yD={tokenize:ND,partial:!0},bD={name:`wwwAutolink`,tokenize:DD,previous:PD},xD={name:`protocolAutolink`,tokenize:OD,previous:FD},SD={name:`emailAutolink`,tokenize:ED,previous:ID},CD={};function wD(){return{text:CD}}for(var TD=48;TD<123;)CD[TD]=SD,TD++,TD===58?TD=65:TD===91&&(TD=97);CD[43]=SD,CD[45]=SD,CD[46]=SD,CD[95]=SD,CD[72]=[SD,xD],CD[104]=[SD,xD],CD[87]=[SD,bD],CD[119]=[SD,bD];function ED(e,t,n){let r=this,i,a;return o;function o(t){return!LD(t)||!ID.call(r,r.previous)||RD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return LD(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(yD,u,l)(t):t===45||t===95||yb(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&vb(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function DD(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!PD.call(r,r.previous)||RD(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(hD,e.attempt(gD,e.attempt(_D,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function OD(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&FD.call(r,r.previous)&&!RD(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(vb(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||xb(t)||Eb(t)||kb(t)||Ob(t)?n(t):e.attempt(gD,e.attempt(_D,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function kD(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function AD(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(vD,c,s)(t):t===null||Eb(t)||kb(t)||t!==45&&Ob(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function jD(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(vD,t,a)(o):o===null||Eb(o)||kb(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function MD(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Eb(o)||kb(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Eb(e)||kb(e)?t(e):r(e)}function a(e){return vb(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):vb(t)?(e.consume(t),o):n(t)}}function ND(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return yb(e)?n(e):t(e)}}function PD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Eb(e)}function FD(e){return!vb(e)}function ID(e){return!(e===47||LD(e))}function LD(e){return e===43||e===45||e===46||e===95||yb(e)}function RD(e){let t=e.length,n=!1;for(;t--;){let 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}var zD={tokenize:qD,partial:!0};function BD(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:WD,continuation:{tokenize:GD},exit:KD}},text:{91:{name:`gfmFootnoteCall`,tokenize:UD},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:VD,resolveTo:HD}}}}function VD(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=_b(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function HD(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`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function UD(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Eb(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(_b(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Eb(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function WD(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Eb(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=_b(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Eb(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Mb(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function GD(e,t,n){return e.check(qb,t,e.attempt(zD,t,n))}function KD(e){e.exit(`gfmFootnoteDefinition`)}function qD(e,t,n){let r=this;return Mb(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function JD(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ub(o,o.length,0,Bb(s,e.slice(r+1,n),t)),ub(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ub(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=zb(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=zb(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var YD=class{constructor(){this.map=[]}add(e,t,n){XD(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function XD(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function ZD(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function QD(){return{flow:{null:{name:`table`,tokenize:$D,resolveAll:eO}}}}function $D(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Tb(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Db(t)?Mb(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Eb(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Db(t)?Mb(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Db(t)?Mb(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Tb(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Db(t)?Mb(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Tb(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Tb(n)?(e.exit(`tableRow`),t(n)):Db(n)?Mb(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Eb(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function eO(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new YD;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(nO(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=tO(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=tO(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=tO(f,t,o,i,n,d)):(o[0]=o[1],d=tO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&nO(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=ZD(t.events,n))}return e}function tO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},rO(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=rO(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=rO(t.events,n[2]),a=rO(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},rO(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function nO(e,t,n,r,i){let a=[],o=rO(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function rO(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var iO={name:`tasklistCheck`,tokenize:oO};function aO(){return{text:{91:iO}}}function oO(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Eb(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Tb(r)?t(r):Db(r)?e.check({tokenize:sO},t,n)(r):n(r)}}function sO(e,t,n){return Mb(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function cO(e){return pb([wD(),BD(),JD(e),QD(),aO()])}var lO={};function uO(e){let t=this,n=e||lO,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(cO(n)),a.push(pD()),o.push(mD(n))}var dO=180;function fO(e){return e.replace(/\*\*([^*]+)\*\*/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/^#+\s+/gm,``).replace(/\s+/g,` `).trim()}function pO(e,t){if(t?.trim())return t.trim();let n=fO(e.split(/\n\n+/)[0]?.replace(/\n/g,` `)??e);return n.length<=dO?n:`${n.slice(0,179).trimEnd()}…`}function mO(e,t){return t?.trim()&&e.length>dO?!0:e.length>dO||/\n/.test(e)}function hO({description:e,title:t,expanded:n,onToggle:r}){let i=pO(e,t),a=mO(e,t);return e?a?(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`line-clamp-3 text-sm leading-relaxed`,children:i}),(0,V.jsxs)(`button`,{type:`button`,onClick:r,className:`inline-flex items-center gap-1 text-xs text-[#92E4DD] hover:text-white`,children:[(0,V.jsx)(xi,{className:`h-3.5 w-3.5 transition-transform ${n?`rotate-180`:``}`}),n?`Hide full description`:`Show full description`]})]}):(0,V.jsx)(`span`,{children:i}):(0,V.jsx)(`span`,{className:`text-gray-500`,children:`—`})}function gO({description:e}){return(0,V.jsx)(`div`,{className:`max-h-64 overflow-auto rounded border border-white/10 bg-[#0F0F0C] p-3`,children:(0,V.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:(0,V.jsx)(oT,{remarkPlugins:[uO],children:e})})})}function _O(){let[e,t]=(0,b.useState)(null);return{expandedDescription:e,toggleDescription:e=>{t(t=>t===e?null:e)}}}function vO(e){return new Set(e.filter(e=>e.enabled===!1).map(e=>e.name))}function yO({serviceId:e,tools:t,isLoading:n}){let[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(null),{expandedDescription:s,toggleDescription:c}=_O(),[l,u]=(0,b.useState)(()=>vO(t)),d=we(),{toast:f}=dn(),p=(0,b.useMemo)(()=>t.map(e=>`${e.name}:${e.enabled===!1?`0`:`1`}`).sort().join(`\0`),[t]);(0,b.useEffect)(()=>{u(vO(t))},[e,p]);let m=qt({mutationFn:async t=>{await H(`PUT`,`/api/services/${e}/tool-settings`,{disabledTools:t})},onSuccess:()=>{d.invalidateQueries({queryKey:[`/api/services`,e,`tools`]}),d.invalidateQueries({queryKey:[`/api/services`]})},onError:e=>{f({title:`Could not save tool settings`,description:e.message,variant:`destructive`}),u(vO(t))}}),h=e=>{u(e),m.mutate([...e])},g=(e,t)=>{let n=new Set(l);t?n.delete(e):n.add(e),h(n)},_=e=>{if(e){h(new Set);return}h(new Set(t.map(e=>e.name)))},v=(0,b.useMemo)(()=>{let e=r.trim().toLowerCase();return e?t.filter(t=>t.name.toLowerCase().includes(e)||(t.title?.toLowerCase().includes(e)??!1)||t.description.toLowerCase().includes(e)):t},[t,r]),y=t.length-l.size;return n?(0,V.jsx)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Loading tools…`})}):t.length===0?null:(0,V.jsxs)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:[(0,V.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center`,children:[(0,V.jsx)(ia,{className:`w-5 h-5 mr-2`}),`Tools`,(0,V.jsxs)(`span`,{className:`ml-2 text-sm font-normal text-gray-400`,children:[y,` of `,t.length,` enabled`]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10`,onClick:()=>_(!0),disabled:l.size===0||m.isPending,children:`Enable all`}),(0,V.jsx)(q,{type:`button`,size:`sm`,variant:`ghost`,className:`h-8 text-xs text-[#A8C4C0] hover:text-white hover:bg-white/10`,onClick:()=>_(!1),disabled:y===0||m.isPending,children:`Disable all`})]})]}),(0,V.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.`}),(0,V.jsxs)(`div`,{className:`relative mb-3`,children:[(0,V.jsx)(qi,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-500`}),(0,V.jsx)(xd,{value:r,onChange:e=>i(e.target.value),placeholder:`Search tools…`,className:`border-white/15 bg-[#0F0F0C] pl-9 text-[#E8F6F4] placeholder:text-[#6B8581]`})]}),(0,V.jsx)(`div`,{className:`rounded-md border border-white/10 overflow-hidden`,children:(0,V.jsxs)(_v,{children:[(0,V.jsx)(vv,{children:(0,V.jsxs)(xv,{className:`border-white/10 hover:bg-transparent`,children:[(0,V.jsx)(Sv,{className:`w-[72px] text-center text-[#A8C4C0]`,children:`Enabled`}),(0,V.jsx)(Sv,{className:`w-[220px] text-[#A8C4C0]`,children:`Tool`}),(0,V.jsx)(Sv,{className:`text-[#A8C4C0]`,children:`Description`})]})}),(0,V.jsx)(yv,{children:v.length===0?(0,V.jsx)(xv,{className:`border-white/10 hover:bg-transparent`,children:(0,V.jsx)(Cv,{colSpan:3,className:`py-8 text-center text-sm text-gray-400`,children:`No tools match your search.`})}):v.map(e=>{let t=!l.has(e.name),n=a===e.name,r=s===e.name,i=e.inputSchema&&Object.keys(e.inputSchema).length>0;return(0,V.jsxs)(b.Fragment,{children:[(0,V.jsxs)(xv,{className:`border-white/10 ${t?`hover:bg-white/5`:`opacity-60 hover:bg-white/5`}`,children:[(0,V.jsx)(Cv,{className:`text-center`,children:(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsx)(gv,{checked:t,onCheckedChange:t=>g(e.name,t===!0),disabled:m.isPending,"aria-label":`${t?`Disable`:`Enable`} ${e.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]`})})}),(0,V.jsx)(Cv,{children:i?(0,V.jsxs)(`button`,{type:`button`,onClick:()=>o(n?null:e.name),className:`flex w-full items-center gap-1 text-left font-mono text-sm text-[#92E4DD] hover:text-white`,children:[(0,V.jsx)(xi,{className:`h-4 w-4 shrink-0 transition-transform ${n?`rotate-180`:``}`}),e.name]}):(0,V.jsx)(`span`,{className:`font-mono text-sm text-[#92E4DD]`,children:e.name})}),(0,V.jsx)(Cv,{className:`max-w-0 text-sm text-gray-300`,children:(0,V.jsx)(hO,{description:e.description,title:e.title,expanded:r,onToggle:()=>c(e.name)})})]}),r&&(0,V.jsx)(xv,{className:`border-white/10 bg-black/30 hover:bg-black/30`,children:(0,V.jsx)(Cv,{colSpan:3,className:`py-3`,children:(0,V.jsx)(gO,{description:e.description})})}),i&&n&&(0,V.jsx)(xv,{className:`border-white/10 bg-black/30 hover:bg-black/30`,children:(0,V.jsx)(Cv,{colSpan:3,className:`py-3`,children:(0,V.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(e.inputSchema,null,2)})})})]},e.name)})})]})})]})}function bO({items:e,className:t}){return e.length===0?null:(0,V.jsx)(`ol`,{className:`list-decimal list-inside space-y-1 text-xs ${t??``}`,children:e.map((e,t)=>(0,V.jsx)(`li`,{children:e},`${t}-${e.slice(0,24)}`))})}function xO({serviceId:e,onConnected:t}){let{toast:n}=dn(),[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),{data:p,isLoading:m}=Kt({queryKey:[`/api/oauth`,e,`setup`],queryFn:async()=>{let t=await H(`GET`,`/api/oauth/${e}/setup`),n=await t.json();if(!t.ok||!n.success)throw Error(n.error||`Failed to load OAuth setup`);return n.data},enabled:!!e}),h=p?.guide,g=!!p?.hasSavedCredentials,_=()=>{if(!l||h?.setupMode!==`manual`)return;let e={};return r.trim()&&(e.clientId=r.trim()),a.trim()&&(e.clientSecret=a.trim()),e},v=async(e,t)=>{try{await navigator.clipboard.writeText(t),n({title:`Copied`,description:`${e} copied to clipboard.`})}catch{n({title:`Copy failed`,description:`Select and copy manually.`,variant:`destructive`})}};(0,b.useEffect)(()=>{h?.setupMode===`manual`?u(!0):u(!1),f(!g)},[h?.setupMode,g]),(0,b.useEffect)(()=>{p?.savedOAuthClientId&&!r&&i(p.savedOAuthClientId)},[p?.savedOAuthClientId,r]);let y=async r=>{c(!0);try{let i=await H(`POST`,`/api/oauth/${e}/connect`,r??{}),a=await i.json();if(!i.ok||!a.success){(a.data?.needsCredentials||a.data?.setupMode===`manual`)&&u(!0),n({title:`OAuth setup`,description:a.error||`Could not start OAuth flow.`,variant:`destructive`});return}a.data?.authorizationUrl&&(window.open(a.data.authorizationUrl,`_blank`),n({title:`Continue in browser`,description:`Complete sign-in in the new tab, then return here.`}),t?.())}catch(e){n({title:`OAuth setup failed`,description:e instanceof Error?e.message:`Unknown error`,variant:`destructive`})}finally{c(!1)}};if(m)return(0,V.jsx)(`p`,{className:`text-sm text-orange-200`,children:`Loading setup guide…`});if(!h)return null;if(h.setupMode===`unavailable`)return(0,V.jsxs)(`div`,{className:`space-y-3 text-sm text-orange-100`,children:[(0,V.jsx)(`p`,{children:h.unavailableReason}),h.docsUrl&&(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>window.open(h.docsUrl,`_blank`),children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),`Provider docs`]})]});let x=h.setupMode===`dynamic`||h.setupMode===`managed`||h.setupMode===`manual`;return(0,V.jsxs)(`div`,{className:`space-y-4 text-sm text-orange-100`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`font-medium text-orange-200`,children:h.title}),h.summary&&(0,V.jsx)(`p`,{className:`mt-1 text-xs text-orange-100/90`,children:h.summary}),x&&(0,V.jsxs)(`p`,{className:`mt-2 text-xs text-orange-100/80`,children:[`Redirect URI:`,` `,(0,V.jsx)(`code`,{className:`text-orange-50`,children:h.redirectUri})]}),h.easierAlternative&&(0,V.jsx)(`p`,{className:`mt-2 text-xs text-orange-100/70 border-l-2 border-orange-500/30 pl-2`,children:h.easierAlternative})]}),g&&h.setupMode===`manual`&&(0,V.jsxs)(`div`,{className:`rounded-lg border border-green-500/30 bg-green-500/10 p-3 text-xs text-green-100`,children:[(0,V.jsx)(`p`,{className:`font-medium text-green-200`,children:`OAuth credentials saved`}),(0,V.jsx)(`p`,{className:`mt-1 text-green-100/90`,children:`Client ID is prefilled and your secret is remembered. Click Reconnect — no need to paste the secret again unless Slack rejects the flow.`})]}),h.prerequisites&&h.prerequisites.length>0&&!g&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-orange-200 mb-1`,children:`Before you start`}),(0,V.jsx)(`ul`,{className:`list-disc list-inside space-y-1 text-xs text-orange-100/90`,children:h.prerequisites.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}),(h.manifestJson||h.createAppUrl||x)&&(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[h.manifestJson&&(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>void v(`App manifest`,h.manifestJson),children:[(0,V.jsx)(Oi,{className:`w-4 h-4 mr-1`}),`Copy manifest`]}),x&&(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>void v(`Redirect URI`,h.redirectUri),children:[(0,V.jsx)(ki,{className:`w-4 h-4 mr-1`}),`Copy redirect URI`]}),h.createAppUrl&&(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>window.open(h.createAppUrl,`_blank`),children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),h.createAppLabel??`Open app creator`]})]}),h.steps.length>0&&(0,V.jsx)(`div`,{children:g&&h.setupMode===`manual`?(0,V.jsxs)(`details`,{className:`rounded-lg border border-orange-500/20 bg-orange-500/5 p-3`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-orange-200`,children:`First-time Slack app setup`}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(bO,{items:h.steps})})]}):(0,V.jsxs)(V.Fragment,{children:[h.setupMode===`informational`?(0,V.jsx)(`p`,{className:`text-xs font-medium text-orange-200 mb-1`,children:`What to do`}):null,(0,V.jsx)(bO,{items:h.steps})]})}),h.tokenAlternative&&(0,V.jsxs)(`p`,{className:`text-xs text-orange-100/80 border-l-2 border-orange-500/30 pl-2`,children:[(0,V.jsx)(`span`,{className:`font-medium text-orange-200`,children:`Alternative: `}),h.tokenAlternative]}),l&&h.setupMode===`manual`&&(0,V.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-orange-500/20 bg-orange-500/5 p-3`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)($m,{htmlFor:`oauth-client-id-${e}`,className:`text-orange-200`,children:`Client ID`}),(0,V.jsx)(xd,{id:`oauth-client-id-${e}`,value:r,onChange:e=>i(e.target.value),placeholder:`OAuth Client ID`,className:`bg-black/20 border-orange-500/30`})]}),d?(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)($m,{htmlFor:`oauth-client-secret-${e}`,className:`text-orange-200`,children:`Client Secret`}),(0,V.jsx)(xd,{id:`oauth-client-secret-${e}`,type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:`OAuth Client Secret`,className:`bg-black/20 border-orange-500/30`})]}):(0,V.jsx)(`p`,{className:`text-xs text-orange-200/80`,children:`Client secret is saved locally for this service.`}),g&&(0,V.jsx)(q,{type:`button`,size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>f(e=>!e),children:d?`Hide client secret field`:`Update client secret`}),p?.hasStoredClientSecret&&d&&(0,V.jsx)(`p`,{className:`text-xs text-orange-200/80`,children:`Leave blank to keep the saved secret. Enter a new value only if Slack rejected the last connect attempt.`})]}),h.afterConnect&&h.afterConnect.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-orange-200 mb-1`,children:`After connect`}),(0,V.jsx)(bO,{items:h.afterConnect,className:`text-orange-100/80`})]}),x&&(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(q,{size:`sm`,className:`bg-orange-600 hover:bg-orange-700`,disabled:s||l&&h.setupMode===`manual`&&!g&&(!r.trim()||!a.trim()),onClick:()=>y(_()),children:s?`Connecting…`:g&&h.setupMode===`manual`?`Reconnect`:h.setupMode===`dynamic`||h.setupMode===`managed`?`Connect`:`Connect with credentials`}),h.docsUrl&&(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>window.open(h.docsUrl,`_blank`),children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),`Docs`]})]}),h.setupMode===`informational`&&h.docsUrl&&(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-200`,onClick:()=>window.open(h.docsUrl,`_blank`),children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),`Docs`]})]})}function SO(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`]}))}var CO=`agent-deck:oauth-complete`;function wO(e){return typeof e==`object`&&!!e&&e.type===`agent-deck:oauth-complete`}function TO(e){return!!(e&&typeof e==`object`&&Object.keys(e).length>0)}function EO(e){return TO(e)?JSON.stringify(e,null,2):`{
|
|
205
|
+
|
|
206
|
+
}`}function DO(e){let t=e.trim();if(!t||t===`{}`)return{ok:!0,headers:{}};try{let e=JSON.parse(t);if(typeof e!=`object`||!e||Array.isArray(e))return{ok:!1,error:`Headers must be a JSON object (e.g. {"Authorization": "Bearer token"})`};for(let[t,n]of Object.entries(e))if(typeof n!=`string`)return{ok:!1,error:`Header "${t}" must be a string value`};return{ok:!0,headers:e}}catch{return{ok:!1,error:`Invalid JSON — fix syntax before saving`}}}function OO(e){return/^bearer\s+/i.test(e)?`Bearer ••••`:e.length>0?`••••`:``}function kO(e){return TO(e)?Object.entries(e).map(([e,t])=>({name:e,masked:OO(t)})):[]}function AO(e){return e===`not_required`||e===`authenticated`||e===`authenticated_refreshable`}function jO(e){if(!e)return`unknown`;let t=new Date(e).getTime()-Date.now();if(t<=0)return`soon`;let n=Math.round(t/6e4);if(n<60)return`in ${n} minute${n===1?``:`s`}`;let r=Math.round(n/60);if(r<48)return`in ${r} hour${r===1?``:`s`}`;let i=Math.round(r/24);return`in ${i} day${i===1?``:`s`}`}function MO(e){if(!e||e.type!==`local-mcp`)return!1;let t=[e.localCommand,...e.localArgs??[],e.url,e.name].filter(Boolean).join(` `).toLowerCase();return t.includes(`google-drive`)||t.includes(`google_drive`)}function NO({service:e,isOpen:t,onClose:n}){let[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(``),[d,f]=(0,b.useState)(``),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!1),[y,x]=(0,b.useState)(`{
|
|
207
|
+
|
|
208
|
+
}`),[S,C]=(0,b.useState)(null),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(null),O=(0,b.useRef)(null),k=we(),{toast:A}=dn(),j=e&&E?.id===e.id?E:e,M=j,N=M?.headers&&typeof M.headers==`object`?M.headers:null,P=!!(M&&M.id&&M.url),{data:F,isLoading:I,error:L,refetch:ee}=Kt({queryKey:[`/api/mcp/discover`,M?.url],queryFn:async()=>{if(!M||M.type!==`mcp`)return null;console.log(`🔍 Attempting MCP discovery for: ${M.url}`);try{let e=await(await H(`POST`,`/api/mcp/discover`,{url:M.url})).json();return console.log(`✅ MCP discovery successful for ${M.url}:`,e),e}catch(e){throw console.log(`❌ MCP discovery failed for ${M.url}:`,e),e}},enabled:P&&M.type===`mcp`&&t,staleTime:0,gcTime:12e4}),te=F?.data?.oauth?.required===!0,{data:ne,refetch:R}=Kt({queryKey:[`/api/oauth`,M?.id,`status`],queryFn:async()=>{let e=await H(`GET`,`/api/oauth/${M.id}/status`),t=await e.json();if(!e.ok||!t.success)throw Error(t.error||`Failed to load OAuth status`);return t.data},enabled:P&&M.type===`mcp`&&t&&te,refetchInterval:e=>{let t=e.state.data;return t?.authenticated||t?.refreshFailed?!1:2e3}}),z=te?ne?.refreshFailed?{status:`refresh_failed`,message:`OAuth renewal failed — please re-authenticate`}:ne?.authenticated?ne.hasRefreshToken&&ne.expiresAt?{status:`authenticated_refreshable`,message:`Access expires ${jO(ne.expiresAt)} · renews automatically`}:{status:`authenticated`,message:null}:ne?.hasToken&&ne?.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:M?.id,apiServiceType:M?.type,apiServiceUrl:M?.url,isOpen:t,hasValidService:P,enabled:P&&M.type===`mcp`&&t,mcpDiscoveryLoading:I,mcpDiscoveryData:F?JSON.stringify(F,null,2):null,mcpDiscoveryDataKeys:F?Object.keys(F):null,oauthRequired:F?.data?.oauth?.required,oauthData:F?.data?.oauth?JSON.stringify(F.data.oauth,null,2):null,toolsQueryEnabled:P&&M.type===`mcp`&&t&&!F?.data?.oauth?.required});let{data:B,isLoading:re,error:ie,refetch:ae}=Kt({queryKey:[`/api/services`,M?.id,`tools`],queryFn:async()=>{if(!M||M.type!==`mcp`&&M.type!==`local-mcp`)return{data:[]};console.log(`🔍 Attempting to discover tools for MCP service: ${M.id} at ${M.url}`);try{let e=await(await H(`GET`,`/api/services/${M.id}/tools`)).json();return console.log(`✅ MCP tools discovery successful for ${M.id}:`,e),e}catch(e){throw console.log(`❌ MCP tools discovery failed for ${M.id}:`,e),e}},enabled:P&&(M.type===`mcp`||M.type===`local-mcp`)&&t&&(M.type===`local-mcp`||AO(z.status)),staleTime:0,gcTime:12e4});(0,b.useEffect)(()=>{if(!t||!M?.id||M.type!==`mcp`&&M.type!==`local-mcp`||!(M.type===`local-mcp`||AO(z.status)||z.status===`not_required`)||re||ie)return;let e=!1;return(async()=>{try{let t=await(await H(`GET`,`/api/services/${M.id}`)).json();!e&&t?.success&&t.data&&D(t.data),k.invalidateQueries({queryKey:[`/api/services`]})}catch{}})(),()=>{e=!0}},[t,M?.id,M?.type,re,ie,z.status,k]),(0,b.useEffect)(()=>{if(!t||!M?.id||M.type!==`a2a`)return;let e=!1;return(async()=>{try{await H(`GET`,`/api/services/${M.id}/health`);let t=await(await H(`GET`,`/api/services/${M.id}`)).json();!e&&t?.success&&t.data&&D(t.data),k.invalidateQueries({queryKey:[`/api/services`]})}catch{}})(),()=>{e=!0}},[t,M?.id,M?.type,k]),console.log(`MCP Tools Query Debug:`,{hasValidService:P,apiServiceType:M?.type,isOpen:t,oauthRequired:F?.data?.oauth?.required,oauthStatus:z.status,toolsQueryEnabled:P&&(M.type===`mcp`||M.type===`local-mcp`)&&t&&(M.type===`local-mcp`||AO(z.status)),mcpToolsLoading:re});let{data:oe,isLoading:se,error:ce}=Kt({queryKey:[`/api/proxy/a2a`,M?.id,`manifest`],queryFn:async()=>{if(!M||M.type!==`a2a`)return null;let e=await(await H(`GET`,`/api/proxy/a2a/${M.id}/manifest`)).text();return JSON.parse(e)},enabled:P&&M.type===`a2a`&&t,staleTime:0,gcTime:12e4}),le=B?.data||[],ue=oe,de=re||se;console.log(`ServiceDetailsModal Debug:`,{service:e?.id,serviceType:e?.type,isOpen:t,mcpDiscoveryLoading:I,mcpDiscoveryData:F,mcpDiscoveryError:L?String(L):null,mcpToolsLoading:re,a2aManifestLoading:se,mcpToolsError:ie?String(ie):null,a2aManifestError:ce?String(ce):null,mcpToolsCount:le.length,mcpToolsData:B,hasA2aManifest:!!ue,isLoading:de,oauthRequired:F?.data?.oauth?.required,oauthStatus:z.status,oauthMessage:z.message,oauthAuthenticated:ne?.authenticated,expiresAt:ne?.expiresAt}),(0,b.useEffect)(()=>{if(!t){D(null),v(!1),C(null),pe.current=!1,fe.current=!1;return}e&&(D(e),u(e.name||``),f(e.description||``),v(!1),C(null))},[e,t]);let fe=(0,b.useRef)(!1),pe=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!t||!M?.id){fe.current=!1;return}if(!ne?.authenticated){fe.current=!1;return}fe.current||(fe.current=!0,pe.current=!0,(async()=>{A({title:`OAuth completed`,description:`Authentication successful! Refreshing service status...`}),SO(k,M.id),k.invalidateQueries({queryKey:[`/api/mcp/discover`,M.url]});try{let e=await H(`GET`,`/api/services/${M.id}`);if(e.ok){let t=await e.json();D(t.data??t)}}catch{}await ee(),k.invalidateQueries({queryKey:[`/api/services`,M.id,`tools`]}),await ae(),pe.current=!1})())},[ne?.authenticated,t,M?.id]);let me=()=>e?.type===`mcp`?(0,V.jsx)(Ai,{className:`w-6 h-6`}):(0,V.jsx)(yi,{className:`w-6 h-6`}),he=()=>e?.type===`mcp`?`text-blue-400`:`text-purple-400`,ge=()=>e?.type===`mcp`?`bg-blue-500/20`:`bg-purple-500/20`,_e=e=>new Date(e).toLocaleDateString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`});(0,b.useEffect)(()=>{a&&(O.current?.focus(),O.current?.select())},[a]);let ve=async()=>{let e=j?.name||``,t=l.trim();if(!j||!t||t===e){u(e),o(!1);return}m(!0);try{await H(`PUT`,`/api/services/${j.id}`,{name:t}),D({...j,name:t}),k.invalidateQueries({queryKey:[`/api/services`]}),k.invalidateQueries({queryKey:[`/api/collection/warnings`]}),k.invalidateQueries({queryKey:[`/api/decks`]}),o(!1)}catch(t){u(e),o(!1),A({title:`Could not rename service`,description:t instanceof Error?t.message:`Failed to update name`,variant:`destructive`})}finally{m(!1)}};return(0,V.jsx)(Vm,{open:t,onOpenChange:t=>{t||(pe.current&&=(SO(k,M?.id??e?.id),!1),fe.current=!1,n())},children:(0,V.jsxs)(Wm,{className:`sm:max-w-6xl bg-linear-to-br from-cosmic-900 to-cosmic-800 border border-white/20 text-white max-h-[90vh] overflow-y-auto`,children:[(0,V.jsx)(Gm,{children:(0,V.jsxs)(qm,{className:`text-2xl font-bold flex items-center`,children:[me(),(0,V.jsx)(`div`,{className:`ml-3 flex min-w-0 items-center`,children:a?(0,V.jsx)(`input`,{ref:O,type:`text`,value:l,disabled:p,onChange:e=>u(e.target.value),onBlur:()=>{ve()},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ve()):e.key===`Escape`&&(e.preventDefault(),u(j?.name||``),o(!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-hidden sm:max-w-[20rem]`,"aria-label":`Service name`,"data-testid":`input-service-name`}):(0,V.jsx)(`button`,{type:`button`,className:`min-w-0 truncate text-left hover:underline`,title:`Click to rename`,onClick:()=>{u(j?.name||``),o(!0)},"data-testid":`button-rename-service`,children:j?.name})}),(0,V.jsx)(b_,{className:`ml-3 ${ge()} ${he()}`,children:e?.type?.toUpperCase()})]})}),e&&(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:[(0,V.jsx)(`div`,{className:`mb-3`,children:(0,V.jsxs)(`h3`,{className:`text-lg font-semibold flex items-center`,children:[(0,V.jsx)(pi,{className:`w-5 h-5 mr-2`}),`Service Overview`]})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-1`,children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm`,children:`Description`}),!s&&(0,V.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>c(!0),className:`h-6 w-6 p-0 opacity-0 hover:opacity-100 transition-opacity`,title:`Edit description`,children:(0,V.jsx)(ia,{className:`w-3 h-3`})})]}),s?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),className:`w-full bg-black/30 border border-white/20 rounded px-2 py-1 text-white focus:outline-hidden focus:border-white/40 resize-none`,rows:3,placeholder:`Enter description...`,autoFocus:!0}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(q,{size:`sm`,onClick:async()=>{if(e){g(!0);try{if((await H(`PUT`,`/api/services/${e.id}`,{description:d.trim()})).ok){if(E){let e={...E,description:d.trim()};D(e)}k.invalidateQueries({queryKey:[`/api/services`]}),k.invalidateQueries({queryKey:[`/api/collection/warnings`]}),k.invalidateQueries({queryKey:[`/api/decks`]}),k.invalidateQueries({queryKey:[`/api/decks`]}),A({title:`Description updated`,description:`Service description has been updated successfully.`}),c(!1)}else throw Error(`Failed to update description`)}catch{A({title:`Update failed`,description:`Failed to update service description. Please try again.`,variant:`destructive`})}finally{g(!1)}}},disabled:h,className:`h-6 px-2 text-xs`,children:h?`Saving...`:`Save`}),(0,V.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>{c(!1),f(j?.description||``)},className:`h-6 px-2 text-xs`,children:`Cancel`})]})]}):(0,V.jsx)(`p`,{className:`text-white cursor-pointer hover:bg-white/10 px-2 py-1 rounded transition-colors`,onClick:()=>c(!0),title:`Click to edit description`,children:j?.description||`No description`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Endpoint`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,V.jsx)(b_,{variant:`outline`,className:`border-blue-500/30 text-blue-300`,children:M.type.toUpperCase()}),TO(N)&&(0,V.jsx)(b_,{variant:`outline`,className:`border-green-500/30 text-green-300`,children:`Custom Headers`})]}),(0,V.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>window.open(M.url,`_blank`),className:`p-1 h-auto`,children:(0,V.jsx)(Mi,{className:`w-4 h-4`})})]}),(0,V.jsx)(`div`,{className:`text-xs text-gray-400 break-all bg-black/20 p-2 rounded border border-white/10`,children:M.url||`No URL available`}),M.type===`mcp`?(0,V.jsxs)(`div`,{className:`text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10`,"data-testid":`custom-headers-section`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,V.jsx)(`p`,{className:`font-semibold text-gray-300`,children:`Custom Headers`}),!_&&(0,V.jsx)(q,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs text-teal-300 hover:text-teal-200`,onClick:()=>{x(EO(N)),C(null),v(!0)},"data-testid":`button-edit-headers`,children:`Edit`})]}),_?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(eh,{value:y,onChange:e=>{x(e.target.value),S&&C(null)},rows:6,className:`bg-white/10 border-white/20 text-white placeholder-gray-400 resize-none font-mono text-xs`,"data-testid":`textarea-edit-headers`,disabled:w}),S&&(0,V.jsxs)(`p`,{className:`text-red-400 text-xs flex items-center gap-1`,"data-testid":`headers-json-error`,children:[(0,V.jsx)(ta,{className:`w-3 h-3 shrink-0`}),S]}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,V.jsx)(q,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>{v(!1),C(null),x(EO(N))},disabled:w,"data-testid":`button-cancel-headers`,children:`Cancel`}),(0,V.jsx)(q,{size:`sm`,className:`h-7 px-3 text-xs bg-teal-600 hover:bg-teal-500`,onClick:async()=>{if(!j)return;let e=DO(y);if(!e.ok){C(e.error);return}T(!0);try{if(!(await H(`PUT`,`/api/services/${j.id}`,{headers:e.headers})).ok)throw Error(`Failed to update headers`);let t=Object.keys(e.headers).length>0?e.headers:void 0;D({...j,headers:t}),v(!1),C(null),SO(k,j.id),k.invalidateQueries({queryKey:[`/api/decks`]}),A({title:`Headers updated`,description:`Custom headers saved. Reconnecting with the new values.`})}catch(e){A({title:`Update failed`,description:e instanceof Error?e.message:`Failed to update headers. Please try again.`,variant:`destructive`})}finally{T(!1)}},disabled:w,"data-testid":`button-save-headers`,children:w?`Saving…`:`Save`})]})]}):TO(N)?(0,V.jsx)(`ul`,{className:`space-y-1 font-mono`,"data-testid":`headers-masked-list`,children:kO(N).map(({name:e,masked:t})=>(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`span`,{className:`text-gray-300`,children:e}),(0,V.jsx)(`span`,{className:`text-gray-500`,children:`: `}),(0,V.jsx)(`span`,{children:t})]},e))}):(0,V.jsx)(`p`,{className:`text-gray-500`,"data-testid":`headers-empty-state`,children:`No custom headers. Add Bearer or API key headers to authenticate.`})]}):TO(N)&&(0,V.jsxs)(`div`,{className:`text-xs text-gray-400 bg-black/20 p-2 rounded border border-white/10`,children:[(0,V.jsx)(`p`,{className:`font-semibold mb-1`,children:`Custom Headers:`}),(0,V.jsx)(`ul`,{className:`space-y-1 font-mono`,children:kO(N).map(({name:e,masked:t})=>(0,V.jsxs)(`li`,{children:[(0,V.jsx)(`span`,{className:`text-gray-300`,children:e}),(0,V.jsx)(`span`,{className:`text-gray-500`,children:`: `}),(0,V.jsx)(`span`,{children:t})]},e))})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Health Status`}),(0,V.jsx)(b_,{className:M.health===`healthy`?`bg-green-500/20 text-green-300`:M.health===`unhealthy`?`bg-red-500/20 text-red-300`:`bg-amber-500/20 text-amber-200`,children:M.health===`healthy`?`Healthy`:M.health===`unhealthy`?`Unreachable`:z.status===`required`||z.status===`expired`||z.status===`refresh_failed`?`Auth required`:`Unknown`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Registered`}),(0,V.jsx)(`p`,{className:`text-white text-sm`,children:_e(M.registeredAt)})]})]})]}),de&&(0,V.jsxs)(`div`,{className:`text-center py-8`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-white mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-gray-400`,children:`Fetching service details...`})]}),r&&(0,V.jsx)(`div`,{className:`bg-red-500/20 border border-red-500/30 rounded-lg p-4`,children:(0,V.jsx)(`p`,{className:`text-red-300`,children:r})}),(e.type===`mcp`||e.type===`local-mcp`)&&(0,V.jsxs)(V.Fragment,{children:[e.type===`local-mcp`&&(0,V.jsxs)(`div`,{className:`bg-cyan-500/15 border border-cyan-500/30 rounded-lg p-4 mb-4`,children:[(0,V.jsx)(`h3`,{className:`text-cyan-200 font-semibold mb-2`,children:`Local MCP — auth happens outside Agent Deck`}),(0,V.jsx)(`div`,{className:`text-cyan-100/90 text-sm space-y-2`,children:MO(M)?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{children:[`This card runs `,(0,V.jsx)(`code`,{className:`text-xs`,children:`@piotr-agier/google-drive-mcp`}),` on your machine. Agent Deck does `,(0,V.jsx)(`strong`,{children:`not`}),` handle Google OAuth for it. If Google shows "app not verified", that is `,(0,V.jsx)(`strong`,{children:`your Google Cloud project`}),`, not Agent Deck.`]}),(0,V.jsxs)(`ol`,{className:`list-decimal list-inside space-y-1 ml-1`,children:[(0,V.jsxs)(`li`,{children:[`Create a GCP OAuth client type `,(0,V.jsx)(`strong`,{children:`Desktop app`}),` (not Web).`]}),(0,V.jsxs)(`li`,{children:[`Add yourself as a `,(0,V.jsx)(`strong`,{children:`Test user`}),` on the consent screen.`]}),(0,V.jsxs)(`li`,{children:[`Run in terminal first:`,` `,(0,V.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"
|
|
209
|
+
export GOOGLE_DRIVE_MCP_AUTH_PORT=3100
|
|
210
|
+
npx @piotr-agier/google-drive-mcp auth`})]}),(0,V.jsxs)(`li`,{children:[`Set `,(0,V.jsx)(`code`,{className:`text-xs`,children:`GOOGLE_DRIVE_MCP_TOKEN_PATH`}),` in the card env to the same token file (`,(0,V.jsx)(`code`,{className:`text-xs`,children:`~/.config/google-drive-mcp/tokens.json`}),`).`]})]}),(0,V.jsxs)(`p`,{className:`text-xs text-cyan-200/80`,children:[`Full steps: `,(0,V.jsx)(`code`,{className:`text-xs`,children:`docs/GOOGLE_DRIVE_WORKAROUND.md`}),` in the repo.`]})]}):(0,V.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.`})})]}),(0,V.jsx)(yO,{serviceId:M.id,tools:le,isLoading:re})]}),e.type===`a2a`&&ue&&(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center`,children:[(0,V.jsx)(ra,{className:`w-5 h-5 mr-2`}),`Agent Overview`]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Agent Name`}),(0,V.jsx)(`p`,{className:`text-white font-semibold`,children:ue.name})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Version`}),(0,V.jsx)(`p`,{className:`text-white`,children:ue.version})]}),(0,V.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Description`}),(0,V.jsx)(`p`,{className:`text-white`,children:ue.description})]}),ue.provider&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Provider`}),(0,V.jsx)(`p`,{className:`text-white`,children:ue.provider.organization})]}),ue.documentationUrl&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`Documentation`}),(0,V.jsxs)(q,{size:`sm`,variant:`ghost`,onClick:()=>window.open(ue.documentationUrl,`_blank`),className:`p-1 h-auto text-purple-300`,children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),`View Docs`]})]})]})]}),ue.capabilities&&(0,V.jsxs)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center`,children:[(0,V.jsx)(gi,{className:`w-5 h-5 mr-2`}),`Capabilities`]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-3`,children:[ue.capabilities.streaming&&(0,V.jsx)(b_,{className:`bg-green-500/20 text-green-300`,children:`Streaming`}),ue.capabilities.pushNotifications&&(0,V.jsx)(b_,{className:`bg-blue-500/20 text-blue-300`,children:`Push Notifications`}),ue.capabilities.stateTransitionHistory&&(0,V.jsx)(b_,{className:`bg-purple-500/20 text-purple-300`,children:`State History`})]})]}),ue.skills&&ue.skills.length>0&&(0,V.jsxs)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold mb-4 flex items-center`,children:[(0,V.jsx)(yi,{className:`w-5 h-5 mr-2`}),`Skills (`,ue.skills.length,`)`]}),(0,V.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:ue.skills.map((e,t)=>(0,V.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:[(0,V.jsx)(`div`,{className:`absolute top-2 left-2 text-xs font-bold`,children:(0,V.jsx)(`div`,{className:`text-purple-300 leading-none`,children:`S`})}),(0,V.jsx)(`div`,{className:`absolute bottom-2 right-2 text-xs font-bold rotate-180`,children:(0,V.jsx)(`div`,{className:`text-purple-300 leading-none`,children:`S`})}),(0,V.jsxs)(`div`,{className:`absolute inset-x-3 top-8 bottom-8 flex flex-col items-center justify-center text-center`,children:[(0,V.jsx)(`div`,{className:`text-purple-300 mb-2`,children:(0,V.jsx)(yi,{className:`w-6 h-6`})}),(0,V.jsx)(`h4`,{className:`font-bold text-sm mb-2 line-clamp-2 text-white`,children:e.name}),(0,V.jsx)(`p`,{className:`text-gray-300 text-xs line-clamp-4 mb-2`,children:e.description}),e.tags&&e.tags.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1 justify-center`,children:e.tags.slice(0,2).map((e,t)=>(0,V.jsx)(`span`,{className:`text-purple-300 text-xs bg-purple-500/20 px-1 py-0.5 rounded`,children:e},t))})]}),(0,V.jsx)(`div`,{className:`absolute inset-0 rounded-lg bg-linear-to-br from-transparent via-purple-500/5 to-transparent opacity-0 group-hover:opacity-100 transition-all duration-500 pointer-events-none`})]},t))})]}),(ue.defaultInputModes||ue.defaultOutputModes)&&(0,V.jsxs)(`div`,{className:`bg-black/20 rounded-lg p-4 border border-white/10`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold mb-3 flex items-center`,children:[(0,V.jsx)(Ai,{className:`w-5 h-5 mr-2`}),`Data Modes`]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[ue.defaultInputModes&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-2`,children:`Input Modes`}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ue.defaultInputModes.map((e,t)=>(0,V.jsx)(b_,{className:`bg-blue-500/20 text-blue-300 text-xs`,children:e},t))})]}),ue.defaultOutputModes&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-2`,children:`Output Modes`}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ue.defaultOutputModes.map((e,t)=>(0,V.jsx)(b_,{className:`bg-green-500/20 text-green-300 text-xs`,children:e},t))})]})]})]})]}),e?.type===`mcp`&&z.status===`not_required`&&M?.id&&(0,V.jsxs)(`div`,{className:`bg-blue-500/20 border border-blue-500/30 rounded-lg p-4 mb-4`,children:[(0,V.jsx)(`h3`,{className:`text-blue-300 font-semibold mb-2`,children:`How to connect`}),(0,V.jsx)(xO,{serviceId:M.id})]}),e?.type===`mcp`&&z.status===`authenticated_refreshable`&&(0,V.jsxs)(`div`,{className:`bg-green-500/15 border border-green-500/30 rounded-lg p-4 mb-4`,children:[(0,V.jsx)(`h3`,{className:`text-green-300 font-semibold mb-2`,children:`✓ OAuth connected`}),(0,V.jsx)(`p`,{className:`text-green-100 text-sm`,children:z.message})]}),e?.type===`mcp`&&!AO(z.status)&&z.status!==`not_required`&&(0,V.jsxs)(`div`,{className:`${z.status===`expired`||z.status===`refresh_failed`?`bg-red-500/20 border-red-500/30`:`bg-orange-500/20 border-orange-500/30`} rounded-lg p-4 mb-4`,children:[(0,V.jsx)(`h3`,{className:`${z.status===`expired`||z.status===`refresh_failed`?`text-red-300`:`text-orange-300`} font-semibold mb-2`,children:z.status===`expired`||z.status===`refresh_failed`?`⏰ Token Expired`:`🔐 Authentication Required`}),(0,V.jsxs)(`div`,{className:`${z.status===`expired`||z.status===`refresh_failed`?`text-red-200`:`text-orange-200`} text-sm space-y-2`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:z.message})}),(0,V.jsx)(`p`,{children:z.status===`expired`||z.status===`refresh_failed`?`Your OAuth token has expired or could not be renewed. Please re-authenticate to continue using this service.`:`This MCP server requires OAuth authentication to access its tools. Please authenticate to continue.`}),M?.id&&(0,V.jsx)(xO,{serviceId:M.id,onConnected:()=>void R()}),F?.data?.oauth?.resourceName&&(0,V.jsx)(`div`,{className:`mt-3 p-2 bg-orange-500/10 rounded border border-orange-500/20 text-xs text-orange-100`,children:(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`strong`,{children:`Resource:`}),` `,F.data.oauth.resourceName]})})]})]}),e?.type===`mcp`&&(0,V.jsxs)(`div`,{className:`bg-gray-800/50 border border-gray-600/30 rounded-lg p-4 mb-4`,children:[(0,V.jsx)(`h3`,{className:`text-gray-300 font-semibold mb-2`,children:`Connection Logs`}),(0,V.jsxs)(`div`,{className:`text-gray-200 text-sm space-y-2`,children:[(0,V.jsxs)(`div`,{className:`bg-black/30 p-2 rounded text-xs`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`🔍 Attempting to discover tools for MCP service:`})}),(0,V.jsxs)(`p`,{children:[`Service ID: `,e?.id]}),(0,V.jsxs)(`p`,{children:[`Service URL: `,M?.url]}),(0,V.jsxs)(`p`,{children:[`Status: `,re?`🔄 Loading...`:ie?`❌ Failed`:`✅ Complete`]})]}),re&&(0,V.jsxs)(`div`,{className:`bg-yellow-500/20 p-2 rounded text-xs`,children:[(0,V.jsxs)(`p`,{children:[`🔄 Making HTTP request to: `,(0,V.jsxs)(`code`,{children:[`GET /api/services/`,e?.id,`/tools`]})]}),(0,V.jsxs)(`p`,{children:[`Target MCP server: `,(0,V.jsx)(`code`,{children:M?.url})]})]}),ie&&(0,V.jsxs)(`div`,{className:`bg-red-500/20 p-2 rounded text-xs`,children:[(0,V.jsx)(`p`,{children:`❌ Request failed:`}),(0,V.jsx)(`pre`,{className:`whitespace-pre-wrap overflow-x-auto`,children:ie instanceof Error?ie.message:String(ie)}),(0,V.jsxs)(`div`,{className:`mt-2 p-2 bg-black/30 rounded`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`🔍 What we tried:`})}),(0,V.jsxs)(`p`,{children:[`• Service ID: `,e?.id]}),(0,V.jsxs)(`p`,{children:[`• Target URL: `,M?.url]}),(0,V.jsxs)(`p`,{children:[`• Request: GET /api/services/`,e?.id,`/tools`]}),TO(N)&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`📋 Headers sent:`})}),(0,V.jsx)(`ul`,{className:`text-xs font-mono`,children:kO(N).map(({name:e,masked:t})=>(0,V.jsxs)(`li`,{children:[e,`: `,t]},e))})]}),(0,V.jsxs)(`div`,{className:`mt-2`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`💡 What this means:`})}),(0,V.jsxs)(`p`,{children:[`• The MCP server at `,M?.url,` returned an error`]}),(0,V.jsx)(`p`,{children:`• This could be due to authentication issues, server being down, or invalid configuration`}),(0,V.jsx)(`p`,{children:`• Check the error message above for specific details from the MCP server`})]})]})]}),!re&&!ie&&le.length>0&&(0,V.jsx)(`div`,{className:`bg-green-500/20 p-2 rounded text-xs`,children:(0,V.jsxs)(`p`,{children:[`✅ Successfully discovered `,le.length,` tools from MCP server`]})}),!re&&!ie&&le.length===0&&(0,V.jsxs)(`div`,{className:`bg-yellow-500/20 p-2 rounded text-xs`,children:[(0,V.jsx)(`p`,{children:`⚠️ Connected to MCP server but no tools were found`}),(0,V.jsx)(`p`,{children:`This could mean the server has no tools or requires specific authentication`})]})]})]}),ie&&(e.type===`mcp`||e.type===`local-mcp`)&&(0,V.jsxs)(`div`,{className:`bg-red-500/20 border border-red-500/30 rounded-lg p-4`,children:[(0,V.jsx)(`h3`,{className:`text-red-300 font-semibold mb-2`,children:`MCP Tool Discovery Failed`}),(0,V.jsxs)(`div`,{className:`text-red-200 text-sm space-y-2`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`Raw Error:`})}),(0,V.jsx)(`pre`,{className:`bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap`,children:ie instanceof Error?ie.message:String(ie)}),(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`strong`,{children:`Service URL:`}),` `,M?.url]}),(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`strong`,{children:`Service ID:`}),` `,M?.id]}),TO(N)&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`Custom Headers:`})}),(0,V.jsx)(`ul`,{className:`bg-black/30 p-2 rounded text-xs font-mono`,children:kO(N).map(({name:e,masked:t})=>(0,V.jsxs)(`li`,{children:[e,`: `,t]},e))})]})]})]}),ce&&e.type===`a2a`&&(0,V.jsxs)(`div`,{className:`bg-red-500/20 border border-red-500/30 rounded-lg p-4`,children:[(0,V.jsx)(`h3`,{className:`text-red-300 font-semibold mb-2`,children:`A2A Manifest Discovery Failed`}),(0,V.jsxs)(`div`,{className:`text-red-200 text-sm space-y-2`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`Raw Error:`})}),(0,V.jsx)(`pre`,{className:`bg-black/30 p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap`,children:ce instanceof Error?ce.message:String(ce)}),(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`strong`,{children:`Service URL:`}),` `,M?.url]}),(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`strong`,{children:`Service ID:`}),` `,M?.id]})]})]}),!de&&!ie&&!ce&&(e.type===`mcp`||e.type===`local-mcp`)&&le.length===0&&(e.type===`local-mcp`||!F?.data?.oauth?.required)&&(0,V.jsxs)(`div`,{className:`bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4`,children:[(0,V.jsx)(`h3`,{className:`text-yellow-300 font-semibold mb-2`,children:`No Tools Available`}),(0,V.jsxs)(`p`,{className:`text-yellow-200 text-sm`,children:[`Successfully connected to MCP server at `,M?.url,`, but no tools were discovered.`]}),(0,V.jsxs)(`div`,{className:`text-yellow-200 text-xs mt-2`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`This could mean:`})}),(0,V.jsxs)(`ul`,{className:`list-disc list-inside ml-2 space-y-1`,children:[(0,V.jsx)(`li`,{children:`The MCP server has no tools registered`}),(0,V.jsx)(`li`,{children:`Tools require specific authentication`}),(0,V.jsx)(`li`,{children:`Tools are only available after certain operations`})]})]})]}),(e.type===`mcp`||e.type===`local-mcp`)&&(0,V.jsxs)(`div`,{className:`bg-blue-500/20 border border-blue-500/30 rounded-lg p-4`,children:[(0,V.jsx)(`h3`,{className:`text-blue-300 font-semibold mb-2`,children:`🔍 MCP Server Analysis`}),(0,V.jsxs)(`div`,{className:`text-blue-200 text-sm space-y-2`,children:[(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`strong`,{children:`Server URL:`}),` `,M?.url]}),I&&(0,V.jsx)(`div`,{className:`mt-3 p-3 bg-black/30 rounded`,children:(0,V.jsx)(`p`,{children:`🔍 Analyzing MCP server configuration...`})}),F&&(0,V.jsxs)(`div`,{className:`mt-3 p-3 bg-black/30 rounded`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`🔍 What we discovered:`})}),F.error&&F.analysis&&(0,V.jsxs)(`div`,{className:`text-yellow-200`,children:[F.analysis.auth_type===`oauth2`&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`OAuth 2.0 Authentication Required`})]}),(0,V.jsx)(`p`,{children:`• This MCP server requires OAuth 2.0 Bearer token authentication`}),(0,V.jsx)(`p`,{children:`• You'll need to provide OAuth credentials (client ID, client secret, authorization URL, token URL)`}),(0,V.jsx)(`p`,{children:`• Check the service provider's documentation for OAuth setup instructions`})]}),F.analysis.protocol===`sse`&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`SSE Protocol Required`})]}),(0,V.jsx)(`p`,{children:`• This MCP server uses Server-Sent Events (SSE) protocol`}),(0,V.jsx)(`p`,{children:`• We'll need to connect using event streaming instead of HTTP`})]}),F.analysis.issue===`not_found`&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`Server Not Found`})]}),(0,V.jsx)(`p`,{children:`• The MCP server URL might be incorrect`}),(0,V.jsx)(`p`,{children:`• Check if the server is running and the URL is correct`})]}),F.analysis.issue===`server_error`&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`Server Error`})]}),(0,V.jsx)(`p`,{children:`• The MCP server is experiencing internal errors`}),(0,V.jsx)(`p`,{children:`• Try again later or contact the service provider`})]}),F.analysis.message&&(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`Analysis:`}),` `,F.analysis.message]})]}),F?.data?.oauth?.required&&(0,V.jsxs)(`div`,{className:`text-yellow-200`,children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`OAuth 2.0 Authentication Required`})]}),F.data.oauth.authorizationUrl&&(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,V.jsx)(q,{size:`sm`,variant:`default`,className:`h-7`,onClick:async()=>{if(M?.id)try{A({title:`Setting up OAuth...`,description:`Automatically registering OAuth application and starting authorization flow...`});let e=await H(`POST`,`/api/oauth/${M.id}/auto-setup`,{});if(!e.ok){let t=await e.json();t.data?.registrationUrl?(window.open(t.data.registrationUrl,`_blank`),A({title:`OAuth Registration Required`,description:`${t.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:`OAuth Setup Failed`,description:t.error||`Failed to setup OAuth automatically. Please configure manually.`,variant:`destructive`});return}let t=await e.json();t.success&&t.data?.authorizationUrl?(window.open(t.data.authorizationUrl,`_blank`),A({title:`OAuth Setup Successful`,description:`OAuth application registered automatically! Please complete the authorization in the new window.`,duration:1e4}),R()):A({title:`OAuth Setup Failed`,description:`Failed to get authorization URL. Please try again.`,variant:`destructive`})}catch(e){A({title:`OAuth Setup Failed`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}},children:`🔧 Auto-Setup OAuth`}),(0,V.jsxs)(q,{size:`sm`,variant:`ghost`,className:`p-1 h-auto text-blue-300`,onClick:()=>window.open(F.data.oauth.authorizationUrl,`_blank`),children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),`Open Raw Authorization URL`]})]}),!F.data.oauth.authorizationUrl&&F.data.oauth.protectedResourceConfigUrl&&(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsxs)(q,{size:`sm`,variant:`ghost`,className:`p-1 h-auto text-blue-300`,onClick:()=>window.open(F.data.oauth.protectedResourceConfigUrl,`_blank`),children:[(0,V.jsx)(Mi,{className:`w-4 h-4 mr-1`}),`View OAuth Configuration`]})}),F.data.oauth.authorizationServerMetadataUrl&&(0,V.jsxs)(`div`,{className:`mt-2 text-xs text-gray-300`,children:[(0,V.jsx)(`span`,{className:`mr-1`,children:`Auth Server Metadata:`}),(0,V.jsx)(`button`,{className:`underline text-blue-300`,onClick:()=>window.open(F.data.oauth.authorizationServerMetadataUrl,`_blank`),children:F.data.oauth.authorizationServerMetadataUrl})]})]}),F?.success&&!F?.data?.oauth?.required&&(0,V.jsxs)(`div`,{className:`text-green-200`,children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`✅ Server Analysis Complete`})]}),(0,V.jsx)(`p`,{children:`• MCP server is accessible and responding`}),(0,V.jsx)(`p`,{children:`• No authentication issues detected`}),(0,V.jsx)(`p`,{children:`• Protocol compatibility confirmed`})]}),F?.data?.oauth?.required&&(0,V.jsxs)(`div`,{className:`text-orange-200`,children:[(0,V.jsxs)(`p`,{children:[`• `,(0,V.jsx)(`strong`,{children:`🔐 OAuth 2.0 Authentication Required`})]}),(0,V.jsx)(`p`,{children:`• This MCP server requires OAuth authentication`}),F.data.oauth.resourceName&&(0,V.jsxs)(`p`,{children:[`• Service: `,F.data.oauth.resourceName]}),F.data.oauth.authorizationUrl&&(0,V.jsxs)(`p`,{children:[`• Authorization URL: `,F.data.oauth.authorizationUrl]}),F.data.oauth.tokenUrl&&(0,V.jsxs)(`p`,{children:[`• Token URL: `,F.data.oauth.tokenUrl]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(q,{size:`sm`,variant:`default`,className:`bg-orange-600 hover:bg-orange-700`,onClick:async()=>{if(M?.id)try{A({title:`Setting up OAuth...`,description:`Automatically registering OAuth application and starting authorization flow...`});let e=await H(`POST`,`/api/oauth/${M.id}/auto-setup`,{});if(!e.ok){let t=await e.json();t.data?.registrationUrl?(window.open(t.data.registrationUrl,`_blank`),A({title:`OAuth Registration Required`,description:`${t.error} I've opened the registration page for you. Please create an OAuth app and then come back to add your credentials.`,duration:15e3})):A({title:`OAuth Setup Failed`,description:t.error||`Failed to setup OAuth automatically. Please configure manually.`,variant:`destructive`});return}let t=await e.json();t.success&&t.data?.authorizationUrl?(window.open(t.data.authorizationUrl,`_blank`),A({title:`OAuth Setup Successful`,description:`OAuth application registered automatically! Please complete the authorization in the new window.`,duration:1e4}),R()):A({title:`OAuth Setup Failed`,description:`Failed to get authorization URL. Please try again.`,variant:`destructive`})}catch(e){A({title:`OAuth Setup Failed`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}},children:`🔧 Auto-Setup OAuth`}),(0,V.jsx)(q,{size:`sm`,variant:`outline`,className:`border-orange-500/30 text-orange-300 hover:bg-orange-500/10`,onClick:()=>{let e=`OAuth Setup Instructions:
|
|
211
|
+
|
|
212
|
+
1. Go to the service provider's OAuth/Developer settings
|
|
213
|
+
2. Create a new OAuth application
|
|
214
|
+
3. Set Redirect URL: http://localhost:8000/api/oauth/${M?.id}/callback
|
|
215
|
+
4. Copy the Client ID and Client Secret
|
|
216
|
+
5. Edit this service and add the credentials
|
|
217
|
+
|
|
218
|
+
${F.data.oauth.authorizationUrl?`Authorization URL: ${F.data.oauth.authorizationUrl}`:``}
|
|
219
|
+
${F.data.oauth.tokenUrl?`Token URL: ${F.data.oauth.tokenUrl}`:``}
|
|
220
|
+
${F.data.oauth.issuer?`Issuer: ${F.data.oauth.issuer}`:``}`;A({title:`OAuth Setup Instructions`,description:e,duration:1e4})},children:`📋 Setup Instructions`})]})]}),(0,V.jsxs)(`div`,{className:`mt-2 text-xs`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`💡 Next Steps:`})}),(0,V.jsxs)(`ul`,{className:`list-disc list-inside ml-2 space-y-1`,children:[(0,V.jsx)(`li`,{children:`For OAuth servers: Provide OAuth credentials in service settings`}),(0,V.jsx)(`li`,{children:`For SSE servers: We'll automatically use the correct protocol`}),(0,V.jsx)(`li`,{children:`For connection issues: Verify the server URL and status`})]})]})]}),L&&(0,V.jsxs)(`div`,{className:`mt-3 p-3 bg-red-500/20 rounded`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`❌ Discovery Failed`})}),(0,V.jsx)(`p`,{children:`Could not analyze MCP server configuration`}),(0,V.jsx)(`pre`,{className:`text-xs overflow-x-auto`,children:L instanceof Error?L.message:String(L)})]})]})]}),!de&&!ie&&!ce&&e.type===`a2a`&&!ue&&(0,V.jsxs)(`div`,{className:`bg-yellow-500/20 border border-yellow-500/30 rounded-lg p-4`,children:[(0,V.jsx)(`h3`,{className:`text-yellow-300 font-semibold mb-2`,children:`Agent Details Not Available`}),(0,V.jsxs)(`p`,{className:`text-yellow-200 text-sm`,children:[`Successfully connected to A2A agent at `,M?.url,`, but no manifest was found.`]}),(0,V.jsxs)(`div`,{className:`text-yellow-200 text-xs mt-2`,children:[(0,V.jsx)(`p`,{children:(0,V.jsx)(`strong`,{children:`This could mean:`})}),(0,V.jsxs)(`ul`,{className:`list-disc list-inside ml-2 space-y-1`,children:[(0,V.jsx)(`li`,{children:`The agent doesn't provide a manifest`}),(0,V.jsx)(`li`,{children:`Manifest endpoint is not implemented`}),(0,V.jsx)(`li`,{children:`Agent requires specific authentication`})]})]})]})]})]})})}function PO({open:e,onOpenChange:t}){let[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(!1),u=we(),{toast:d}=dn(),f=()=>{r(null),a(null),s(null),l(!1)},p=qt({mutationFn:async()=>{if(!n)throw Error(`Choose a bundle file first`);let e=await n.text(),t;try{t=JSON.parse(e)}catch{throw Error(`File is not valid JSON`)}return Yg(t)},onSuccess:e=>{s(e),u.invalidateQueries({queryKey:[`/api/decks`]}),u.invalidateQueries({queryKey:[`/api/services`]}),u.invalidateQueries({queryKey:[`/api/playbooks`]}),u.invalidateQueries({queryKey:[`/api/playbooks/collection`]}),u.invalidateQueries({queryKey:[`/api/credentials/collection`]}),u.invalidateQueries({queryKey:[`/api/collection/warnings`]}),d({title:`Import complete`,description:Qg(e)})},onError:e=>{d({title:`Import failed`,description:e.message,variant:`destructive`})}}),m=async e=>{if(r(e),s(null),!e){a(null);return}try{let t=await e.text(),n=JSON.parse(t);a(`${n.services?.length??0} services · ${n.playbooks?.length??0} playbooks · ${n.decks?.length??0} decks`)}catch{a(`Invalid JSON`)}};return(0,V.jsx)(Vm,{open:e,onOpenChange:e=>{e||f(),t(e)},children:(0,V.jsxs)(Wm,{className:`sm:max-w-lg border-border bg-[#161612] text-[#E8F6F4]`,children:[(0,V.jsxs)(Gm,{children:[(0,V.jsx)(qm,{children:`Import bundle`}),(0,V.jsx)(Jm,{asChild:!0,children:(0,V.jsxs)(`div`,{className:`space-y-2 text-left text-sm text-[#A8C4C0]`,children:[(0,V.jsx)(`p`,{children:`Adds MCP, playbooks, and decks from a JSON file.`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`font-medium text-amber-200/90`,children:`Notes`}),(0,V.jsxs)(`ul`,{className:`mt-1 list-disc space-y-0.5 pl-4`,children:[(0,V.jsx)(`li`,{children:`Same name as an existing card or deck is skipped (linked only).`}),(0,V.jsx)(`li`,{children:`No credentials or secrets — re-enter keys and reconnect OAuth.`})]})]})]})})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`bundle-file`,children:`Bundle file`}),(0,V.jsx)(xd,{id:`bundle-file`,type:`file`,accept:`.json,.agent-deck.json,application/json`,className:`cursor-pointer bg-white/5 border-white/20`,onChange:e=>m(e.target.files?.[0]??null),"data-testid":`input-import-bundle`}),i&&(0,V.jsx)(`p`,{className:`text-xs text-[#A8C4C0]`,"data-testid":`import-preview`,children:i})]}),!o&&(0,V.jsx)(q,{onClick:()=>p.mutate(),disabled:!n||p.isPending||i===`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:p.isPending?`Importing…`:`Import`}),o&&(0,V.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-white/10 bg-white/5 p-3 text-sm`,"data-testid":`import-report`,children:[(0,V.jsx)(`p`,{className:`font-medium`,children:Qg(o)}),o.servicesNeedingOauth.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-amber-200`,children:`Needs OAuth reconnect:`}),(0,V.jsx)(`ul`,{className:`list-disc pl-5 text-[#A8C4C0]`,children:o.servicesNeedingOauth.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}),o.warnings.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-amber-200`,children:`Warnings:`}),(0,V.jsx)(`ul`,{className:`list-disc pl-5 text-[#A8C4C0]`,children:o.warnings.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}),(0,V.jsx)(q,{variant:`outline`,size:`sm`,className:`rounded-full border border-white/20 text-white hover:bg-white/10`,onClick:()=>l(e=>!e),children:c?`Hide id map`:`Show id map`}),c&&(0,V.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-black/40 p-2 text-xs`,children:JSON.stringify(o.idMap,null,2)}),(0,V.jsx)(q,{className:`rounded-full border px-6 text-sm font-semibold hover:opacity-90`,style:{background:`#C4B643`,borderColor:`#C4B643`,color:`black`},onClick:()=>{f(),t(!1)},children:`Done`})]})]})]})})}function FO(){let[e,t]=(0,b.useState)(`connecting`),[n,r]=(0,b.useState)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(null),o=we();return(0,b.useEffect)(()=>{let e=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/api/ws/events`,n=()=>{try{let s=new WebSocket(e);i.current=s,s.onopen=()=>{console.log(`WebSocket connected`),t(`connected`)},s.onmessage=e=>{try{let n=JSON.parse(e.data);r(n),n.type===`deck_update`?(console.log(`Received deck update:`,n),o.invalidateQueries({queryKey:[`/api/decks`]})):n.type===`service_update`?(console.log(`Received service update:`,n),SO(o,typeof n.data?.serviceId==`string`?n.data.serviceId:void 0)):n.type===`connection_status`&&t(n.status===`connected`?`connected`:`disconnected`)}catch(e){console.error(`Failed to parse WebSocket message:`,e)}},s.onclose=()=>{console.log(`WebSocket disconnected`),t(`disconnected`),a.current=setTimeout(()=>{console.log(`Attempting to reconnect WebSocket...`),t(`connecting`),n()},3e3)},s.onerror=e=>{console.error(`WebSocket error:`,e),t(`disconnected`)}}catch(e){console.error(`Failed to connect WebSocket:`,e),t(`disconnected`)}};n();let s=e=>{e.origin===window.location.origin&&wO(e.data)&&SO(o,e.data.serviceId)};return window.addEventListener(`message`,s),()=>{window.removeEventListener(`message`,s),a.current&&clearTimeout(a.current),i.current&&i.current.readyState===WebSocket.OPEN&&i.current.close()}},[o]),{connectionStatus:e,lastMessage:n}}async function IO(e,t){return(await(await H(`GET`,`/api/playbooks/dependents/check?${e===`credential`?`credentialId=${encodeURIComponent(t)}`:`serviceId=${encodeURIComponent(t)}`}`)).json()).data??[]}function LO(e){let[t,n]=(0,b.useState)(null),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(!1),l=we(),{toast:u}=dn(),d=()=>{if(!e)throw Error(`Select a deck to edit first`);return e},f=qt({mutationFn:async e=>{let t=d(),n=(await(await H(`GET`,`/api/decks`)).json()).data?.find(e=>e.id===t);if(!n)throw Error(`Selected deck not found`);if(n.services?.some(t=>t.id===e))throw Error(`Service is already in the deck`);let r=n.services?.length??0;return H(`POST`,`/api/decks/${t}/services`,{serviceId:e,position:r})},onSuccess:()=>{l.invalidateQueries({queryKey:[`/api/decks`]}),u({title:`Service added to deck`,description:`${t?.name||`Service`} has been added to the deck.`})},onError:e=>{u({title:`Failed to add service`,description:e.message,variant:`destructive`})}}),p=qt({mutationFn:async e=>{let t=d();if(((await(await H(`GET`,`/api/decks`)).json()).data?.find(e=>e.id===t))?.credentials?.some(t=>t.id===e))throw Error(`API key is already in the deck`);return H(`POST`,`/api/decks/${t}/credentials`,{credentialId:e})},onSuccess:()=>{l.invalidateQueries({queryKey:[`/api/decks`]}),u({title:`API key added to deck`,description:`${r?.label||`API key`} is scoped to this deck.`})},onError:e=>{u({title:`Failed to add API key`,description:e.message,variant:`destructive`})}}),m=qt({mutationFn:async e=>{let t=d();if(((await(await H(`GET`,`/api/decks`)).json()).data?.find(e=>e.id===t))?.playbooks?.some(t=>t.id===e))throw Error(`Playbook is already in the deck`);return H(`POST`,`/api/decks/${t}/playbooks`,{playbookId:e})},onSuccess:()=>{l.invalidateQueries({queryKey:[`/api/decks`]}),u({title:`Playbook added to deck`,description:`${a?.title||`Playbook`} is on this deck.`})},onError:e=>{u({title:`Failed to add playbook`,description:e.message,variant:`destructive`})}}),h=qt({mutationFn:async e=>{let t=await IO(`service`,e);if(t.length>0){let e=t.map(e=>e.title).join(`, `);if(!window.confirm(`Warning: ${t.length} playbook(s) depend on this MCP (${e}). Remove from deck anyway?`))throw Error(`Cancelled`)}return H(`DELETE`,`/api/decks/${d()}/services`,{serviceId:e})},onSuccess:()=>{l.invalidateQueries({queryKey:[`/api/decks`]}),u({title:`Service removed from deck`,description:`${t?.name||`Service`} has been removed from the deck.`})},onError:e=>{e.message!==`Cancelled`&&u({title:`Failed to remove service`,description:e.message,variant:`destructive`})}}),g=qt({mutationFn:async e=>{let t=await IO(`credential`,e);if(t.length>0){let e=t.map(e=>e.title).join(`, `);if(!window.confirm(`Warning: ${t.length} playbook(s) depend on this API key (${e}). Remove from deck anyway?`))throw Error(`Cancelled`)}return H(`DELETE`,`/api/decks/${d()}/credentials`,{credentialId:e})},onSuccess:()=>{l.invalidateQueries({queryKey:[`/api/decks`]}),u({title:`API key removed from deck`,description:`${r?.label||`API key`} is no longer on this deck.`})},onError:e=>{e.message!==`Cancelled`&&u({title:`Failed to remove API key`,description:e.message,variant:`destructive`})}}),_=qt({mutationFn:async e=>H(`DELETE`,`/api/decks/${d()}/playbooks`,{playbookId:e}),onSuccess:()=>{l.invalidateQueries({queryKey:[`/api/decks`]}),u({title:`Playbook removed from deck`,description:`${a?.title||`Playbook`} is no longer on this deck.`})},onError:e=>{u({title:`Failed to remove playbook`,description:e.message,variant:`destructive`})}}),v=(e,t)=>{e.currentTarget instanceof HTMLElement&&(e.currentTarget.style.opacity=t)},y=(e,t)=>{e.dataTransfer.setData(`text/plain`,t.id),e.dataTransfer.setData(`application/json`,JSON.stringify(t)),e.dataTransfer.effectAllowed=t.fromDeck?`move`:`copy`},x=(e,t,r=!1)=>{n(t),i(null),o(null),c(r),y(e,{kind:`service`,id:t.id,fromDeck:r}),v(e,`0.5`)},S=(e,t,r=!1)=>{i(t),n(null),o(null),c(r),y(e,{kind:`credential`,id:t.id,fromDeck:r}),v(e,`0.5`)},C=(e,t,r=!1)=>{o(t),n(null),i(null),c(r),y(e,{kind:`playbook`,id:t.id,fromDeck:r}),v(e,`0.5`)},w=e=>{n(null),i(null),o(null),v(e,`1`)},T=e=>{if(e.kind===`service`){e.fromDeck?h.mutate(e.id):f.mutate(e.id);return}if(e.kind===`credential`){e.fromDeck?g.mutate(e.id):p.mutate(e.id);return}e.fromDeck?_.mutate(e.id):m.mutate(e.id)};return{draggedService:t,draggedCredential:r,draggedPlaybook:a,isDraggingFromDeck:s,handleDragStart:x,handleCredentialDragStart:S,handlePlaybookDragStart:C,handleDragEnd:w,handleDrop:e=>{e.preventDefault();let r=e.dataTransfer.getData(`application/json`);if(r){try{T(JSON.parse(r))}catch{let n=e.dataTransfer.getData(`text/plain`);n&&t&&f.mutate(n)}n(null),i(null),o(null),c(!1)}},handleGlobalDrop:e=>{e.preventDefault();let t=e.dataTransfer.getData(`application/json`);if(t){try{let e=JSON.parse(t);e.fromDeck&&T(e)}catch{}n(null),i(null),o(null),c(!1)}},isDropping:f.isPending||p.isPending||m.isPending||h.isPending||g.isPending||_.isPending}}var RO=`agent-deck-editing-deck-id`;function zO(e){let[t,n]=(0,b.useState)(()=>typeof window>`u`?null:localStorage.getItem(RO));return(0,b.useEffect)(()=>{if(e.length!==0&&!(t&&e.some(e=>e.id===t))){let t=e[0].id;n(t),localStorage.setItem(RO,t)}},[e,t]),{editingDeck:e.find(e=>e.id===t)??null,editingDeckId:t,setEditingDeckId:e=>{n(e),localStorage.setItem(RO,e)}}}function BO(e,[t,n]){return Math.min(n,Math.max(t,e))}function VO(e){let 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 HO=[` `,`Enter`,`ArrowUp`,`ArrowDown`],UO=[` `,`Enter`],WO=`Select`,[GO,KO,qO]=Dn(WO),[JO,YO]=_n(WO,[qO,El]),XO=El(),[ZO,QO]=JO(WO),[$O,ek]=JO(WO),tk=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=XO(t),[g,_]=b.useState(null),[v,y]=b.useState(null),[x,S]=b.useState(!1),C=Yh(l),[w,T]=nr({prop:r,defaultProp:i??!1,onChange:a,caller:WO}),[E,D]=nr({prop:o,defaultProp:s,onChange:c,caller:WO}),O=b.useRef(null),k=!g||m||!!g.closest(`form`),[A,j]=b.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,V.jsx)(Hl,{...h,children:(0,V.jsxs)(ZO,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:ns(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,V.jsx)(GO.Provider,{scope:t,children:(0,V.jsx)($O,{scope:e.__scopeSelect,onNativeOptionAdd:b.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:b.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,V.jsxs)(Xk,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,V.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};tk.displayName=WO;var nk=`SelectTrigger`,rk=b.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=XO(n),o=QO(nk,n),s=o.disabled||r,c=hn(t,o.onTriggerChange),l=KO(n),u=b.useRef(`touch`),[d,f,p]=Qk(e=>{let t=l().filter(e=>!e.disabled),n=$k(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,V.jsx)(Ul,{asChild:!0,...a,children:(0,V.jsx)(On.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Zk(o.value)?``:void 0,...i,ref:c,onClick:U(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:U(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:U(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&HO.includes(e.key)&&(m(),e.preventDefault())})})})});rk.displayName=nk;var ik=`SelectValue`,ak=b.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=QO(ik,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=hn(t,c.onValueNodeChange);return qn(()=>{l(u)},[l,u]),(0,V.jsx)(On.span,{...s,ref:d,style:{pointerEvents:`none`},children:Zk(c.value)?(0,V.jsx)(V.Fragment,{children:o}):a})});ak.displayName=ik;var ok=`SelectIcon`,sk=b.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(On.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});sk.displayName=ok;var ck=`SelectPortal`,lk=e=>(0,V.jsx)(Yn,{asChild:!0,...e});lk.displayName=ck;var uk=`SelectContent`,dk=b.forwardRef((e,t)=>{let n=QO(uk,e.__scopeSelect),[r,i]=b.useState();if(qn(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?fn.createPortal((0,V.jsx)(pk,{scope:e.__scopeSelect,children:(0,V.jsx)(GO.Slot,{scope:e.__scopeSelect,children:(0,V.jsx)(`div`,{children:e.children})})}),t):null}return(0,V.jsx)(_k,{...e,ref:t})});dk.displayName=uk;var fk=10,[pk,mk]=JO(uk),hk=`SelectContentImpl`,gk=yn(`SelectContent.RemoveScroll`),_k=b.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=QO(uk,n),[y,x]=b.useState(null),[S,C]=b.useState(null),w=hn(t,e=>x(e)),[T,E]=b.useState(null),[D,O]=b.useState(null),k=KO(n),[A,j]=b.useState(!1),M=b.useRef(!1);b.useEffect(()=>{if(y)return $p(y)},[y]),Ff();let N=b.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=b.useCallback(()=>N([T,y]),[N,T,y]);b.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=v;b.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,F,I]),b.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,ee]=Qk(e=>{let t=k().filter(e=>!e.disabled),n=$k(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),te=b.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&(E(e),r&&(M.current=!0))},[v.value]),ne=b.useCallback(()=>y?.focus(),[y]),R=b.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&O(e)},[v.value]),z=r===`popper`?xk:yk,B=z===xk?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,V.jsx)(pk,{scope:n,content:y,viewport:S,onViewportChange:C,itemRefCallback:te,selectedItem:T,onItemLeave:ne,itemTextRefCallback:R,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,V.jsx)(Wp,{as:gk,allowPinchZoom:!0,children:(0,V.jsx)(Sf,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:U(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(Rn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,V.jsx)(z,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...B,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:U(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});_k.displayName=hk;var vk=`SelectItemAlignedPosition`,yk=b.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=QO(uk,n),o=mk(uk,n),[s,c]=b.useState(null),[l,u]=b.useState(null),d=hn(t,e=>u(e)),f=KO(n),p=b.useRef(!1),m=b.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=b.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-fk,d=BO(a,[fk,Math.max(fk,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-fk,d=BO(a,[fk,Math.max(fk,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-fk*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-fk,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${fk}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);qn(()=>y(),[y]);let[x,S]=b.useState();qn(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]);let C=b.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]);return(0,V.jsx)(Sk,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:C,children:(0,V.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,V.jsx)(On.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});yk.displayName=vk;var bk=`SelectPopperPosition`,xk=b.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=fk,...a}=e,o=XO(n);return(0,V.jsx)(Wl,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.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)`}})});xk.displayName=bk;var[Sk,Ck]=JO(uk,{}),wk=`SelectViewport`,Tk=b.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=mk(wk,n),o=Ck(wk,n),s=hn(t,a.onViewportChange),c=b.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.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}),(0,V.jsx)(GO.Slot,{scope:n,children:(0,V.jsx)(On.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:U(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-fk*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Tk.displayName=wk;var Ek=`SelectGroup`,[Dk,Ok]=JO(Ek),kk=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=ns();return(0,V.jsx)(Dk,{scope:n,id:i,children:(0,V.jsx)(On.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});kk.displayName=Ek;var Ak=`SelectLabel`,jk=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ok(Ak,n);return(0,V.jsx)(On.div,{id:i.id,...r,ref:t})});jk.displayName=Ak;var Mk=`SelectItem`,[Nk,Pk]=JO(Mk),Fk=b.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=QO(Mk,n),c=mk(Mk,n),l=s.value===r,[u,d]=b.useState(a??``),[f,p]=b.useState(!1),m=hn(t,e=>c.itemRefCallback?.(e,r,i)),h=ns(),g=b.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw 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(0,V.jsx)(Nk,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:b.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(GO.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,V.jsx)(On.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:U(o.onFocus,()=>p(!0)),onBlur:U(o.onBlur,()=>p(!1)),onClick:U(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:U(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:U(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:U(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:U(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:U(o.onKeyDown,e=>{(c.searchRef?.current===``||e.key!==` `)&&(UO.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Fk.displayName=Mk;var Ik=`SelectItemText`,Lk=b.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=QO(Ik,n),s=mk(Ik,n),c=Pk(Ik,n),l=ek(Ik,n),[u,d]=b.useState(null),f=hn(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=b.useMemo(()=>(0,V.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return qn(()=>(h(m),()=>g(m)),[h,g,m]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(On.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?fn.createPortal(a.children,o.valueNode):null]})});Lk.displayName=Ik;var Rk=`SelectItemIndicator`,zk=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Pk(Rk,n).isSelected?(0,V.jsx)(On.span,{"aria-hidden":!0,...r,ref:t}):null});zk.displayName=Rk;var Bk=`SelectScrollUpButton`,Vk=b.forwardRef((e,t)=>{let n=mk(Bk,e.__scopeSelect),r=Ck(Bk,e.__scopeSelect),[i,a]=b.useState(!1),o=hn(t,r.onScrollButtonChange);return qn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(Wk,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Vk.displayName=Bk;var Hk=`SelectScrollDownButton`,Uk=b.forwardRef((e,t)=>{let n=mk(Hk,e.__scopeSelect),r=Ck(Hk,e.__scopeSelect),[i,a]=b.useState(!1),o=hn(t,r.onScrollButtonChange);return qn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(Wk,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Uk.displayName=Hk;var Wk=b.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=mk(`SelectScrollButton`,n),o=b.useRef(null),s=KO(n),c=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>c(),[c]),qn(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(On.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:U(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:U(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:U(i.onPointerLeave,()=>{c()})})}),Gk=`SelectSeparator`,Kk=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,V.jsx)(On.div,{"aria-hidden":!0,...r,ref:t})});Kk.displayName=Gk;var qk=`SelectArrow`,Jk=b.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=XO(n),a=QO(qk,n),o=mk(qk,n);return a.open&&o.position===`popper`?(0,V.jsx)(Gl,{...i,...r,ref:t}):null});Jk.displayName=qk;var Yk=`SelectBubbleInput`,Xk=b.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=b.useRef(null),a=hn(r,i),o=VO(t);return b.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,V.jsx)(On.select,{...n,style:{...ar,...n.style},ref:a,defaultValue:t})});Xk.displayName=Yk;function Zk(e){return e===``||e===void 0}function Qk(e){let t=An(e),n=b.useRef(``),r=b.useRef(0),i=b.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=b.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function $k(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=eA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function eA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tA=tk,nA=rk,rA=ak,iA=sk,aA=lk,oA=dk,sA=Tk,cA=jk,lA=Fk,uA=Lk,dA=zk,fA=Vk,pA=Uk,mA=Kk,hA=tA,gA=rA,_A=b.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(nA,{ref:r,className:Wo(`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-hidden 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,(0,V.jsx)(iA,{asChild:!0,children:(0,V.jsx)(xi,{className:`h-4 w-4 opacity-50`})})]}));_A.displayName=nA.displayName;var vA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(fA,{ref:n,className:Wo(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(wi,{className:`h-4 w-4`})}));vA.displayName=fA.displayName;var yA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(pA,{ref:n,className:Wo(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(xi,{className:`h-4 w-4`})}));yA.displayName=pA.displayName;var bA=b.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,V.jsx)(aA,{children:(0,V.jsxs)(oA,{ref:i,className:Wo(`relative z-50 max-h-(--radix-select-content-available-height) min-w-32 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:[(0,V.jsx)(vA,{}),(0,V.jsx)(sA,{className:Wo(`p-1`,n===`popper`&&`h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)`),children:t}),(0,V.jsx)(yA,{})]})}));bA.displayName=oA.displayName;var xA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(cA,{ref:n,className:Wo(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));xA.displayName=cA.displayName;var SA=b.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(lA,{ref:r,className:Wo(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(dA,{children:(0,V.jsx)(bi,{className:`h-4 w-4`})})}),(0,V.jsx)(uA,{children:t})]}));SA.displayName=lA.displayName;var CA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(mA,{ref:n,className:Wo(`-mx-1 my-1 h-px bg-muted`,e),...t}));CA.displayName=mA.displayName;var wA=`/api/mcp/endpoint`;async function TA(){let e=await fetch(wA,{credentials:`include`});if(!e.ok)throw Error(`MCP endpoint request failed: ${e.status}`);let t=(await e.json())?.data?.url;if(typeof t!=`string`||t.length===0)throw Error(`MCP endpoint response did not include a URL`);return t}async function EA(e){try{let t=await TA();await navigator.clipboard.writeText(t),e({title:`MCP URL copied!`,description:t})}catch(t){e({title:`Failed to copy MCP URL`,description:t instanceof Error?t.message:`Unknown error`,variant:`destructive`})}}var DA=`/assets/AgentDeckLogo3-X5qCXS2A.png`,OA=`agent-deck open`,kA=`agent-deck://open`;function AA(e=document){let t=e.createElement(`iframe`);t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`tabindex`,`-1`),t.style.display=`none`,t.src=kA,e.body.appendChild(t),window.setTimeout(()=>{t.remove()},5e3)}async function jA(e=e=>navigator.clipboard.writeText(e)){try{return await e(OA),!0}catch{return!1}}var MA=`Agent Deck carries the method; Agent Dealer runs the issue queue.`;function NA(){let[e,t]=(0,b.useState)(!1),{toast:n}=dn();return(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-900`,children:(0,V.jsxs)(`div`,{className:`text-center max-w-lg px-4`,"data-testid":`dashboard-recovery`,children:[(0,V.jsx)(`h2`,{className:`text-2xl font-bold text-gray-100 mb-4`,children:`Open your dashboard securely`}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-2`,children:`This page is Agent Deck running on your own machine — nothing is broken.`}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm mb-6`,children:`Your browser just doesn't have a launch pass yet. Agent Deck opens the dashboard with a fresh pass each time, so typing this address alone can never sign anyone in — this page can't grant access by itself.`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{AA(),t(!0)},"data-testid":`button-open-dashboard`,className:`px-5 py-2.5 bg-blue-600 text-white rounded hover:bg-blue-700 font-medium`,children:(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsx)(Mi,{className:`w-4 h-4`}),`Open dashboard`]})}),e&&(0,V.jsxs)(`div`,{className:`mt-6 rounded-lg border border-white/10 bg-black/30 p-4`,"data-testid":`dashboard-recovery-manual`,children:[(0,V.jsx)(`p`,{className:`text-gray-300 text-sm mb-1`,children:`If nothing opened, run this in your terminal:`}),(0,V.jsx)(`code`,{className:`mb-3 block rounded bg-black/40 px-3 py-2 text-gray-100 select-all`,children:`agent-deck open`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{jA().then(e=>{n(e?{title:`Command copied`,description:`Run it in your terminal.`}:{title:`Copy failed`,description:`Type this in your terminal: ${OA}`})})},"data-testid":`button-copy-open-command`,className:`px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 text-sm`,children:(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,V.jsx)(ki,{className:`w-4 h-4`}),`Copy command`]})}),(0,V.jsxs)(`p`,{className:`text-gray-500 text-xs mt-3`,children:[`Then come back here and reload — or pick `,(0,V.jsx)(`strong`,{children:`Open dashboard`}),` from the Agent Deck menubar, which runs the same command.`]})]})]})})}var PA=[],FA=[],IA=[];function LA(){let[e,t]=(0,b.useState)(``),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(`default`),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(null),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(null),[v,y]=(0,b.useState)(!1),[x,S]=(0,b.useState)(!1),[C,w]=(0,b.useState)(null),[T,E]=(0,b.useState)(!1),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),{toast:N}=dn(),{connectionStatus:P}=FO(),{data:F=[]}=Kt({queryKey:[`/api/playbook-patches`,`proposed`],queryFn:()=>i_(`proposed`)}),{data:I=0}=Kt({queryKey:[`/api/feedback-signals/count`,`available`],queryFn:()=>u_()}),{data:L}=Kt({queryKey:[`/api/dashboard-auth/context`]}),ee=async()=>{A(!0);try{let e=await Jg({scope:`collection`});Xg(e,`backup.agent-deck.json`),N({title:`Exported collection`,description:`${e.services.length} services, ${e.playbooks.length} playbooks, ${e.decks.length} decks`})}catch(e){N({title:`Export failed`,description:e instanceof Error?e.message:`Unknown error`,variant:`destructive`})}finally{A(!1)}},{data:te,isLoading:ne,error:R}=Kt({queryKey:[`/api/decks`]}),z=te?.data||[],{editingDeck:B,editingDeckId:re,setEditingDeckId:ie}=zO(z),[ae,oe]=(0,b.useState)(!1),se=e=>{(e===re||!ae||window.confirm(`You have unsaved deck instructions. Discard them?`))&&ie(e)},{handleDragStart:ce,handleCredentialDragStart:le,handlePlaybookDragStart:ue,handleDragEnd:de,handleDrop:fe,handleGlobalDrop:pe,isDraggingFromDeck:me}=LO(re),{data:he,isLoading:ge,error:_e}=Kt({queryKey:[`/api/services`]}),{data:ve,isLoading:be}=Kt({queryKey:[`/api/credentials/vault`]}),{data:xe,isLoading:Se}=Kt({queryKey:[`/api/playbooks/vault`]}),{data:Ce}=Kt({queryKey:[`/api/collection/warnings`],staleTime:6e4}),{data:we}=ju(),Te=(0,b.useMemo)(()=>Nu(we?.data?.cards),[we?.data?.cards]),Ee=he?.data??PA,De=ve?.data??FA,Oe=xe?.data??IA,ke=(0,b.useMemo)(()=>Ou(Ce?.data),[Ce?.data]),Ae=Array.isArray(we?.data?.cards),je=(0,b.useMemo)(()=>new Map(Ee.map(e=>[e.id,e])),[Ee]),Me=(0,b.useMemo)(()=>new Map(De.map(e=>[e.id,e])),[De]),Ne=(0,b.useMemo)(()=>new Map(Oe.map(e=>[e.id,e])),[Oe]),Pe=(0,b.useMemo)(()=>Lu({services:Ee,credentials:De,playbooks:Oe},{searchQuery:e,typeFilter:n,warningsOnly:i,warnings:ke,getUsageCount:(e,t)=>Te.get(Mu(e,t))?.usageCount}).map(e=>e.kind===`playbook`?{...e,playbook:Ne.get(e.id)}:e.kind===`credential`?{...e,credential:Me.get(e.id)}:{...e,service:je.get(e.id)}),[Ee,De,Oe,e,n,i,ke,Te,je,Me,Ne]),Fe=Pe.length,Ie=(0,b.useMemo)(()=>Iu(Pe,o,Ae),[Pe,o,Ae]);_e&&console.error(`Services error:`,_e),R&&console.error(`Decks error:`,R);let Le=()=>{t(``),r(``),a(!1)},Re=!!(e||n||i),ze=new Set((B?.credentials??[]).map(e=>e.id)),Be=new Set((B?.playbooks??[]).map(e=>e.id)),Ve=B?.services||[],He=B?.playbooks||[],Ue=e=>{d(e),p(!0)},We=e=>{w(e.id),E(!0)},Ge=e=>{_(e.id),y(!0)},Ke=e=>{M(e)};if(_e||R){if(Yt(R)||Yt(_e))return(0,V.jsx)(NA,{});let e=(R instanceof Error?R.message:null)??(_e instanceof Error?_e.message:null)??`There was an error loading the application data.`;return(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-900`,children:(0,V.jsxs)(`div`,{className:`text-center max-w-lg px-4`,children:[(0,V.jsx)(`h2`,{className:`text-2xl font-bold text-red-400 mb-4`,children:`Error Loading Data`}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-2`,children:`There was an error loading the application data.`}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm mb-4`,children:e}),(0,V.jsxs)(`p`,{className:`text-gray-500 text-xs mb-6`,children:[`Is the API running? Try `,(0,V.jsx)(`code`,{className:`text-gray-300`,children:`agent-deck stop && agent-deck start`})]}),(0,V.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 ge||ne||be||Se?(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-900`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-yellow-400 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-gray-300`,children:`Loading AgentDeck...`})]})}):(0,V.jsxs)(`div`,{className:`flex min-h-dvh flex-col overflow-x-hidden`,onDrop:pe,onDragOver:e=>e.preventDefault(),style:{position:`relative`,...me&&{background:`linear-gradient(to bottom right, #1a1a2e, #16213e, #0f3460)`}},children:[(0,V.jsx)(`header`,{className:`relative z-20 shrink-0 bg-black/30 backdrop-blur-md border-b border-white/10`,"data-testid":`top-bar`,children:(0,V.jsx)(`div`,{className:`container mx-auto px-4 py-2`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`img`,{src:DA,alt:`Agent Deck Logo`,className:`h-9 w-9 shrink-0 object-contain`}),(0,V.jsx)(`h1`,{className:`whitespace-nowrap text-xl font-bold bg-linear-to-r from-yellow-400 to-yellow-600 bg-clip-text text-transparent`,style:{background:`linear-gradient(to right, #C4B643, #D4C760)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`},children:`AgentDeck`}),(0,V.jsx)(`p`,{className:`sr-only`,children:`Build tool deck for your agent`})]}),(0,V.jsxs)(`div`,{className:`flex flex-nowrap items-center gap-2 overflow-x-auto -my-1 py-1 sm:gap-3`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`flex h-9 shrink-0 items-center gap-2 whitespace-nowrap rounded-full border px-3 text-sm ${P===`connected`?`bg-emerald-500/20 border-emerald-500/30`:`bg-red-500/20 border-red-500/30`}`,"data-testid":`button-copy-mcp-url`,onClick:()=>{EA(N)},title:`Click to copy MCP URL`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full animate-pulse ${P===`connected`?`bg-emerald-400`:`bg-red-400`}`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`font-ui-display hover:underline ${P===`connected`?`text-emerald-300`:`text-red-300`}`,children:`Get MCP URL`})]}),(0,V.jsx)(qh,{highlightDeckId:re??void 0}),L?.data.hosted&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ye,{href:`/grants`,children:(0,V.jsxs)(q,{variant:`outline`,size:`sm`,className:`shrink-0 border-white/20 bg-white/5 text-[#E8F6F4]`,children:[(0,V.jsx)(Yi,{className:`mr-2 h-4 w-4`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Grants`})]})}),(0,V.jsx)(ye,{href:`/audit`,children:(0,V.jsxs)(q,{variant:`outline`,size:`sm`,className:`shrink-0 border-white/20 bg-white/5 text-[#E8F6F4]`,children:[(0,V.jsx)(Ki,{className:`mr-2 h-4 w-4`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Audit`})]})})]}),(0,V.jsx)(ye,{href:`/feedback-signals`,children:(0,V.jsxs)(q,{variant:`outline`,size:`sm`,className:`relative shrink-0 border-white/20 bg-white/5 text-[#E8F6F4]`,children:[(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Feedback`}),I>0&&(0,V.jsx)(`span`,{className:`ml-2 rounded-full px-2 py-0.5 text-xs font-semibold`,style:{background:`#C4B643`,color:`#0A0A07`},title:`Open feedback available for curation`,children:I})]})}),(0,V.jsx)(ye,{href:`/playbook-patches`,children:(0,V.jsxs)(q,{variant:`outline`,size:`sm`,className:`relative shrink-0 border-white/20 bg-white/5 text-[#E8F6F4]`,children:[(0,V.jsx)(Ii,{className:`mr-2 h-4 w-4`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Review`}),F.length>0&&(0,V.jsx)(`span`,{className:`ml-2 rounded-full px-2 py-0.5 text-xs font-semibold`,style:{background:`#C4B643`,color:`#0A0A07`},title:`Proposed playbook patches`,children:F.length})]})})]})]})})}),me&&(0,V.jsx)(`div`,{className:`fixed inset-0 pointer-events-none z-50 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-red-500/20 border-2 border-dashed border-red-500/50 rounded-lg p-8 text-center`,children:[(0,V.jsx)(`div`,{className:`text-red-400 text-lg font-bold mb-2`,children:`Drop to Remove`}),(0,V.jsx)(`div`,{className:`text-red-300 text-sm`,children:`Release to remove card from deck`})]})}),(0,V.jsx)(`main`,{className:`container mx-auto flex min-h-0 flex-1 flex-col px-4 py-4 sm:py-6`,children:(0,V.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:[(0,V.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:[(0,V.jsx)(`div`,{className:`panel-surface h-64 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80`,children:(0,V.jsx)($g,{decks:z,editingDeckId:re,onSelectDeck:se,isLoading:ne})}),(0,V.jsxs)(`div`,{className:`panel-surface p-4`,children:[(0,V.jsxs)(`h2`,{className:`text-lg font-bold mb-3 flex items-center`,children:[(0,V.jsx)(gi,{className:`w-4 h-4 mr-2`,style:{color:`#92E4DD`}}),(0,V.jsx)(`span`,{className:`font-ui-display`,style:{color:`#92E4DD`},children:`Add Cards`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(q,{variant:`ghost`,className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Vu}`,style:Uu(Ru),onClick:()=>l(!0),"data-testid":`button-register-mcp`,children:[(0,V.jsx)(Ji,{className:`w-3 h-3 mr-2`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Register MCP`})]}),(0,V.jsxs)(q,{variant:`ghost`,className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Vu}`,style:Uu(zu),onClick:()=>h(!0),"data-testid":`button-register-api-key`,children:[(0,V.jsx)(Li,{className:`w-3 h-3 mr-2`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Register API key`})]}),(0,V.jsxs)(q,{variant:`ghost`,className:`w-full border-2 text-sm py-2 hover:opacity-90 ${Vu}`,style:Uu(Bu),onClick:()=>S(!0),"data-testid":`button-register-playbook`,children:[(0,V.jsx)(_i,{className:`w-3 h-3 mr-2`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Register Playbook`})]})]})]})]}),(0,V.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:[(0,V.jsx)(`div`,{className:`panel-surface h-64 shrink-0 overflow-hidden p-4 min-w-0 sm:h-72 xl:h-80`,children:B?(0,V.jsx)(`div`,{className:`h-full`,children:(0,V.jsx)(nh,{deck:B,services:Ve,credentials:B.credentials??[],playbooks:He,allServices:Ee,collectionWarnings:ke,onDrop:fe,onDragStart:ce,onCredentialDragStart:le,onPlaybookDragStart:ue,onDragEnd:de,onCardClick:Ue,onPlaybookClick:We,onCredentialClick:Ge,onInstructionsDirtyChange:oe})}):(0,V.jsxs)(`div`,{className:`text-center h-full flex flex-col justify-center`,children:[(0,V.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:(0,V.jsx)(zi,{className:`w-6 h-6 text-yellow-400`})}),(0,V.jsx)(`h3`,{className:`text-lg font-bold mb-2`,style:{color:`#92E4DD`},children:`No deck selected`}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-4 text-sm`,children:`Create a deck or select one from the sidebar to edit its cards.`}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(q,{onClick:()=>{let e=document.querySelector(`[data-testid="create-deck-button"]`);e&&e.click()},className:`border text-sm py-2`,style:{background:`#C4B643`,borderColor:`#C4B643`,color:`black`},children:[(0,V.jsx)(Wi,{className:`w-4 h-4 mr-2`}),`Create New Deck`]}),(0,V.jsxs)(q,{variant:`outline`,className:`border-white/20 text-white hover:bg-white/10 text-sm py-2`,onClick:()=>{let e=document.querySelector(`[data-testid="deck-management-panel"]`);e&&e.scrollIntoView({behavior:`smooth`})},children:[(0,V.jsx)(zi,{className:`w-4 h-4 mr-2`}),`Manage Decks`]})]})]})}),(0,V.jsxs)(`div`,{className:`panel-surface flex min-h-80 flex-col overflow-hidden p-4 min-w-0 sm:min-h-96 xl:min-h-0 xl:flex-1`,"data-testid":`collection-panel`,children:[(0,V.jsxs)(`div`,{className:`mb-3 flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,V.jsxs)(`h2`,{className:`text-lg font-bold flex items-center`,children:[(0,V.jsx)(Bi,{className:`w-4 h-4 mr-2`,style:{color:`#92E4DD`}}),(0,V.jsx)(`span`,{className:`font-ui-display`,style:{color:`#92E4DD`},children:`My Collection`}),(0,V.jsxs)(`span`,{className:`ml-3 text-sm font-normal text-gray-400`,children:[`(`,Fe,` cards)`]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10`,onClick:ee,disabled:k,title:`Export all MCP, playbooks, and decks`,"data-testid":`button-export-all`,children:[(0,V.jsx)(ji,{className:`w-3 h-3 mr-1`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:k?`Exporting…`:`Export all`})]}),(0,V.jsxs)(q,{size:`sm`,variant:`outline`,className:`h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10`,onClick:()=>O(!0),title:`Import a bundle file`,"data-testid":`button-import-bundle`,children:[(0,V.jsx)(na,{className:`w-3 h-3 mr-1`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Import`})]}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(qi,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4`}),(0,V.jsx)(xd,{placeholder:`Search...`,value:e,onChange:e=>t(e.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`})]}),(0,V.jsxs)(hA,{value:n||`all`,onValueChange:e=>r(e===`all`?``:e),children:[(0,V.jsxs)(_A,{className:`w-30 h-8 bg-white/10 border-white/20 text-white text-xs shrink-0`,"data-testid":`select-type`,children:[(0,V.jsx)(Pi,{className:`w-3 h-3 mr-1 shrink-0`}),(0,V.jsx)(gA,{placeholder:`Type`})]}),(0,V.jsxs)(bA,{children:[(0,V.jsx)(SA,{value:`all`,children:`All`}),(0,V.jsx)(SA,{value:`mcp`,children:`MCP`}),(0,V.jsx)(SA,{value:`local-mcp`,children:`Local MCP`}),(0,V.jsx)(SA,{value:`api-key`,children:`API Key`}),(0,V.jsx)(SA,{value:`playbook`,children:`Playbook`})]})]}),(0,V.jsxs)(hA,{value:Ae?o:`default`,onValueChange:e=>s(e),disabled:!Ae,children:[(0,V.jsxs)(_A,{className:`w-30 h-8 bg-white/10 border-white/20 text-white text-xs shrink-0`,"data-testid":`select-sort`,title:Ae?`Sort collection by 30-day use`:`Usage data unavailable — showing Default order`,"aria-label":`Sort collection`,children:[(0,V.jsx)(hi,{className:`w-3 h-3 mr-1 shrink-0`}),(0,V.jsx)(gA,{placeholder:`Sort`})]}),(0,V.jsxs)(bA,{children:[(0,V.jsx)(SA,{value:`default`,children:`Default`}),(0,V.jsx)(SA,{value:`most-used`,children:`Most used`}),(0,V.jsx)(SA,{value:`least-used`,children:`Least used`})]})]}),(e||n||i)&&(0,V.jsx)(q,{size:`sm`,variant:`outline`,className:`h-8 px-2 text-xs border-white/20 text-white hover:bg-white/10`,onClick:Le,title:`Clear all filters`,children:`Clear`})]})]}),ke.total>0&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`mb-3 w-full shrink-0 rounded-lg border px-3 py-2 text-left text-sm transition-colors ${i?`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:(0,V.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(ta,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-300`}),(0,V.jsx)(`span`,{children:i?(0,V.jsxs)(V.Fragment,{children:[`Showing `,(0,V.jsx)(`strong`,{children:Fe}),` card`,Fe===1?``:`s`,` needing attention.`,(0,V.jsx)(`span`,{className:`text-amber-200/80`,children:` Click to show all cards.`})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`strong`,{children:ke.total}),` card`,ke.total===1?``:`s`,` need attention`,ke.byKind.oauth_expired+ke.byKind.oauth_required>0&&(0,V.jsxs)(V.Fragment,{children:[` `,`(`,ke.byKind.oauth_expired+ke.byKind.oauth_required,` `,`OAuth)`]}),`. `,(0,V.jsx)(`span`,{className:`text-amber-200/80`,children:`Click to filter.`})]})})]})}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-1 py-2`,children:ge||be||Se?(0,V.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,5rem)] gap-y-2 pr-12`,children:Array.from({length:10}).map((e,t)=>(0,V.jsx)(`div`,{className:`animate-pulse`,children:(0,V.jsx)(`div`,{className:`bg-white/10 rounded-lg w-32 h-48 aspect-2/3`})},t))}):Fe===0?(0,V.jsxs)(`div`,{className:`text-center py-12`,children:[(0,V.jsx)(`div`,{className:`text-gray-400 mb-4`,children:(0,V.jsx)(`i`,{className:`fas fa-layer-group text-4xl`})}),(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-gray-300 mb-2`,children:`No cards yet`}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm mb-4`,children:Re?i?`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`}),!Re&&(0,V.jsxs)(`div`,{className:`flex gap-3 justify-center`,children:[(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,className:`border-2 hover:opacity-90 bg-linear-to-b from-gray-900 via-gray-800 to-gray-900`,style:Uu(`#92E4DD`),onClick:()=>l(!0),"data-testid":`button-register-mcp-empty`,children:[(0,V.jsx)(Ji,{className:`w-3 h-3 mr-1`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Register MCP`})]}),(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,className:`border-2 hover:opacity-90 bg-linear-to-b from-gray-900 via-gray-800 to-gray-900`,style:Uu(`#F9386D`),onClick:()=>h(!0),"data-testid":`button-register-api-key-empty`,children:[(0,V.jsx)(Li,{className:`w-3 h-3 mr-1`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Register API key`})]})]})]}):(0,V.jsx)(`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:Ie.map((e,t)=>{let{playbook:n,credential:r,service:i}=e;return(0,V.jsxs)(`div`,{className:`relative group`,style:{zIndex:j===e.id?999999:Fe-t},children:[e.kind===`playbook`&&n?(0,V.jsx)(od,{playbook:n,isInActiveDeck:Be.has(n.id),activeDeck:B??void 0,isInCollection:!0,onDragStart:ue,onDragEnd:de,onCardClick:We,onMouseEnter:()=>Ke(n.id),onMouseLeave:()=>Ke(null),warnings:ke.playbookWarnings.get(n.id),usage:Te.get(Mu(`playbook`,n.id))}):null,e.kind===`credential`&&r?(0,V.jsx)(id,{credential:r,isInActiveDeck:ze.has(r.id),activeDeck:B??void 0,isInCollection:!0,onDragStart:le,onDragEnd:de,onMouseEnter:()=>Ke(r.id),onMouseLeave:()=>Ke(null),onCardClick:Ge,warnings:ke.credentialWarnings.get(r.id),usage:Te.get(Mu(`credential`,r.id))}):null,e.kind===`service`&&i?(0,V.jsx)(ed,{service:i,onDragStart:ce,onDragEnd:de,isInActiveDeck:B?.services?.some(e=>e.id===i.id)||!1,onCardClick:Ue,isInCollection:!0,onMouseEnter:()=>Ke(i.id),onMouseLeave:()=>Ke(null),activeDeck:B??void 0,warnings:ke.serviceWarnings.get(i.id),usage:Te.get(Mu(`service`,i.id))}):null]},`${e.kind}:${e.id}`)})})})]})]})]})}),(0,V.jsx)(`footer`,{className:`shrink-0 border-t border-white/5 py-2 text-center text-xs text-gray-500`,"data-testid":`deck-dealer-note`,children:MA}),(0,V.jsxs)(`div`,{className:`fixed inset-0 pointer-events-none z-0 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`absolute top-20 left-20`,children:(0,V.jsx)(`div`,{className:`h-96 w-96 rounded-full bg-cyan-500/10 blur-3xl animate-orb-drift-1`})}),(0,V.jsx)(`div`,{className:`absolute bottom-20 right-20`,children:(0,V.jsx)(`div`,{className:`h-96 w-96 rounded-full bg-pink-500/10 blur-3xl animate-orb-drift-2`})}),(0,V.jsx)(`div`,{className:`absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,children:(0,V.jsx)(`div`,{className:`h-96 w-96 rounded-full bg-purple-500/5 blur-3xl animate-orb-drift-3`})})]}),(0,V.jsx)(Kg,{type:`mcp`,open:c,onOpenChange:l}),(0,V.jsx)(NO,{service:u,isOpen:f,onClose:()=>p(!1)}),(0,V.jsx)(e_,{open:m,onOpenChange:h}),(0,V.jsx)(v_,{credentialId:g,open:v,onOpenChange:y}),(0,V.jsx)(t_,{open:x,onOpenChange:S}),(0,V.jsx)(__,{playbookId:C,open:T,onOpenChange:E}),(0,V.jsx)(PO,{open:D,onOpenChange:O})]})}var RA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:Wo(`rounded-lg border bg-card text-card-foreground shadow-xs`,e),...t}));RA.displayName=`Card`;var zA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:Wo(`flex flex-col space-y-1.5 p-6`,e),...t}));zA.displayName=`CardHeader`;var BA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:Wo(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));BA.displayName=`CardTitle`;var VA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:Wo(`text-sm text-muted-foreground`,e),...t}));VA.displayName=`CardDescription`;var HA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:Wo(`p-6 pt-0`,e),...t}));HA.displayName=`CardContent`;var UA=b.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:Wo(`flex items-center p-6 pt-0`,e),...t}));UA.displayName=`CardFooter`;function WA(){return(0,V.jsx)(`div`,{className:`min-h-screen w-full flex items-center justify-center bg-gray-50`,children:(0,V.jsx)(RA,{className:`w-full max-w-md mx-4`,children:(0,V.jsxs)(HA,{className:`pt-6`,children:[(0,V.jsxs)(`div`,{className:`flex mb-4 gap-2`,children:[(0,V.jsx)(Ti,{className:`h-8 w-8 text-red-500`}),(0,V.jsx)(`h1`,{className:`text-2xl font-bold text-gray-900`,children:`404 Page Not Found`})]}),(0,V.jsx)(`p`,{className:`mt-4 text-sm text-gray-600`,children:`Did you forget to add the page to the router?`})]})})})}function GA(){let[e]=pe(),[t,n]=(0,b.useState)(`loading`),[r,i]=(0,b.useState)(`Authenticating...`);return(0,b.useEffect)(()=>{(async()=>{try{let e=new URL(window.location.href),t=e.searchParams.get(`success`),r=e.searchParams.get(`error`),a=e.searchParams.get(`serviceId`);t===`true`?(n(`success`),i(`Authentication successful! This window will close automatically.`),window.opener&&!window.opener.closed&&window.opener.postMessage({type:CO,serviceId:a??void 0},window.location.origin),setTimeout(()=>{window.close()},2e3)):t===`false`?(n(`error`),i(`OAuth Error: ${r||`Authentication failed`}`)):(n(`error`),i(`Invalid OAuth callback - please try again`))}catch(e){n(`error`),i(e instanceof Error?e.message:`Authentication failed`)}})()},[e]),(0,V.jsx)(`div`,{className:`flex items-center justify-center min-h-screen bg-background`,children:(0,V.jsxs)(`div`,{className:`text-center space-y-4`,children:[t===`loading`&&(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto`}),t===`success`&&(0,V.jsx)(`div`,{className:`text-green-500 text-4xl`,children:`✓`}),t===`error`&&(0,V.jsx)(`div`,{className:`text-red-500 text-4xl`,children:`✗`}),(0,V.jsx)(`h1`,{className:`text-xl font-semibold`,children:r}),t===`error`&&(0,V.jsx)(`button`,{onClick:()=>window.close(),className:`px-4 py-2 bg-primary text-primary-foreground rounded hover:bg-primary/90`,children:`Close Window`})]})})}function KA(e){let t=()=>{throw Error(`Invalid url to pass to open(): ${e}`)},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/gi,`/`),n.search=n.search.slice(0,1)+Array.from(n.searchParams.entries()).map(qA).join(`&`),n.hash=n.hash.slice(0,1)+encodeURIComponent(n.hash.slice(1)),n.href}function qA([e,t]){return`${encodeURIComponent(e)}${t.length>0?`=${encodeURIComponent(t)}`:``}`}var JA=class{serverUrl;storageKeyPrefix;serverUrlHash;clientName;clientUri;callbackUrl;preventAutoAuth;onPopupWindow;constructor(e,t={}){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=KA(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 KA(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(){let e=this.getKey(`client_info`),t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse client information:`,t),localStorage.removeItem(e);return}}async saveClientInformation(e){let t=this.getKey(`client_info`);localStorage.setItem(t,JSON.stringify(e))}async tokens(){let e=this.getKey(`tokens`),t=localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(t){console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`,t),localStorage.removeItem(e);return}}async saveTokens(e){let 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){let t=this.getKey(`code_verifier`);localStorage.setItem(t,e)}async codeVerifier(){let e=this.getKey(`code_verifier`),t=localStorage.getItem(e);if(!t)throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);return t}async prepareAuthorizationUrl(e){let t=crypto.randomUUID(),n=`${this.storageKeyPrefix}:state_${t}`,r={serverUrlHash:this.serverUrlHash,expiry:Date.now()+6e5,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);let i=KA(e.toString());return localStorage.setItem(this.getKey(`last_auth_url`),i),i}async redirectToAuthorization(e){if(this.preventAutoAuth)return;let t=await this.prepareAuthorizationUrl(e),n=`width=600,height=700,resizable=yes,scrollbars=yes,status=yes`;try{let e=window.open(t,`mcp_auth_${this.serverUrlHash}`,n);this.onPopupWindow&&this.onPopupWindow(t,n,e),!e||e.closed||e.closed===void 0?console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`):(e.focus(),console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`))}catch(e){console.error(`[${this.storageKeyPrefix}] Error opening popup window:`,e)}}getLastAttemptedAuthUrl(){let e=localStorage.getItem(this.getKey(`last_auth_url`));return e?KA(e):null}clearStorage(){let e=`${this.storageKeyPrefix}_${this.serverUrlHash}_`,t=`${this.storageKeyPrefix}:state_`,n=[],r=0;for(let r=0;r<localStorage.length;r++){let i=localStorage.key(r);if(i){if(i.startsWith(e))n.push(i);else if(i.startsWith(t))try{let e=localStorage.getItem(i);e&&JSON.parse(e).serverUrlHash===this.serverUrlHash&&n.push(i)}catch(e){console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`,e)}}}return[...new Set(n)].forEach(e=>{localStorage.removeItem(e),r++}),r}hashString(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t).toString(16)}getKey(e){return`${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`}},YA=Object.freeze({status:`aborted`});function Y(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var XA=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ZA={};function QA(e){return e&&Object.assign(ZA,e),ZA}function $A(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ej(e,t){return typeof t==`bigint`?t.toString():t}function tj(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function nj(e){return e==null}function rj(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ij(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function aj(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function oj(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function sj(e){return JSON.stringify(e)}var cj=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function lj(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var uj=tj(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function dj(e){if(lj(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return lj(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}var fj=new Set([`string`,`number`,`symbol`]);function pj(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function mj(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function X(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw 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 hj(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var gj={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function _j(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return mj(e,{...e._zod.def,shape:n,checks:[]})}function vj(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return mj(e,{...e._zod.def,shape:n,checks:[]})}function yj(e,t){if(!dj(t))throw Error(`Invalid input to extend: expected a plain object`);return mj(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return oj(this,`shape`,n),n},checks:[]})}function bj(e,t){return mj(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return oj(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function xj(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return mj(t,{...t._zod.def,shape:i,checks:[]})}function Sj(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return mj(t,{...t._zod.def,shape:i,checks:[]})}function Cj(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function wj(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tj(e){return typeof e==`string`?e:e?.message}function Ej(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Tj(e.inst?._zod.def?.error?.(e))??Tj(t?.error?.(e))??Tj(n.customError?.(e))??Tj(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Dj(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Oj(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var kj=(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,ej,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Aj=Y(`$ZodError`,kj),jj=Y(`$ZodError`,kj,{Parent:Error});function Mj(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Nj(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}var Pj=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new XA;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ej(e,a,QA())));throw cj(t,i?.callee),t}return o.value},Fj=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ej(e,a,QA())));throw cj(t,i?.callee),t}return o.value},Ij=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new XA;return a.issues.length?{success:!1,error:new(e??Aj)(a.issues.map(e=>Ej(e,i,QA())))}:{success:!0,data:a.value}},Lj=Ij(jj),Rj=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ej(e,i,QA())))}:{success:!0,data:a.value}},zj=Rj(jj),Bj=/^[cC][^\s-]{8,}$/,Vj=/^[0-9a-z]+$/,Hj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Uj=/^[0-9a-vA-V]{20}$/,Wj=/^[A-Za-z0-9]{27}$/,Gj=/^[a-zA-Z0-9_-]{21}$/,Kj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qj=/^([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})$/,Jj=e=>e?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)$/,Yj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xj=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Zj(){return new RegExp(Xj,`u`)}var Qj=/^(?:(?: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])$/,$j=/^(([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})$/,eM=/^((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])$/,tM=/^(([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])$/,nM=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rM=/^[A-Za-z0-9_-]*$/,iM=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,aM=/^\+(?:[0-9]){6,14}[0-9]$/,oM=`(?:(?:\\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])))`,sM=RegExp(`^${oM}$`);function cM(e){let 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 lM(e){return RegExp(`^${cM(e)}$`)}function uM(e){let t=cM({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${oM}T(?:${r})$`)}var dM=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},fM=/^\d+$/,pM=/^-?\d+(?:\.\d+)?/i,mM=/true|false/i,hM=/null/i,gM=/^[^A-Z]*$/,_M=/^[^a-z]*$/,vM=Y(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),yM={number:`number`,bigint:`bigint`,object:`date`},bM=Y(`$ZodCheckLessThan`,(e,t)=>{vM.init(e,t);let n=yM[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.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})}}),xM=Y(`$ZodCheckGreaterThan`,(e,t)=>{vM.init(e,t);let n=yM[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.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})}}),SM=Y(`$ZodCheckMultipleOf`,(e,t)=>{vM.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ij(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})}}),CM=Y(`$ZodCheckNumberFormat`,(e,t)=>{vM.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=gj[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=fM)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),wM=Y(`$ZodCheckMaxLength`,(e,t)=>{var n;vM.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nj(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Dj(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),TM=Y(`$ZodCheckMinLength`,(e,t)=>{var n;vM.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nj(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Dj(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),EM=Y(`$ZodCheckLengthEquals`,(e,t)=>{var n;vM.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!nj(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Dj(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),DM=Y(`$ZodCheckStringFormat`,(e,t)=>{var n,r;vM.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),OM=Y(`$ZodCheckRegex`,(e,t)=>{DM.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})}}),kM=Y(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gM,DM.init(e,t)}),AM=Y(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_M,DM.init(e,t)}),jM=Y(`$ZodCheckIncludes`,(e,t)=>{vM.init(e,t);let n=pj(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),MM=Y(`$ZodCheckStartsWith`,(e,t)=>{vM.init(e,t);let n=RegExp(`^${pj(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),NM=Y(`$ZodCheckEndsWith`,(e,t)=>{vM.init(e,t);let n=RegExp(`.*${pj(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),PM=Y(`$ZodCheckOverwrite`,(e,t)=>{vM.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),FM=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
221
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
222
|
+
`))}},IM={major:4,minor:0,patch:0},LM=Y(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=IM;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Cj(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new XA;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Cj(e,t))});else{if(e.issues.length===t)continue;r||=Cj(e,t)}}return i?i.then(()=>e):e};e._zod.run=(n,i)=>{let a=e._zod.parse(n,i);if(a instanceof Promise){if(i.async===!1)throw new XA;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e[`~standard`]={validate:t=>{try{let n=Lj(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return zj(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),RM=Y(`$ZodString`,(e,t)=>{LM.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dM(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),zM=Y(`$ZodStringFormat`,(e,t)=>{DM.init(e,t),RM.init(e,t)}),BM=Y(`$ZodGUID`,(e,t)=>{t.pattern??=qj,zM.init(e,t)}),VM=Y(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Jj(e)}else t.pattern??=Jj();zM.init(e,t)}),HM=Y(`$ZodEmail`,(e,t)=>{t.pattern??=Yj,zM.init(e,t)}),UM=Y(`$ZodURL`,(e,t)=>{zM.init(e,t),e._zod.check=n=>{try{let r=n.value,i=new URL(r),a=i.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:iM.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=!r.endsWith(`/`)&&a.endsWith(`/`)?a.slice(0,-1):a;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),WM=Y(`$ZodEmoji`,(e,t)=>{t.pattern??=Zj(),zM.init(e,t)}),GM=Y(`$ZodNanoID`,(e,t)=>{t.pattern??=Gj,zM.init(e,t)}),KM=Y(`$ZodCUID`,(e,t)=>{t.pattern??=Bj,zM.init(e,t)}),qM=Y(`$ZodCUID2`,(e,t)=>{t.pattern??=Vj,zM.init(e,t)}),JM=Y(`$ZodULID`,(e,t)=>{t.pattern??=Hj,zM.init(e,t)}),YM=Y(`$ZodXID`,(e,t)=>{t.pattern??=Uj,zM.init(e,t)}),XM=Y(`$ZodKSUID`,(e,t)=>{t.pattern??=Wj,zM.init(e,t)}),ZM=Y(`$ZodISODateTime`,(e,t)=>{t.pattern??=uM(t),zM.init(e,t)}),QM=Y(`$ZodISODate`,(e,t)=>{t.pattern??=sM,zM.init(e,t)}),$M=Y(`$ZodISOTime`,(e,t)=>{t.pattern??=lM(t),zM.init(e,t)}),eN=Y(`$ZodISODuration`,(e,t)=>{t.pattern??=Kj,zM.init(e,t)}),tN=Y(`$ZodIPv4`,(e,t)=>{t.pattern??=Qj,zM.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),nN=Y(`$ZodIPv6`,(e,t)=>{t.pattern??=$j,zM.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.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})}}}),rN=Y(`$ZodCIDRv4`,(e,t)=>{t.pattern??=eM,zM.init(e,t)}),iN=Y(`$ZodCIDRv6`,(e,t)=>{t.pattern??=tM,zM.init(e,t),e._zod.check=n=>{let[r,i]=n.value.split(`/`);try{if(!i)throw Error();let e=Number(i);if(`${e}`!==i||e<0||e>128)throw Error();new URL(`http://[${r}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function aN(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var oN=Y(`$ZodBase64`,(e,t)=>{t.pattern??=nM,zM.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{aN(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function sN(e){if(!rM.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return aN(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var cN=Y(`$ZodBase64URL`,(e,t)=>{t.pattern??=rM,zM.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{sN(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),lN=Y(`$ZodE164`,(e,t)=>{t.pattern??=aM,zM.init(e,t)});function uN(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var dN=Y(`$ZodJWT`,(e,t)=>{zM.init(e,t),e._zod.check=n=>{uN(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),fN=Y(`$ZodNumber`,(e,t)=>{LM.init(e,t),e._zod.pattern=e._zod.bag.pattern??pM,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),pN=Y(`$ZodNumber`,(e,t)=>{CM.init(e,t),fN.init(e,t)}),mN=Y(`$ZodBoolean`,(e,t)=>{LM.init(e,t),e._zod.pattern=mM,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),hN=Y(`$ZodNull`,(e,t)=>{LM.init(e,t),e._zod.pattern=hM,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),gN=Y(`$ZodAny`,(e,t)=>{LM.init(e,t),e._zod.parse=e=>e}),_N=Y(`$ZodUnknown`,(e,t)=>{LM.init(e,t),e._zod.parse=e=>e}),vN=Y(`$ZodNever`,(e,t)=>{LM.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function yN(e,t,n){e.issues.length&&t.issues.push(...wj(n,e.issues)),t.value[n]=e.value}var bN=Y(`$ZodArray`,(e,t)=>{LM.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>yN(t,n,e))):yN(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function xN(e,t,n){e.issues.length&&t.issues.push(...wj(n,e.issues)),t.value[n]=e.value}function SN(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(...wj(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}var CN=Y(`$ZodObject`,(e,t)=>{LM.init(e,t);let n=tj(()=>{let e=Object.keys(t.shape);for(let n of e)if(!(t.shape[n]instanceof LM))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=hj(t.shape);return{shape:t.shape,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}});aj(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=e=>{let t=new FM([`shape`,`payload`,`ctx`]),r=n.value,i=e=>{let t=sj(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of r.keys)a[e]=`key_${o++}`;t.write(`const newResult = {}`);for(let e of r.keys)if(r.optionalKeys.has(e)){let n=a[e];t.write(`const ${n} = ${i(e)};`);let r=sj(e);t.write(`
|
|
223
|
+
if (${n}.issues.length) {
|
|
224
|
+
if (input[${r}] === undefined) {
|
|
225
|
+
if (${r} in input) {
|
|
226
|
+
newResult[${r}] = undefined;
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
payload.issues = payload.issues.concat(
|
|
230
|
+
${n}.issues.map((iss) => ({
|
|
231
|
+
...iss,
|
|
232
|
+
path: iss.path ? [${r}, ...iss.path] : [${r}],
|
|
233
|
+
}))
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
} else if (${n}.value === undefined) {
|
|
237
|
+
if (${r} in input) newResult[${r}] = undefined;
|
|
238
|
+
} else {
|
|
239
|
+
newResult[${r}] = ${n}.value;
|
|
240
|
+
}
|
|
241
|
+
`)}else{let n=a[e];t.write(`const ${n} = ${i(e)};`),t.write(`
|
|
242
|
+
if (${n}.issues.length) payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
243
|
+
...iss,
|
|
244
|
+
path: iss.path ? [${sj(e)}, ...iss.path] : [${sj(e)}]
|
|
245
|
+
})));`),t.write(`newResult[${sj(e)}] = ${n}.value`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},i,a=lj,o=!ZA.jitless,s=o&&uj.value,c=t.catchall,l;e._zod.parse=(u,d)=>{l??=n.value;let f=u.value;if(!a(f))return u.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),u;let p=[];if(o&&s&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),u=i(u,d);else{u.value={};let e=l.shape;for(let t of l.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?SN(e,u,t,f):xN(e,u,t))):i?SN(r,u,t,f):xN(r,u,t)}}if(!c)return p.length?Promise.all(p).then(()=>u):u;let m=[],h=l.keySet,g=c._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>xN(t,u,e))):xN(t,u,e)}return m.length&&u.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>u):u}});function wN(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ej(e,r,QA())))}),t}var TN=Y(`$ZodUnion`,(e,t)=>{LM.init(e,t),aj(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),aj(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),aj(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),aj(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>rj(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>wN(t,n,e,r)):wN(a,n,e,r)}}),EN=Y(`$ZodDiscriminatedUnion`,(e,t)=>{TN.init(e,t);let n=e._zod.parse;aj(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=tj(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!lj(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,input:o,path:[t.discriminator],inst:e}),i)}}),DN=Y(`$ZodIntersection`,(e,t)=>{LM.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>kN(e,t,n)):kN(e,i,a)}});function ON(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(dj(e)&&dj(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=ON(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ON(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function kN(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Cj(e))return e;let r=ON(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var AN=Y(`$ZodRecord`,(e,t)=>{LM.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!dj(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...wj(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...wj(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>Ej(e,r,QA())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...wj(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...wj(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),jN=Y(`$ZodEnum`,(e,t)=>{LM.init(e,t);let n=$A(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>fj.has(typeof e)).map(e=>typeof e==`string`?pj(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),MN=Y(`$ZodLiteral`,(e,t)=>{LM.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?pj(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),NN=Y(`$ZodTransform`,(e,t)=>{LM.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(t=>(e.value=t,e));if(r instanceof Promise)throw new XA;return e.value=r,e}}),PN=Y(`$ZodOptional`,(e,t)=>{LM.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,aj(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),aj(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${rj(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),FN=Y(`$ZodNullable`,(e,t)=>{LM.init(e,t),aj(e._zod,`optin`,()=>t.innerType._zod.optin),aj(e._zod,`optout`,()=>t.innerType._zod.optout),aj(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${rj(e.source)}|null)$`):void 0}),aj(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),IN=Y(`$ZodDefault`,(e,t)=>{LM.init(e,t),e._zod.optin=`optional`,aj(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>LN(e,t)):LN(r,t)}});function LN(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var RN=Y(`$ZodPrefault`,(e,t)=>{LM.init(e,t),e._zod.optin=`optional`,aj(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),zN=Y(`$ZodNonOptional`,(e,t)=>{LM.init(e,t),aj(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>BN(t,e)):BN(i,e)}});function BN(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var VN=Y(`$ZodCatch`,(e,t)=>{LM.init(e,t),e._zod.optin=`optional`,aj(e._zod,`optout`,()=>t.innerType._zod.optout),aj(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ej(e,n,QA()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Ej(e,n,QA()))},input:e.value}),e.issues=[]),e)}}),HN=Y(`$ZodPipe`,(e,t)=>{LM.init(e,t),aj(e._zod,`values`,()=>t.in._zod.values),aj(e._zod,`optin`,()=>t.in._zod.optin),aj(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>UN(e,t,n)):UN(r,t,n)}});function UN(e,t,n){return Cj(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}var WN=Y(`$ZodReadonly`,(e,t)=>{LM.init(e,t),aj(e._zod,`propValues`,()=>t.innerType._zod.propValues),aj(e._zod,`values`,()=>t.innerType._zod.values),aj(e._zod,`optin`,()=>t.innerType._zod.optin),aj(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(GN):GN(r)}});function GN(e){return e.value=Object.freeze(e.value),e}var KN=Y(`$ZodCustom`,(e,t)=>{vM.init(e,t),LM.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>qN(t,n,r,e));qN(i,n,r,e)}});function qN(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Oj(e))}}var JN=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function YN(){return new JN}var XN=YN();function ZN(e,t){return new e({type:`string`,...X(t)})}function QN(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...X(t)})}function $N(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...X(t)})}function eP(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...X(t)})}function tP(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...X(t)})}function nP(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...X(t)})}function rP(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...X(t)})}function iP(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...X(t)})}function aP(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...X(t)})}function oP(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...X(t)})}function sP(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...X(t)})}function cP(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...X(t)})}function lP(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...X(t)})}function uP(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...X(t)})}function dP(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...X(t)})}function fP(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...X(t)})}function pP(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...X(t)})}function mP(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...X(t)})}function hP(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...X(t)})}function gP(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...X(t)})}function _P(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...X(t)})}function vP(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...X(t)})}function yP(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...X(t)})}function bP(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...X(t)})}function xP(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...X(t)})}function SP(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...X(t)})}function CP(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...X(t)})}function wP(e,t){return new e({type:`number`,checks:[],...X(t)})}function TP(e,t){return new e({type:`number`,coerce:!0,checks:[],...X(t)})}function EP(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...X(t)})}function DP(e,t){return new e({type:`boolean`,...X(t)})}function OP(e,t){return new e({type:`null`,...X(t)})}function kP(e){return new e({type:`any`})}function AP(e){return new e({type:`unknown`})}function jP(e,t){return new e({type:`never`,...X(t)})}function MP(e,t){return new bM({check:`less_than`,...X(t),value:e,inclusive:!1})}function NP(e,t){return new bM({check:`less_than`,...X(t),value:e,inclusive:!0})}function PP(e,t){return new xM({check:`greater_than`,...X(t),value:e,inclusive:!1})}function FP(e,t){return new xM({check:`greater_than`,...X(t),value:e,inclusive:!0})}function IP(e,t){return new SM({check:`multiple_of`,...X(t),value:e})}function LP(e,t){return new wM({check:`max_length`,...X(t),maximum:e})}function RP(e,t){return new TM({check:`min_length`,...X(t),minimum:e})}function zP(e,t){return new EM({check:`length_equals`,...X(t),length:e})}function BP(e,t){return new OM({check:`string_format`,format:`regex`,...X(t),pattern:e})}function VP(e){return new kM({check:`string_format`,format:`lowercase`,...X(e)})}function HP(e){return new AM({check:`string_format`,format:`uppercase`,...X(e)})}function UP(e,t){return new jM({check:`string_format`,format:`includes`,...X(t),includes:e})}function WP(e,t){return new MM({check:`string_format`,format:`starts_with`,...X(t),prefix:e})}function GP(e,t){return new NM({check:`string_format`,format:`ends_with`,...X(t),suffix:e})}function KP(e){return new PM({check:`overwrite`,tx:e})}function qP(e){return KP(t=>t.normalize(e))}function JP(){return KP(e=>e.trim())}function YP(){return KP(e=>e.toLowerCase())}function XP(){return KP(e=>e.toUpperCase())}function ZP(e,t,n){return new e({type:`array`,element:t,...X(n)})}function QP(e,t,n){let r=X(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function $P(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...X(n)})}var eF=Y(`ZodISODateTime`,(e,t)=>{ZM.init(e,t),_F.init(e,t)});function tF(e){return bP(eF,e)}var nF=Y(`ZodISODate`,(e,t)=>{QM.init(e,t),_F.init(e,t)});function rF(e){return xP(nF,e)}var iF=Y(`ZodISOTime`,(e,t)=>{$M.init(e,t),_F.init(e,t)});function aF(e){return SP(iF,e)}var oF=Y(`ZodISODuration`,(e,t)=>{eN.init(e,t),_F.init(e,t)});function sF(e){return CP(oF,e)}var cF=(e,t)=>{Aj.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Nj(e,t)},flatten:{value:t=>Mj(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})};Y(`ZodError`,cF);var lF=Y(`ZodError`,cF,{Parent:Error}),uF=Pj(lF),dF=Fj(lF),fF=Ij(lF),pF=Rj(lF),mF=Y(`ZodType`,(e,t)=>(LM.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>mj(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>uF(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>fF(e,t,n),e.parseAsync=async(t,n)=>dF(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>pF(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(PI(t,n)),e.superRefine=t=>e.check(FI(t)),e.overwrite=t=>e.check(KP(t)),e.optional=()=>gI(e),e.nullable=()=>vI(e),e.nullish=()=>gI(vI(e)),e.nonoptional=t=>wI(e,t),e.array=()=>Q(e),e.or=t=>nI([e,t]),e.and=t=>oI(e,t),e.transform=t=>OI(e,mI(t)),e.default=t=>bI(e,t),e.prefault=t=>SI(e,t),e.catch=t=>EI(e,t),e.pipe=t=>OI(e,t),e.readonly=()=>AI(e),e.describe=t=>{let n=e.clone();return XN.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return XN.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return XN.get(e);let n=e.clone();return XN.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),hF=Y(`_ZodString`,(e,t)=>{RM.init(e,t),mF.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(BP(...t)),e.includes=(...t)=>e.check(UP(...t)),e.startsWith=(...t)=>e.check(WP(...t)),e.endsWith=(...t)=>e.check(GP(...t)),e.min=(...t)=>e.check(RP(...t)),e.max=(...t)=>e.check(LP(...t)),e.length=(...t)=>e.check(zP(...t)),e.nonempty=(...t)=>e.check(RP(1,...t)),e.lowercase=t=>e.check(VP(t)),e.uppercase=t=>e.check(HP(t)),e.trim=()=>e.check(JP()),e.normalize=(...t)=>e.check(qP(...t)),e.toLowerCase=()=>e.check(YP()),e.toUpperCase=()=>e.check(XP())}),gF=Y(`ZodString`,(e,t)=>{RM.init(e,t),hF.init(e,t),e.email=t=>e.check(QN(vF,t)),e.url=t=>e.check(iP(xF,t)),e.jwt=t=>e.check(yP(LF,t)),e.emoji=t=>e.check(aP(CF,t)),e.guid=t=>e.check($N(yF,t)),e.uuid=t=>e.check(eP(bF,t)),e.uuidv4=t=>e.check(tP(bF,t)),e.uuidv6=t=>e.check(nP(bF,t)),e.uuidv7=t=>e.check(rP(bF,t)),e.nanoid=t=>e.check(oP(wF,t)),e.guid=t=>e.check($N(yF,t)),e.cuid=t=>e.check(sP(TF,t)),e.cuid2=t=>e.check(cP(EF,t)),e.ulid=t=>e.check(lP(DF,t)),e.base64=t=>e.check(gP(PF,t)),e.base64url=t=>e.check(_P(FF,t)),e.xid=t=>e.check(uP(OF,t)),e.ksuid=t=>e.check(dP(kF,t)),e.ipv4=t=>e.check(fP(AF,t)),e.ipv6=t=>e.check(pP(jF,t)),e.cidrv4=t=>e.check(mP(MF,t)),e.cidrv6=t=>e.check(hP(NF,t)),e.e164=t=>e.check(vP(IF,t)),e.datetime=t=>e.check(tF(t)),e.date=t=>e.check(rF(t)),e.time=t=>e.check(aF(t)),e.duration=t=>e.check(sF(t))});function Z(e){return ZN(gF,e)}var _F=Y(`ZodStringFormat`,(e,t)=>{zM.init(e,t),hF.init(e,t)}),vF=Y(`ZodEmail`,(e,t)=>{HM.init(e,t),_F.init(e,t)}),yF=Y(`ZodGUID`,(e,t)=>{BM.init(e,t),_F.init(e,t)}),bF=Y(`ZodUUID`,(e,t)=>{VM.init(e,t),_F.init(e,t)}),xF=Y(`ZodURL`,(e,t)=>{UM.init(e,t),_F.init(e,t)});function SF(e){return iP(xF,e)}var CF=Y(`ZodEmoji`,(e,t)=>{WM.init(e,t),_F.init(e,t)}),wF=Y(`ZodNanoID`,(e,t)=>{GM.init(e,t),_F.init(e,t)}),TF=Y(`ZodCUID`,(e,t)=>{KM.init(e,t),_F.init(e,t)}),EF=Y(`ZodCUID2`,(e,t)=>{qM.init(e,t),_F.init(e,t)}),DF=Y(`ZodULID`,(e,t)=>{JM.init(e,t),_F.init(e,t)}),OF=Y(`ZodXID`,(e,t)=>{YM.init(e,t),_F.init(e,t)}),kF=Y(`ZodKSUID`,(e,t)=>{XM.init(e,t),_F.init(e,t)}),AF=Y(`ZodIPv4`,(e,t)=>{tN.init(e,t),_F.init(e,t)}),jF=Y(`ZodIPv6`,(e,t)=>{nN.init(e,t),_F.init(e,t)}),MF=Y(`ZodCIDRv4`,(e,t)=>{rN.init(e,t),_F.init(e,t)}),NF=Y(`ZodCIDRv6`,(e,t)=>{iN.init(e,t),_F.init(e,t)}),PF=Y(`ZodBase64`,(e,t)=>{oN.init(e,t),_F.init(e,t)}),FF=Y(`ZodBase64URL`,(e,t)=>{cN.init(e,t),_F.init(e,t)}),IF=Y(`ZodE164`,(e,t)=>{lN.init(e,t),_F.init(e,t)}),LF=Y(`ZodJWT`,(e,t)=>{dN.init(e,t),_F.init(e,t)}),RF=Y(`ZodNumber`,(e,t)=>{fN.init(e,t),mF.init(e,t),e.gt=(t,n)=>e.check(PP(t,n)),e.gte=(t,n)=>e.check(FP(t,n)),e.min=(t,n)=>e.check(FP(t,n)),e.lt=(t,n)=>e.check(MP(t,n)),e.lte=(t,n)=>e.check(NP(t,n)),e.max=(t,n)=>e.check(NP(t,n)),e.int=t=>e.check(VF(t)),e.safe=t=>e.check(VF(t)),e.positive=t=>e.check(PP(0,t)),e.nonnegative=t=>e.check(FP(0,t)),e.negative=t=>e.check(MP(0,t)),e.nonpositive=t=>e.check(NP(0,t)),e.multipleOf=(t,n)=>e.check(IP(t,n)),e.step=(t,n)=>e.check(IP(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function zF(e){return wP(RF,e)}var BF=Y(`ZodNumberFormat`,(e,t)=>{pN.init(e,t),RF.init(e,t)});function VF(e){return EP(BF,e)}var HF=Y(`ZodBoolean`,(e,t)=>{mN.init(e,t),mF.init(e,t)});function UF(e){return DP(HF,e)}var WF=Y(`ZodNull`,(e,t)=>{hN.init(e,t),mF.init(e,t)});function GF(e){return OP(WF,e)}var KF=Y(`ZodAny`,(e,t)=>{gN.init(e,t),mF.init(e,t)});function qF(){return kP(KF)}var JF=Y(`ZodUnknown`,(e,t)=>{_N.init(e,t),mF.init(e,t)});function YF(){return AP(JF)}var XF=Y(`ZodNever`,(e,t)=>{vN.init(e,t),mF.init(e,t)});function ZF(e){return jP(XF,e)}var QF=Y(`ZodArray`,(e,t)=>{bN.init(e,t),mF.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(RP(t,n)),e.nonempty=t=>e.check(RP(1,t)),e.max=(t,n)=>e.check(LP(t,n)),e.length=(t,n)=>e.check(zP(t,n)),e.unwrap=()=>e.element});function Q(e,t){return ZP(QF,e,t)}var $F=Y(`ZodObject`,(e,t)=>{CN.init(e,t),mF.init(e,t),aj(e,`shape`,()=>t.shape),e.keyof=()=>uI(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:YF()}),e.loose=()=>e.clone({...e._zod.def,catchall:YF()}),e.strict=()=>e.clone({...e._zod.def,catchall:ZF()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>yj(e,t),e.merge=t=>bj(e,t),e.pick=t=>_j(e,t),e.omit=t=>vj(e,t),e.partial=(...t)=>xj(hI,e,t[0]),e.required=(...t)=>Sj(CI,e,t[0])});function $(e,t){return new $F({type:`object`,get shape(){return oj(this,`shape`,{...e}),this.shape},...X(t)})}function eI(e,t){return new $F({type:`object`,get shape(){return oj(this,`shape`,{...e}),this.shape},catchall:YF(),...X(t)})}var tI=Y(`ZodUnion`,(e,t)=>{TN.init(e,t),mF.init(e,t),e.options=t.options});function nI(e,t){return new tI({type:`union`,options:e,...X(t)})}var rI=Y(`ZodDiscriminatedUnion`,(e,t)=>{tI.init(e,t),EN.init(e,t)});function iI(e,t,n){return new rI({type:`union`,options:t,discriminator:e,...X(n)})}var aI=Y(`ZodIntersection`,(e,t)=>{DN.init(e,t),mF.init(e,t)});function oI(e,t){return new aI({type:`intersection`,left:e,right:t})}var sI=Y(`ZodRecord`,(e,t)=>{AN.init(e,t),mF.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function cI(e,t,n){return new sI({type:`record`,keyType:e,valueType:t,...X(n)})}var lI=Y(`ZodEnum`,(e,t)=>{jN.init(e,t),mF.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new lI({...t,checks:[],...X(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new lI({...t,checks:[],...X(r),entries:i})}});function uI(e,t){return new lI({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...X(t)})}var dI=Y(`ZodLiteral`,(e,t)=>{MN.init(e,t),mF.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function fI(e,t){return new dI({type:`literal`,values:Array.isArray(e)?e:[e],...X(t)})}var pI=Y(`ZodTransform`,(e,t)=>{NN.init(e,t),mF.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Oj(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(Oj(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function mI(e){return new pI({type:`transform`,transform:e})}var hI=Y(`ZodOptional`,(e,t)=>{PN.init(e,t),mF.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gI(e){return new hI({type:`optional`,innerType:e})}var _I=Y(`ZodNullable`,(e,t)=>{FN.init(e,t),mF.init(e,t),e.unwrap=()=>e._zod.def.innerType});function vI(e){return new _I({type:`nullable`,innerType:e})}var yI=Y(`ZodDefault`,(e,t)=>{IN.init(e,t),mF.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bI(e,t){return new yI({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var xI=Y(`ZodPrefault`,(e,t)=>{RN.init(e,t),mF.init(e,t),e.unwrap=()=>e._zod.def.innerType});function SI(e,t){return new xI({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var CI=Y(`ZodNonOptional`,(e,t)=>{zN.init(e,t),mF.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wI(e,t){return new CI({type:`nonoptional`,innerType:e,...X(t)})}var TI=Y(`ZodCatch`,(e,t)=>{VN.init(e,t),mF.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function EI(e,t){return new TI({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var DI=Y(`ZodPipe`,(e,t)=>{HN.init(e,t),mF.init(e,t),e.in=t.in,e.out=t.out});function OI(e,t){return new DI({type:`pipe`,in:e,out:t})}var kI=Y(`ZodReadonly`,(e,t)=>{WN.init(e,t),mF.init(e,t)});function AI(e){return new kI({type:`readonly`,innerType:e})}var jI=Y(`ZodCustom`,(e,t)=>{KN.init(e,t),mF.init(e,t)});function MI(e){let t=new vM({check:`custom`});return t._zod.check=e,t}function NI(e,t){return QP(jI,e??(()=>!0),t)}function PI(e,t={}){return $P(jI,e,t)}function FI(e){let t=MI(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(Oj(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(Oj(r))}},e(n.value,n)));return t}function II(e,t){return OI(mI(e),t)}var LI={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};function RI(e){return TP(RF,e)}var zI=`2025-11-25`,BI=[zI,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],VI=`io.modelcontextprotocol/related-task`,HI=NI(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),UI=nI([Z(),zF().int()]),WI=Z();eI({ttl:zF().optional(),pollInterval:zF().optional()});var GI=$({ttl:zF().optional()}),KI=$({taskId:Z()}),qI=eI({progressToken:UI.optional(),[VI]:KI.optional()}),JI=$({_meta:qI.optional()}),YI=JI.extend({task:GI.optional()}),XI=e=>YI.safeParse(e).success,ZI=$({method:Z(),params:JI.loose().optional()}),QI=$({_meta:qI.optional()}),$I=$({method:Z(),params:QI.loose().optional()}),eL=eI({_meta:qI.optional()}),tL=nI([Z(),zF().int()]),nL=$({jsonrpc:fI(`2.0`),id:tL,...ZI.shape}).strict(),rL=e=>nL.safeParse(e).success,iL=$({jsonrpc:fI(`2.0`),...$I.shape}).strict(),aL=e=>iL.safeParse(e).success,oL=$({jsonrpc:fI(`2.0`),id:tL,result:eL}).strict(),sL=e=>oL.safeParse(e).success,cL;(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`})(cL||={});var lL=$({jsonrpc:fI(`2.0`),id:tL.optional(),error:$({code:zF().int(),message:Z(),data:YF().optional()})}).strict(),uL=e=>lL.safeParse(e).success,dL=nI([nL,iL,oL,lL]);nI([oL,lL]);var fL=eL.strict(),pL=QI.extend({requestId:tL.optional(),reason:Z().optional()}),mL=$I.extend({method:fI(`notifications/cancelled`),params:pL}),hL=$({icons:Q($({src:Z(),mimeType:Z().optional(),sizes:Q(Z()).optional(),theme:uI([`light`,`dark`]).optional()})).optional()}),gL=$({name:Z(),title:Z().optional()}),_L=gL.extend({...gL.shape,...hL.shape,version:Z(),websiteUrl:Z().optional(),description:Z().optional()}),vL=II(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,oI($({form:oI($({applyDefaults:UF().optional()}),cI(Z(),YF())).optional(),url:HI.optional()}),cI(Z(),YF()).optional())),yL=eI({list:HI.optional(),cancel:HI.optional(),requests:eI({sampling:eI({createMessage:HI.optional()}).optional(),elicitation:eI({create:HI.optional()}).optional()}).optional()}),bL=eI({list:HI.optional(),cancel:HI.optional(),requests:eI({tools:eI({call:HI.optional()}).optional()}).optional()}),xL=$({experimental:cI(Z(),HI).optional(),sampling:$({context:HI.optional(),tools:HI.optional()}).optional(),elicitation:vL.optional(),roots:$({listChanged:UF().optional()}).optional(),tasks:yL.optional(),extensions:cI(Z(),HI).optional()}),SL=JI.extend({protocolVersion:Z(),capabilities:xL,clientInfo:_L}),CL=ZI.extend({method:fI(`initialize`),params:SL}),wL=$({experimental:cI(Z(),HI).optional(),logging:HI.optional(),completions:HI.optional(),prompts:$({listChanged:UF().optional()}).optional(),resources:$({subscribe:UF().optional(),listChanged:UF().optional()}).optional(),tools:$({listChanged:UF().optional()}).optional(),tasks:bL.optional(),extensions:cI(Z(),HI).optional()}),TL=eL.extend({protocolVersion:Z(),capabilities:wL,serverInfo:_L,instructions:Z().optional()}),EL=$I.extend({method:fI(`notifications/initialized`),params:QI.optional()}),DL=e=>EL.safeParse(e).success,OL=ZI.extend({method:fI(`ping`),params:JI.optional()}),kL=$({progress:zF(),total:gI(zF()),message:gI(Z())}),AL=$({...QI.shape,...kL.shape,progressToken:UI}),jL=$I.extend({method:fI(`notifications/progress`),params:AL}),ML=JI.extend({cursor:WI.optional()}),NL=ZI.extend({params:ML.optional()}),PL=eL.extend({nextCursor:WI.optional()}),FL=uI([`working`,`input_required`,`completed`,`failed`,`cancelled`]),IL=$({taskId:Z(),status:FL,ttl:nI([zF(),GF()]),createdAt:Z(),lastUpdatedAt:Z(),pollInterval:gI(zF()),statusMessage:gI(Z())}),LL=eL.extend({task:IL}),RL=QI.merge(IL),zL=$I.extend({method:fI(`notifications/tasks/status`),params:RL}),BL=ZI.extend({method:fI(`tasks/get`),params:JI.extend({taskId:Z()})}),VL=eL.merge(IL),HL=ZI.extend({method:fI(`tasks/result`),params:JI.extend({taskId:Z()})});eL.loose();var UL=NL.extend({method:fI(`tasks/list`)}),WL=PL.extend({tasks:Q(IL)}),GL=ZI.extend({method:fI(`tasks/cancel`),params:JI.extend({taskId:Z()})}),KL=eL.merge(IL),qL=$({uri:Z(),mimeType:gI(Z()),_meta:cI(Z(),YF()).optional()}),JL=qL.extend({text:Z()}),YL=Z().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),XL=qL.extend({blob:YL}),ZL=uI([`user`,`assistant`]),QL=$({audience:Q(ZL).optional(),priority:zF().min(0).max(1).optional(),lastModified:tF({offset:!0}).optional()}),$L=$({...gL.shape,...hL.shape,uri:Z(),description:gI(Z()),mimeType:gI(Z()),size:gI(zF()),annotations:QL.optional(),_meta:gI(eI({}))}),eR=$({...gL.shape,...hL.shape,uriTemplate:Z(),description:gI(Z()),mimeType:gI(Z()),annotations:QL.optional(),_meta:gI(eI({}))}),tR=NL.extend({method:fI(`resources/list`)}),nR=PL.extend({resources:Q($L)}),rR=NL.extend({method:fI(`resources/templates/list`)}),iR=PL.extend({resourceTemplates:Q(eR)}),aR=JI.extend({uri:Z()}),oR=aR,sR=ZI.extend({method:fI(`resources/read`),params:oR}),cR=eL.extend({contents:Q(nI([JL,XL]))}),lR=$I.extend({method:fI(`notifications/resources/list_changed`),params:QI.optional()}),uR=aR,dR=ZI.extend({method:fI(`resources/subscribe`),params:uR}),fR=aR,pR=ZI.extend({method:fI(`resources/unsubscribe`),params:fR}),mR=QI.extend({uri:Z()}),hR=$I.extend({method:fI(`notifications/resources/updated`),params:mR}),gR=$({name:Z(),description:gI(Z()),required:gI(UF())}),_R=$({...gL.shape,...hL.shape,description:gI(Z()),arguments:gI(Q(gR)),_meta:gI(eI({}))}),vR=NL.extend({method:fI(`prompts/list`)}),yR=PL.extend({prompts:Q(_R)}),bR=JI.extend({name:Z(),arguments:cI(Z(),Z()).optional()}),xR=ZI.extend({method:fI(`prompts/get`),params:bR}),SR=$({type:fI(`text`),text:Z(),annotations:QL.optional(),_meta:cI(Z(),YF()).optional()}),CR=$({type:fI(`image`),data:YL,mimeType:Z(),annotations:QL.optional(),_meta:cI(Z(),YF()).optional()}),wR=$({type:fI(`audio`),data:YL,mimeType:Z(),annotations:QL.optional(),_meta:cI(Z(),YF()).optional()}),TR=$({type:fI(`tool_use`),name:Z(),id:Z(),input:cI(Z(),YF()),_meta:cI(Z(),YF()).optional()}),ER=$({type:fI(`resource`),resource:nI([JL,XL]),annotations:QL.optional(),_meta:cI(Z(),YF()).optional()}),DR=nI([SR,CR,wR,$L.extend({type:fI(`resource_link`)}),ER]),OR=$({role:ZL,content:DR}),kR=eL.extend({description:Z().optional(),messages:Q(OR)}),AR=$I.extend({method:fI(`notifications/prompts/list_changed`),params:QI.optional()}),jR=$({title:Z().optional(),readOnlyHint:UF().optional(),destructiveHint:UF().optional(),idempotentHint:UF().optional(),openWorldHint:UF().optional()}),MR=$({taskSupport:uI([`required`,`optional`,`forbidden`]).optional()}),NR=$({...gL.shape,...hL.shape,description:Z().optional(),inputSchema:$({type:fI(`object`),properties:cI(Z(),HI).optional(),required:Q(Z()).optional()}).catchall(YF()),outputSchema:$({type:fI(`object`),properties:cI(Z(),HI).optional(),required:Q(Z()).optional()}).catchall(YF()).optional(),annotations:jR.optional(),execution:MR.optional(),_meta:cI(Z(),YF()).optional()}),PR=NL.extend({method:fI(`tools/list`)}),FR=PL.extend({tools:Q(NR)}),IR=eL.extend({content:Q(DR).default([]),structuredContent:cI(Z(),YF()).optional(),isError:UF().optional()});IR.or(eL.extend({toolResult:YF()}));var LR=YI.extend({name:Z(),arguments:cI(Z(),YF()).optional()}),RR=ZI.extend({method:fI(`tools/call`),params:LR}),zR=$I.extend({method:fI(`notifications/tools/list_changed`),params:QI.optional()}),BR=$({autoRefresh:UF().default(!0),debounceMs:zF().int().nonnegative().default(300)}),VR=uI([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),HR=JI.extend({level:VR}),UR=ZI.extend({method:fI(`logging/setLevel`),params:HR}),WR=QI.extend({level:VR,logger:Z().optional(),data:YF()}),GR=$I.extend({method:fI(`notifications/message`),params:WR}),KR=$({hints:Q($({name:Z().optional()})).optional(),costPriority:zF().min(0).max(1).optional(),speedPriority:zF().min(0).max(1).optional(),intelligencePriority:zF().min(0).max(1).optional()}),qR=$({mode:uI([`auto`,`required`,`none`]).optional()}),JR=$({type:fI(`tool_result`),toolUseId:Z().describe(`The unique identifier for the corresponding tool call.`),content:Q(DR).default([]),structuredContent:$({}).loose().optional(),isError:UF().optional(),_meta:cI(Z(),YF()).optional()}),YR=iI(`type`,[SR,CR,wR]),XR=iI(`type`,[SR,CR,wR,TR,JR]),ZR=$({role:ZL,content:nI([XR,Q(XR)]),_meta:cI(Z(),YF()).optional()}),QR=YI.extend({messages:Q(ZR),modelPreferences:KR.optional(),systemPrompt:Z().optional(),includeContext:uI([`none`,`thisServer`,`allServers`]).optional(),temperature:zF().optional(),maxTokens:zF().int(),stopSequences:Q(Z()).optional(),metadata:HI.optional(),tools:Q(NR).optional(),toolChoice:qR.optional()}),$R=ZI.extend({method:fI(`sampling/createMessage`),params:QR}),ez=eL.extend({model:Z(),stopReason:gI(uI([`endTurn`,`stopSequence`,`maxTokens`]).or(Z())),role:ZL,content:YR}),tz=eL.extend({model:Z(),stopReason:gI(uI([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(Z())),role:ZL,content:nI([XR,Q(XR)])}),nz=$({type:fI(`boolean`),title:Z().optional(),description:Z().optional(),default:UF().optional()}),rz=$({type:fI(`string`),title:Z().optional(),description:Z().optional(),minLength:zF().optional(),maxLength:zF().optional(),format:uI([`email`,`uri`,`date`,`date-time`]).optional(),default:Z().optional()}),iz=$({type:uI([`number`,`integer`]),title:Z().optional(),description:Z().optional(),minimum:zF().optional(),maximum:zF().optional(),default:zF().optional()}),az=$({type:fI(`string`),title:Z().optional(),description:Z().optional(),enum:Q(Z()),default:Z().optional()}),oz=$({type:fI(`string`),title:Z().optional(),description:Z().optional(),oneOf:Q($({const:Z(),title:Z()})),default:Z().optional()}),sz=nI([nI([$({type:fI(`string`),title:Z().optional(),description:Z().optional(),enum:Q(Z()),enumNames:Q(Z()).optional(),default:Z().optional()}),nI([az,oz]),nI([$({type:fI(`array`),title:Z().optional(),description:Z().optional(),minItems:zF().optional(),maxItems:zF().optional(),items:$({type:fI(`string`),enum:Q(Z())}),default:Q(Z()).optional()}),$({type:fI(`array`),title:Z().optional(),description:Z().optional(),minItems:zF().optional(),maxItems:zF().optional(),items:$({anyOf:Q($({const:Z(),title:Z()}))}),default:Q(Z()).optional()})])]),nz,rz,iz]),cz=nI([YI.extend({mode:fI(`form`).optional(),message:Z(),requestedSchema:$({type:fI(`object`),properties:cI(Z(),sz),required:Q(Z()).optional()})}),YI.extend({mode:fI(`url`),message:Z(),elicitationId:Z(),url:Z().url()})]),lz=ZI.extend({method:fI(`elicitation/create`),params:cz}),uz=QI.extend({elicitationId:Z()}),dz=$I.extend({method:fI(`notifications/elicitation/complete`),params:uz}),fz=eL.extend({action:uI([`accept`,`decline`,`cancel`]),content:II(e=>e===null?void 0:e,cI(Z(),nI([Z(),zF(),UF(),Q(Z())])).optional())}),pz=$({type:fI(`ref/resource`),uri:Z()}),mz=$({type:fI(`ref/prompt`),name:Z()}),hz=JI.extend({ref:nI([mz,pz]),argument:$({name:Z(),value:Z()}),context:$({arguments:cI(Z(),Z()).optional()}).optional()}),gz=ZI.extend({method:fI(`completion/complete`),params:hz}),_z=eL.extend({completion:eI({values:Q(Z()).max(100),total:gI(zF().int()),hasMore:gI(UF())})}),vz=$({uri:Z().startsWith(`file://`),name:Z().optional(),_meta:cI(Z(),YF()).optional()}),yz=ZI.extend({method:fI(`roots/list`),params:JI.optional()}),bz=eL.extend({roots:Q(vz)}),xz=$I.extend({method:fI(`notifications/roots/list_changed`),params:QI.optional()});nI([OL,CL,gz,UR,xR,vR,tR,rR,sR,dR,pR,RR,PR,BL,HL,UL,GL]),nI([mL,jL,EL,xz,zL]),nI([fL,ez,tz,fz,bz,VL,WL,LL]),nI([OL,$R,lz,yz,BL,HL,UL,GL]),nI([mL,jL,GR,hR,lR,zR,AR,zL,dz]),nI([fL,TL,_z,kR,yR,nR,iR,cR,IR,FR,VL,WL,LL]);var Sz=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===cL.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Cz(e.elicitations,n)}return new e(t,n,r)}},Cz=class extends Sz{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(cL.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},wz=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Tz(e){}function Ez(e){if(typeof e==`function`)throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:t=Tz,onError:n=Tz,onRetry:r=Tz,onComment:i}=e,a=``,o=!0,s,c=``,l=``;function u(e){let t=o?e.replace(/^\xEF\xBB\xBF/,``):e,[n,r]=Dz(`${a}${t}`);for(let e of n)d(e);a=r,o=!1}function d(e){if(e===``){p();return}if(e.startsWith(`:`)){i&&i(e.slice(e.startsWith(`: `)?2:1));return}let t=e.indexOf(`:`);if(t!==-1){let n=e.slice(0,t),r=e[t+1]===` `?2:1;f(n,e.slice(t+r),e);return}f(e,``,e)}function f(e,t,i){switch(e){case`event`:l=t;break;case`data`:c=`${c}${t}
|
|
246
|
+
`;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new wz(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new wz(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}))}}function p(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
|
|
247
|
+
`)?c.slice(0,-1):c}),s=void 0,c=``,l=``}function m(e={}){a&&e.consume&&d(a),o=!0,s=void 0,c=``,l=``,a=``}return{feed:u,reset:m}}function Dz(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e.indexOf(`\r`,r),a=e.indexOf(`
|
|
248
|
+
`,r),o=-1;if(i!==-1&&a!==-1?o=Math.min(i,a):i===-1?a!==-1&&(o=a):o=i===e.length-1?-1:i,o===-1){n=e.slice(r);break}{let n=e.slice(r,o);t.push(n),r=o+1,e[r-1]===`\r`&&e[r]===`
|
|
249
|
+
`&&r++}}return[t,n]}var Oz=class extends Event{constructor(e,t){super(e),this.code=t?.code??void 0,this.message=t?.message??void 0}[Symbol.for(`nodejs.util.inspect.custom`)](e,t,n){return n(jz(this),t)}[Symbol.for(`Deno.customInspect`)](e,t){return e(jz(this),t)}};function kz(e){let t=globalThis.DOMException;return typeof t==`function`?new t(e,`SyntaxError`):SyntaxError(e)}function Az(e){return e instanceof Error?`errors`in e&&Array.isArray(e.errors)?e.errors.map(Az).join(`, `):`cause`in e&&e.cause instanceof Error?`${e}: ${Az(e.cause)}`:e.message:`${e}`}function jz(e){return{type:e.type,message:e.message,code:e.code,defaultPrevented:e.defaultPrevented,cancelable:e.cancelable,timeStamp:e.timeStamp}}var Mz=e=>{throw TypeError(e)},Nz=(e,t,n)=>t.has(e)||Mz(`Cannot `+n),Pz=(e,t,n)=>(Nz(e,t,`read from private field`),n?n.call(e):t.get(e)),Fz=(e,t,n)=>t.has(e)?Mz(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Iz=(e,t,n,r)=>(Nz(e,t,`write to private field`),t.set(e,n),n),Lz=(e,t,n)=>(Nz(e,t,`access private method`),n),Rz,zz,Bz,Vz,Hz,Uz,Wz,Gz,Kz,qz,Jz,Yz,Xz,Zz,Qz,$z,eB,tB,nB,rB,iB,aB,oB,sB=class extends EventTarget{constructor(e,t){super(),Fz(this,Zz),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Fz(this,Rz),Fz(this,zz),Fz(this,Bz),Fz(this,Vz),Fz(this,Hz),Fz(this,Uz),Fz(this,Wz),Fz(this,Gz,null),Fz(this,Kz),Fz(this,qz),Fz(this,Jz,null),Fz(this,Yz,null),Fz(this,Xz,null),Fz(this,$z,async e=>{var t;Pz(this,qz).reset();let{body:n,redirected:r,status:i,headers:a}=e;if(i===204){Lz(this,Zz,iB).call(this,`Server sent HTTP 204, not reconnecting`,204),this.close();return}if(r?Iz(this,Bz,new URL(e.url)):Iz(this,Bz,void 0),i!==200){Lz(this,Zz,iB).call(this,`Non-200 status code (${i})`,i);return}if(!(a.get(`content-type`)||``).startsWith(`text/event-stream`)){Lz(this,Zz,iB).call(this,`Invalid content type, expected "text/event-stream"`,i);return}if(Pz(this,Rz)===this.CLOSED)return;Iz(this,Rz,this.OPEN);let o=new Event(`open`);if((t=Pz(this,Xz))==null||t.call(this,o),this.dispatchEvent(o),typeof n!=`object`||!n||!(`getReader`in n)){Lz(this,Zz,iB).call(this,`Invalid response body, expected a web ReadableStream`,i),this.close();return}let s=new TextDecoder,c=n.getReader(),l=!0;do{let{done:e,value:t}=await c.read();t&&Pz(this,qz).feed(s.decode(t,{stream:!e})),e&&(l=!1,Pz(this,qz).reset(),Lz(this,Zz,aB).call(this))}while(l)}),Fz(this,eB,e=>{Iz(this,Kz,void 0),e.name!==`AbortError`&&e.type!==`aborted`&&Lz(this,Zz,aB).call(this,Az(e))}),Fz(this,nB,e=>{typeof e.id==`string`&&Iz(this,Gz,e.id);let t=new MessageEvent(e.event||`message`,{data:e.data,origin:Pz(this,Bz)?Pz(this,Bz).origin:Pz(this,zz).origin,lastEventId:e.id||``});Pz(this,Yz)&&(!e.event||e.event===`message`)&&Pz(this,Yz).call(this,t),this.dispatchEvent(t)}),Fz(this,rB,e=>{Iz(this,Uz,e)}),Fz(this,oB,()=>{Iz(this,Wz,void 0),Pz(this,Rz)===this.CONNECTING&&Lz(this,Zz,Qz).call(this)});try{if(e instanceof URL)Iz(this,zz,e);else if(typeof e==`string`)Iz(this,zz,new URL(e,cB()));else throw Error(`Invalid URL`)}catch{throw kz(`An invalid or illegal string was specified`)}Iz(this,qz,Ez({onEvent:Pz(this,nB),onRetry:Pz(this,rB)})),Iz(this,Rz,this.CONNECTING),Iz(this,Uz,3e3),Iz(this,Hz,t?.fetch??globalThis.fetch),Iz(this,Vz,t?.withCredentials??!1),Lz(this,Zz,Qz).call(this)}get readyState(){return Pz(this,Rz)}get url(){return Pz(this,zz).href}get withCredentials(){return Pz(this,Vz)}get onerror(){return Pz(this,Jz)}set onerror(e){Iz(this,Jz,e)}get onmessage(){return Pz(this,Yz)}set onmessage(e){Iz(this,Yz,e)}get onopen(){return Pz(this,Xz)}set onopen(e){Iz(this,Xz,e)}addEventListener(e,t,n){let r=t;super.addEventListener(e,r,n)}removeEventListener(e,t,n){let r=t;super.removeEventListener(e,r,n)}close(){Pz(this,Wz)&&clearTimeout(Pz(this,Wz)),Pz(this,Rz)!==this.CLOSED&&(Pz(this,Kz)&&Pz(this,Kz).abort(),Iz(this,Rz,this.CLOSED),Iz(this,Kz,void 0))}};Rz=new WeakMap,zz=new WeakMap,Bz=new WeakMap,Vz=new WeakMap,Hz=new WeakMap,Uz=new WeakMap,Wz=new WeakMap,Gz=new WeakMap,Kz=new WeakMap,qz=new WeakMap,Jz=new WeakMap,Yz=new WeakMap,Xz=new WeakMap,Zz=new WeakSet,Qz=function(){Iz(this,Rz,this.CONNECTING),Iz(this,Kz,new AbortController),Pz(this,Hz)(Pz(this,zz),Lz(this,Zz,tB).call(this)).then(Pz(this,$z)).catch(Pz(this,eB))},$z=new WeakMap,eB=new WeakMap,tB=function(){let e={mode:`cors`,redirect:`follow`,headers:{Accept:`text/event-stream`,...Pz(this,Gz)?{"Last-Event-ID":Pz(this,Gz)}:void 0},cache:`no-store`,signal:Pz(this,Kz)?.signal};return`window`in globalThis&&(e.credentials=this.withCredentials?`include`:`same-origin`),e},nB=new WeakMap,rB=new WeakMap,iB=function(e,t){var n;Pz(this,Rz)!==this.CLOSED&&Iz(this,Rz,this.CLOSED);let r=new Oz(`error`,{code:t,message:e});(n=Pz(this,Jz))==null||n.call(this,r),this.dispatchEvent(r)},aB=function(e,t){var n;if(Pz(this,Rz)===this.CLOSED)return;Iz(this,Rz,this.CONNECTING);let r=new Oz(`error`,{code:t,message:e});(n=Pz(this,Jz))==null||n.call(this,r),this.dispatchEvent(r),Iz(this,Wz,setTimeout(Pz(this,oB),Pz(this,Uz)))},oB=new WeakMap,sB.CONNECTING=0,sB.OPEN=1,sB.CLOSED=2;function cB(){let 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 lB(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function uB(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...lB(t.headers),...lB(r.headers)}:t.headers}):e}var dB=globalThis.crypto;async function fB(e){return(await dB).getRandomValues(new Uint8Array(e))}async function pB(e){let t=``,n=await fB(e);for(let r=0;r<e;r++){let e=n[r]%66;t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e]}return t}async function mB(e){return await pB(e)}async function hB(e){let t=await(await dB).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function gB(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await mB(e);return{code_verifier:t,code_challenge:await hB(t)}}var _B=SF().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:LI.custom,message:`URL must be parseable`,fatal:!0}),YA}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),vB=eI({resource:Z().url(),authorization_servers:Q(_B).optional(),jwks_uri:Z().url().optional(),scopes_supported:Q(Z()).optional(),bearer_methods_supported:Q(Z()).optional(),resource_signing_alg_values_supported:Q(Z()).optional(),resource_name:Z().optional(),resource_documentation:Z().optional(),resource_policy_uri:Z().url().optional(),resource_tos_uri:Z().url().optional(),tls_client_certificate_bound_access_tokens:UF().optional(),authorization_details_types_supported:Q(Z()).optional(),dpop_signing_alg_values_supported:Q(Z()).optional(),dpop_bound_access_tokens_required:UF().optional()}),yB=eI({issuer:Z(),authorization_endpoint:_B,token_endpoint:_B,registration_endpoint:_B.optional(),scopes_supported:Q(Z()).optional(),response_types_supported:Q(Z()),response_modes_supported:Q(Z()).optional(),grant_types_supported:Q(Z()).optional(),token_endpoint_auth_methods_supported:Q(Z()).optional(),token_endpoint_auth_signing_alg_values_supported:Q(Z()).optional(),service_documentation:_B.optional(),revocation_endpoint:_B.optional(),revocation_endpoint_auth_methods_supported:Q(Z()).optional(),revocation_endpoint_auth_signing_alg_values_supported:Q(Z()).optional(),introspection_endpoint:Z().optional(),introspection_endpoint_auth_methods_supported:Q(Z()).optional(),introspection_endpoint_auth_signing_alg_values_supported:Q(Z()).optional(),code_challenge_methods_supported:Q(Z()).optional(),client_id_metadata_document_supported:UF().optional()}),bB=$({...eI({issuer:Z(),authorization_endpoint:_B,token_endpoint:_B,userinfo_endpoint:_B.optional(),jwks_uri:_B,registration_endpoint:_B.optional(),scopes_supported:Q(Z()).optional(),response_types_supported:Q(Z()),response_modes_supported:Q(Z()).optional(),grant_types_supported:Q(Z()).optional(),acr_values_supported:Q(Z()).optional(),subject_types_supported:Q(Z()),id_token_signing_alg_values_supported:Q(Z()),id_token_encryption_alg_values_supported:Q(Z()).optional(),id_token_encryption_enc_values_supported:Q(Z()).optional(),userinfo_signing_alg_values_supported:Q(Z()).optional(),userinfo_encryption_alg_values_supported:Q(Z()).optional(),userinfo_encryption_enc_values_supported:Q(Z()).optional(),request_object_signing_alg_values_supported:Q(Z()).optional(),request_object_encryption_alg_values_supported:Q(Z()).optional(),request_object_encryption_enc_values_supported:Q(Z()).optional(),token_endpoint_auth_methods_supported:Q(Z()).optional(),token_endpoint_auth_signing_alg_values_supported:Q(Z()).optional(),display_values_supported:Q(Z()).optional(),claim_types_supported:Q(Z()).optional(),claims_supported:Q(Z()).optional(),service_documentation:Z().optional(),claims_locales_supported:Q(Z()).optional(),ui_locales_supported:Q(Z()).optional(),claims_parameter_supported:UF().optional(),request_parameter_supported:UF().optional(),request_uri_parameter_supported:UF().optional(),require_request_uri_registration:UF().optional(),op_policy_uri:_B.optional(),op_tos_uri:_B.optional(),client_id_metadata_document_supported:UF().optional()}).shape,...yB.pick({code_challenge_methods_supported:!0}).shape}),xB=$({access_token:Z(),id_token:Z().optional(),token_type:Z(),expires_in:RI().optional(),scope:Z().optional(),refresh_token:Z().optional()}).strip(),SB=$({error:Z(),error_description:Z().optional(),error_uri:Z().optional()}),CB=_B.optional().or(fI(``).transform(()=>void 0)),wB=$({redirect_uris:Q(_B),token_endpoint_auth_method:Z().optional(),grant_types:Q(Z()).optional(),response_types:Q(Z()).optional(),client_name:Z().optional(),client_uri:_B.optional(),logo_uri:CB,scope:Z().optional(),contacts:Q(Z()).optional(),tos_uri:CB,policy_uri:Z().optional(),jwks_uri:_B.optional(),jwks:qF().optional(),software_id:Z().optional(),software_version:Z().optional(),software_statement:Z().optional()}).strip(),TB=$({client_id:Z(),client_secret:Z().optional(),client_id_issued_at:zF().optional(),client_secret_expires_at:zF().optional()}).strip(),EB=wB.merge(TB);$({error:Z(),error_description:Z().optional()}).strip(),$({token:Z(),token_type_hint:Z().optional()}).strip();function DB(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function OB({requestedResource:e,configuredResource:t}){let 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;let i=n.pathname.endsWith(`/`)?n.pathname:n.pathname+`/`,a=r.pathname.endsWith(`/`)?r.pathname:r.pathname+`/`;return i.startsWith(a)}var kB=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},AB=class extends kB{};AB.errorCode=`invalid_request`;var jB=class extends kB{};jB.errorCode=`invalid_client`;var MB=class extends kB{};MB.errorCode=`invalid_grant`;var NB=class extends kB{};NB.errorCode=`unauthorized_client`;var PB=class extends kB{};PB.errorCode=`unsupported_grant_type`;var FB=class extends kB{};FB.errorCode=`invalid_scope`;var IB=class extends kB{};IB.errorCode=`access_denied`;var LB=class extends kB{};LB.errorCode=`server_error`;var RB=class extends kB{};RB.errorCode=`temporarily_unavailable`;var zB=class extends kB{};zB.errorCode=`unsupported_response_type`;var BB=class extends kB{};BB.errorCode=`unsupported_token_type`;var VB=class extends kB{};VB.errorCode=`invalid_token`;var HB=class extends kB{};HB.errorCode=`method_not_allowed`;var UB=class extends kB{};UB.errorCode=`too_many_requests`;var WB=class extends kB{};WB.errorCode=`invalid_client_metadata`;var GB=class extends kB{};GB.errorCode=`insufficient_scope`;var KB=class extends kB{};KB.errorCode=`invalid_target`;var qB={[AB.errorCode]:AB,[jB.errorCode]:jB,[MB.errorCode]:MB,[NB.errorCode]:NB,[PB.errorCode]:PB,[FB.errorCode]:FB,[IB.errorCode]:IB,[LB.errorCode]:LB,[RB.errorCode]:RB,[zB.errorCode]:zB,[BB.errorCode]:BB,[VB.errorCode]:VB,[HB.errorCode]:HB,[UB.errorCode]:UB,[WB.errorCode]:WB,[GB.errorCode]:GB,[KB.errorCode]:KB},JB=class extends Error{constructor(e){super(e??`Unauthorized`)}};function YB(e){return[`client_secret_basic`,`client_secret_post`,`none`].includes(e)}var XB=`code`,ZB=`S256`;function QB(e,t){let n=e.client_secret!==void 0;return`token_endpoint_auth_method`in e&&e.token_endpoint_auth_method&&YB(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 $B(e,t,n,r){let{client_id:i,client_secret:a}=t;switch(e){case`client_secret_basic`:eV(i,a,n);return;case`client_secret_post`:tV(i,a,r);return;case`none`:nV(i,r);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function eV(e,t,n){if(!t)throw Error(`client_secret_basic authentication requires a client_secret`);let r=btoa(`${e}:${t}`);n.set(`Authorization`,`Basic ${r}`)}function tV(e,t,n){n.set(`client_id`,e),t&&n.set(`client_secret`,t)}function nV(e,t){t.set(`client_id`,e)}async function rV(e){let t=e instanceof Response?e.status:void 0,n=e instanceof Response?await e.text():e;try{let{error:e,error_description:t,error_uri:r}=SB.parse(JSON.parse(n));return new(qB[e]||LB)(t||``,r)}catch(e){return new LB(`${t?`HTTP ${t}: `:``}Invalid OAuth error response: ${e}. Raw body: ${n}`)}}async function iV(e,t){try{return await aV(e,t)}catch(n){if(n instanceof jB||n instanceof NB)return await e.invalidateCredentials?.(`all`),await aV(e,t);if(n instanceof MB)return await e.invalidateCredentials?.(`tokens`),await aV(e,t);throw n}}async function aV(e,{serverUrl:t,authorizationCode:n,scope:r,resourceMetadataUrl:i,fetchFn:a}){let o=await e.discoveryState?.(),s,c,l,u=i;if(!u&&o?.resourceMetadataUrl&&(u=new URL(o.resourceMetadataUrl)),o?.authorizationServerUrl){if(c=o.authorizationServerUrl,s=o.resourceMetadata,l=o.authorizationServerMetadata??await _V(c,{fetchFn:a}),!s)try{s=await uV(t,{resourceMetadataUrl:u},a)}catch{}(l!==o.authorizationServerMetadata||s!==o.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}else{let n=await vV(t,{resourceMetadataUrl:u,fetchFn:a});c=n.authorizationServerUrl,l=n.authorizationServerMetadata,s=n.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:u?.toString(),resourceMetadata:s,authorizationServerMetadata:l})}let d=await sV(t,e,s),f=r||s?.scopes_supported?.join(` `)||e.clientMetadata.scope,p=await Promise.resolve(e.clientInformation());if(!p){if(n!==void 0)throw Error(`Existing OAuth client information is required when exchanging an authorization code`);let t=l?.client_id_metadata_document_supported===!0,r=e.clientMetadataUrl;if(r&&!oV(r))throw new WB(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${r}`);if(t&&r)p={client_id:r},await e.saveClientInformation?.(p);else{if(!e.saveClientInformation)throw Error(`OAuth client information must be saveable for dynamic registration`);let t=await wV(c,{metadata:l,clientMetadata:e.clientMetadata,scope:f,fetchFn:a});await e.saveClientInformation(t),p=t}}let m=!e.redirectUrl;if(n!==void 0||m){let t=await CV(e,c,{metadata:l,resource:d,authorizationCode:n,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}let h=await e.tokens();if(h?.refresh_token)try{let t=await SV(c,{metadata:l,clientInformation:p,refreshToken:h.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(t),`AUTHORIZED`}catch(e){if(!(!(e instanceof kB)||e instanceof LB))throw e}let g=e.state?await e.state():void 0,{authorizationUrl:_,codeVerifier:v}=await yV(c,{metadata:l,clientInformation:p,state:g,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(v),await e.redirectToAuthorization(_),`REDIRECT`}function oV(e){if(!e)return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.pathname!==`/`}catch{return!1}}async function sV(e,t,n){let r=DB(e);if(t.validateResourceURL)return await t.validateResourceURL(r,n?.resource);if(n){if(!OB({requestedResource:r,configuredResource:n.resource}))throw Error(`Protected resource ${n.resource} does not match expected ${r} (or origin)`);return new URL(n.resource)}}function cV(e){let t=e.headers.get(`WWW-Authenticate`);if(!t)return{};let[n,r]=t.split(` `);if(n.toLowerCase()!==`bearer`||!r)return{};let i=lV(e,`resource_metadata`)||void 0,a;if(i)try{a=new URL(i)}catch{}let o=lV(e,`scope`)||void 0,s=lV(e,`error`)||void 0;return{resourceMetadataUrl:a,scope:o,error:s}}function lV(e,t){let n=e.headers.get(`WWW-Authenticate`);if(!n)return null;let r=RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),i=n.match(r);return i?i[1]||i[2]:null}async function uV(e,t,n=fetch){let r=await hV(e,`oauth-protected-resource`,n,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!r||r.status===404)throw await r?.body?.cancel(),Error(`Resource server does not implement OAuth 2.0 Protected Resource Metadata.`);if(!r.ok)throw await r.body?.cancel(),Error(`HTTP ${r.status} trying to load well-known OAuth protected resource metadata.`);return vB.parse(await r.json())}async function dV(e,t,n=fetch){try{return await n(e,{headers:t})}catch(r){if(r instanceof TypeError)return t?dV(e,void 0,n):void 0;throw r}}function fV(e,t=``,n={}){return t.endsWith(`/`)&&(t=t.slice(0,-1)),n.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function pV(e,t,n=fetch){return await dV(e,{"MCP-Protocol-Version":t},n)}function mV(e,t){return!e||e.status>=400&&e.status<500&&t!==`/`}async function hV(e,t,n,r){let i=new URL(e),a=r?.protocolVersion??`2025-11-25`,o;if(r?.metadataUrl)o=new URL(r.metadataUrl);else{let e=fV(t,i.pathname);o=new URL(e,r?.metadataServerUrl??i),o.search=i.search}let s=await pV(o,a,n);return!r?.metadataUrl&&mV(s,i.pathname)&&(s=await pV(new URL(`/.well-known/${t}`,i),a,n)),s}function gV(e){let 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 i=t.pathname;return i.endsWith(`/`)&&(i=i.slice(0,-1)),r.push({url:new URL(`/.well-known/oauth-authorization-server${i}`,t.origin),type:`oauth`}),r.push({url:new URL(`/.well-known/openid-configuration${i}`,t.origin),type:`oidc`}),r.push({url:new URL(`${i}/.well-known/openid-configuration`,t.origin),type:`oidc`}),r}async function _V(e,{fetchFn:t=fetch,protocolVersion:n=zI}={}){let r={"MCP-Protocol-Version":n,Accept:`application/json`},i=gV(e);for(let{url:e,type:n}of i){let i=await dV(e,r,t);if(i){if(!i.ok){if(await i.body?.cancel(),i.status>=400&&i.status<500)continue;throw Error(`HTTP ${i.status} trying to load ${n===`oauth`?`OAuth`:`OpenID provider`} metadata from ${e}`)}return n===`oauth`?yB.parse(await i.json()):bB.parse(await i.json())}}}async function vV(e,t){let n,r;try{n=await uV(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),n.authorization_servers&&n.authorization_servers.length>0&&(r=n.authorization_servers[0])}catch{}r||=String(new URL(`/`,e));let i=await _V(r,{fetchFn:t?.fetchFn});return{authorizationServerUrl:r,authorizationServerMetadata:i,resourceMetadata:n}}async function yV(e,{metadata:t,clientInformation:n,redirectUrl:r,scope:i,state:a,resource:o}){let s;if(t){if(s=new URL(t.authorization_endpoint),!t.response_types_supported.includes(XB))throw Error(`Incompatible auth server: does not support response type ${XB}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(ZB))throw Error(`Incompatible auth server: does not support code challenge method ${ZB}`)}else s=new URL(`/authorize`,e);let c=await gB(),l=c.code_verifier,u=c.code_challenge;return s.searchParams.set(`response_type`,XB),s.searchParams.set(`client_id`,n.client_id),s.searchParams.set(`code_challenge`,u),s.searchParams.set(`code_challenge_method`,ZB),s.searchParams.set(`redirect_uri`,String(r)),a&&s.searchParams.set(`state`,a),i&&s.searchParams.set(`scope`,i),i?.includes(`offline_access`)&&s.searchParams.append(`prompt`,`consent`),o&&s.searchParams.set(`resource`,o.href),{authorizationUrl:s,codeVerifier:l}}function bV(e,t,n){return new URLSearchParams({grant_type:`authorization_code`,code:e,code_verifier:t,redirect_uri:String(n)})}async function xV(e,{metadata:t,tokenRequestParams:n,clientInformation:r,addClientAuthentication:i,resource:a,fetchFn:o}){let s=t?.token_endpoint?new URL(t.token_endpoint):new URL(`/token`,e),c=new Headers({"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`});a&&n.set(`resource`,a.href),i?await i(c,n,s,t):r&&$B(QB(r,t?.token_endpoint_auth_methods_supported??[]),r,c,n);let l=await(o??fetch)(s,{method:`POST`,headers:c,body:n});if(!l.ok)throw await rV(l);return xB.parse(await l.json())}async function SV(e,{metadata:t,clientInformation:n,refreshToken:r,resource:i,addClientAuthentication:a,fetchFn:o}){return{refresh_token:r,...await xV(e,{metadata:t,tokenRequestParams:new URLSearchParams({grant_type:`refresh_token`,refresh_token:r}),clientInformation:n,addClientAuthentication:a,resource:i,fetchFn:o})}}async function CV(e,t,{metadata:n,resource:r,authorizationCode:i,fetchFn:a}={}){let o=e.clientMetadata.scope,s;if(e.prepareTokenRequest&&(s=await e.prepareTokenRequest(o)),!s){if(!i)throw Error(`Either provider.prepareTokenRequest() or authorizationCode is required`);if(!e.redirectUrl)throw Error(`redirectUrl is required for authorization_code flow`);s=bV(i,await e.codeVerifier(),e.redirectUrl)}let c=await e.clientInformation();return xV(t,{metadata:n,tokenRequestParams:s,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:r,fetchFn:a})}async function wV(e,{metadata:t,clientMetadata:n,scope:r,fetchFn:i}){let a;if(t){if(!t.registration_endpoint)throw Error(`Incompatible auth server: does not support dynamic client registration`);a=new URL(t.registration_endpoint)}else a=new URL(`/register`,e);let o=await(i??fetch)(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...n,...r===void 0?{}:{scope:r}})});if(!o.ok)throw await rV(o);return EB.parse(await o.json())}var TV=class extends Error{constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n}},EV=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=t?.eventSourceInit,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=uB(t?.fetch,t?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new JB(`No auth provider`);let e;try{e=await iV(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if(e!==`AUTHORIZED`)throw new JB;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let t=lB(this._requestInit?.headers);return new Headers({...e,...t})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((t,n)=>{this._eventSource=new sB(this._url.href,{...this._eventSourceInit,fetch:async(t,n)=>{let r=await this._commonHeaders();r.set(`Accept`,`text/event-stream`);let i=await e(t,{...n,headers:r});if(i.status===401&&i.headers.has(`www-authenticate`)){let{resourceMetadataUrl:e,scope:t}=cV(i);this._resourceMetadataUrl=e,this._scope=t}return i}}),this._abortController=new AbortController,this._eventSource.onerror=e=>{if(e.code===401&&this._authProvider){this._authThenStart().then(t,n);return}let r=new TV(e.code,e.message,e);n(r),this.onerror?.(r)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener(`endpoint`,e=>{let r=e;try{if(this._endpoint=new URL(r.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(e){n(e),this.onerror?.(e),this.close();return}t()}),this._eventSource.onmessage=e=>{let t=e,n;try{n=dL.parse(JSON.parse(t.data))}catch(e){this.onerror?.(e);return}this.onmessage?.(n)}})}async start(){if(this._eventSource)throw Error(`SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.`);return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new JB(`No auth provider`);if(await iV(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new JB(`Failed to authorize`)}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw Error(`Not connected`);try{let t=await this._commonHeaders();t.set(`content-type`,`application/json`);let n={...this._requestInit,method:`POST`,headers:t,body:JSON.stringify(e),signal:this._abortController?.signal},r=await(this._fetch??fetch)(this._endpoint,n);if(!r.ok){let t=await r.text().catch(()=>null);if(r.status===401&&this._authProvider){let{resourceMetadataUrl:t,scope:n}=cV(r);if(this._resourceMetadataUrl=t,this._scope=n,await iV(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new JB;return this.send(e)}throw Error(`Error POSTing to endpoint (HTTP ${r.status}): ${t}`)}await r.body?.cancel()}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}},DV=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Ez({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}},OV={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},kV=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},AV=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=uB(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??OV}async _authThenStart(){if(!this._authProvider)throw new JB(`No auth provider`);let e;try{e=await iV(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(e){throw this.onerror?.(e),e}if(e!==`AUTHORIZED`)throw new JB;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let t=await this._authProvider.tokens();t&&(e.Authorization=`Bearer ${t.access_token}`)}this._sessionId&&(e[`mcp-session-id`]=this._sessionId),this._protocolVersion&&(e[`mcp-protocol-version`]=this._protocolVersion);let t=lB(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let n=await this._commonHeaders();n.set(`Accept`,`text/event-stream`),t&&n.set(`last-event-id`,t);let r=await(this._fetch??fetch)(this._url,{method:`GET`,headers:n,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new kV(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(e){throw this.onerror?.(e),e}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*n**+e,r)}_scheduleReconnection(e,t=0){let n=this._reconnectionOptions.maxRetries;if(t>=n){this.onerror?.(Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(n=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,n){if(!e)return;let{onresumptiontoken:r,replayMessageId:i}=t,a,o=!1,s=!1;(async()=>{try{let t=e.pipeThrough(new TextDecoderStream).pipeThrough(new DV({onRetry:e=>{this._serverRetryMs=e}})).getReader();for(;;){let{value:e,done:n}=await t.read();if(n)break;if(e.id&&(a=e.id,o=!0,r?.(e.id)),e.data&&(!e.event||e.event===`message`))try{let t=dL.parse(JSON.parse(e.data));sL(t)&&(s=!0,i!==void 0&&(t.id=i)),this.onmessage?.(t)}catch(e){this.onerror?.(e)}}(n||o)&&!s&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:r,replayMessageId:i},0)}catch(e){if(this.onerror?.(Error(`SSE stream disconnected: ${e}`)),(n||o)&&!s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:r,replayMessageId:i},0)}catch(e){this.onerror?.(Error(`Failed to reconnect: ${e instanceof Error?e.message:String(e)}`))}}})()}async start(){if(this._abortController)throw Error(`StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.`);this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new JB(`No auth provider`);if(await iV(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new JB(`Failed to authorize`)}async close(){this._reconnectionTimeout&&=(clearTimeout(this._reconnectionTimeout),void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:n,onresumptiontoken:r}=t||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:rL(e)?e.id:void 0}).catch(e=>this.onerror?.(e));return}let i=await this._commonHeaders();i.set(`content-type`,`application/json`),i.set(`accept`,`application/json, text/event-stream`);let a={...this._requestInit,method:`POST`,headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,a),s=o.headers.get(`mcp-session-id`);if(s&&(this._sessionId=s),!o.ok){let t=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new kV(401,`Server returned 401 after successful authentication`);let{resourceMetadataUrl:t,scope:n}=cV(o);if(this._resourceMetadataUrl=t,this._scope=n,await iV(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!==`AUTHORIZED`)throw new JB;return this._hasCompletedAuthFlow=!0,this.send(e)}if(o.status===403&&this._authProvider){let{resourceMetadataUrl:t,scope:n,error:r}=cV(o);if(r===`insufficient_scope`){let r=o.headers.get(`WWW-Authenticate`);if(this._lastUpscopingHeader===r)throw new kV(403,`Server returned 403 after trying upscoping`);if(n&&(this._scope=n),t&&(this._resourceMetadataUrl=t),this._lastUpscopingHeader=r??void 0,await iV(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!==`AUTHORIZED`)throw new JB;return this.send(e)}}throw new kV(o.status,`Error POSTing to endpoint: ${t}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,o.status===202){await o.body?.cancel(),DL(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(e=>this.onerror?.(e));return}let c=(Array.isArray(e)?e:[e]).filter(e=>`method`in e&&`id`in e&&e.id!==void 0).length>0,l=o.headers.get(`content-type`);if(c){if(l?.includes(`text/event-stream`))this._handleSseStream(o.body,{onresumptiontoken:r},!1);else if(l?.includes(`application/json`)){let e=await o.json(),t=Array.isArray(e)?e.map(e=>dL.parse(e)):[dL.parse(e)];for(let e of t)this.onmessage?.(e)}else throw await o.body?.cancel(),new kV(-1,`Unexpected content type: ${l}`)}else await o.body?.cancel()}catch(e){throw this.onerror?.(e),e}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),t={...this._requestInit,method:`DELETE`,headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,t);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new kV(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};function jV(e){return!!e._zod}function MV(e,t){return jV(e)?Lj(e,t):e.safeParse(t)}function NV(e){if(!e)return;let t;if(t=jV(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function PV(e){if(jV(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}function FV(e){return e===`completed`||e===`failed`||e===`cancelled`}function IV(e){let t=NV(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=PV(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function LV(e,t){let n=MV(e,t);if(!n.success)throw n.error;return n.data}var RV=class{constructor(e){this._options=e,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(mL,e=>{this._oncancel(e)}),this.setNotificationHandler(jL,e=>{this._onprogress(e)}),this.setRequestHandler(OL,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(BL,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Sz(cL.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(HL,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new Sz(e.error.code,e.error.message,e.error.data))}}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new Sz(cL.InvalidParams,`Task not found: ${r}`);if(!FV(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(FV(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[VI]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(UL,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new Sz(cL.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(GL,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Sz(cL.InvalidParams,`Task not found: ${e.params.taskId}`);if(FV(n.status))throw new Sz(cL.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Sz(cL.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof Sz?e:new Sz(cL.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Sz.fromError(cL.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),sL(e)||uL(e)?this._onresponse(e):rL(e)?this._onrequest(e,t):aL(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=Sz.fromError(cL.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[VI]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:cL.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=XI(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new Sz(cL.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:cL.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),sL(e)?n(e):n(new Sz(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(sL(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),sL(e)?r(e):r(Sz.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof Sz?e:new Sz(cL.InternalError,String(e))}}return}let i;try{let r=await this.request(e,LL,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new Sz(cL.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},FV(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new Sz(cL.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new Sz(cL.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof Sz?e:new Sz(cL.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[VI]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof Sz?e:new Sz(cL.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=MV(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(Sz.fromError(cL.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},VL,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},WL,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},KL,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[VI]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[VI]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[VI]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=IV(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=LV(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=IV(e);this._notificationHandlers.set(n,n=>{let r=LV(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&rL(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new Sz(cL.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new Sz(cL.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new Sz(cL.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new Sz(cL.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=zL.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),FV(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new Sz(cL.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(FV(a.status))throw new Sz(cL.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=zL.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),FV(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function zV(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function BV(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=zV(a)&&zV(i)?{...a,...i}:i}return n}var VV=s((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;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),HV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=VV(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),UV=s((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;var t=VV(),n=HV(),r=VV();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 i=HV();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return i.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(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(t!==!1&&this.nodes.length)return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
250
|
+
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}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,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),WV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=UV(),n=VV();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0||(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0||{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0||(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0||Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),GV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),KV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=UV(),n=WV(),r=GV();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={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 d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),qV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=KV(),n=UV(),r=GV(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),JV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let 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:{}}}e.getRules=r})),YV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),XV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=JV(),n=YV(),r=KV(),i=UV(),a=WV(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|
|
251
|
+
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
252
|
+
|| (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
|
|
253
|
+
|| ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),ZV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;var t=UV(),n=WV();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),QV=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=UV(),n=WV(),r=GV(),i=WV();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),$V=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=UV(),n=GV(),r=QV(),i=KV();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)b(),i.modifying&&s(e),x(()=>e.error());else{let t=i.async?v():y();i.modifying&&s(e),x(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>b((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function y(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),b(t.nil),e}function b(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function x(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),eH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=UV(),n=WV();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),tH=s(((e,t)=>{t.exports=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,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))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(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),nH=s(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.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 r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else(p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),rH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=WV(),n=tH(),r=nH(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),iH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=qV(),n=XV(),r=YV(),i=XV(),a=ZV(),o=$V(),s=eH(),c=UV(),l=GV(),u=rH(),d=WV(),f=KV();function p(e){if(S(e)&&(w(e),x(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${y(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(y(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&A(e),D(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),T(e),j(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function y(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function b(e,n){if(S(e)&&(w(e),x(e))){C(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function x({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function S(e){return typeof e.schema!=`boolean`}function C(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&A(e),O(e),k(e);let a=r.const(`_errs`,l.default.errors);T(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function w(e){(0,d.checkUnknownRules)(e),E(e)}function T(e,t){if(e.opts.jtd)return N(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);N(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function E(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function D(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function O(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function k(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function j(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&M(e),t.return((0,c._)`${l.default.errors} === 0`))}function M({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function N(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>re(e,`$ref`,h.all.$ref.definition));return}p.jtd||F(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),P(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):P(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function P(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&re(e,n.keyword,n.definition,t.type)})}function F(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(I(e,t),e.opts.allowUnionTypes||L(e,t),ee(e,e.dataTypes))}function I(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{ne(e.dataTypes,t)||z(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),R(e,t)}}function L(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&z(e,`use allowUnionTypes to allow union type keyword`)}function ee(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>te(t,e))&&z(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function te(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function ne(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function R(e,t){let n=[];for(let r of e.dataTypes)ne(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function z(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var B=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,oe(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return b(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=B;function re(e,t,n,r){let i=new B(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var ie=/^\/(?:[^~]|~0|~1)*$/,ae=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!ie.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=ae.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=oe})),aH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),oH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=rH();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),sH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=UV(),n=aH(),r=GV(),i=rH(),a=WV(),o=iH(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),cH=c({$id:()=>lH,additionalProperties:()=>!1,default:()=>mH,description:()=>uH,properties:()=>pH,required:()=>fH,type:()=>dH}),lH,uH,dH,fH,pH,mH,hH=o((()=>{lH=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,uH=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,dH=`object`,fH=[`$data`],pH={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},mH={$id:lH,description:uH,type:dH,required:fH,properties:pH,additionalProperties:!1}})),gH=s(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?: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),i=RegExp.prototype.test.bind(/^\d*$/u),a=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),l=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),u=Array(256);{let e=`0123456789ABCDEF`;for(let t=0;t<256;t++)u[t]=`%`+e[t>>4]+e[t&15]}function d(e){return e<2048?u[192|e>>6]+u[128|e&63]:e<65536?u[224|e>>12]+u[128|e>>6&63]+u[128|e&63]:u[240|e>>18]+u[128|e>>12&63]+u[128|e>>6&63]+u[128|e&63]}function f(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var p=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),m=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),h=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),g=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function _(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!h(e[t])){if(e[t]===`%`&&t+2<e.length&&a(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function v(e){let t=-1,n=0,r=-1,i=0;for(let a=0;a<e.length;a++)e[a]===`0`?(r===-1&&(r=a),i++,i>n&&(n=i,t=r)):(r=-1,i=0);if(n<2)return e.join(`:`);let a=e.slice(0,t).join(`:`),o=e.slice(t+n).join(`:`);return a+`::`+o}function y(e){let t=e.indexOf(`::`);if(t!==-1&&e.indexOf(`::`,t+1)!==-1)return;let n=t===-1?e.split(`:`):e.slice(0,t).split(`:`),i=t===-1?[]:e.slice(t+2).split(`:`);t!==-1&&(n.length===1&&n[0]===``&&(n.length=0),i.length===1&&i[0]===``&&(i.length=0));let a=n.concat(i),o=0;for(let e=0;e<a.length;e++){let n=a[e];if(n===``)return;if(n.indexOf(`.`)!==-1){if(e!==a.length-1||t!==-1&&i.length===0||!r(n))return;o+=2;continue}if(!p(n))return;a[e]=parseInt(n,16).toString(16),o++}if(t===-1)return o===8?v(a):void 0;if(o>=8)return;let s=a.slice(0,n.length);for(let e=o;e<8;e++)s.push(`0`);for(let e=n.length;e<a.length;e++)s.push(a[e]);return v(s)}function b(e){let t=e[0]===`[`&&e[e.length-1]===`]`;if((e[0]===`[`||e[e.length-1]===`]`)&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&m(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(x(n,`:`)<2)return{host:e,isIPV6:!1,error:t};let r=``,i=n.indexOf(`%`);if(i!==-1){let t=n.slice(i,i+3).toLowerCase()===`%25`?3:1;if(r=n.slice(i+t),!_(r))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=y(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?`%`+r:``),escapedHost:a+(r?`%25`+r:``),isIPV6:!0}}function x(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function S(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}n.push(t);break}if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}var C={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},w=/[@/?#:]/g,T=/[@/?#]/g;function E(e,t){let n=t?T:w;return n.lastIndex=0,e.replace(n,e=>C[e])}function D(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let i=e.slice(r+1,r+3);if(a(i)){let e=i.toUpperCase(),a=String.fromCharCode(parseInt(e,16));t&&o(a)?n+=a:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}function O(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(s(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=P(i)?r:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=d(65536+(i-55296<<10)+(r-56320)),n++):t+=d(65533)}else t+=d(65533)}}return t}function k(e,t=!1){let n=``,r=t&&e[0]!==`/`;for(let t=0;t<e.length;t++){let i=e[t];if(i===`%`&&t+2<e.length){let r=e.slice(t+1,t+3);if(a(r)){n+=`%`+r.toUpperCase(),t+=2;continue}}if(i===`/`&&(r=!1),s(i)&&(i!==`:`||!r))n+=i;else{let r=e.charCodeAt(t);if(r<128)n+=u[r];else if(r<55296||r>57343)n+=d(r);else if(r<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(n+=d(65536+(r-55296<<10)+(i-56320)),t++):n+=d(65533)}else n+=d(65533)}}return n}function A(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`%`&&r+2<e.length){let t=e.slice(r+1,r+3);if(a(t)){n+=`%`+t.toUpperCase(),r+=2;continue}}if(t(i))n+=i;else{let t=e.charCodeAt(r);if(t<128)n+=u[t];else if(t<55296||t>57343)n+=d(t);else if(t<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(n+=d(65536+(t-55296<<10)+(i-56320)),r++):n+=d(65533)}else n+=d(65533)}}return n}function j(e){return A(e,l)}function M(e){return A(e,c)}function N(e){return A(e,c)}function P(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function F(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(c(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=P(i)?r:u[i];else if(i<55296||i>57343)t+=d(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=d(65536+(i-55296<<10)+(r-56320)),n++):t+=d(65533)}else t+=d(65533)}}return t}function I(e){let t=``;for(let n=0;n<e.length;n++){if(e[n]===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function L(e){let t=[];if(e.userinfo!==void 0&&(t.push(j(e.userinfo)),t.push(`@`)),e.host!==void 0){let n=e.host;if(!r(n)){let e=b(n);e.isIPV6!==!0&&e.isIPVFuture!==!0&&(n=D(n,!0),e=b(n)),n=e.isIPV6===!0||e.isIPVFuture===!0?`[${e.escapedHost}]`:E(n,!1)}t.push(n)}if(typeof e.port==`number`||typeof e.port==`string`){let n=String(e.port);if(!i(n))throw TypeError(`URI port is malformed.`);t.push(`:`),t.push(n)}return t.length?t.join(``):void 0}t.exports={nonSimpleDomain:g,recomposeAuthority:L,reescapeHostDelimiters:E,normalizePercentEncoding:D,normalizePathEncoding:O,serializePathEncoding:k,normalizeQueryFragmentEncoding:F,encodeUserinfo:j,encodeQuery:M,encodeFragment:N,escapePreservingEscapes:I,removeDotSegments:S,isIPv4:r,isUUID:n,normalizeIPv6:b,stringArrayToHexStripped:f}})),_H=s(((e,t)=>{var{isUUID:n}=gH(),r=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(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){let t=e.resourceName.indexOf(`?`),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!==`/`?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=y(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=y(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={http:h,https:g,ws:_,wss:{scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},urn:{scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},"urn:uuid":{scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(v,null);function y(e){return e&&(v[e]||v[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:v,isValidSchemeName:a,getSchemeHandler:y}})),vH=s(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,serializePathEncoding:s,normalizeQueryFragmentEncoding:c,encodeQuery:l,encodeFragment:u,reescapeHostDelimiters:d,isIPv4:f,nonSimpleDomain:p}=gH(),{SCHEMES:m,getSchemeHandler:h}=_H(),g=/^[A-Za-z][A-Za-z0-9+.-]*$/u,_=`URI scheme is malformed.`;function v(e){let t=unescape(String(e));if(!g.test(t))throw TypeError(_);return t}function y(e,t){return typeof e==`string`?e=P(e,t):typeof e==`object`&&(e=N(C(e,t),t)),e}function b(e,t,r){let i=r?Object.assign({scheme:`null`},r):{scheme:`null`},{parsed:a,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:c,malformedHost:l,malformedScheme:u}=M(e,i),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:m,malformedSchemeSpecific:g,malformedHost:_,malformedScheme:v}=M(t,i);if(o||p||s||m||c||g||l||_||u||v)throw Error(a.error||d.error||`URI is malformed.`);let y=x(a,d,i,!0),b=h(r&&r.scheme||y.scheme),S=y.host,w=S!==void 0&&S!==``&&(f(S)||n(S).isIPV6);j(y,r||{},b,w);let T=S&&S.indexOf(`%`)!==-1&&!/\P{ASCII}/u.test(S);if(y.error&&!T)throw Error(y.error);return i.skipEscape=!0,C(y,i)}function x(e,t,n,i){let a={};return i||(e=N(C(e,n),n),t=N(C(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):(a.path=(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?`/`+t.path:e.path?e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,a.query=t.query===void 0?e.query:t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function S(e,t,n){let r=I(e,n),i=I(t,n);return r!==void 0&&i!==void 0&&r===i}function C(e,t){let 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:``},o=Object.assign({},t),c=[];n.scheme&&=v(n.scheme);let d=h(o.scheme||n.scheme);d&&d.serialize&&d.serialize(n,o);let f=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,p=!o.skipEscape&&n.scheme===void 0&&!f;n.path!==void 0&&(n.path=o.skipEscape?a(n.path):s(n.path,p)),o.reference!==`suffix`&&n.scheme&&(n.scheme=v(n.scheme),c.push(n.scheme,`:`));let m=i(n);if(m!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(m),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!d||!d.absolutePath)&&(e=r(e)),p&&(e=s(e,!0)),m===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,l(n.query)),n.fragment!==void 0&&c.push(`#`,u(n.fragment)),c.join(``)}var w=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,T=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,E=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function D(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function O(e){if(e===void 0)return!1;let t=e.indexOf(`%`);for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(`%`,t+3)}return!1}function k(e){return e[0]===`[`&&e[e.length-1]===`]`}function A(e){let t=e[4];return O(e[3])||t!==void 0&&!k(t)&&O(t)||O(e[6])||O(e[7])||O(e[8])}function j(e,t,n,r){if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!k(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&p(e.host))try{e.host=new URL(`http://`+e.host).hostname}catch(t){return e.error=e.error||`Host's domain name can not be converted to ASCII: `+t,!0}return!1}function M(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},s=!1,l=!1,u=!1,p=!1,v=!1,y=!1,b=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let x=e.match(T);x!==null&&x[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,s=!0);let S=e.match(E);if(S!==null){let e=S[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,s=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,s=!0))}let C=e.match(w);if(C){if(i.scheme=C[1],i.userinfo=C[3],i.host=C[4],i.port=parseInt(C[5],10),i.path=C[6]||``,i.query=C[7],i.fragment=C[8],i.scheme!==void 0){let e=unescape(i.scheme);g.test(e)?i.scheme=e.toLowerCase():(i.error=i.error||_,y=!0)}l=A(C),l&&(i.error=i.error||`URI contains malformed percent-encoding.`),isNaN(i.port)&&(i.port=C[5]);let t=D(i,C);if(t!==void 0&&(i.error=i.error||t,s=!0),i.host){if(f(i.host)===!1){let e=k(i.host),t=i.host.indexOf(`[`)!==-1||i.host.indexOf(`]`)!==-1,r=n(i.host);b=r.isIPV6||r.isIPVFuture===!0,v=t&&(!e||r.error===!0),i.host=b?r.host:r.host.toLowerCase(),v&&(i.error=i.error||`URI host is malformed.`,s=!0)}else b=!0}i.reference=i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?`same-document`:i.scheme===void 0?`relative`:i.fragment===void 0?`absolute`:`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let x=h(r.scheme||i.scheme);if(v||(p=j(i,r,x,b)),e.indexOf(`%`)!==-1&&i.host!==void 0&&!v){let e=b?i.host:a(i.host,!0);b||(e=a(e.toLowerCase())),i.host=d(e,b)}(!x||x&&!x.skipNormalize)&&(i.path&&=o(i.path),i.query&&=c(i.query),i.fragment&&=c(i.fragment)),x&&x.parse&&(x.parse(i,r),x===m.urn&&i.nid===void 0&&(u=!0))}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:l,malformedSchemeSpecific:u,malformedHost:p,malformedScheme:y}}function N(e,t){return M(e,t).parsed}function P(e,t){return F(e,t).normalized}function F(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}=M(e,t);return{normalized:r||i||a||o||s?e:C(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}}function I(e,t){if(typeof e!=`string`&&typeof e!=`object`)return;let n;try{n=typeof e==`string`?e:C(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}=F(n,t);return i||a||o||s||c?void 0:r}var L={SCHEMES:m,normalize:y,resolve:b,resolveComponent:x,equal:S,serialize:C,parse:N};t.exports=L,t.exports.default=L,t.exports.fastUri=L})),yH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=vH();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),bH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=iH();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var n=UV();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}});var r=aH(),i=oH(),a=JV(),o=sH(),s=UV(),c=rH(),l=XV(),u=WV(),f=(hH(),d(cH).default),p=yH(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={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.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},y=200;function b(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??y,loopEnum:e.loopEnum??y,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var x=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...b(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new s.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=k(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),S.call(this,_,e,`NOT SUPPORTED`),S.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=D.call(this),e.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),w.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await a.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function a(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof i.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await a.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=C.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new o.SchemaEnv({schema:{},schemaId:n});if(t=o.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=C.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,c.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(j.call(this,n,t),!t)return(0,u.eachItem)(n,e=>M.call(this,e)),this;P.call(this,t);let r={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,u.eachItem)(n,r.type.length===0?e=>M.call(this,e,r):e=>r.type.forEach(t=>M.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=I(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e==`object`)a=e[s];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let l=this._cache.get(e);if(l!==void 0)return l;n=(0,c.normalizeId)(a||n);let u=c.getSchemaRefs.call(this,e,n);return l=new o.SchemaEnv({schema:e,schemaId:s,meta:t,baseId:n,localRefs:u}),this._cache.set(l.schema,l),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=l),r&&this.validateSchema(e,!0),l}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):o.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{o.compileSchema.call(this,e)}finally{this.opts=t}}};x.ValidationError=r.default,x.MissingRefError=i.default,e.default=x;function S(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function C(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function w(){let e=this.opts.schemas;if(e){if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}}function T(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function D(){let e={...this.opts};for(let t of h)delete e[t];return e}var O={log(){},warn(){},error(){}};function k(e){if(e===!1)return O;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var A=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){let{RULES:n}=this;if((0,u.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!A.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function M(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?N.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function N(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function P(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=I(t)),e.validateSchema=this.compile(t,!0))}var F={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function I(e){return{anyOf:[e,F]}}})),xH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),SH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;var t=oH(),n=QV(),r=UV(),i=GV(),a=sH(),o=WV(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0){if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}}if(l.items!==!0){if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}}e.callRef=l,e.default=s})),CH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=xH(),n=SH();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),wH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),TH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),EH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),DH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV(),r=EH();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),OH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=QV(),n=WV(),r=UV();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),kH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),AH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=QV(),n=UV(),r=WV();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),jH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),MH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tH();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),NH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=XV(),n=UV(),r=WV(),i=MH();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),PH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV(),r=MH();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),FH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV(),r=MH();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),IH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=wH(),n=TH(),r=DH(),i=OH(),a=kH(),o=AH(),s=jH(),c=NH(),l=PH(),u=FH();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),LH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;var t=UV(),n=WV(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),RH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;var t=UV(),n=WV(),r=QV(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),zH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=RH();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),BH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV(),r=QV(),i=LH();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),VH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),HH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=UV(),n=WV(),r=QV();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
|
|
254
|
+
missingProperty: ${i},
|
|
255
|
+
depsCount: ${n},
|
|
256
|
+
deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),UH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),WH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=QV(),n=UV(),r=GV(),i=WV();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(y(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(y(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function y(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),GH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=iH(),n=QV(),r=WV(),i=WH();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),KH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=QV(),n=UV(),r=WV(),i=WV();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),qH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=WV();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),JH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:QV().validateUnion,error:{message:`must match a schema in anyOf`}}})),YH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),XH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=WV();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),ZH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=WV(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),QH=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=WV();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),$H=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=LH(),n=zH(),r=RH(),i=BH(),a=VH(),o=HH(),s=UH(),c=WH(),l=GH(),u=KH(),d=qH(),f=JH(),p=YH(),m=XH(),h=ZH(),g=QH();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),eU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),tU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=[eU().default]})),nU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),rU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=CH(),n=IH(),r=$H(),i=tU(),a=nU();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),iU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),aU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=UV(),n=iU(),r=sH(),i=oH(),a=WV();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),oU=c({$id:()=>cU,$schema:()=>sU,default:()=>pU,definitions:()=>uU,properties:()=>fU,title:()=>lU,type:()=>dU}),sU,cU,lU,uU,dU,fU,pU,mU=o((()=>{sU=`http://json-schema.org/draft-07/schema#`,cU=`http://json-schema.org/draft-07/schema#`,lU=`Core schema meta-schema`,uU={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:[]}},dU=[`object`,`boolean`],fU={$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:`#`}},pU={$schema:sU,$id:cU,title:lU,definitions:uU,type:dU,properties:fU,default:!0}})),hU=s(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var n=bH(),r=rU(),i=aU(),a=(mU(),d(oU).default),o=[`/properties`],s=`http://json-schema.org/draft-07/schema`,c=class extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(a,o):a;this.addMetaSchema(e,s,!1),this.refs[`http://json-schema.org/schema`]=s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}};e.Ajv=c,t.exports=e=c,t.exports.Ajv=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var l=iH();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=UV();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var f=aH();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return f.default}});var p=oH();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),gU=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"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:E,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:y,int32:{type:`number`,validate:S},int64:{type:`number`,validate:C},float:{type:`number`,validate:w},double:{type:`number`,validate:w},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"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,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"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,m),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(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-+(d<0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[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 _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function y(e){return v.lastIndex=0,v.test(e)}var b=-(2**31),x=2**31-1;function S(e){return Number.isInteger(e)&&e<=x&&e>=b}function C(e){return Number.isInteger(e)}function w(){return!0}var T=/[^\\]\\Z/;function E(e){if(T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),_U=s((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;var t=hU(),n=UV(),r=n.operators,i={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}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)})),vU=s(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=gU(),r=_U(),i=UV(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s})),yU=u(hU(),1),bU=u(vU(),1);function xU(){let e=new yU.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,bU.default)(e),e}var SU=class{constructor(e){this._ajv=e??xU()}getValidator(e){let t=`$id`in e&&typeof e.$id==`string`?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}},CU=class{constructor(e){this._client=e}async*callToolStream(e,t=IR,n){let r=this._client,i={...n,task:n?.task??(r.isToolTask(e.name)?{}:void 0)},a=r.requestStream({method:`tools/call`,params:e},t,i),o=r.getToolOutputValidator(e.name);for await(let t of a){if(t.type===`result`&&o){let n=t.result;if(!n.structuredContent&&!n.isError){yield{type:`error`,error:new Sz(cL.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(n.structuredContent)try{let e=o(n.structuredContent);if(!e.valid){yield{type:`error`,error:new Sz(cL.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)};return}}catch(e){if(e instanceof Sz){yield{type:`error`,error:e};return}yield{type:`error`,error:new Sz(cL.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)};return}}yield t}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._client.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,n){return this._client.requestStream(e,t,n)}};function wU(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);if(t===`tools/call`&&!e.tools?.call)throw Error(`${n} does not support task creation for tools/call (required for ${t})`)}function TU(e,t,n){if(!e)throw Error(`${n} does not support task creation (required for ${t})`);switch(t){case`sampling/createMessage`:if(!e.sampling?.createMessage)throw Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case`elicitation/create`:if(!e.elicitation?.create)throw Error(`${n} does not support task creation for elicitation/create (required for ${t})`)}}function EU(e,t){if(e&&typeof t==`object`&&t){if(e.type===`object`&&e.properties&&typeof e.properties==`object`){let n=t,r=e.properties;for(let e of Object.keys(r)){let t=r[e];n[e]===void 0&&Object.prototype.hasOwnProperty.call(t,`default`)&&(n[e]=t.default),n[e]!==void 0&&EU(t,n[e])}}if(Array.isArray(e.anyOf))for(let n of e.anyOf)typeof n!=`boolean`&&EU(n,t);if(Array.isArray(e.oneOf))for(let n of e.oneOf)typeof n!=`boolean`&&EU(n,t)}}function DU(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,n=e.url!==void 0;return{supportsFormMode:t||!t&&!n,supportsUrlMode:n}}var OU=class extends RV{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new SU,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler(`tools`,zR,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler(`prompts`,AR,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler(`resources`,lR,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||={tasks:new CU(this)},this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=BV(this._capabilities,e)}setRequestHandler(e,t){let n=NV(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let r;if(jV(n)){let e=n;r=e._zod?.def?.value??e.value}else{let e=n;r=e._def?.value??e.value}if(typeof r!=`string`)throw Error(`Schema method literal must be a string`);let i=r;return i===`elicitation/create`?super.setRequestHandler(e,async(e,n)=>{let r=MV(lz,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new Sz(cL.InvalidParams,`Invalid elicitation request: ${e}`)}let{params:i}=r.data;i.mode=i.mode??`form`;let{supportsFormMode:a,supportsUrlMode:o}=DU(this._capabilities.elicitation);if(i.mode===`form`&&!a)throw new Sz(cL.InvalidParams,`Client does not support form-mode elicitation requests`);if(i.mode===`url`&&!o)throw new Sz(cL.InvalidParams,`Client does not support URL-mode elicitation requests`);let s=await Promise.resolve(t(e,n));if(i.task){let e=MV(LL,s);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new Sz(cL.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let c=MV(fz,s);if(!c.success){let e=c.error instanceof Error?c.error.message:String(c.error);throw new Sz(cL.InvalidParams,`Invalid elicitation result: ${e}`)}let l=c.data,u=i.mode===`form`?i.requestedSchema:void 0;if(i.mode===`form`&&l.action===`accept`&&l.content&&u&&this._capabilities.elicitation?.form?.applyDefaults)try{EU(u,l.content)}catch{}return l}):i===`sampling/createMessage`?super.setRequestHandler(e,async(e,n)=>{let r=MV($R,e);if(!r.success){let e=r.error instanceof Error?r.error.message:String(r.error);throw new Sz(cL.InvalidParams,`Invalid sampling request: ${e}`)}let{params:i}=r.data,a=await Promise.resolve(t(e,n));if(i.task){let e=MV(LL,a);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new Sz(cL.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let o=MV(i.tools||i.toolChoice?tz:ez,a);if(!o.success){let e=o.error instanceof Error?o.error.message:String(o.error);throw new Sz(cL.InvalidParams,`Invalid sampling result: ${e}`)}return o.data}):super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let n=await this.request({method:`initialize`,params:{protocolVersion:zI,capabilities:this._capabilities,clientInfo:this._clientInfo}},TL,t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!BI.includes(n.protocolVersion))throw Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:`notifications/initialized`}),this._pendingListChangedConfig&&=(this._setupListChangedHandlers(this._pendingListChangedConfig),void 0)}catch(e){throw this.close(),e}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case`logging/setLevel`:if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:case`resources/subscribe`:case`resources/unsubscribe`:if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e===`resources/subscribe`&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`completion/complete`:if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`)}}assertNotificationCapability(e){if(e===`notifications/roots/list_changed`&&!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`)}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`sampling/createMessage`:if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case`elicitation/create`:if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case`roots/list`:if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){wU(this._serverCapabilities?.tasks?.requests,e,`Server`)}assertTaskHandlerCapability(e){this._capabilities&&TU(this._capabilities.tasks?.requests,e,`Client`)}async ping(e){return this.request({method:`ping`},fL,e)}async complete(e,t){return this.request({method:`completion/complete`,params:e},_z,t)}async setLoggingLevel(e,t){return this.request({method:`logging/setLevel`,params:{level:e}},fL,t)}async getPrompt(e,t){return this.request({method:`prompts/get`,params:e},kR,t)}async listPrompts(e,t){return this.request({method:`prompts/list`,params:e},yR,t)}async listResources(e,t){return this.request({method:`resources/list`,params:e},nR,t)}async listResourceTemplates(e,t){return this.request({method:`resources/templates/list`,params:e},iR,t)}async readResource(e,t){return this.request({method:`resources/read`,params:e},cR,t)}async subscribeResource(e,t){return this.request({method:`resources/subscribe`,params:e},fL,t)}async unsubscribeResource(e,t){return this.request({method:`resources/unsubscribe`,params:e},fL,t)}async callTool(e,t=IR,n){if(this.isToolTaskRequired(e.name))throw new Sz(cL.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let r=await this.request({method:`tools/call`,params:e},t,n),i=this.getToolOutputValidator(e.name);if(i){if(!r.structuredContent&&!r.isError)throw new Sz(cL.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{let e=i(r.structuredContent);if(!e.valid)throw new Sz(cL.InvalidParams,`Structured content does not match the tool's output schema: ${e.errorMessage}`)}catch(e){throw e instanceof Sz?e:new Sz(cL.InvalidParams,`Failed to validate structured content: ${e instanceof Error?e.message:String(e)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let e=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,e)}let e=t.execution?.taskSupport;(e===`required`||e===`optional`)&&this._cachedKnownTaskTools.add(t.name),e===`required`&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let n=await this.request({method:`tools/list`,params:e},FR,t);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,t,n,r){let i=BR.safeParse(n);if(!i.success)throw Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!=`function`)throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:o}=i.data,{onChanged:s}=n,c=async()=>{if(!a){s(null,null);return}try{let e=await r();s(null,e)}catch(e){let t=e instanceof Error?e:Error(String(e));s(t,null)}};this.setNotificationHandler(t,()=>{if(o){let t=this._listChangedDebounceTimers.get(e);t&&clearTimeout(t);let n=setTimeout(c,o);this._listChangedDebounceTimers.set(e,n)}else c()})}async sendRootsListChanged(){return this.notification({method:`notifications/roots/list_changed`})}};function kU(e,t){if(!e)throw Error(t)}var AU=3e3,jU=5e3,MU=3e5;function NU(e){let{url:t,clientName:n,clientUri:r,callbackUrl:i=typeof window<`u`?KA(new URL(`/oauth/callback`,window.location.origin).toString()):`/oauth/callback`,storageKeyPrefix:a=`mcp:auth`,clientConfig:o={},customHeaders:s={},debug:c=!1,autoRetry:l=!1,autoReconnect:u=AU,transportType:d=`auto`,preventAutoAuth:f=!1,onPopupWindow:p}=e,[m,h]=(0,b.useState)(`discovering`),[g,_]=(0,b.useState)([]),[v,y]=(0,b.useState)([]),[x,S]=(0,b.useState)([]),[C,w]=(0,b.useState)([]),[T,E]=(0,b.useState)(void 0),[D,O]=(0,b.useState)([]),[k,A]=(0,b.useState)(void 0),j=(0,b.useRef)(null),M=(0,b.useRef)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(!1),F=(0,b.useRef)(!0),I=(0,b.useRef)(0),L=(0,b.useRef)(null),ee=(0,b.useRef)(m),te=(0,b.useRef)(u),ne=(0,b.useRef)(null);(0,b.useEffect)(()=>{ee.current=m,te.current=u},[m,u]);let R=(0,b.useCallback)((e,t,...n)=>{let r=n.length>0?`${t} ${n.map(e=>JSON.stringify(e)).join(` `)}`:t;console[e](`[useMcp] ${r}`),F.current&&O(t=>[...t.slice(-100),{level:e,message:r,timestamp:Date.now()}])},[]),z=(0,b.useCallback)(async(e=!1)=>{e||R(`info`,`Disconnecting...`),P.current=!1,L.current&&clearTimeout(L.current),L.current=null;let t=M.current;if(j.current=null,M.current=null,F.current&&!e&&(h(`discovering`),_([]),y([]),S([]),w([]),E(void 0),A(void 0)),t)try{await t.close(),e||R(`debug`,`Transport closed`)}catch(t){e||R(`warn`,`Error closing transport:`,t)}},[R]),B=(0,b.useCallback)((e,t)=>{if(R(`error`,e,t??``),F.current){h(`failed`),E(e);let t=N.current?.getLastAttemptedAuthUrl();t&&(A(t),R(`info`,`Manual authentication URL may be available.`,t))}P.current=!1},[R]),re=(0,b.useCallback)(async()=>{if(P.current){R(`debug`,`Connection attempt already in progress.`);return}if(!F.current){R(`debug`,`Connect called after unmount, aborting.`);return}P.current=!0,I.current+=1,E(void 0),A(void 0),ne.current=null,h(`discovering`),R(`info`,`Connecting attempt #${I.current} to ${t}...`),N.current||(N.current=new JA(t,{storageKeyPrefix:a,clientName:n,clientUri:r,callbackUrl:i,preventAutoAuth:f,onPopupWindow:p}),R(`debug`,`BrowserOAuthClientProvider initialized in connect.`)),j.current||(j.current=new OU({name:o.name||`use-mcp-react-client`,version:o.version||`0.1.0`},{capabilities:{}}),R(`debug`,`MCP Client initialized in connect.`));let e=async e=>{R(`info`,`Attempting connection with ${e.toUpperCase()} transport...`),ee.current!==`authenticating`&&h(`connecting`);let n;try{kU(N.current,`Auth Provider must be initialized`),kU(j.current,`Client must be initialized`),M.current&&=(await M.current.close().catch(e=>R(`warn`,`Error closing previous transport: ${e.message}`)),null);let r={authProvider:N.current,requestInit:{headers:{Accept:`application/json, text/event-stream`,...s}}},i=KA(t),a=new URL(i);R(`debug`,`Creating ${e.toUpperCase()} transport for URL: ${a.toString()}`),R(`debug`,`Transport options:`,{authProvider:!!N.current,headers:s,url:a.toString()}),e===`http`?(R(`debug`,`Creating StreamableHTTPClientTransport...`),n=new AV(a,r),R(`debug`,`StreamableHTTPClientTransport created successfully`)):(R(`debug`,`Creating SSEClientTransport...`),n=new EV(a,r),R(`debug`,`SSEClientTransport created successfully`)),M.current=n,R(`debug`,`${e.toUpperCase()} transport created and assigned to ref.`)}catch(t){return B(`Failed to create ${e.toUpperCase()} transport: ${t instanceof Error?t.message:String(t)}`,t instanceof Error?t:void 0),`failed`}n.onmessage=e=>{R(`debug`,`[Transport] Received: ${JSON.stringify(e)}`),j.current?.handleMessage?.(e)},n.onerror=t=>{R(`warn`,`Transport error event (${e.toUpperCase()}):`,t),R(`debug`,`Error details:`,{message:t.message,stack:t.stack,name:t.name,cause:t.cause}),B(`Transport error (${e.toUpperCase()}): ${t.message}`,t)},n.onclose=()=>{if(!F.current||P.current)return;R(`info`,`Transport connection closed (${ne.current||`unknown`} type).`);let e=ee.current,t=te.current;if(e===`ready`&&t){let e=typeof t==`number`?t:AU;R(`info`,`Attempting to reconnect in ${e}ms...`),h(`connecting`),setTimeout(()=>{F.current&&re()},e)}else e!==`failed`&&e!==`authenticating`&&B(`Connection closed unexpectedly.`)};try{R(`info`,`Connecting client via ${e.toUpperCase()}...`),R(`debug`,`About to call client.connect() with transport instance`),R(`debug`,`Transport instance type: ${n.constructor.name}`),await j.current.connect(n),R(`info`,`Client connected via ${e.toUpperCase()}. Loading tools, resources, and prompts...`),ne.current=e,h(`loading`);let t=await j.current.request({method:`tools/list`},FR),r={resources:[],resourceTemplates:[]};try{r=await j.current.request({method:`resources/list`},nR)}catch(e){R(`debug`,`Server does not support resources/list method`,e)}let i={prompts:[]};try{i=await j.current.request({method:`prompts/list`},yR)}catch(e){R(`debug`,`Server does not support prompts/list method`,e)}if(F.current){_(t.tools),y(r.resources),S(Array.isArray(r.resourceTemplates)?r.resourceTemplates:[]),w(i.prompts);let e=[`Loaded ${t.tools.length} tools`];return(r.resources.length>0||r.resourceTemplates&&r.resourceTemplates.length>0)&&(e.push(`${r.resources.length} resources`),Array.isArray(r.resourceTemplates)&&r.resourceTemplates.length>0&&e.push(`${r.resourceTemplates.length} resource templates`)),i.prompts.length>0&&e.push(`${i.prompts.length} prompts`),R(`info`,e.join(`, `)+`.`),h(`ready`),I.current=0,`success`}return`failed`}catch(n){R(`debug`,`Client connect error via ${e.toUpperCase()}:`,n),R(`debug`,`Connect error details:`,{message:n instanceof Error?n.message:String(n),stack:n instanceof Error?n.stack:`N/A`,name:n instanceof Error?n.name:`Unknown`,cause:n instanceof Error?n.cause:void 0});let r=n instanceof Error?n:Error(String(n)),i=r.message,a=i.includes(`404`)||i.includes(`Not Found`),o=i.includes(`405`)||i.includes(`Method Not Allowed`),s=i===`Failed to fetch`||i===`NetworkError when attempting to fetch resource.`||i===`Load failed`;if(e===`http`&&(a||o||s))return R(`warn`,`HTTP transport failed (${s?`CORS`:a?`404`:`405`}).`),`fallback`;if(r instanceof JB||i.includes(`Unauthorized`)||i.includes(`401`)){R(`info`,`Authentication required.`),kU(N.current,`Auth Provider not available for auth flow`);let e=await N.current.tokens();if(f&&!e)return R(`info`,`Authentication required but auto-auth prevented. User action needed.`),h(`pending_auth`),`auth_redirect`;ee.current!==`authenticating`&&ee.current!==`pending_auth`&&(h(`authenticating`),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{},MU));try{let e=await iV(N.current,{serverUrl:t});if(!F.current)return`failed`;if(e===`AUTHORIZED`)return R(`info`,`Authentication successful via existing token or refresh. Re-attempting connection...`),L.current&&clearTimeout(L.current),P.current=!1,re(),`failed`;if(e===`REDIRECT`)return R(`info`,`Redirecting for authentication. Waiting for callback...`),`auth_redirect`}catch(e){return F.current?(L.current&&clearTimeout(L.current),B(`Failed to initiate authentication: ${e instanceof Error?e.message:String(e)}`,e instanceof Error?e:void 0),`failed`):`failed`}}return B(`Failed to connect via ${e.toUpperCase()}: ${i}`,r),`failed`}},c=`failed`;if(console.log({transportType:d}),d===`sse`)R(`debug`,`Using SSE-only transport mode`),c=await e(`sse`);else if(d===`http`)R(`debug`,`Using HTTP-only transport mode`),c=await e(`http`);else{R(`debug`,`Using auto transport mode (HTTP with SSE fallback)`);let t=await e(`http`);if(t===`fallback`&&F.current&&ee.current!==`authenticating`){R(`info`,`HTTP failed, attempting SSE fallback...`);let t=await e(`sse`);c=t,t===`failed`&&F.current}else c=t}(c===`success`||c===`failed`)&&(P.current=!1),R(`debug`,`Connection sequence finished with status: ${c}`)},[R,B,z,iV,t,a,n,r,i,o.name,o.version]),ie=(0,b.useCallback)(async(e,n)=>{if(ee.current!==`ready`||!j.current)throw Error(`MCP client is not ready (current state: ${m}). Cannot call tool "${e}".`);R(`info`,`Calling tool: ${e}`,n);try{let t=await j.current.request({method:`tools/call`,params:{name:e,arguments:n}},IR);return R(`info`,`Tool "${e}" call successful:`,t),t}catch(n){R(`error`,`Error calling tool "${e}": ${n instanceof Error?n.message:String(n)}`,n);let r=n instanceof Error?n:Error(String(n));if(r instanceof JB||r.message.includes(`Unauthorized`)||r.message.includes(`401`)){R(`warn`,`Tool call unauthorized, attempting re-authentication...`),h(`authenticating`),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{},MU);try{kU(N.current,`Auth Provider not available for tool re-auth`);let e=await iV(N.current,{serverUrl:t});if(!F.current)return;e===`AUTHORIZED`?(R(`info`,`Re-authentication successful. Retrying tool call is recommended, or reconnecting.`),L.current&&clearTimeout(L.current),P.current=!1,re()):e===`REDIRECT`&&R(`info`,`Redirecting for re-authentication for tool call.`)}catch(e){if(!F.current)return;L.current&&clearTimeout(L.current),B(`Re-authentication failed: ${e instanceof Error?e.message:String(e)}`,e instanceof Error?e:void 0)}}if(ee.current!==`authenticating`)throw n;return}},[m,t,R,B,re]),ae=(0,b.useCallback)(()=>{ee.current===`failed`?(R(`info`,`Retry requested...`),re()):R(`warn`,`Retry called but state is not 'failed' (state: ${ee.current}). Ignoring.`)},[R,re]),oe=(0,b.useCallback)(async()=>{R(`info`,`Manual authentication requested...`);let e=ee.current;if(e===`failed`)R(`info`,`Attempting to reconnect and authenticate via retry...`),ae();else if(e===`pending_auth`){R(`info`,`Proceeding with authentication from pending state...`),h(`authenticating`),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{},MU);try{kU(N.current,`Auth Provider not available for manual auth`);let e=await iV(N.current,{serverUrl:t});if(!F.current)return;e===`AUTHORIZED`?(R(`info`,`Manual authentication successful. Re-attempting connection...`),L.current&&clearTimeout(L.current),P.current=!1,re()):e===`REDIRECT`&&R(`info`,`Redirecting for manual authentication. Waiting for callback...`)}catch(e){if(!F.current)return;L.current&&clearTimeout(L.current),B(`Manual authentication failed: ${e instanceof Error?e.message:String(e)}`,e instanceof Error?e:void 0)}}else if(e===`authenticating`){R(`warn`,`Already attempting authentication. Check for blocked popups or wait for timeout.`);let e=N.current?.getLastAttemptedAuthUrl();e&&!k&&(A(e),R(`info`,`Manual authentication URL retrieved:`,e))}else R(`info`,`Client not in a state requiring manual authentication trigger (state: ${e}). If needed, try disconnecting and reconnecting.`)},[R,ae,k,t,B,re]),se=(0,b.useCallback)(()=>{if(N.current){let e=N.current.clearStorage();R(`info`,`Cleared ${e} item(s) from localStorage for ${t}.`),A(void 0),z()}else R(`warn`,`Auth provider not initialized, cannot clear storage.`)},[t,R,z]),ce=(0,b.useCallback)(async()=>{if(ee.current!==`ready`||!j.current)throw Error(`MCP client is not ready (current state: ${m}). Cannot list resources.`);R(`info`,`Listing resources...`);try{let e=await j.current.request({method:`resources/list`},nR);F.current&&(y(e.resources),S(Array.isArray(e.resourceTemplates)?e.resourceTemplates:[]),R(`info`,`Listed ${e.resources.length} resources, ${Array.isArray(e.resourceTemplates)?e.resourceTemplates.length:0} resource templates.`))}catch(e){throw R(`error`,`Error listing resources: ${e instanceof Error?e.message:String(e)}`,e),e}},[m,R]),le=(0,b.useCallback)(async e=>{if(ee.current!==`ready`||!j.current)throw Error(`MCP client is not ready (current state: ${m}). Cannot read resource "${e}".`);R(`info`,`Reading resource: ${e}`);try{let t=await j.current.request({method:`resources/read`,params:{uri:e}},cR);return R(`info`,`Resource "${e}" read successfully`),t}catch(t){throw R(`error`,`Error reading resource "${e}": ${t instanceof Error?t.message:String(t)}`,t),t}},[m,R]),ue=(0,b.useCallback)(async()=>{if(ee.current!==`ready`||!j.current)throw Error(`MCP client is not ready (current state: ${m}). Cannot list prompts.`);R(`info`,`Listing prompts...`);try{let e=await j.current.request({method:`prompts/list`},yR);F.current&&(w(e.prompts),R(`info`,`Listed ${e.prompts.length} prompts.`))}catch(e){throw R(`error`,`Error listing prompts: ${e instanceof Error?e.message:String(e)}`,e),e}},[m,R]),de=(0,b.useCallback)(async(e,t)=>{if(ee.current!==`ready`||!j.current)throw Error(`MCP client is not ready (current state: ${m}). Cannot get prompt "${e}".`);R(`info`,`Getting prompt: ${e}`,t);try{let n=await j.current.request({method:`prompts/get`,params:{name:e,arguments:t}},kR);return R(`info`,`Prompt "${e}" retrieved successfully`),n}catch(t){throw R(`error`,`Error getting prompt "${e}": ${t instanceof Error?t.message:String(t)}`,t),t}},[m,R]);return(0,b.useEffect)(()=>{let e=e=>{e.origin===window.location.origin&&e.data?.type===`mcp_auth_callback`&&(R(`info`,`Received auth callback message.`,e.data),L.current&&clearTimeout(L.current),e.data.success?(R(`info`,`Authentication successful via popup. Reconnecting client...`),P.current=!1,re()):B(`Authentication failed in callback: ${e.data.error||`Unknown reason.`}`))};return window.addEventListener(`message`,e),R(`debug`,`Auth callback message listener added.`),()=>{window.removeEventListener(`message`,e),R(`debug`,`Auth callback message listener removed.`),L.current&&clearTimeout(L.current)}},[R,B,re]),(0,b.useEffect)(()=>(F.current=!0,R(`debug`,`useMcp mounted, initiating connection.`),I.current=0,(!N.current||N.current.serverUrl!==t)&&(N.current=new JA(t,{storageKeyPrefix:a,clientName:n,clientUri:r,callbackUrl:i,preventAutoAuth:f,onPopupWindow:p}),R(`debug`,`BrowserOAuthClientProvider initialized/updated on mount/option change.`)),re(),()=>{F.current=!1,R(`debug`,`useMcp unmounting, disconnecting.`),z(!0)}),[t,a,i,n,r,o.name,o.version,re,z]),(0,b.useEffect)(()=>{let e=null;if(m===`failed`&&l&&I.current>0){let t=typeof l==`number`?l:jU;R(`info`,`Connection failed, auto-retrying in ${t}ms...`),e=setTimeout(()=>{F.current&&ee.current===`failed`&&ae()},t)}return()=>{e&&clearTimeout(e)}},[m,l,ae,R]),{state:m,tools:g,resources:v,resourceTemplates:x,prompts:C,error:T,log:D,authUrl:k,callTool:ie,listResources:ce,readResource:le,listPrompts:ue,getPrompt:de,retry:ae,disconnect:z,authenticate:oe,clearStorage:se}}function PU({service:e,autoConnect:t=!1,onConnected:n,onError:r}){let{toast:i}=dn(),{state:a,tools:o,resources:s,prompts:c,error:l,authUrl:u,callTool:d,readResource:f,listResources:p,getPrompt:m,listPrompts:h,retry:g,disconnect:_,authenticate:v,clearStorage:y}=NU({url:e.url,clientName:`AgentDeck`,clientUri:window.location.origin,callbackUrl:`${window.location.origin}/oauth/callback`,storageKeyPrefix:`mcp:auth:${e.id}`,debug:!0,autoRetry:3,autoReconnect:5e3,transportType:`auto`,preventAutoAuth:!t}),x=a===`ready`,S=a===`connecting`||a===`loading`,C=a===`authenticating`||a===`pending_auth`,w=a===`failed`;return b.useEffect(()=>{x&&n&&(n(),i({title:`Connected to MCP service`,description:`Successfully connected to ${e.name}`}))},[x,n,e.name,i]),b.useEffect(()=>{w&&l&&r&&(r(l),i({title:`MCP connection failed`,description:l,variant:`destructive`}))},[w,l,r,i]),{isConnected:x,isConnecting:S,isAuthenticating:C,hasError:w,error:l,tools:o,resources:s,prompts:c,connect:()=>{g()},disconnect:_,retry:g,authenticate:v,callTool:async(e,t)=>{try{return await d(e,t)}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw i({title:`Tool call failed`,description:t,variant:`destructive`}),e}},readResource:async e=>{try{return await f(e)}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw i({title:`Resource read failed`,description:t,variant:`destructive`}),e}},listResources:async()=>{try{await p()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw i({title:`Resource listing failed`,description:t,variant:`destructive`}),e}},getPrompt:async(e,t)=>{try{return await m(e,t)}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw i({title:`Prompt retrieval failed`,description:t,variant:`destructive`}),e}},listPrompts:async()=>{try{await h()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw i({title:`Prompt listing failed`,description:t,variant:`destructive`}),e}},authUrl:u,clearStorage:y}}function FU(){let[e,t]=(0,b.useState)(`https://api.githubcopilot.com/mcp`),[n,r]=(0,b.useState)(`get_me`),[i,a]=(0,b.useState)(`{}`),[o,s]=(0,b.useState)(``),{isConnected:c,isConnecting:l,isAuthenticating:u,hasError:d,error:f,tools:p,resources:m,prompts:h,connect:g,disconnect:_,retry:v,authenticate:y,callTool:x,authUrl:S,clearStorage:C}=PU({service:{id:`test-mcp-service`,name:`Test MCP Service`,type:`mcp`,url:e,health:`unknown`,description:`Test service for use-mcp integration`,cardColor:`#7ed4da`,isConnected:!1,lastPing:void 0,registeredAt:new Date().toISOString(),updatedAt:new Date().toISOString()},autoConnect:!1,onConnected:()=>{console.log(`Connected to test MCP service`)},onError:e=>{console.error(`Test MCP service error:`,e)}}),w=l?{status:`connecting`,icon:Vi,color:`text-yellow-500`}:u?{status:`authenticating`,icon:Ri,color:`text-blue-500`}:c?{status:`connected`,icon:Ei,color:`text-green-500`}:d?{status:`error`,icon:Di,color:`text-red-500`}:{status:`disconnected`,icon:Di,color:`text-gray-500`};return(0,V.jsxs)(`div`,{className:`container mx-auto p-6 space-y-6`,children:[(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`h1`,{className:`text-3xl font-bold mb-2`,children:`use-mcp Integration Test`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Testing the new use-mcp library integration with OAuth support`})]}),(0,V.jsxs)(RA,{children:[(0,V.jsxs)(zA,{children:[(0,V.jsxs)(BA,{className:`flex items-center gap-2`,children:[(0,V.jsx)(w.icon,{className:`w-5 h-5 ${w.color}`}),`Connection Status: `,w.status]}),(0,V.jsx)(VA,{children:`Current connection state and available actions`})]}),(0,V.jsxs)(HA,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)($m,{children:`Service URL`}),(0,V.jsx)(xd,{value:e,onChange:e=>t(e.target.value),placeholder:`Enter MCP service URL`})]}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[!c&&!l&&(0,V.jsx)(q,{onClick:g,children:`Connect`}),c&&(0,V.jsx)(q,{onClick:_,variant:`outline`,children:`Disconnect`}),d&&(0,V.jsxs)(q,{onClick:v,variant:`outline`,children:[(0,V.jsx)(Vi,{className:`w-4 h-4 mr-1`}),`Retry`]}),S&&!c&&(0,V.jsxs)(q,{onClick:y,variant:`outline`,children:[(0,V.jsx)(Ri,{className:`w-4 h-4 mr-1`}),`Authenticate`]})]})]}),f&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md`,children:[(0,V.jsx)(Ti,{className:`w-4 h-4 text-destructive`}),(0,V.jsx)(`span`,{className:`text-sm text-destructive`,children:f})]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,V.jsxs)(RA,{children:[(0,V.jsx)(zA,{children:(0,V.jsxs)(BA,{className:`flex items-center gap-2`,children:[(0,V.jsx)(ia,{className:`w-4 h-4`}),`Tools (`,p.length,`)`]})}),(0,V.jsx)(HA,{children:p.length===0?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c?`No tools available`:`Connect to see tools`}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[p.slice(0,5).map((e,t)=>(0,V.jsx)(`div`,{className:`text-sm`,children:(0,V.jsx)(b_,{variant:`outline`,className:`text-xs`,children:e.name})},t)),p.length>5&&(0,V.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`+`,p.length-5,` more tools`]})]})})]}),(0,V.jsxs)(RA,{children:[(0,V.jsx)(zA,{children:(0,V.jsxs)(BA,{children:[`Resources (`,m.length,`)`]})}),(0,V.jsx)(HA,{children:(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c?`${m.length} resources available`:`Connect to see resources`})})]}),(0,V.jsxs)(RA,{children:[(0,V.jsx)(zA,{children:(0,V.jsxs)(BA,{children:[`Prompts (`,h.length,`)`]})}),(0,V.jsx)(HA,{children:(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:c?`${h.length} prompts available`:`Connect to see prompts`})})]})]}),c&&(0,V.jsxs)(RA,{children:[(0,V.jsxs)(zA,{children:[(0,V.jsx)(BA,{children:`Test Tool Call`}),(0,V.jsx)(VA,{children:`Test calling a tool on the connected MCP service`})]}),(0,V.jsxs)(HA,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`toolName`,children:`Tool Name`}),(0,V.jsx)(xd,{id:`toolName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g., get_me`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{htmlFor:`toolArgs`,children:`Arguments (JSON)`}),(0,V.jsx)(xd,{id:`toolArgs`,value:i,onChange:e=>a(e.target.value),placeholder:`{"key": "value"}`})]})]}),(0,V.jsxs)(q,{onClick:async()=>{try{let e={};i.trim()&&(e=JSON.parse(i));let t=await x(n,e);s(JSON.stringify(t,null,2))}catch(e){s(`Error: ${e instanceof Error?e.message:`Unknown error`}`)}},disabled:!c,children:[(0,V.jsx)(Ui,{className:`w-4 h-4 mr-1`}),`Call Tool`]}),o&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)($m,{children:`Result`}),(0,V.jsx)(eh,{value:o,readOnly:!0,rows:10,className:`font-mono text-sm`})]})]})]}),S&&(0,V.jsxs)(RA,{children:[(0,V.jsxs)(zA,{children:[(0,V.jsxs)(BA,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Ri,{className:`w-4 h-4`}),`OAuth Authentication`]}),(0,V.jsx)(VA,{children:`This service requires OAuth authentication`})]}),(0,V.jsxs)(HA,{className:`space-y-4`,children:[(0,V.jsx)(`div`,{className:`p-3 bg-blue-50 border border-blue-200 rounded-md`,children:(0,V.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.`})}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsxs)(q,{onClick:y,variant:`outline`,children:[(0,V.jsx)(Ri,{className:`w-4 h-4 mr-1`}),`Start OAuth Flow`]}),(0,V.jsx)(q,{onClick:C,variant:`outline`,children:`Clear OAuth Data`})]})]})]})]})}function IU(e){return e.before.title!==e.after.title||e.before.body!==e.after.body||e.before.triggers.join(`
|
|
257
|
+
`)!==e.after.triggers.join(`
|
|
258
|
+
`)}var LU=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends LU{};function RU(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function zU(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function BU(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function VU(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function HU(e,t){return BU(e,t,``)}function UU(e,t){return VU(e,t,``)}function WU(e,t){return t.slice(0,GU(e,t))}function GU(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function KU(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function qU(e,t){if(t)return YU(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function JU(e,t){if(t)return YU(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function YU(e,t){if(!t)return[JU(e),qU(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=KU(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var XU=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,ZU=RegExp(`[${XU}]+|\\s+|[^${XU}]`,`ug`);new class extends LU{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=KU(e,r)}else n=e.match(ZU)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&QU(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&QU(n,i,r,null,t.intlSegmenter),e}};function QU(e,t,n,r,i){if(t&&n){let[a,o]=YU(t.value,i),[s,c]=YU(n.value,i);if(e){let r=RU(a,s);e.value=VU(e.value,s,r),t.value=HU(t.value,r),n.value=HU(n.value,r)}if(r){let e=zU(o,c);r.value=BU(r.value,c,e),t.value=UU(t.value,e),n.value=UU(n.value,e)}}else if(n){if(e){let e=JU(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=JU(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=JU(r.value,i),[a,o]=YU(t.value,i),s=RU(n,a);t.value=HU(t.value,s);let c=zU(HU(n,s),o);t.value=UU(t.value,c),r.value=BU(r.value,n,c),e.value=VU(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=JU(r.value,i),n=WU(qU(t.value,i),e);t.value=UU(t.value,n)}else if(e){let n=WU(qU(e.value,i),JU(t.value,i));t.value=HU(t.value,n)}}new class extends LU{tokenize(e){let t=RegExp(`(\\r?\\n)|[${XU}]+|[^\\S\\n\\r]+|[^${XU}]`,`ug`);return e.match(t)||[]}};var $U=new class extends LU{constructor(){super(...arguments),this.tokenize=tW}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
259
|
+
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
260
|
+
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
261
|
+
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
262
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function eW(e,t,n){return $U.diff(e,t,n)}function tW(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
263
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function nW(e){return e==`.`||e==`!`||e==`?`}new class extends LU{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(nW(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends LU{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends LU{constructor(){super(...arguments),this.tokenize=tW}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(rW(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function rW(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a=0;for(;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=rW(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=rW(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends LU{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var iW=3,aW=10;function oW(e){return e===``?[]:e.replace(/\n$/,``).split(`
|
|
264
|
+
`)}function sW(e,t){let n=eW(e,t),r=[],i=1,a=1;for(let e of n){let t=oW(e.value);if(!e.added&&!e.removed&&t.length>=aW){let e=t.slice(0,iW),n=t.slice(-3),o=t.length-6;for(let t of e)r.push({kind:`unchanged`,text:t,oldLine:i++,newLine:a++});o>0&&(r.push({kind:`ellipsis`,text:`${o} unchanged lines`}),i+=o,a+=o);for(let e of n)r.push({kind:`unchanged`,text:e,oldLine:i++,newLine:a++});continue}for(let n of t)e.added?r.push({kind:`added`,text:n,newLine:a++}):e.removed?r.push({kind:`removed`,text:n,oldLine:i++}):r.push({kind:`unchanged`,text:n,oldLine:i++,newLine:a++})}return r}function cW(e){return e.some(e=>e.kind===`added`||e.kind===`removed`)}var lW=`max-w-full overflow-x-auto rounded-md border border-gray-800 bg-gray-950 font-mono text-xs leading-5`;function uW(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 dW(e){switch(e){case`added`:return`+`;case`removed`:return`-`;case`ellipsis`:return`…`;default:return` `}}function fW({rows:e,emptyLabel:t}){return e.length===0?(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:t}):(0,V.jsx)(`div`,{className:lW,children:e.map((e,t)=>(0,V.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] gap-0 ${uW(e.kind)}`,children:[(0,V.jsx)(`span`,{className:`select-none border-r border-gray-800/80 px-2 py-0.5 text-right text-gray-600`,children:e.oldLine??``}),(0,V.jsx)(`span`,{className:`select-none border-r border-gray-800/80 px-2 py-0.5 text-right text-gray-600`,children:e.newLine??``}),(0,V.jsxs)(`div`,{className:`flex min-w-0 gap-2 px-2 py-0.5`,children:[(0,V.jsx)(`span`,{className:`w-3 shrink-0 select-none text-gray-500`,children:dW(e.kind)}),(0,V.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap wrap-break-word`,children:e.text||` `})]})]},`${e.kind}-${t}-${e.oldLine??``}-${e.newLine??``}`))})}function pW({before:e,after:t}){let n=e.filter(e=>!t.includes(e)),r=t.filter(t=>!e.includes(t));return n.length===0&&r.length===0?null:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-medium text-gray-400`,children:`Triggers`}),(0,V.jsxs)(`div`,{className:`${lW} p-0`,children:[n.map(e=>(0,V.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-rose-950/70 text-rose-100`,children:[(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsxs)(`div`,{className:`flex gap-2 px-2 py-0.5`,children:[(0,V.jsx)(`span`,{className:`w-3 shrink-0 text-gray-500`,children:`-`}),(0,V.jsx)(`span`,{children:e})]})]},`removed-${e}`)),r.map(e=>(0,V.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-emerald-950/70 text-emerald-100`,children:[(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsxs)(`div`,{className:`flex gap-2 px-2 py-0.5`,children:[(0,V.jsx)(`span`,{className:`w-3 shrink-0 text-gray-500`,children:`+`}),(0,V.jsx)(`span`,{children:e})]})]},`added-${e}`))]})]})}function mW({preview:e}){let t=IU(e),n=sW(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))&&cW(n),i=e.before.title!==e.after.title,a=e.before.triggers.join(`
|
|
265
|
+
`)!==e.after.triggers.join(`
|
|
266
|
+
`);return(0,V.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[!t&&(0,V.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 `,(0,V.jsx)(`code`,{children:`rewrite_body`}),`.`]}),r&&(0,V.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.`}),i&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-medium text-gray-400`,children:`Title`}),(0,V.jsxs)(`div`,{className:`${lW} p-0`,children:[e.before.title&&(0,V.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-rose-950/70 text-rose-100`,children:[(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsxs)(`div`,{className:`flex gap-2 px-2 py-0.5`,children:[(0,V.jsx)(`span`,{className:`w-3 shrink-0 text-gray-500`,children:`-`}),(0,V.jsx)(`span`,{children:e.before.title})]})]}),e.after.title&&(0,V.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[3rem_3rem_minmax(0,1fr)] bg-emerald-950/70 text-emerald-100`,children:[(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsx)(`span`,{className:`border-r border-gray-800/80 px-2 py-0.5`}),(0,V.jsxs)(`div`,{className:`flex gap-2 px-2 py-0.5`,children:[(0,V.jsx)(`span`,{className:`w-3 shrink-0 text-gray-500`,children:`+`}),(0,V.jsx)(`span`,{children:e.after.title})]})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h4`,{className:`text-sm font-medium text-gray-400`,children:`Body`}),(0,V.jsx)(fW,{rows:n,emptyLabel:`No body changes.`})]}),a&&(0,V.jsx)(pW,{before:e.before.triggers,after:e.after.triggers})]})}function hW(e){if(!e)return[];try{return JSON.parse(e)}catch{return[]}}function gW({conflicts:e,title:t=`Trigger overlap warnings`}){return e.length===0?null:(0,V.jsxs)(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 p-4 text-sm text-amber-50`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-amber-200/90`,children:t}),(0,V.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.`}),(0,V.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.map(e=>(0,V.jsxs)(`li`,{className:`rounded border border-amber-500/20 bg-gray-950/60 p-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(b_,{variant:`outline`,className:`border-amber-400/40 text-amber-100`,children:e.level}),(0,V.jsx)(`span`,{className:`font-medium text-amber-50`,children:e.otherPlaybookTitle}),(0,V.jsx)(`span`,{className:`font-mono text-xs text-amber-200/70`,children:e.otherPlaybookId})]}),(0,V.jsxs)(`p`,{className:`mt-2 text-amber-100/90`,children:[(0,V.jsx)(`span`,{className:`text-amber-200/80`,children:`Candidate:`}),` `,e.trigger]}),(0,V.jsxs)(`p`,{className:`text-amber-100/80`,children:[(0,V.jsx)(`span`,{className:`text-amber-200/80`,children:`Other:`}),` `,e.otherTrigger]})]},`${e.trigger}-${e.otherPlaybookId}-${e.level}`))})]})}var _W=8,vW=[{value:`proposed`,label:`Waiting`},{value:`accepted`,label:`Accepted`},{value:`rejected`,label:`Rejected`},{value:`superseded`,label:`Superseded`},{value:`stale`,label:`Stale`},{value:`all`,label:`All`}];function yW(e){if(!e.evidenceJson)return null;try{return JSON.parse(e.evidenceJson)}catch{return null}}function bW(e){switch(e){case`proposed`:return`border-blue-500/40 text-blue-200`;case`accepted`:return`border-emerald-500/40 text-emerald-200`;case`rejected`:return`border-rose-500/40 text-rose-200`;case`superseded`:return`border-violet-500/40 text-violet-200`;case`stale`:return`border-amber-500/40 text-amber-200`}}function xW(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)(`proposed`),[i,a]=(0,b.useState)(0),{toast:o}=dn(),s=we();function c(e){t(e)}function l(e){r(e),a(0),t(null)}let{data:u=[]}=Kt({queryKey:[`/api/playbook-patches`,`proposed`],queryFn:()=>i_(`proposed`)}),d=n===`all`?void 0:n,{data:f=[],isLoading:p}=Kt({queryKey:[`/api/playbook-patches`,n],queryFn:()=>i_(d)}),m=Math.max(1,Math.ceil(f.length/_W)),h=Math.min(i,m-1),g=(0,b.useMemo)(()=>{let e=h*_W;return f.slice(e,e+_W)},[f,h]);(0,b.useEffect)(()=>{i!==h&&a(h)},[i,h]);let{data:_,isLoading:v,isError:y,error:x}=Kt({queryKey:[`/api/playbook-patches`,e,`preview`],queryFn:()=>a_(e),enabled:!!e}),S=_?IU(_):!1,C=f.find(t=>t.id===e)??null,w=C?.status===`proposed`,T=qt({mutationFn:e=>o_(e),onSuccess:()=>{o({title:`Patch accepted`}),t(null),s.invalidateQueries({queryKey:[`/api/playbook-patches`]}),s.invalidateQueries({queryKey:[`/api/playbooks`]}),s.invalidateQueries({queryKey:[`/api/feedback-signals`]})},onError:e=>{o({title:`Accept failed`,description:e.message,variant:`destructive`})}}),E=qt({mutationFn:e=>s_(e),onSuccess:()=>{o({title:`Patch rejected`}),t(null),s.invalidateQueries({queryKey:[`/api/playbook-patches`]}),s.invalidateQueries({queryKey:[`/api/feedback-signals`]})},onError:e=>{o({title:`Reject failed`,description:e.message,variant:`destructive`})}}),D=n===`proposed`?`No proposals waiting for review.`:n===`all`?`No playbook patches yet.`:`No ${n} patches.`;return(0,V.jsxs)(`div`,{className:`flex h-dvh flex-col overflow-hidden bg-gray-950 text-gray-100`,children:[(0,V.jsx)(`header`,{className:`shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center gap-3`,children:[(0,V.jsx)(ye,{href:`/`,children:(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,className:`text-gray-300`,children:[(0,V.jsx)(mi,{className:`mr-1 h-4 w-4`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Deck`})]})}),(0,V.jsx)(`h1`,{className:`font-ui-display text-lg font-semibold`,children:`Playbook review queue`}),(0,V.jsxs)(b_,{variant:`secondary`,children:[u.length,` waiting`]}),(0,V.jsx)(ye,{href:`/feedback-signals`,className:`ml-auto text-sm hover:underline`,style:{color:`#92E4DD`},children:`Feedback data →`})]})}),(0,V.jsxs)(`main`,{className:`mx-auto grid w-full max-w-7xl min-h-0 flex-1 gap-6 overflow-hidden px-4 py-6 sm:px-6 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)] lg:items-stretch`,children:[(0,V.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-col`,children:[(0,V.jsx)(`h2`,{className:`font-ui-display mb-3 shrink-0 text-sm font-medium text-gray-400`,children:`Proposals`}),(0,V.jsx)(`div`,{className:`mb-3 flex shrink-0 flex-wrap gap-1`,children:vW.map(({value:e,label:t})=>{let r=n===e;return(0,V.jsx)(q,{size:`sm`,variant:r?`gold`:`outline`,className:r?void 0:`border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800 hover:text-gray-100`,"aria-pressed":r,onClick:()=>l(e),children:t},e)})}),(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Loading…`}),!p&&f.length===0&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:D}),(0,V.jsx)(`ul`,{className:`space-y-2`,children:g.map(t=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,onClick:()=>c(t.id),className:`w-full rounded-lg border p-3 text-left transition ${e===t.id?`border-blue-500 bg-gray-900`:`border-gray-800 bg-gray-900/50 hover:border-gray-700`}`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`block font-medium leading-snug`,children:t.kind===`create`?`New: ${t.displayTitle}`:t.displayTitle}),t.playbookId&&t.kind!==`create`&&(0,V.jsx)(`span`,{className:`mt-0.5 block truncate font-mono text-xs text-gray-600`,children:t.playbookId}),r_(t.deckNames)&&(0,V.jsxs)(`span`,{className:`mt-1 block text-xs text-gray-500`,children:[`Decks: `,r_(t.deckNames)]})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,V.jsx)(b_,{variant:`outline`,className:`shrink-0`,children:t.kind}),n!==`proposed`&&(0,V.jsx)(b_,{variant:`outline`,className:`shrink-0 ${bW(t.status)}`,children:t.status})]})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-gray-400`,children:t.rationale}),(0,V.jsxs)(`p`,{className:`mt-1 text-xs text-gray-600`,children:[t.source,` · `,new Date(t.createdAt).toLocaleString()]})]})},t.id))})]}),f.length>_W&&(0,V.jsxs)(`div`,{className:`mt-3 flex shrink-0 items-center justify-between gap-2 border-t border-gray-800 pt-3`,children:[(0,V.jsxs)(q,{type:`button`,size:`sm`,variant:`outline`,className:`border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800`,disabled:h<=0,onClick:()=>a(e=>Math.max(0,e-1)),children:[(0,V.jsx)(Si,{className:`mr-1 h-4 w-4`}),`Newer`]}),(0,V.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[h+1,` / `,m,(0,V.jsxs)(`span`,{className:`ml-1 text-gray-600`,children:[`(`,f.length,`)`]})]}),(0,V.jsxs)(q,{type:`button`,size:`sm`,variant:`outline`,className:`border-gray-600 bg-transparent text-gray-300 hover:bg-gray-800`,disabled:h>=m-1,onClick:()=>a(e=>Math.min(m-1,e+1)),children:[`Older`,(0,V.jsx)(Ci,{className:`ml-1 h-4 w-4`})]})]})]}),(0,V.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,V.jsx)(`h2`,{className:`font-ui-display mb-3 shrink-0 text-sm font-medium text-gray-400`,children:`Detail`}),!C&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Select a proposal to preview the diff.`}),C&&(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-gray-800 bg-gray-900/50`,children:[(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 sm:p-5`,children:(0,V.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(b_,{variant:`outline`,className:bW(C.status),children:C.status}),C.resolvedAt&&(0,V.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`Resolved `,new Date(C.resolvedAt).toLocaleString()]})]}),(0,V.jsx)(`p`,{className:`text-sm leading-relaxed text-gray-300`,children:C.rationale}),C.status===`rejected`&&C.rejectionReason&&(0,V.jsxs)(`div`,{className:`rounded-md border border-rose-500/40 bg-rose-500/10 p-3 text-sm text-rose-100`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-rose-300/80`,children:`Rejection reason`}),(0,V.jsx)(`p`,{className:`mt-1`,children:C.rejectionReason})]}),C.status===`superseded`&&C.supersededBy&&(0,V.jsxs)(`div`,{className:`rounded-md border border-violet-500/40 bg-violet-500/10 p-3 text-sm text-violet-100`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-violet-300/80`,children:`Superseded by`}),(0,V.jsx)(`button`,{type:`button`,className:`mt-1 font-mono text-sm underline-offset-2 hover:underline`,onClick:()=>{let e=C.supersededBy;r(`all`),a(0),c(e)},children:C.supersededBy})]}),(()=>{let e=yW(C);return e?(0,V.jsxs)(`div`,{className:`rounded-md border border-gray-700 bg-gray-950 p-4 text-sm`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-gray-500`,children:`Your correction`}),(0,V.jsxs)(`p`,{className:`mt-2 italic text-gray-200`,children:[`“`,e.user_feedback_excerpt,`”`]}),e.failure_summary&&(0,V.jsx)(`p`,{className:`mt-2 text-gray-400`,children:e.failure_summary})]}):null})(),(()=>{let e=hW(C.conflictsJson),t=_?.trigger_conflicts??[],n=t.length>0?t:e;return(0,V.jsx)(gW,{conflicts:n})})(),v&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Loading preview…`}),y&&(0,V.jsxs)(`div`,{className:`rounded-md border border-rose-500/50 bg-rose-500/10 p-3 text-sm text-rose-100`,children:[`Preview failed —`,` `,x?.message??`could not apply ops to the current playbook.`,w?` Reject and re-propose with exact list anchors or rewrite_body.`:` Historical preview may be incomplete if the playbook changed.`]}),_&&(0,V.jsx)(mW,{preview:_}),C.status===`stale`&&(0,V.jsx)(`p`,{className:`text-sm text-amber-400`,children:`Stale — playbook changed since proposal. Re-propose from a fresh session.`})]})}),w?(0,V.jsxs)(`div`,{className:`relative z-10 shrink-0 space-y-3 border-t border-gray-800 bg-gray-950 p-4 shadow-[0_-16px_32px_rgba(0,0,0,0.55)] sm:p-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-gray-400`,children:`Your decision`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(q,{variant:`gold`,onClick:()=>T.mutate(C.id),disabled:T.isPending||y||!S,children:`Accept`}),(0,V.jsx)(q,{variant:`destructive`,onClick:()=>E.mutate(C.id),disabled:E.isPending,children:`Reject`})]})]}):(0,V.jsxs)(`div`,{className:`shrink-0 border-t border-gray-800 bg-gray-950 px-4 py-3 text-sm text-gray-500 sm:px-5`,children:[`Read-only — already `,C.status,`. Switch to Waiting to review open proposals.`]})]})]})]})]})}async function SW(e){let t=await e.json();if(!t.success)throw Error(t.error??`Request failed`);return t.data}async function CW(e){let t=new URLSearchParams;return e?.targetPlaybookId&&t.set(`targetPlaybookId`,e.targetPlaybookId),e?.status&&t.set(`status`,e.status),SW(await H(`GET`,`/api/evaluation-scenarios${t.size>0?`?${t.toString()}`:``}`))}async function wW(e){return SW(await H(`POST`,`/api/evaluation-scenarios`,e))}async function TW(e,t){return SW(await H(`PUT`,`/api/evaluation-scenarios/${e}`,t))}function EW(e){if(e.length===0)return{eligible:!1,playbookId:null,reason:`Select feedback rows first.`};if(e.some(e=>!e.candidatePlaybookId))return{eligible:!1,playbookId:null,reason:`Every selected row must have a candidate playbook.`};let t=new Set(e.map(e=>e.candidatePlaybookId));return t.size===1?{eligible:!0,playbookId:[...t][0],reason:null}:{eligible:!1,playbookId:null,reason:`Selected rows must belong to the same candidate playbook.`}}var DW=`mt-1 w-full rounded border border-gray-700 bg-gray-950 px-2 py-1.5 text-sm text-gray-100`;function OW(e){return e?{name:e.name,description:e.description,taskInput:e.taskInput,historicalFailedOutput:e.historicalFailedOutput,expectations:e.expectations}:{name:``,description:``,taskInput:``,historicalFailedOutput:null,expectations:[]}}function kW({scenario:e,playbookId:t,playbookTitle:n,sourceSignals:r,error:i,busy:a,onCancel:o,onSave:s}){let[c,l]=(0,b.useState)(()=>OW(e));(0,b.useEffect)(()=>l(OW(e)),[e]);let u=(e,t)=>{l(n=>({...n,expectations:n.expectations.map((n,r)=>r===e?{...n,...t}:n)}))};return(0,V.jsxs)(`section`,{"aria-label":`Scenario editor`,className:`rounded-lg border border-gray-700 bg-gray-900/70 p-4`,children:[(0,V.jsxs)(`div`,{className:`mb-4 flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h2`,{className:`font-ui-display text-base font-semibold`,children:e?`Edit ${e.name}`:`Create scenario`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-400`,children:[`Fixed playbook: `,n,` `,(0,V.jsxs)(`span`,{className:`font-mono`,children:[`(`,t,`)`]})]}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-400`,children:[`Fixed signals: `,r.map(e=>e.id).join(`, `)]})]}),(0,V.jsx)(q,{size:`sm`,variant:`ghost`,onClick:o,"aria-label":`Close scenario editor`,children:(0,V.jsx)(aa,{className:`h-4 w-4`})})]}),(0,V.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,3fr)_minmax(16rem,2fr)]`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`label`,{className:`block text-xs text-gray-400`,children:[`Name`,(0,V.jsx)(`input`,{className:DW,value:c.name,onChange:e=>l({...c,name:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`block text-xs text-gray-400`,children:[`Description`,(0,V.jsx)(`textarea`,{className:DW,rows:2,value:c.description,onChange:e=>l({...c,description:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`block text-xs text-gray-400`,children:[`Real task input`,(0,V.jsx)(`textarea`,{className:DW,rows:4,value:c.taskInput,onChange:e=>l({...c,taskInput:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`block text-xs text-gray-400`,children:[`Historical failed output`,(0,V.jsx)(`textarea`,{className:DW,rows:4,value:c.historicalFailedOutput??``,onChange:e=>l({...c,historicalFailedOutput:e.target.value||null})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`text-xs text-gray-400`,children:`Deterministic checks`}),(0,V.jsxs)(q,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>l({...c,expectations:[...c.expectations,{id:`check-${c.expectations.length+1}`,type:`contains`,value:``}]}),children:[(0,V.jsx)(Wi,{className:`mr-1 h-3.5 w-3.5`}),` Add check`]})]}),(0,V.jsx)(`div`,{className:`mt-2 space-y-2`,children:c.expectations.map((e,t)=>(0,V.jsxs)(`div`,{className:`grid gap-2 rounded border border-gray-800 p-2 sm:grid-cols-[1fr_9rem_2fr_auto]`,children:[(0,V.jsx)(`input`,{"aria-label":`Check ${t+1} id`,className:DW.replace(`mt-1 `,``),value:e.id,onChange:e=>u(t,{id:e.target.value})}),(0,V.jsxs)(`select`,{"aria-label":`Check ${t+1} type`,className:DW.replace(`mt-1 `,``),value:e.type,onChange:e=>u(t,{type:e.target.value}),children:[(0,V.jsx)(`option`,{value:`contains`,children:`contains`}),(0,V.jsx)(`option`,{value:`not_contains`,children:`not_contains`}),(0,V.jsx)(`option`,{value:`equals`,children:`equals`}),(0,V.jsx)(`option`,{value:`regex`,children:`regex`})]}),(0,V.jsx)(`input`,{"aria-label":`Check ${t+1} value`,className:DW.replace(`mt-1 `,``),value:e.value,onChange:e=>u(t,{value:e.target.value})}),(0,V.jsx)(q,{size:`sm`,variant:`ghost`,"aria-label":`Remove check ${t+1}`,onClick:()=>l({...c,expectations:c.expectations.filter((e,n)=>n!==t)}),children:(0,V.jsx)(aa,{className:`h-4 w-4`})})]},t))})]}),i&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-red-300`,children:i}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(q,{disabled:a||!c.name.trim(),onClick:()=>s(c,`draft`),children:`Save draft`}),(0,V.jsx)(q,{variant:`gold`,disabled:a||!c.name.trim(),onClick:()=>s(c,`ready`),children:e?.status===`ready`?`Save ready scenario`:`Mark ready`})]})]}),(0,V.jsxs)(`aside`,{className:`rounded border border-gray-800 bg-gray-950/60 p-3`,children:[(0,V.jsx)(`h3`,{className:`font-ui-display text-sm font-semibold`,children:`Source feedback`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-gray-500`,children:`Read-only evidence. Supply real task/output text; do not infer it from excerpts.`}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:r.map(e=>(0,V.jsxs)(`article`,{className:`rounded border border-gray-800 p-2 text-xs`,children:[(0,V.jsx)(`p`,{className:`font-mono text-gray-500`,children:e.id}),(0,V.jsxs)(`p`,{className:`mt-1 text-gray-200`,children:[`“`,e.userFeedbackExcerpt,`”`]}),(0,V.jsx)(`p`,{className:`mt-1 text-gray-400`,children:e.failureSummary}),e.correctedOutputHint&&(0,V.jsxs)(`p`,{className:`mt-1 text-gray-500`,children:[`Hint: `,e.correctedOutputHint]})]},e.id))})]})]})]})}var AW=`border-[#C4B643] data-[state=checked]:bg-[#C4B643] data-[state=checked]:text-[#0A0A07] data-[state=indeterminate]:bg-[#C4B643] data-[state=indeterminate]:text-[#0A0A07]`;function jW(){let{toast:e}=dn(),t=we(),[n,r]=(0,b.useState)(`feedback`),[i,a]=(0,b.useState)(`open`),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(new Set),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(``),[v,y]=(0,b.useState)(`all`),{data:x}=Kt({queryKey:[`/api/playbooks/vault`]}),S=x?.data??[],C=(0,b.useMemo)(()=>new Map(S.map(e=>[e.id,e.title])),[S]),w={status:i===`all`?void 0:i,playbookId:o||void 0,excludeInProposal:i===`open`?!c:void 0},{data:T=[],isLoading:E}=Kt({queryKey:[`/api/feedback-signals`,w],queryFn:()=>d_(w)}),{data:D=[]}=Kt({queryKey:[`/api/feedback-signals`,{allForScenarios:!0}],queryFn:()=>d_(),enabled:n===`scenarios`||f?.kind===`edit`}),O={targetPlaybookId:g||void 0,status:v===`all`?void 0:v},{data:k=[],isLoading:A}=Kt({queryKey:[`/api/evaluation-scenarios`,O],queryFn:()=>CW(O),enabled:n===`scenarios`}),j=()=>t.invalidateQueries({queryKey:[`/api/evaluation-scenarios`]}),M=qt({mutationFn:async({value:e,status:t})=>{if(!f)throw Error(`Scenario editor is closed`);return f.kind===`create`?wW({targetPlaybookId:f.playbookId,sourceSignalIds:f.signalIds,...e,status:t}):TW(f.scenario.id,{...e,targetPlaybookId:f.scenario.targetPlaybookId,sourceSignalIds:f.scenario.sourceSignalIds,status:t})},onSuccess:t=>{h(null),p({kind:`edit`,scenario:t}),j(),e({title:t.status===`ready`?`Scenario ready`:`Draft saved`})},onError:e=>h(e.message)}),N=qt({mutationFn:({id:e,status:t})=>TW(e,{status:t}),onSuccess:t=>{j(),e({title:`Scenario ${t.status}`})},onError:t=>e({title:`Status change rejected`,description:t.message,variant:`destructive`})}),P=qt({mutationFn:f_,onSuccess:n=>{e({title:`Discarded ${n.discarded} signal(s)`}),d(new Set),t.invalidateQueries({queryKey:[`/api/feedback-signals`]})},onError:t=>e({title:`Discard failed`,description:t.message,variant:`destructive`})}),F=T.filter(e=>u.has(e.id)),I=EW(F),L=F.filter(e=>e.status===`open`).map(e=>e.id),ee=T.length>0&&T.every(e=>u.has(e.id)),te=T.some(e=>u.has(e.id)),ne=f?.kind===`edit`?f.scenario:null,R=f?.kind===`create`?f.playbookId:ne?.targetPlaybookId,z=f?.kind===`create`?f.signalIds:ne?.sourceSignalIds,B=(f?.kind===`create`?T:D).filter(e=>z?.includes(e.id)),re=e=>d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),ie=async()=>{let t=u.size>0?F:T;if(t.length!==0)try{await navigator.clipboard.writeText(g_(t)),e({title:`Copied curation prompt`,description:`${t.length} signal id(s) included.`})}catch(t){e({title:`Copy failed`,description:t instanceof Error?t.message:`Clipboard unavailable`,variant:`destructive`})}},ae=async t=>{try{await navigator.clipboard.writeText(JSON.stringify((0,_f.evaluationScenarioToExperimentCase)(t),null,2)),e({title:`Copied evaluator case JSON`})}catch(t){e({title:`Copy failed`,description:t instanceof Error?t.message:`Clipboard unavailable`,variant:`destructive`})}},oe=e=>{h(null),p({kind:`edit`,scenario:e})};return(0,V.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-gray-950 text-gray-100`,children:[(0,V.jsx)(`header`,{className:`shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center gap-3`,children:[(0,V.jsx)(ye,{href:`/`,children:(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,className:`text-gray-300`,children:[(0,V.jsx)(mi,{className:`mr-1 h-4 w-4`}),`Home`]})}),(0,V.jsx)(`h1`,{className:`font-ui-display text-lg font-semibold`,children:`Feedback`}),(0,V.jsx)(q,{size:`sm`,variant:n===`feedback`?`gold`:`ghost`,onClick:()=>r(`feedback`),children:`Signals`}),(0,V.jsx)(q,{size:`sm`,variant:n===`scenarios`?`gold`:`ghost`,onClick:()=>r(`scenarios`),children:`Scenarios`}),(0,V.jsx)(ye,{href:`/playbook-patches`,className:`ml-auto text-sm hover:underline`,style:{color:`#92E4DD`},children:`Playbook proposals →`})]})}),(0,V.jsx)(`main`,{className:`mx-auto w-full max-w-7xl flex-1 space-y-4 px-4 py-6 sm:px-6`,children:n===`feedback`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Review correction signals or curate same-playbook rows into deterministic evaluation scenarios.`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-3`,children:[(0,V.jsxs)(`label`,{className:`text-xs text-gray-500`,children:[(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Playbook`}),(0,V.jsxs)(`select`,{className:`mt-1 block min-w-48 rounded border border-gray-700 bg-gray-950 px-2 py-1.5 text-sm text-gray-100`,value:o,onChange:e=>{s(e.target.value),d(new Set)},children:[(0,V.jsx)(`option`,{value:``,children:`All`}),S.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[[`open`,`Open`],[`actioned`,`Actioned`],[`discarded`,`Discarded`],[`all`,`All`]].map(([e,t])=>(0,V.jsx)(q,{size:`sm`,variant:i===e?`gold`:`outline`,"aria-pressed":i===e,onClick:()=>{a(e),d(new Set)},children:t},e))}),i===`open`&&(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-gray-400`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked)}),`Include already in an open proposal`]}),(0,V.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-start gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col items-end`,children:[(0,V.jsxs)(q,{size:`sm`,variant:`gold`,disabled:!I.eligible,onClick:()=>{I.eligible&&(h(null),p({kind:`create`,playbookId:I.playbookId,signalIds:F.map(e=>e.id)}))},children:[(0,V.jsx)(Fi,{className:`mr-1 h-3.5 w-3.5`}),`Create scenario`]}),!I.eligible&&u.size>0&&(0,V.jsx)(`p`,{role:`status`,className:`mt-1 max-w-xs text-right text-xs text-amber-300`,children:I.reason})]}),(0,V.jsxs)(q,{size:`sm`,variant:`outline`,disabled:T.length===0,onClick:()=>void ie(),children:[(0,V.jsx)(ki,{className:`mr-1 h-3.5 w-3.5`}),(0,V.jsx)(`span`,{className:`font-ui-display`,children:`Copy for agent`}),u.size>0?` (${u.size})`:``]}),(0,V.jsxs)(q,{size:`sm`,variant:`destructive`,disabled:L.length===0||P.isPending,onClick:()=>P.mutate(L),children:[(0,V.jsx)(ea,{className:`mr-1 h-3.5 w-3.5`}),`Discard selected`]})]})]}),f&&R&&(0,V.jsx)(kW,{scenario:ne,playbookId:R,playbookTitle:C.get(R)??R,sourceSignals:B,error:m,busy:M.isPending,onCancel:()=>{p(null),h(null)},onSave:(e,t)=>M.mutate({value:e,status:t})}),E&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Loading…`}),!E&&T.length===0&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`No signals match these filters.`}),!E&&T.length>0&&(0,V.jsx)(MW,{signals:T,selected:u,titleById:C,allVisibleSelected:ee,someVisibleSelected:te,onToggle:re,onToggleAll:()=>d(ee?new Set:new Set(T.map(e=>e.id)))})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Saved human-curated scenarios. Ready scenarios can be copied into a deterministic experiment manifest.`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-3`,children:[(0,V.jsxs)(`label`,{className:`text-xs text-gray-500`,children:[`Playbook`,(0,V.jsxs)(`select`,{"aria-label":`Scenario playbook filter`,className:`mt-1 block min-w-48 rounded border border-gray-700 bg-gray-950 px-2 py-1.5 text-sm text-gray-100`,value:g,onChange:e=>_(e.target.value),children:[(0,V.jsx)(`option`,{value:``,children:`All`}),S.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,V.jsxs)(`label`,{className:`text-xs text-gray-500`,children:[`Status`,(0,V.jsxs)(`select`,{"aria-label":`Scenario status filter`,className:`mt-1 block min-w-36 rounded border border-gray-700 bg-gray-950 px-2 py-1.5 text-sm text-gray-100`,value:v,onChange:e=>y(e.target.value),children:[(0,V.jsx)(`option`,{value:`all`,children:`All`}),(0,V.jsx)(`option`,{value:`draft`,children:`Draft`}),(0,V.jsx)(`option`,{value:`ready`,children:`Ready`}),(0,V.jsx)(`option`,{value:`retired`,children:`Retired`})]})]})]}),f&&R&&(0,V.jsx)(kW,{scenario:ne,playbookId:R,playbookTitle:C.get(R)??R,sourceSignals:B,error:m,busy:M.isPending,onCancel:()=>{p(null),h(null)},onSave:(e,t)=>M.mutate({value:e,status:t})}),A&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Loading…`}),!A&&k.length===0&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`No scenarios match these filters.`}),(0,V.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>(0,V.jsxs)(`article`,{className:`flex flex-wrap items-center gap-3 rounded-lg border border-gray-800 bg-gray-900/40 p-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h2`,{className:`font-ui-display font-semibold`,children:e.name}),(0,V.jsx)(b_,{variant:`outline`,children:e.status})]}),(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:e.description||`No description`}),(0,V.jsxs)(`p`,{className:`font-mono text-xs text-gray-600`,children:[e.id,` · `,C.get(e.targetPlaybookId)??e.targetPlaybookId,` · `,e.sourceSignalIds.length,` signal(s) · `,e.expectations.length,` check(s)`]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(q,{size:`sm`,variant:`outline`,onClick:()=>oe(e),children:[(0,V.jsx)(Hi,{className:`mr-1 h-3.5 w-3.5`}),`Edit`]}),e.status===`draft`&&(0,V.jsx)(q,{size:`sm`,variant:`gold`,onClick:()=>N.mutate({id:e.id,status:`ready`}),children:`Mark ready`}),e.status!==`retired`&&(0,V.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>N.mutate({id:e.id,status:`retired`}),children:`Retire`}),e.status===`ready`&&(0,V.jsxs)(q,{size:`sm`,onClick:()=>void ae(e),children:[(0,V.jsx)(ki,{className:`mr-1 h-3.5 w-3.5`}),`Copy case JSON`]})]})]},e.id))})]})})]})}function MW({signals:e,selected:t,titleById:n,allVisibleSelected:r,someVisibleSelected:i,onToggle:a,onToggleAll:o}){return(0,V.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-gray-800`,children:(0,V.jsxs)(`table`,{className:`w-full min-w-3xl text-left text-sm`,children:[(0,V.jsx)(`thead`,{className:`border-b border-gray-800 bg-gray-900/80 text-xs uppercase text-gray-500`,children:(0,V.jsxs)(`tr`,{children:[(0,V.jsx)(`th`,{className:`w-10 px-3 py-2`,children:(0,V.jsx)(gv,{checked:r?!0:i?`indeterminate`:!1,onCheckedChange:o,"aria-label":`Select all visible signals`,className:AW})}),(0,V.jsx)(`th`,{className:`px-3 py-2`,children:`Excerpt`}),(0,V.jsx)(`th`,{className:`px-3 py-2`,children:`Failure`}),(0,V.jsx)(`th`,{className:`px-3 py-2`,children:`Playbook`}),(0,V.jsx)(`th`,{className:`px-3 py-2`,children:`Source`}),(0,V.jsx)(`th`,{className:`px-3 py-2`,children:`When`})]})}),(0,V.jsx)(`tbody`,{children:e.map(e=>(0,V.jsxs)(`tr`,{className:`border-b border-gray-800/80 align-top`,children:[(0,V.jsx)(`td`,{className:`px-3 py-2`,children:(0,V.jsx)(gv,{checked:t.has(e.id),onCheckedChange:()=>a(e.id),"aria-label":`Select ${e.id}`,className:AW})}),(0,V.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,V.jsx)(`p`,{className:`font-mono text-[11px] text-gray-600`,children:e.id}),(0,V.jsxs)(`p`,{className:`text-gray-200`,children:[`“`,e.userFeedbackExcerpt,`”`]}),p_(e)&&(0,V.jsx)(b_,{variant:`outline`,className:`mt-1 text-[10px]`,children:`In proposal`})]}),(0,V.jsx)(`td`,{className:`px-3 py-2 text-gray-400`,children:e.failureSummary}),(0,V.jsx)(`td`,{className:`px-3 py-2 text-gray-300`,children:e.candidatePlaybookId?n.get(e.candidatePlaybookId)??e.candidatePlaybookId:`—`}),(0,V.jsx)(`td`,{className:`px-3 py-2 text-gray-500`,children:e.source}),(0,V.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2 text-gray-500`,children:new Date(e.createdAt).toLocaleString()})]},e.id))})]})})}function NW(e){return e instanceof Jt?e.errorCode===`GRANT_REQUIRED`||e.errorCode===`DASHBOARD_REQUIRED`?{message:`This browser is not signed in to the Agent Deck dashboard. Run agent-deck open, then open this approval link again.`,retryable:!0}:e.errorCode===`ADMIN_CHALLENGE_EXPIRED`?{message:`This approval request expired or was already used. Ask the agent to request admin elevation again.`,retryable:!1}:e.errorCode===`SESSION_INVALID`?{message:`The agent session for this request is gone. Ask the agent to reconnect and request admin elevation again.`,retryable:!1}:{message:e.message||`Approval failed`,retryable:!0}:e instanceof TypeError?{message:`Could not reach Agent Deck. Check that it is running (agent-deck status) and try again.`,retryable:!0}:{message:e instanceof Error&&e.message?e.message:`Approval failed`,retryable:!0}}function PW(){let e=new URLSearchParams(window.location.search),t=e.get(`challenge`)??``,n=e.get(`session`)??``,[r,i]=(0,b.useState)(`idle`),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(!0);(0,b.useEffect)(()=>{(!t||!n)&&(i(`error`),c(!1),o(`This link is incomplete. Ask the agent to request admin elevation again.`))},[t,n]);async function l(){if(t&&n){i(`approving`);try{await H(`POST`,`/api/trusted-session/admin/approve`,{challengeId:t,runtimeSessionId:n}),i(`success`),o(`Admin elevation approved for this MCP session. Return to the agent.`)}catch(e){let t=NW(e);i(`error`),c(t.retryable),o(t.message)}}}async function u(){if(t&&n){i(`denying`);try{await H(`POST`,`/api/trusted-session/admin/deny`,{challengeId:t,runtimeSessionId:n}),i(`success`),o(`Admin elevation denied. The MCP session remains in normal mode.`)}catch(e){let t=NW(e);i(`error`),c(t.retryable),o(t.message)}}}return(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center p-6 bg-muted/30`,children:(0,V.jsxs)(RA,{className:`w-full max-w-md`,children:[(0,V.jsxs)(zA,{children:[(0,V.jsx)(BA,{children:`Approve agent-admin elevation`}),(0,V.jsx)(VA,{children:`Grants ephemeral deck-admin mode to one MCP session (30-minute lease). This does not change the folder's deck assignment.`})]}),(0,V.jsxs)(HA,{className:`space-y-4`,children:[t&&n?(0,V.jsxs)(`dl`,{className:`text-sm space-y-1 text-muted-foreground`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Session `}),(0,V.jsx)(`dd`,{className:`inline font-mono text-xs`,children:n})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Challenge `}),(0,V.jsx)(`dd`,{className:`inline font-mono text-xs`,children:t})]})]}):null,r===`success`?(0,V.jsx)(`p`,{role:`status`,className:`text-sm text-green-700 dark:text-green-400`,children:a}):r===`error`?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,r!==`success`&&t&&n&&(r!==`error`||s)?(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,V.jsx)(q,{variant:`outline`,onClick:()=>void u(),disabled:r===`approving`||r===`denying`,className:`w-full`,children:r===`denying`?`Denying…`:`Deny`}),(0,V.jsx)(q,{onClick:()=>void l(),disabled:r===`approving`||r===`denying`,className:`w-full`,children:r===`approving`?`Approving…`:`Approve elevation`})]}):null]})]})})}function FW(e){return e instanceof Jt?e.errorCode===`GRANT_REQUIRED`||e.errorCode===`DASHBOARD_REQUIRED`?{message:`This browser is not signed in to the Agent Deck dashboard. Run agent-deck open, then open this approval link again.`,retryable:!0}:e.errorCode===`DECK_SWITCH_EXPIRED`||e.status===410?{message:`This deck-switch request expired. The session and workspace default were not changed. Ask the agent to request the switch again.`,retryable:!1}:e.errorCode===`DECK_SWITCH_CONSUMED`||e.status===409?{message:`This deck-switch request was already resolved. The switch was not applied twice — check the current deck before requesting again.`,retryable:!1}:e.errorCode===`RESOURCE_OUT_OF_SCOPE`?{message:`This approval link does not match the requesting session. Only the matching session's request can be approved here — ask the agent for a fresh link if needed.`,retryable:!1}:e.errorCode===`SESSION_INVALID`?{message:`The agent session for this request is gone. Ask the agent to reconnect and request the deck switch again.`,retryable:!1}:e.status===404?{message:`This deck-switch request was not found. It may have been cleaned up. Ask the agent to request the switch again.`,retryable:!1}:{message:e.message||`Approval failed`,retryable:!0}:e instanceof TypeError?{message:`Could not reach Agent Deck. Check that it is running (agent-deck status) and try again.`,retryable:!0}:{message:e instanceof Error&&e.message?e.message:`Approval failed`,retryable:!0}}function IW(){let e=new URLSearchParams(window.location.search);return{requestId:(e.get(`request`)??e.get(`requestId`)??``).trim(),runtimeSessionId:(e.get(`session`)??e.get(`runtimeSessionId`)??``).trim()}}function LW(e){return e===`expired`?`This deck-switch request expired. The session and workspace default were not changed. Ask the agent to request the switch again.`:e===`declined`?`This deck-switch request was already declined. Nothing was changed.`:`This deck-switch request was already resolved. The switch was not applied twice — check the current deck before requesting again.`}function RW(e){let t=e.deckName?` “${e.deckName}”`:``,n=!!e.workspaceRoot?.trim();return e.decision===`session`?n?`Approved for this session only. This session now uses${t}. The workspace default was not changed.`:`Approved for this session only. This session now uses${t}. The agent's configured default was not changed.`:e.decision===`workspace-default`?`Approved. Future sessions${e.workspaceRoot?` in ${e.workspaceRoot}`:``} will use${t} as the new default. This session was switched too.`:n?`Declined. Nothing was changed — the session and workspace default are untouched.`:`Declined. Nothing was changed — the session and the agent's configured default are untouched.`}function zW(){let[{requestId:e,runtimeSessionId:t}]=(0,b.useState)(IW),[n,r]=(0,b.useState)(`loading`),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(!0),[u,d]=(0,b.useState)(null),f=(0,b.useRef)(!1),p=(0,b.useCallback)(async()=>{if(!e){r(`error`),l(!1),s(`This link is incomplete. Ask the agent to request the deck switch again.`);return}r(`loading`),s(``);try{let t=(await(await H(`GET`,`/api/trusted-session/deck-switch/${e}`)).json()).data;if(!t||t.requestId!==e)throw Error(`Approval lookup returned an unexpected response`);a(t),t.status===`pending`?r(`pending`):(r(`error`),l(!1),s(LW(t.status)))}catch(e){let t=FW(e);r(`error`),l(t.retryable),s(t.message)}},[e]);(0,b.useEffect)(()=>{p()},[p]);async function m(n){if(f.current)return;let a=t||i?.runtimeSessionId||``;if(!e||!a){r(`error`),l(!1),s(`This link is incomplete. Ask the agent to request the deck switch again.`);return}f.current=!0,d(n),r(`submitting`);try{let t=await(await H(`POST`,`/api/trusted-session/deck-switch/${e}/resolve`,{runtimeSessionId:a,decision:n})).json(),o={decision:n,deckName:t.data?.deckName??i?.requestedDeckName,workspaceRoot:t.data?.workspaceRoot??i?.workspaceRoot};s(RW(o)),r(`success`)}catch(e){let t=FW(e);l(t.retryable),s(t.message),t.retryable&&i?r(`pending`):r(`error`)}finally{f.current=!1,d(null)}}function h(){s(``),i&&c?r(`pending`):p()}let g=n===`loading`||n===`submitting`,_=i?.currentDeckName??i?.currentDeckId,v=i?.requestedDeckName??i?.requestedDeckId,y=t||i?.runtimeSessionId,x=!!i?.workspaceRoot?.trim();return(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center p-6 bg-muted/30`,children:(0,V.jsxs)(RA,{className:`w-full max-w-md`,children:[(0,V.jsxs)(zA,{children:[(0,V.jsx)(BA,{children:`Approve deck switch`}),(0,V.jsx)(VA,{children:x?`Choose whether the requested deck applies to this session only or becomes the workspace default. Declining leaves everything unchanged.`:`Choose whether the requested deck applies to this session only, or decline. This session has no writable workspace default.`})]}),(0,V.jsxs)(HA,{className:`space-y-4`,children:[i&&(_||v)?(0,V.jsxs)(`dl`,{className:`text-sm space-y-1 text-muted-foreground`,children:[_?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Current deck `}),(0,V.jsx)(`dd`,{className:`inline`,children:_})]}):null,v?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Requested deck `}),(0,V.jsx)(`dd`,{className:`inline`,children:v})]}):null,i.workspaceRoot?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Workspace `}),(0,V.jsx)(`dd`,{className:`inline font-mono text-xs`,children:i.workspaceRoot})]}):null,y?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Session `}),(0,V.jsx)(`dd`,{className:`inline font-mono text-xs`,children:y})]}):null]}):e?(0,V.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Request `,(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:e})]}):null,n===`loading`?(0,V.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Loading the deck-switch request…`}):null,n===`success`?(0,V.jsx)(`p`,{role:`status`,className:`text-sm text-green-700 dark:text-green-400`,children:o}):null,(n===`error`||n===`pending`)&&o?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:o}):null,(n===`pending`||n===`submitting`)&&i?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{onClick:()=>void m(`session`),disabled:g,className:`w-full`,children:u===`session`?`Approving…`:`This session only`}),x?(0,V.jsx)(q,{onClick:()=>void m(`workspace-default`),disabled:g,variant:`secondary`,className:`w-full`,children:u===`workspace-default`?`Approving…`:`This workspace by default`}):null,(0,V.jsx)(q,{onClick:()=>void m(`decline`),disabled:g,variant:`outline`,className:`w-full`,children:u===`decline`?`Declining…`:`Decline`})]}):null,n===`error`?c?(0,V.jsx)(q,{onClick:h,variant:`outline`,className:`w-full`,children:`Try again`}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No further action is possible on this link. You can close this tab.`}):null,n===`success`?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You can close this tab and return to the agent.`}):null]})]})})}function BW(e){return e instanceof Jt?e.errorCode===`GRANT_REQUIRED`||e.errorCode===`DASHBOARD_REQUIRED`?{message:`This browser is not signed in to the Agent Deck dashboard. Run agent-deck open, then open this approval link again.`,retryable:!0}:e.errorCode===`DECK_SWITCH_EXPIRED`||e.status===410?{message:`This deck-assignment request expired. Nothing was assigned. Ask the agent to request the assignment again.`,retryable:!1}:e.errorCode===`DECK_SWITCH_CONSUMED`||e.status===409?{message:`This deck-assignment request was already resolved. The assignment was not applied twice — check the current deck before requesting again.`,retryable:!1}:e.errorCode===`SESSION_INVALID`?{message:`The folder for this request is no longer valid. Ask the agent to request the assignment again with the correct folder.`,retryable:!1}:e.status===404?{message:`This deck-assignment request was not found. It may have been cleaned up. Ask the agent to request the assignment again.`,retryable:!1}:{message:e.message||`Approval failed`,retryable:!0}:e instanceof TypeError?{message:`Could not reach Agent Deck. Check that it is running (agent-deck status) and try again.`,retryable:!0}:{message:e instanceof Error&&e.message?e.message:`Approval failed`,retryable:!0}}function VW(){let e=new URLSearchParams(window.location.search);return{requestId:(e.get(`request`)??e.get(`requestId`)??``).trim()}}function HW(e){return e===`expired`?`This deck-assignment request expired. Nothing was assigned. Ask the agent to request the assignment again.`:e===`declined`?`This deck-assignment request was already declined. Nothing was changed.`:`This deck-assignment request was already resolved. The assignment was not applied twice — check the current deck before requesting again.`}function UW(e){let t=e.deckName?` "${e.deckName}"`:``;return e.decision===`session`?`Approved for this session only. This session now uses${t}. The folder was not assigned on disk.`:e.decision===`workspace-default`?`Approved. Future sessions${e.workspaceRoot?` in ${e.workspaceRoot}`:``} will use${t} as the default. This session was bound too.`:`Declined. Nothing was changed — the session stays unassigned and the folder is untouched.`}function WW(){let[{requestId:e}]=(0,b.useState)(VW),[t,n]=(0,b.useState)(`loading`),[r,i]=(0,b.useState)(null),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)(``),[d,f]=(0,b.useState)(!0),[p,m]=(0,b.useState)(null),h=(0,b.useRef)(!1),g=(0,b.useCallback)(async()=>{if(!e){n(`error`),f(!1),u(`This link is incomplete. Ask the agent to request the deck assignment again.`);return}n(`loading`),u(``);try{let t=(await(await H(`GET`,`/api/trusted-session/deck-assignment/${e}`)).json()).data;if(!t||t.requestId!==e)throw Error(`Approval lookup returned an unexpected response`);if(i(t),t.status!==`pending`){n(`error`),f(!1),u(HW(t.status));return}let r=await(await H(`GET`,`/api/decks`)).json(),a=Array.isArray(r)?r:r.data??[];o(a.filter(e=>e?.id&&e?.name)),n(`pending`)}catch(e){let t=BW(e);n(`error`),f(t.retryable),u(t.message)}},[e]);(0,b.useEffect)(()=>{g()},[g]);async function _(t){if(!h.current){if(!e){n(`error`),f(!1),u(`This link is incomplete. Ask the agent to request the deck assignment again.`);return}if(t!==`decline`&&!s){u(`Pick a deck first, or decline the request.`);return}h.current=!0,m(t),n(`submitting`);try{let i=await(await H(`POST`,`/api/trusted-session/deck-assignment/${e}/resolve`,t===`decline`?{decision:t}:{deckId:s,decision:t})).json(),o=a.find(e=>e.id===s),c={decision:t,deckName:i.data?.deckName??o?.name,workspaceRoot:i.data?.workspaceRoot??r?.workspaceRoot};u(UW(c)),n(`success`)}catch(e){let t=BW(e);f(t.retryable),u(t.message),t.retryable&&r?n(`pending`):n(`error`)}finally{h.current=!1,m(null)}}}function v(){u(``),r&&d?n(`pending`):g()}let y=t===`loading`||t===`submitting`;return(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center p-6 bg-muted/30`,children:(0,V.jsxs)(RA,{className:`w-full max-w-md`,children:[(0,V.jsxs)(zA,{children:[(0,V.jsx)(BA,{children:`Assign a deck to this folder`}),(0,V.jsx)(VA,{children:`Pick the deck for the folder below. Verify the full path before approving — the assignment writes only inside it. Declining leaves everything unchanged.`})]}),(0,V.jsxs)(HA,{className:`space-y-4`,children:[r?.workspaceRoot?(0,V.jsxs)(`dl`,{className:`text-sm space-y-1 text-muted-foreground`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Folder `}),(0,V.jsx)(`dd`,{className:`inline font-mono text-xs break-all`,children:r.workspaceRoot})]}),r.reason?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Note `}),(0,V.jsx)(`dd`,{className:`inline`,children:r.reason})]}):null,r.mcpSessionId?(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{className:`inline font-medium text-foreground`,children:`Session `}),(0,V.jsx)(`dd`,{className:`inline font-mono text-xs`,children:r.mcpSessionId})]}):null]}):e?(0,V.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Request `,(0,V.jsx)(`span`,{className:`font-mono text-xs`,children:e})]}):null,t===`loading`?(0,V.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Loading the deck-assignment request…`}):null,t===`success`?(0,V.jsx)(`p`,{role:`status`,className:`text-sm text-green-700 dark:text-green-400`,children:l}):null,(t===`error`||t===`pending`)&&l?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:l}):null,(t===`pending`||t===`submitting`)&&r?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`label`,{className:`block text-sm font-medium`,htmlFor:`deck-assignment-deck`,children:`Deck`}),(0,V.jsxs)(`select`,{id:`deck-assignment-deck`,className:`w-full rounded-md border bg-background px-3 py-2 text-sm`,value:s,disabled:y,onChange:e=>c(e.target.value),children:[(0,V.jsx)(`option`,{value:``,children:`Pick a deck…`}),a.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),(0,V.jsx)(q,{onClick:()=>void _(`session`),disabled:y||!s,className:`w-full`,children:p===`session`?`Approving…`:`This session only`}),(0,V.jsx)(q,{onClick:()=>void _(`workspace-default`),disabled:y||!s,variant:`secondary`,className:`w-full`,children:p===`workspace-default`?`Approving…`:`This workspace by default`}),(0,V.jsx)(q,{onClick:()=>void _(`decline`),disabled:y,variant:`outline`,className:`w-full`,children:p===`decline`?`Declining…`:`Decline`})]}):null,t===`error`?d?(0,V.jsx)(q,{onClick:v,variant:`outline`,className:`w-full`,children:`Try again`}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No further action is possible on this link. You can close this tab.`}):null,t===`success`?(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`You can close this tab and return to the agent.`}):null]})]})})}async function GW(e){return(await(await H(`POST`,`/api/agent-grants`,e)).json()).data}async function KW(e){await H(`POST`,`/api/agent-grants/${encodeURIComponent(e)}/revoke`)}var qW=[];function JW(e){if(!e)return`Never`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function YW(e){return e.revokedAt?`revoked`:e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()?`expired`:`active`}function XW(e,t){if(e===`none`)return;if(e===`custom`)return new Date(t).toISOString();let n=e===`30`?30:90;return new Date(Date.now()+n*24*60*60*1e3).toISOString()}function ZW(){let e=we(),{toast:t}=dn(),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(new Set),[c,l]=(0,b.useState)(`none`),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(null),[v,y]=(0,b.useState)(null),x=(0,b.useRef)(!1),{data:S,isLoading:C,error:w}=Kt({queryKey:[`/api/dashboard-auth/context`]}),T=S?.data.hosted===!0,{data:E}=Kt({queryKey:[`/api/decks`],enabled:T}),D=E?.data??[],{data:O,isLoading:k,error:A}=Kt({queryKey:[`/api/agent-grants`],enabled:T}),j=O?.data??qW;(0,b.useEffect)(()=>{x.current||D.length===0||(x.current=!0,a(D[0].id),s(new Set(D.map(e=>e.id))))},[D]);let M=(0,b.useMemo)(()=>new Map(D.map(e=>[e.id,e.name])),[D]),N=qt({mutationFn:KW,onSuccess:(n,r)=>{let i=new Date().toISOString();e.setQueryData([`/api/agent-grants`],e=>e&&{...e,data:e.data.map(e=>e.id===r?{...e,revokedAt:i}:e)}),y(null),e.invalidateQueries({queryKey:[`/api/agent-grants`]}),t({title:`Grant revoked`,description:`The bearer stops working immediately.`})},onError:e=>{t({title:`Revoke failed`,description:e.message,variant:`destructive`})}}),P=(e,t)=>{s(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},F=e=>{a(e),s(t=>new Set(t).add(e))};return C?(0,V.jsx)(eG,{message:`Loading grant settings…`}):w?(0,V.jsx)(eG,{message:`Owner sign-in is required to manage grants.`,isError:!0}):T?(0,V.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-gray-950 text-gray-100`,children:[(0,V.jsx)(`header`,{className:`shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-wrap items-center gap-3`,children:[(0,V.jsx)(ye,{href:`/`,children:(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,className:`text-gray-300`,children:[(0,V.jsx)(mi,{className:`mr-1 h-4 w-4`}),`Deck`]})}),(0,V.jsx)(Li,{className:`h-5 w-5 text-[#C4B643]`,"aria-hidden":!0}),(0,V.jsx)(`h1`,{className:`font-ui-display text-lg font-semibold`,children:`Remote agent grants`}),(0,V.jsx)(b_,{variant:`outline`,className:`border-gray-700 text-gray-300`,children:j.length})]})}),(0,V.jsxs)(`main`,{className:`mx-auto w-full max-w-7xl flex-1 space-y-5 px-4 py-6 sm:px-6`,children:[(0,V.jsx)(`p`,{className:`max-w-3xl text-sm leading-6 text-gray-400`,children:`Issue a separate bearer for each remote agent. Deck access is fixed at creation; revoke and reissue when it needs to change.`}),f&&(0,V.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-amber-400/50 bg-amber-400/10 p-4`,"aria-label":`New bearer secret`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`h2`,{className:`font-ui-display font-semibold text-amber-200`,children:[`Copy the bearer for `,f.label]}),(0,V.jsx)(`p`,{className:`mt-1 text-sm font-semibold text-amber-100`,children:`This secret will not be shown again.`})]}),(0,V.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`text-amber-100 hover:bg-amber-300/10 hover:text-amber-50`,onClick:()=>p(null),children:[(0,V.jsx)(bi,{className:`h-4 w-4`}),`Done — hide secret`]})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex min-w-0 flex-col gap-2 sm:flex-row`,children:[(0,V.jsx)(xd,{readOnly:!0,"aria-label":`Bearer secret`,value:f.token,className:`min-w-0 flex-1 border-amber-300/30 bg-black/40 font-mono text-xs text-amber-50`}),(0,V.jsxs)(q,{type:`button`,variant:`gold`,className:`w-full sm:w-auto`,onClick:async()=>{try{await navigator.clipboard.writeText(f.token),t({title:`Bearer copied`})}catch{t({title:`Copy failed`,variant:`destructive`})}},children:[(0,V.jsx)(ki,{className:`h-4 w-4`}),`Copy bearer`]})]})]}),(0,V.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(18rem,20rem)_minmax(0,1fr)]`,children:[(0,V.jsxs)(`section`,{className:`h-fit min-w-0 rounded-xl border border-gray-800 bg-gray-900/50 p-4 sm:p-5`,children:[(0,V.jsx)(`h2`,{className:`font-ui-display text-base font-semibold`,children:`Create grant`}),(0,V.jsxs)(`form`,{className:`mt-4 space-y-4`,onSubmit:async t=>{if(t.preventDefault(),_(null),!i){_(`Choose a default deck.`);return}if(c===`custom`&&!u){_(`Choose a custom expiry date.`);return}h(!0);try{let t=await GW({label:n.trim(),defaultDeck:i,allowedDecks:[...o],expiresAt:XW(c,u)});p({label:t.grant.label,token:t.token}),e.setQueryData([`/api/agent-grants`],e=>({success:!0,data:e?[...e.data.filter(e=>e.id!==t.grant.id),t.grant]:[t.grant]})),r(``)}catch(e){_(e instanceof Error?e.message:`Grant creation failed`)}finally{h(!1)}},children:[(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)($m,{htmlFor:`grant-label`,children:`Agent label`}),(0,V.jsx)(xd,{id:`grant-label`,required:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Research agent`})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)($m,{htmlFor:`default-deck`,children:`Default deck`}),(0,V.jsx)(`select`,{id:`default-deck`,required:!0,value:i,onChange:e=>F(e.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 text-sm`,children:D.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,V.jsxs)(`fieldset`,{className:`space-y-2`,children:[(0,V.jsx)(`legend`,{className:`text-sm font-medium`,children:`Allowed decks`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`All decks are selected by default.`}),(0,V.jsx)(`div`,{className:`max-h-48 space-y-2 overflow-y-auto rounded-md border border-gray-800 p-3`,children:D.map(e=>{let t=e.id===i;return(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(gv,{id:`allowed-${e.id}`,checked:o.has(e.id),disabled:t,onCheckedChange:t=>P(e.id,t===!0),className:`border-[#C4B643] data-[state=checked]:bg-[#C4B643] data-[state=checked]:text-[#0A0A07]`}),(0,V.jsxs)($m,{htmlFor:`allowed-${e.id}`,className:`min-w-0 wrap-break-word font-normal`,children:[e.name,t?` (default)`:``]})]},e.id)})})]}),(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)($m,{htmlFor:`grant-expiry`,children:`Expiry`}),(0,V.jsxs)(`select`,{id:`grant-expiry`,value:c,onChange:e=>l(e.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 text-sm`,children:[(0,V.jsx)(`option`,{value:`none`,children:`None`}),(0,V.jsx)(`option`,{value:`30`,children:`30 days`}),(0,V.jsx)(`option`,{value:`90`,children:`90 days`}),(0,V.jsx)(`option`,{value:`custom`,children:`Custom`})]})]}),c===`custom`&&(0,V.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,V.jsx)($m,{htmlFor:`custom-expiry`,children:`Expires at`}),(0,V.jsx)(xd,{id:`custom-expiry`,type:`datetime-local`,required:!0,value:u,onChange:e=>d(e.target.value)})]}),g&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-rose-300`,children:g}),(0,V.jsx)(q,{type:`submit`,variant:`gold`,className:`w-full`,disabled:m||D.length===0,children:m?`Creating…`:`Create grant`})]})]}),(0,V.jsxs)(`section`,{className:`min-w-0 space-y-3`,"aria-label":`Existing grants`,children:[(0,V.jsx)(`h2`,{className:`font-ui-display text-base font-semibold`,children:`Existing grants`}),k&&(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Loading grants…`}),A&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-rose-300`,children:`Could not load grants.`}),!k&&!A&&j.length===0&&(0,V.jsx)(`div`,{className:`rounded-xl border border-dashed border-gray-800 p-8 text-center text-sm text-gray-500`,children:`No remote agent grants yet.`}),j.map(e=>{let t=YW(e),n=t!==`revoked`,r=v===e.id;return(0,V.jsxs)(`article`,{className:`min-w-0 rounded-xl border border-gray-800 bg-gray-900/50 p-4 sm:p-5`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h3`,{className:`wrap-break-word font-semibold text-gray-100`,children:e.label}),(0,V.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-gray-600`,children:e.id})]}),(0,V.jsx)(QW,{status:t})]}),(0,V.jsxs)(`dl`,{className:`mt-4 grid min-w-0 gap-x-5 gap-y-3 text-sm sm:grid-cols-2 xl:grid-cols-3`,children:[(0,V.jsx)($W,{label:`Default deck`,value:M.get(e.defaultDeck)??e.defaultDeck}),(0,V.jsx)($W,{label:`Allowed decks`,value:e.allowedDecks.map(e=>M.get(e)??e).join(`, `)||`None`}),(0,V.jsx)($W,{label:`Created`,value:JW(e.createdAt)}),(0,V.jsx)($W,{label:`Expires`,value:JW(e.expiresAt)}),(0,V.jsx)($W,{label:`Last used`,value:e.lastUsedAt?JW(e.lastUsedAt):`Never`})]}),n&&(0,V.jsx)(`div`,{className:`mt-4 border-t border-gray-800 pt-4`,children:r?(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,role:`group`,"aria-label":`Confirm revoke ${e.label}`,children:[(0,V.jsxs)(`p`,{className:`text-sm text-rose-200`,children:[`Revoke `,e.label,` now? This is immediate.`]}),(0,V.jsxs)(`div`,{className:`flex w-full gap-2 sm:w-auto`,children:[(0,V.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,className:`flex-1 sm:flex-none`,onClick:()=>y(null),children:`Cancel`}),(0,V.jsx)(q,{type:`button`,variant:`destructive`,size:`sm`,className:`flex-1 sm:flex-none`,disabled:N.isPending,onClick:()=>N.mutate(e.id),children:`Confirm revoke`})]})]}):(0,V.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`border-rose-900 text-rose-200 hover:bg-rose-950`,onClick:()=>y(e.id),children:[(0,V.jsx)(Xi,{className:`h-4 w-4`}),`Revoke`]})})]},e.id)})]})]})]})]}):(0,V.jsx)(eG,{message:`Remote agent grants are available in hosted mode only.`})}function QW({status:e}){return(0,V.jsx)(b_,{variant:`outline`,className:e===`active`?`border-emerald-500/40 text-emerald-200`:e===`expired`?`border-amber-500/40 text-amber-200`:`border-rose-500/40 text-rose-200`,children:e})}function $W({label:e,value:t}){return(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`dt`,{className:`font-ui-display text-xs text-gray-500`,children:e}),(0,V.jsx)(`dd`,{className:`mt-1 wrap-break-word text-gray-300`,children:t})]})}function eG({message:e,isError:t=!1}){return(0,V.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-gray-950 text-gray-100`,children:[(0,V.jsx)(`header`,{className:`border-b border-gray-800 px-4 py-4 sm:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center gap-3`,children:[(0,V.jsx)(ye,{href:`/`,children:(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,children:[(0,V.jsx)(mi,{className:`h-4 w-4`}),`Deck`]})}),(0,V.jsx)(`h1`,{className:`font-ui-display text-lg font-semibold`,children:`Remote agent grants`})]})}),(0,V.jsx)(`main`,{className:`mx-auto w-full max-w-7xl px-4 py-8 sm:px-6`,children:(0,V.jsx)(`p`,{role:t?`alert`:`status`,className:t?`text-rose-300`:`text-gray-400`,children:e})})]})}async function tG(e){let t=new URLSearchParams({limit:`50`});return e&&t.set(`before`,e),(await H(`GET`,`/api/audit?${t.toString()}`)).json()}function nG(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}).format(t)}function rG({entry:e}){return(0,V.jsx)(b_,{variant:`outline`,className:e.outcome===`succeeded`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-300`:`border-rose-500/40 bg-rose-500/10 text-rose-300`,children:e.outcome})}function iG({label:e,children:t}){return(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`dt`,{className:`font-ui-display text-xs uppercase tracking-wide text-gray-500`,children:e}),(0,V.jsx)(`dd`,{className:`mt-1 break-all text-sm text-gray-200`,children:t})]})}function aG(){let[e,t]=(0,b.useState)([void 0]),n=e.at(-1),{data:r,isLoading:i,error:a}=Kt({queryKey:[`/api/dashboard-auth/context`]}),o=r?.data.hosted===!0,{data:s,isLoading:c,error:l}=Kt({queryKey:[`audit`,n??`newest`],queryFn:()=>tG(n),enabled:o});return i?(0,V.jsx)(oG,{message:`Loading audit history…`}):a?(0,V.jsx)(oG,{message:`Owner sign-in is required to view audit history.`,isError:!0}):o?(0,V.jsxs)(`div`,{className:`flex min-h-dvh flex-col bg-gray-950 text-gray-100`,children:[(0,V.jsx)(`header`,{className:`shrink-0 border-b border-gray-800 px-4 py-4 sm:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl items-center gap-3`,children:[(0,V.jsx)(ye,{href:`/`,children:(0,V.jsxs)(q,{variant:`ghost`,size:`sm`,className:`text-gray-300`,children:[(0,V.jsx)(mi,{className:`mr-1 h-4 w-4`}),`Deck`]})}),(0,V.jsx)(Ki,{className:`h-5 w-5 text-[#C4B643]`,"aria-hidden":!0}),(0,V.jsx)(`h1`,{className:`font-ui-display text-lg font-semibold`,children:`Audit history`})]})}),(0,V.jsxs)(`main`,{className:`mx-auto w-full max-w-7xl flex-1 space-y-5 px-4 py-6 sm:px-6`,children:[(0,V.jsx)(`p`,{className:`max-w-3xl text-sm leading-6 text-gray-400`,children:`Security-relevant grant, sign-in, deck-selection and elevation activity from the last 90 days.`}),c?(0,V.jsx)(`p`,{className:`text-sm text-gray-400`,children:`Loading events…`}):null,l?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-rose-300`,children:`Audit history could not be loaded.`}):null,s?.data.length===0?(0,V.jsx)(`div`,{className:`rounded-xl border border-gray-800 bg-gray-900/70 p-8 text-center text-sm text-gray-400`,children:`No audit events on this page.`}):null,s?.data.length?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`hidden overflow-hidden rounded-xl border border-gray-800 bg-gray-900/70 md:block`,children:(0,V.jsxs)(_v,{children:[(0,V.jsx)(vv,{children:(0,V.jsxs)(xv,{className:`border-gray-800 hover:bg-transparent`,children:[(0,V.jsx)(Sv,{children:`Time`}),(0,V.jsx)(Sv,{children:`Event`}),(0,V.jsx)(Sv,{children:`Actor`}),(0,V.jsx)(Sv,{children:`Target`}),(0,V.jsx)(Sv,{children:`Outcome`}),(0,V.jsx)(Sv,{children:`Reason`})]})}),(0,V.jsx)(yv,{children:s.data.map(e=>(0,V.jsxs)(xv,{className:`border-gray-800 hover:bg-white/3`,children:[(0,V.jsx)(Cv,{className:`whitespace-nowrap text-xs text-gray-400`,children:nG(e.timestamp)}),(0,V.jsx)(Cv,{className:`font-medium text-[#E8F6F4]`,children:e.event}),(0,V.jsx)(Cv,{className:`max-w-48 break-all font-mono text-xs`,children:e.actor}),(0,V.jsx)(Cv,{className:`max-w-56 break-all font-mono text-xs`,children:e.targetId}),(0,V.jsx)(Cv,{children:(0,V.jsx)(rG,{entry:e})}),(0,V.jsx)(Cv,{className:`text-xs text-gray-400`,children:e.reasonCode??`—`})]},e.id))})]})}),(0,V.jsx)(`ol`,{className:`space-y-3 md:hidden`,"aria-label":`Audit events`,children:s.data.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-gray-800 bg-gray-900/70 p-4`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,V.jsx)(`div`,{className:`min-w-0 wrap-break-word font-medium text-[#E8F6F4]`,children:e.event}),(0,V.jsx)(rG,{entry:e})]}),(0,V.jsxs)(`dl`,{className:`mt-4 grid min-w-0 grid-cols-1 gap-3`,children:[(0,V.jsx)(iG,{label:`Time`,children:nG(e.timestamp)}),(0,V.jsx)(iG,{label:`Actor`,children:e.actor}),(0,V.jsx)(iG,{label:`Target`,children:e.targetId}),(0,V.jsx)(iG,{label:`Reason`,children:e.reasonCode??`—`})]})]},e.id))})]}):null,s?(0,V.jsxs)(`nav`,{className:`flex items-center justify-between gap-3`,"aria-label":`Audit pagination`,children:[(0,V.jsx)(q,{variant:`outline`,disabled:e.length===1,onClick:()=>t(e=>e.slice(0,-1)),children:`Newer`}),(0,V.jsxs)(`span`,{className:`text-xs text-gray-500`,children:[`Page `,e.length]}),(0,V.jsx)(q,{variant:`outline`,disabled:!s.paging.nextBefore,onClick:()=>s.paging.nextBefore&&t(e=>[...e,s.paging.nextBefore]),children:`Older`})]}):null]})]}):(0,V.jsx)(oG,{message:`Audit history is available in hosted mode only.`})}function oG({message:e,isError:t=!1}){return(0,V.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center bg-gray-950 px-4 text-center`,children:(0,V.jsx)(`p`,{className:t?`text-rose-300`:`text-gray-300`,children:e})})}function sG(){return(0,V.jsxs)(xe,{children:[(0,V.jsx)(ve,{path:`/`,component:LA}),(0,V.jsx)(ve,{path:`/oauth/callback`,component:GA}),(0,V.jsx)(ve,{path:`/playbook-patches`,component:xW}),(0,V.jsx)(ve,{path:`/feedback-signals`,component:jW}),(0,V.jsx)(ve,{path:`/grants`,component:ZW}),(0,V.jsx)(ve,{path:`/audit`,component:aG}),(0,V.jsx)(ve,{path:`/admin/approve`,component:PW}),(0,V.jsx)(ve,{path:`/deck-switch/approve`,component:zW}),(0,V.jsx)(ve,{path:`/deck-assignment/approve`,component:WW}),(0,V.jsx)(ve,{path:`/mcp-test`,component:FU}),(0,V.jsx)(ve,{component:WA})]})}function cG(){let[e,t]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{let e=!1;return Qt().finally(()=>{e||t(!0)}),()=>{e=!0}},[]),e?(0,V.jsx)(Te,{client:Zt,children:(0,V.jsxs)(Tu,{children:[(0,V.jsx)($o,{}),(0,V.jsx)(sG,{})]})}):(0,V.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[#0B1220] text-sm text-gray-300`,children:`Loading AgentDeck...`})}(0,x.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(b.StrictMode,{children:(0,V.jsx)(cG,{})}));
|