hmcp-web 0.2.2 → 0.2.3
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/api.d.ts +6 -0
- package/dist/api.js +36 -8
- package/dist/model/app-connect-note.d.ts +114 -0
- package/dist/model/app-connect-note.js +199 -0
- package/dist/model/app-servers.d.ts +24 -1
- package/dist/model/app-servers.js +54 -6
- package/dist/model/apps.d.ts +24 -0
- package/dist/model/apps.js +18 -0
- package/dist/model/bring-in.d.ts +185 -0
- package/dist/model/bring-in.js +755 -0
- package/dist/model/console-settings.d.ts +2 -2
- package/dist/model/import-record.d.ts +4 -0
- package/dist/model/import-record.js +22 -1
- package/dist/model/new-toolbox.d.ts +84 -0
- package/dist/model/new-toolbox.js +209 -0
- package/dist/model/protection.d.ts +4 -1
- package/dist/model/protection.js +12 -9
- package/dist/model/provisional-tools.d.ts +56 -0
- package/dist/model/provisional-tools.js +145 -0
- package/dist/model/server-names.d.ts +25 -0
- package/dist/model/server-names.js +158 -0
- package/dist/model/toolbox-label.d.ts +22 -0
- package/dist/model/toolbox-label.js +42 -0
- package/dist/model/tools.d.ts +20 -5
- package/dist/model/tools.js +22 -11
- package/dist/routes/connect-app.d.ts +54 -0
- package/dist/routes/connect-app.js +1018 -0
- package/dist/routes/connect-import.d.ts +21 -6
- package/dist/routes/connect-import.js +162 -546
- package/dist/routes/connect.d.ts +11 -0
- package/dist/routes/connect.js +28 -116
- package/dist/routes/github.js +2 -1
- package/dist/routes/guard.js +4 -0
- package/dist/routes/runtime.js +21 -22
- package/dist/routes/servers-add.d.ts +1 -0
- package/dist/routes/servers-add.js +6 -5
- package/dist-ui/assets/Activity-BSf4lBm-.js +1 -0
- package/dist-ui/assets/Approvals-CDz3zYpl.js +1 -0
- package/dist-ui/assets/AttachApp-COr1547c.js +5 -0
- package/dist-ui/assets/Connections-ClW5R6ea.js +2 -0
- package/dist-ui/assets/{Gallery-DB_OO7Vw.js → Gallery-0iiv1H9e.js} +3 -3
- package/dist-ui/assets/{PreApprovals-C-2ZGYfc.js → PreApprovals-DYDKgSpr.js} +1 -1
- package/dist-ui/assets/Protection-DMtABpM7.js +1 -0
- package/dist-ui/assets/Safety-BLTF2fqV.js +1 -0
- package/dist-ui/assets/{Settings-CSyTOe8X.js → Settings-DZ4P3Us6.js} +1 -1
- package/dist-ui/assets/StartPage-Bke6mrv5.js +1 -0
- package/dist-ui/assets/{Suggestions-CaQ_ifWR.js → Suggestions-kAWUILyw.js} +1 -1
- package/dist-ui/assets/Tools-BdXSeKeL.js +4 -0
- package/dist-ui/assets/connect-app-words-CT8Fytzv.js +1 -0
- package/dist-ui/assets/index-Cm4wG2zz.js +16 -0
- package/dist-ui/assets/{kit-DRVm92_t.js → kit-BHB_ha4i.js} +1 -1
- package/dist-ui/assets/server-name-D9u6r07i.js +1 -0
- package/dist-ui/index.html +3 -2
- package/package.json +4 -4
- package/dist-ui/assets/Activity-CoVSFaRd.js +0 -1
- package/dist-ui/assets/Approvals-BSEDgiNu.js +0 -1
- package/dist-ui/assets/AttachApp-Cpm6DOaX.js +0 -5
- package/dist-ui/assets/Connections-D5Xd9vH8.js +0 -2
- package/dist-ui/assets/Protection-B4Ltb5iP.js +0 -1
- package/dist-ui/assets/Safety-CSQhoL9D.js +0 -1
- package/dist-ui/assets/StartPage-JBVzYXce.js +0 -1
- package/dist-ui/assets/Tools-CDl6irG1.js +0 -4
- package/dist-ui/assets/index-CTvq_isK.js +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e((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.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.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`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(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 P(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,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(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 F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ee(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}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)};function te(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function L(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else te(L.bind(null,e))}var R={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=R,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=L,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=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.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 D(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)E.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 D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ee}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=te,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{var t=n();function r(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 i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(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=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.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,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,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=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.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=d(n,t.crossOrigin);a.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=d(t.as,t.crossOrigin);a.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,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.0`})),i=e(((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=r()})),a=n(),o=i(),s=class extends Error{status;code;detail;constructor(e,t,n,r){super(n),this.status=e,this.code=t,this.detail=r}get needsLoosenAck(){return this.status===422&&this.detail?.needs===`loosens`}};function c(){return document.cookie.match(/(?:^|;\s*)hmcp_csrf=([^;]+)/)?.[1]??``}async function l(e,t={}){let n={...t.headers??{}};t.method&&t.method!==`GET`&&(n[`Content-Type`]=`application/json`,n[`X-HMCP-CSRF`]=c());let r=await fetch(e,{...t,headers:n}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok){let e=a?.error??{code:`unknown`,message:r.statusText};throw new s(r.status,e.code,e.message,e.detail)}return a}function u(e,t){return t?`${e}${e.includes(`?`)?`&`:`?`}tenant=${encodeURIComponent(t)}`:e}function d(e,t){let n=Object.entries(t).filter(e=>e[1]!==void 0);return n.length===0?e:`${e}?${new URLSearchParams(n.map(([e,t])=>[e,String(t)]))}`}var f=encodeURIComponent,p={session:e=>l(`/api/v1/session`,{method:`POST`,body:JSON.stringify({token:e})}),redaction:()=>l(`/api/v1/meta/redaction`),servers:()=>l(`/api/v1/servers`),addServer:e=>l(`/api/v1/servers`,{method:`POST`,body:JSON.stringify(e)}),removeServer:e=>l(`/api/v1/servers/${f(e)}`,{method:`DELETE`}),tenants:e=>l(`/api/v1/servers/${f(e)}/tenants`),protection:(e,t)=>l(u(`/api/v1/servers/${f(e)}/protection`,t)),tools:(e,t)=>l(u(`/api/v1/servers/${f(e)}/tools`,t)),tool:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/tools/${f(t)}`,n)),setExposure:(e,t,n,r=``,i)=>l(u(`/api/v1/servers/${f(e)}/tools/${f(t)}/exposure`,i),{method:`PUT`,body:JSON.stringify({disabled:n,reason:r})}),toolRulePreview:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule/preview`,n),{method:`POST`,body:JSON.stringify(t)}),setToolRule:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule`,n),{method:`POST`,body:JSON.stringify(t)}),clearPreview:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule/${f(t)}/preview-clear`,n)),clearToolRule:(e,t,n,r)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule/${f(t)}?expectedDigest=${f(n)}`,r),{method:`DELETE`}),setUnclassifiedPosture:(e,t,n,r)=>l(u(`/api/v1/servers/${f(e)}/policy/unclassified`,r),{method:`PUT`,body:JSON.stringify({value:t,expectedDigest:n})}),setPolicySetting:(e,t,n,r,i,a)=>l(u(`/api/v1/servers/${f(e)}/policy/setting`,a),{method:`PUT`,body:JSON.stringify({path:t,value:n,expectedDigest:r,...i?{acknowledged:i}:{}})}),previewRules:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/preview`,n),{method:`POST`,body:JSON.stringify(t)}),setRule:(e,t,n,r,i,a)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/${f(t)}`,a),{method:`PUT`,body:JSON.stringify({rule:n,expectedDigest:r,...i?{acknowledged:i}:{}})}),addRule:(e,t,n,r,i,a)=>l(u(`/api/v1/servers/${f(e)}/policy/rules`,a),{method:`POST`,body:JSON.stringify({rule:t,expectedDigest:n,...r===void 0?{}:{index:r},...i?{acknowledged:i}:{}})}),deleteRule:(e,t,n,r,i)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/${f(t)}?expectedDigest=${f(n)}`+(r?.loosens?`&acknowledged=loosens`:``),i),{method:`DELETE`}),orderRules:(e,t,n,r,i)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/order`,i),{method:`POST`,body:JSON.stringify({order:t,expectedDigest:n,...r?{acknowledged:r}:{}})}),policyFile:(e,t)=>l(u(`/api/v1/servers/${f(e)}/policy/file`,t)),previewPolicyFile:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/file/preview`,n),{method:`POST`,body:JSON.stringify({text:t})}),writePolicyFile:(e,t,n,r,i)=>l(u(`/api/v1/servers/${f(e)}/policy/file`,i),{method:`PUT`,body:JSON.stringify({text:t,expectedDigest:n,...r?{acknowledged:r}:{}})}),pending:(e,t,n={})=>l(u(d(`/api/v1/servers/${f(e)}/approvals/pending`,{limit:n.limit}),t)),approvals:(e,t,n={})=>l(u(d(`/api/v1/servers/${f(e)}/approvals`,{limit:n.limit}),t)),decide:(e,t,n,r,i,a,o)=>l(u(`/api/v1/servers/${f(e)}/approvals/${f(t)}/decide`,i),{method:`POST`,body:JSON.stringify({state:n,note:r,...a?{classify:{effect:a}}:{},...o?{remember:o}:{}})}),grants:(e,t,n={})=>l(u(d(`/api/v1/servers/${f(e)}/grants`,{state:n.state===`active`?`active`:void 0,limit:n.limit}),t)),createGrant:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/grants`,n),{method:`POST`,body:JSON.stringify(t)}),previewGrant:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/grants/preview`,n),{method:`POST`,body:JSON.stringify(t)}),revokeGrant:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/grants/${f(t)}`,n),{method:`DELETE`}),audit:(e,t)=>l(`/api/v1/servers/${f(e)}/audit?${new URLSearchParams(t)}`),verify:(e,t)=>l(`/api/v1/servers/${f(e)}/audit/verify`+(t?`?expectHead=${f(t)}`:``)),combinedAudit:e=>l(`/api/v1/audit?${new URLSearchParams(e)}`),metrics:(e,t,n)=>l(`/api/v1/servers/${f(e)}/metrics?${new URLSearchParams({window:t,...n==null?{}:{tenant:n}})}`),scan:(e,t)=>l(u(`/api/v1/servers/${f(e)}/scan`,t)),scanSarif:(e,t)=>l(u(`/api/v1/servers/${f(e)}/scan?format=sarif`,t)),policy:(e,t)=>l(u(`/api/v1/servers/${f(e)}/policy`,t)),suggestions:(e,t)=>l(`/api/v1/servers/${f(e)}/suggestions`+(t?`?since=${f(t)}`:``)),status:e=>l(`/api/v1/servers/${f(e)}/status`),health:()=>l(`/api/v1/health`)};function m(){return document.cookie.match(/(?:^|;\s*)hmcp_csrf=([^;]+)/)?.[1]??``}async function h(e,t={}){let n={...t.headers??{}};t.method&&t.method!==`GET`&&(n[`Content-Type`]=`application/json`,n[`X-HMCP-CSRF`]=m());let r=await fetch(e,{...t,headers:n}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok){let e=a?.error??{code:`unknown`,message:r.statusText},t=new s(r.status,e.code,e.message);throw e.detail!==void 0&&(t.detail=e.detail),t}return a}var g=(e,t={})=>({method:e,body:JSON.stringify(t)}),_=encodeURIComponent,v=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,r);let n=t.toString();return n?`?${n}`:``},y=new Set;function b(e){return y.add(e),()=>void y.delete(e)}function x(e){S(e)}function S(e){for(let t of[...y])try{t(e)}catch{}}var C={catalog:()=>h(`/api/v1/catalog`),catalogDraft:(e,t)=>h(`/api/v1/catalog/${_(e)}/draft${v({variant:t})}`).then(e=>(S({kind:`opened`}),e)),registrySearch:(e,t)=>h(`/api/v1/registry/search${v({q:e,cursor:t})}`),paste:e=>h(`/api/v1/paste`,g(`POST`,{text:e})),testServer:e=>(S({kind:`testing`}),h(`/api/v1/test-server`,g(`POST`,e))),install:(e,t)=>h(`/api/v1/servers/${_(e)}/gateway/install`,g(`POST`,t)).then(e=>(t.preview||S({kind:`installed`,result:e}),e)),live:e=>h(`/api/v1/servers/${_(e)}/live`),retry:(e,t)=>h(`/api/v1/servers/${_(e)}/upstreams/${_(t)}/retry`,g(`POST`)),moveSecrets:(e,t)=>h(`/api/v1/servers/${_(e)}/gateway/secrets/move`,g(`POST`,{expectedDigest:t})),secrets:()=>h(`/api/v1/secrets`),createSecret:e=>h(`/api/v1/secrets`,g(`POST`,e)),replaceSecret:(e,t)=>h(`/api/v1/secrets/${_(e)}`,g(`PUT`,{value:t})),deleteSecret:e=>h(`/api/v1/secrets/${_(e)}`,{method:`DELETE`,headers:{"X-HMCP-CSRF":m()}}),oauthStart:e=>h(`/api/v1/oauth/start`,g(`POST`,e)),oauthComplete:e=>h(`/api/v1/oauth/complete`,g(`POST`,e)),oauthFlow:e=>h(`/api/v1/oauth/flows/${_(e)}`),doctor:()=>h(`/api/v1/system/doctor`),dirs:e=>h(`/api/v1/fs/dirs${v({path:e})}`),settings:()=>h(`/api/v1/console/settings`),saveSettings:e=>h(`/api/v1/console/settings`,g(`PUT`,e)),attach:e=>h(`/api/v1/connect/attach`,g(`POST`,e))},w=e((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})),T=e(((e,t)=>{t.exports=w()})),E=T(),D={home:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M3.5 10.5 12 3.5l8.5 7`}),(0,E.jsx)(`path`,{d:`M5.5 9v10.5a1 1 0 0 0 1 1h4v-6h3v6h4a1 1 0 0 0 1-1V9`})]}),inbox:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M3.5 13.5 6 5.5a1 1 0 0 1 1-.7h10a1 1 0 0 1 1 .7l2.5 8`}),(0,E.jsx)(`path`,{d:`M3.5 13.5V19a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-5.5h-5a3.5 3.5 0 0 1-7 0z`})]}),clock:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,E.jsx)(`path`,{d:`M12 7.5V12l3 2`})]}),tool:(0,E.jsx)(`path`,{d:`M15 4.5a4.5 4.5 0 0 0-4.3 5.8L4 17a2 2 0 0 0 3 3l6.7-6.7A4.5 4.5 0 0 0 19.5 9l-2.7 2.7-2.6-.9-.9-2.6L16 4.6a4.5 4.5 0 0 0-1-.1z`}),list:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,E.jsx)(`circle`,{cx:`4.5`,cy:`6`,r:`.8`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`4.5`,cy:`12`,r:`.8`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`4.5`,cy:`18`,r:`.8`,fill:`currentColor`})]}),activity:(0,E.jsx)(`path`,{d:`M3 12h4l2.5-6 5 12 2.5-6h4`}),shield:(0,E.jsx)(`path`,{d:`M12 3 19.5 5.8v5.9c0 4.4-2.8 7.4-7.5 9.3-4.7-1.9-7.5-4.9-7.5-9.3V5.8z`}),"shield-check":(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 3 19.5 5.8v5.9c0 4.4-2.8 7.4-7.5 9.3-4.7-1.9-7.5-4.9-7.5-9.3V5.8z`}),(0,E.jsx)(`path`,{d:`m8.8 12 2.2 2.2 4.2-4.4`})]}),key:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`8`,cy:`15`,r:`4`}),(0,E.jsx)(`path`,{d:`m11 12 8.5-8.5M16.5 6.5l2.5 2.5M14.5 8.5l2 2`})]}),lightbulb:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M9 17.5h6M10 20.5h4`}),(0,E.jsx)(`path`,{d:`M12 3.5a6 6 0 0 0-3.6 10.8c.6.5 1 1.2 1 2v1.2h5.2v-1.2c0-.8.4-1.5 1-2A6 6 0 0 0 12 3.5z`})]}),sliders:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4 7h9M17 7h3M4 17h3M11 17h9`}),(0,E.jsx)(`circle`,{cx:`15`,cy:`7`,r:`2`}),(0,E.jsx)(`circle`,{cx:`9`,cy:`17`,r:`2`})]}),plug:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M9 3.5V8M15 3.5V8`}),(0,E.jsx)(`path`,{d:`M6.5 8h11v3a5.5 5.5 0 0 1-11 0z`}),(0,E.jsx)(`path`,{d:`M12 16.5v4`})]}),settings:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,E.jsx)(`path`,{d:`M12 2.8v2.4M12 18.8v2.4M21.2 12h-2.4M5.2 12H2.8M18.5 5.5l-1.7 1.7M7.2 16.8l-1.7 1.7M18.5 18.5l-1.7-1.7M7.2 7.2 5.5 5.5`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6.6`})]}),help:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,E.jsx)(`path`,{d:`M9.6 9.5a2.5 2.5 0 0 1 4.8.8c0 1.7-2.4 2.1-2.4 3.7`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`17`,r:`.6`,fill:`currentColor`})]}),search:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`}),(0,E.jsx)(`path`,{d:`m16 16 4.5 4.5`})]}),bell:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2h-15z`}),(0,E.jsx)(`path`,{d:`M10 20.5a2 2 0 0 0 4 0`})]}),sun:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,E.jsx)(`path`,{d:`M12 2.5v2M12 19.5v2M21.5 12h-2M4.5 12h-2M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4M18.7 18.7l-1.4-1.4M6.7 6.7 5.3 5.3`})]}),moon:(0,E.jsx)(`path`,{d:`M19.5 14.5A7.5 7.5 0 0 1 9.5 4.5a7.5 7.5 0 1 0 10 10z`}),"arrow-up-right":(0,E.jsx)(`path`,{d:`M7 17 17 7M8.5 7H17v8.5`}),"arrow-right":(0,E.jsx)(`path`,{d:`M4.5 12h15M13.5 6l6 6-6 6`}),"arrow-left":(0,E.jsx)(`path`,{d:`M19.5 12h-15M10.5 6l-6 6 6 6`}),plus:(0,E.jsx)(`path`,{d:`M12 5v14M5 12h14`}),minus:(0,E.jsx)(`path`,{d:`M5 12h14`}),check:(0,E.jsx)(`path`,{d:`m5 12.5 4.5 4.5L19 7.5`}),x:(0,E.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`}),power:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 3v8`}),(0,E.jsx)(`path`,{d:`M7 6.3a7.5 7.5 0 1 0 10 0`})]}),play:(0,E.jsx)(`path`,{d:`M7.5 5v14l11-7z`}),stop:(0,E.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`}),pause:(0,E.jsx)(`path`,{d:`M8.5 5.5v13M15.5 5.5v13`}),refresh:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M19.5 12a7.5 7.5 0 1 1-2.2-5.3`}),(0,E.jsx)(`path`,{d:`M19.5 4v4h-4`})]}),download:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 4v11M7.5 10.5 12 15l4.5-4.5`}),(0,E.jsx)(`path`,{d:`M4.5 19.5h15`})]}),copy:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`rect`,{x:`8.5`,y:`8.5`,width:`11`,height:`11`,rx:`2`}),(0,E.jsx)(`path`,{d:`M15.5 8.5V6a1.5 1.5 0 0 0-1.5-1.5H6A1.5 1.5 0 0 0 4.5 6v8A1.5 1.5 0 0 0 6 15.5h2.5`})]}),chevron:(0,E.jsx)(`path`,{d:`m7 9.5 5 5 5-5`}),"chevron-right":(0,E.jsx)(`path`,{d:`m9.5 7 5 5-5 5`}),"chevron-left":(0,E.jsx)(`path`,{d:`m14.5 7-5 5 5 5`}),external:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M13.5 4.5h6v6M19.5 4.5 11 13`}),(0,E.jsx)(`path`,{d:`M17.5 14v4.5a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1H10`})]}),warning:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 4 21 19.5H3z`}),(0,E.jsx)(`path`,{d:`M12 10v4.5`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`17`,r:`.6`,fill:`currentColor`})]}),info:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,E.jsx)(`path`,{d:`M12 11v5.5`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`8`,r:`.6`,fill:`currentColor`})]}),lock:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`rect`,{x:`5`,y:`10.5`,width:`14`,height:`10`,rx:`2`}),(0,E.jsx)(`path`,{d:`M8 10.5V8a4 4 0 0 1 8 0v2.5`})]}),eye:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),"eye-off":(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4 4l16 16`}),(0,E.jsx)(`path`,{d:`M10 5.7A9 9 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-2.7 3.4M6.5 7.2A15.6 15.6 0 0 0 2.5 12S6 18.5 12 18.5c1.4 0 2.7-.3 3.8-.9`})]}),trash:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4.5 7h15M9.5 7V4.5h5V7`}),(0,E.jsx)(`path`,{d:`M6.5 7l1 12.5a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1l1-12.5`}),(0,E.jsx)(`path`,{d:`M10 11v6M14 11v6`})]}),filter:(0,E.jsx)(`path`,{d:`M4 5h16l-6.2 7.5V19l-3.6 1.5v-8z`}),user:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,E.jsx)(`path`,{d:`M4.5 20.5a7.5 7.5 0 0 1 15 0`})]}),users:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`9`,cy:`8.5`,r:`3.5`}),(0,E.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,E.jsx)(`path`,{d:`M15.5 5.2a3.5 3.5 0 0 1 0 6.6M18 14.2a6.5 6.5 0 0 1 3.5 5.8`})]}),menu:(0,E.jsx)(`path`,{d:`M4 7h16M4 12h16M4 17h16`}),server:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`6.5`,rx:`2`}),(0,E.jsx)(`rect`,{x:`4`,y:`13.5`,width:`16`,height:`6.5`,rx:`2`}),(0,E.jsx)(`path`,{d:`M7.5 7.2h.01M7.5 16.7h.01`,strokeWidth:`2.4`})]}),edit:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4.5 19.5h4l10-10a2.8 2.8 0 0 0-4-4l-10 10z`}),(0,E.jsx)(`path`,{d:`m13 7 4 4`})]}),file:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M14 3.5H7a1.5 1.5 0 0 0-1.5 1.5v14A1.5 1.5 0 0 0 7 20.5h10a1.5 1.5 0 0 0 1.5-1.5V8z`}),(0,E.jsx)(`path`,{d:`M14 3.5V8h4.5`})]}),folder:(0,E.jsx)(E.Fragment,{children:(0,E.jsx)(`path`,{d:`M3.5 7A1.5 1.5 0 0 1 5 5.5h4.2l2 2.2H19a1.5 1.5 0 0 1 1.5 1.5V17a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 17z`})}),dots:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`6`,cy:`12`,r:`1`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`12`,r:`1`,fill:`currentColor`})]})},O={wrench:`tool`},k=Object.keys(D);function A({name:e,size:t=20,strokeWidth:n=1.7,label:r,className:i}){return(0,E.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,className:i,role:r?`img`:void 0,"aria-label":r,"aria-hidden":!r||void 0,focusable:`false`,children:D[e in O?O[e]:e]})}function j(){return{path:location.pathname,query:new URLSearchParams(location.search)}}var M=new Set;function N(){let e=j();for(let t of M)t(e)}typeof window<`u`&&window.addEventListener(`popstate`,N);function P(){let[e,t]=(0,a.useState)(j);return(0,a.useEffect)(()=>(M.add(t),()=>{M.delete(t)}),[]),e}function F(e){e!==location.pathname+location.search&&(history.pushState(null,``,e),N())}function ee(e){e!==location.pathname+location.search&&(history.replaceState(null,``,e),N())}function I(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.currentTarget.getAttribute(`target`);t&&t!==`_self`||(e.preventDefault(),F(e.currentTarget.getAttribute(`href`)??`/`))}function te(e,t){let n=new URLSearchParams(e.query);for(let[e,r]of Object.entries(t))r===null||r===``?n.delete(e):n.set(e,r);let r=n.toString();return r?`${e.path}?${r}`:e.path}function L(e,t,n={},r=[`server`,`tenant`]){let i=new URLSearchParams;for(let t of r){let n=e.query.get(t);n!==null&&i.set(t,n)}for(let[e,t]of Object.entries(n))i.set(e,t);let a=i.toString();return a?`${t}?${a}`:t}function R(...e){return e.filter(Boolean).join(` `)}function ne(e,t=250){let[n,r]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function z({variant:e=`secondary`,size:t=`md`,icon:n,iconRight:r,loading:i=!1,className:a,children:o,disabled:s,type:c=`button`,...l}){return(0,E.jsxs)(`button`,{type:c,disabled:s||i,"aria-busy":i||void 0,className:R(`btn`,`btn-${t}`,`btn-${e}`,a),...l,children:[i?(0,E.jsx)(V,{}):n&&(0,E.jsx)(A,{name:n,size:t===`sm`?16:18,strokeWidth:2}),(0,E.jsx)(`span`,{children:o}),r&&(0,E.jsx)(A,{name:r,size:t===`sm`?16:18,strokeWidth:2})]})}function re({href:e,variant:t=`secondary`,size:n=`md`,icon:r,iconRight:i,className:a,children:o,external:s}){return(0,E.jsxs)(`a`,{href:e,onClick:s?void 0:I,target:s?`_blank`:void 0,rel:s?`noreferrer`:void 0,className:R(`btn`,`btn-${n}`,`btn-${t}`,a),children:[r&&(0,E.jsx)(A,{name:r,size:n===`sm`?16:18,strokeWidth:2}),(0,E.jsx)(`span`,{children:o}),i&&(0,E.jsx)(A,{name:i,size:n===`sm`?16:18,strokeWidth:2})]})}function B({icon:e,label:t,variant:n=`ghost`,size:r=40,href:i,className:a,badge:o,...s}){let c=R(`icon-btn`,o?`relative`:void 0,`icon-btn-${n}`,a),l={width:r,height:r},u=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(A,{name:e,size:Math.round(r*.48),strokeWidth:1.8}),o?(0,E.jsx)(`span`,{"aria-hidden":!0,className:`tnum absolute -top-0.5 -right-0.5 grid h-[18px] min-w-[18px] place-items-center rounded-full bg-primary px-1 text-[11px] font-bold text-white`,children:o>99?`99+`:o}):null]}),d=o?`${o>99?`99+`:o} ${t.toLowerCase()}`:t;return i?(0,E.jsx)(`a`,{href:i,onClick:I,"aria-label":d,title:t,className:c,style:l,children:u}):(0,E.jsx)(`button`,{type:`button`,"aria-label":d,title:t,className:c,style:l,...s,children:u})}function V({size:e=16}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`animate-spin`,"aria-hidden":!0,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`none`,stroke:`currentColor`,strokeOpacity:`.25`,strokeWidth:`3`}),(0,E.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`})]})}function ie({title:e,actions:t,tone:n=`plain`,href:r,padded:i=!0,className:a,children:o,as:s=`section`,titleId:c,id:l}){let u=(0,E.jsxs)(E.Fragment,{children:[(e||t)&&(0,E.jsxs)(`header`,{className:`mb-4 flex min-h-8 items-center justify-between gap-3`,children:[e&&(0,E.jsx)(`h2`,{id:c,className:`text-[19px] leading-tight font-medium tracking-[-0.02em]`,children:e}),t&&(0,E.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:t})]}),o]}),d=R(`card block min-w-0`,n===`hero`&&`card-hero`,i&&`p-6`,r&&`card-link`,a);return r?(0,E.jsx)(`a`,{id:l,href:r,onClick:I,className:d,children:u}):(0,E.jsx)(s,{id:l,className:d,"aria-labelledby":c,children:u})}function ae({title:e,value:t,sub:n,delta:r,href:i,hrefLabel:a,tone:o=`plain`,loading:s,className:c}){let l=o===`hero`;return(0,E.jsxs)(`section`,{className:R(`card flex min-h-[184px] min-w-0 flex-col p-6`,l&&`card-hero`,c),children:[(0,E.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsx)(`h2`,{className:`pt-1.5 text-[17px] leading-tight font-medium tracking-[-0.015em]`,children:e}),i&&(0,E.jsx)(B,{icon:`arrow-up-right`,href:i,label:a??`Open ${e}`,variant:l?`hero`:`outline`,size:38})]}),(0,E.jsx)(`div`,{className:`display tnum mt-auto pt-4 text-[52px]`,children:s?(0,E.jsx)(`span`,{className:`skeleton inline-block h-12 w-20 align-middle`}):t}),(n||r!==void 0)&&(0,E.jsxs)(`p`,{className:R(`mt-3 flex items-center gap-2 text-[13px]`,l?`text-on-hero-soft`:`text-soft`),children:[r!==void 0&&(0,E.jsxs)(`span`,{className:R(`tnum inline-flex items-center gap-0.5 rounded-md border px-1 text-[11px] font-semibold`,l?`border-on-hero-soft/60`:`border-line`),children:[Math.abs(r),(0,E.jsx)(A,{name:r>=0?`arrow-up-right`:`chevron`,size:11,strokeWidth:2.4})]}),n]})]})}var H={allow:{label:`Runs freely`,tone:`ok`,short:`Ran`},approve:{label:`Asks you first`,tone:`warn`,short:`Asked`},deny:{label:`Blocked`,tone:`bad`,short:`Blocked`}},U={read:{label:`Looks only`,explain:`Reads information and changes nothing.`},write:{label:`Makes changes`,explain:`Creates or edits something, such as a file or a record.`},destructive:{label:`Deletes`,explain:`Removes or overwrites something that may not come back.`},unknown:{label:`Not labelled yet`,explain:`Nobody has said what this tool does, so it is treated with care.`}},oe={completed:{label:`Done`,tone:`ok`},denied:{label:`Blocked`,tone:`bad`},"pending-approval":{label:`Waiting for you`,tone:`warn`},error:{label:`Failed`,tone:`bad`},relayed:{label:`Let through`,tone:`ok`}},se={"exposure.disabled":`Tool is turned off`,"tenant.on_mismatch":`Wrong customer`,"tenant.required":`No customer named`,"defaults.on_unclassified":`Tool not labelled yet`,"defaults.mode":`Default stance`,"gateway.unknown-tool":`Unknown tool`,rule:`A rule you set`},ce={enforce:{label:`Protecting`,explain:`Rules are applied: blocked calls stop, and some calls wait for you.`,tone:`ok`},observe:{label:`Watch-only`,explain:`Every call runs. The log records what would have been blocked or held.`,tone:`bad`}},le={"read-only":{label:`Only let it look`,explain:`Tools that look run. Anything that changes or deletes is blocked.`},"approve-writes":{label:`Ask before changes`,explain:`Tools that look run. Changes and deletes wait for you to approve.`},locked:{label:`Lock everything`,explain:`Every call is blocked unless a rule lets it through.`}};function ue(e){return H[e]?.label??e}function de(e){return U[e??`unknown`]?.label??e??U.unknown.label}function fe(e){return oe[e]?.label??e}var W={gateway:{plain:`Gateway`,technical:`gateway`,explain:`The technical name for your toolbox: the checkpoint between your AI app and the tools it uses. Every tool call passes through it, and it decides whether the call runs, waits for you, or is blocked.`},connectedServer:{plain:`Connected server`,technical:`upstream`,explain:`A server in your toolbox, such as the Files or GitHub server. Your AI app reaches it through the toolbox.`},customer:{plain:`Customer`,technical:`tenant`,explain:`When one toolbox serves several customers, each one's approvals, pre-approvals and switches are kept apart. You choose which customer you are looking at.`},policyFile:{plain:`Protection settings file`,technical:`policy.yaml`,explain:`The file that holds every rule and setting on the Protection settings page. Your toolbox reads it when it starts and whenever it changes.`},activityLog:{plain:`Activity log`,technical:`audit log`,explain:`A record of every tool call and every change made here: who asked, what was decided, and how it ended.`},hashChain:{plain:`Tamper check`,technical:`hash chain`,explain:`Each log entry carries a fingerprint of the one before it. If anyone edits or removes an entry, the chain breaks and the integrity check says so.`},fingerprint:{plain:`Saved fingerprint`,technical:`expect-head`,explain:`A copy of the log's latest fingerprint, kept somewhere else. Comparing against it shows whether entries were cut from the end of the log.`},redaction:{plain:`Hidden values`,technical:`redaction`,explain:`Passwords, keys and similar secrets are replaced with a marker before a call is written to the log, so the log never holds them.`},preApproval:{plain:`Pre-approval`,technical:`standing grant`,explain:`Permission given in advance for a tool to run without asking you, for a limited time or number of uses. It can be revoked at any time.`},watchOnly:{plain:`Watch-only`,technical:`enforcement: observe`,explain:`Nothing is blocked and nothing waits for you; the log notes what would have happened. Use it to see what your rules would do before turning them on.`},protecting:{plain:`Protecting`,technical:`enforcement: enforce`,explain:`Rules are applied: blocked calls stop and some calls wait for your approval.`},changedTools:{plain:`Changed tools`,technical:`pins / contract change`,explain:`A tool whose name, description or inputs changed since you last reviewed it. A changed tool can mean an update, or someone slipping in new behaviour, so it is held until you accept it.`},killSwitch:{plain:`Turn off tool`,technical:`exposure.disabled`,explain:`Hides a tool from your AI app and blocks every call to it, even in watch-only mode. Turn it back on at any time.`},defaultStance:{plain:`Default stance`,technical:`defaults.mode`,explain:`What happens to a call that no rule mentions: let reading tools run, ask before changes, or block everything.`},unknownTools:{plain:`Tools not labelled yet`,technical:`defaults.on_unclassified`,explain:`A tool nobody has marked as looking, changing or deleting. You choose whether such tools are blocked or wait for you.`},limits:{plain:`Input limits`,technical:`bounds / arg constraints`,explain:`Allowed values for a tool's inputs, such as which folders a file tool may touch. A call outside its limits is blocked or waits for you.`},networkLimits:{plain:`Network limits`,technical:`egress`,explain:`Which internet addresses your toolbox may reach for servers on the web (the allowed addresses), and how big or slow those requests may be. A server that runs on your computer is an ordinary program and reaches the internet itself, so these limits don't cover it.`},toolBudget:{plain:`Tool limit`,technical:`tool_budget`,explain:`The most tools your AI app is shown at once. Fewer tools are easier to review and harder to confuse.`},rule:{plain:`Rule`,technical:`policy rule`,explain:`A line in your protection settings that says what happens when a matching tool is called.`},approval:{plain:`Waiting for you`,technical:`approval request`,explain:`A call that your toolbox paused until you approve it or say no. It expires if nobody answers.`},suggestion:{plain:`Suggestion`,technical:`suggestions`,explain:`A rule proposed from what watch-only mode saw, so you can turn protection on without blocking work you rely on.`},safetyCheck:{plain:`Safety check`,technical:`scan / findings`,explain:`A review of your toolbox's tools and settings that lists weak spots, how serious each is, and how to fix it.`},step1KillSwitch:{plain:`1. Is the tool turned off?`,technical:`exposure.disabled`,explain:`A tool you turned off is blocked before anything else is checked.`},step2Customer:{plain:`2. Is it the right customer?`,technical:`tenant.on_mismatch / tenant.required`,explain:`A call for the wrong customer, or for no customer when one is required, is blocked.`},step3Limits:{plain:`3. Are the inputs within limits?`,technical:`arg constraints / on_violation`,explain:`If a rule sets input limits and the call breaks them, it is blocked or waits for you.`},step4Unlabelled:{plain:`4. Has anyone labelled the tool?`,technical:`defaults.on_unclassified`,explain:`A tool nobody has labelled is blocked or waits for you, as you choose.`},step5Rule:{plain:`5. Does a rule match?`,technical:`rules[]`,explain:`The first rule that matches the tool decides: runs freely, asks you first, or blocked.`},step6Stance:{plain:`6. Default stance`,technical:`defaults.mode`,explain:`If nothing else answered, the default stance decides.`},HMCP001:{plain:`A change can happen without asking`,technical:`HMCP001`,explain:`A tool that makes changes or deletes can run without anyone approving it, or its input limits leave gaps. Make it ask first, or tighten its limits.`},HMCP002:{plain:`Customers are not kept apart`,technical:`HMCP002`,explain:`One customer's calls could reach another customer's data. Turn on customer separation.`},HMCP003:{plain:`A list has no size cap`,technical:`HMCP003`,explain:`A tool that lists things can return unlimited results, which can leak data or swamp the AI app. Set a maximum.`},HMCP004:{plain:`A secret is visible`,technical:`HMCP004`,explain:`A password, key or token appears in a tool's name, description or settings, where your AI app can read it.`},HMCP005:{plain:`Hidden instructions in a tool description`,technical:`HMCP005`,explain:`A tool's description contains text aimed at the AI, such as 'ignore your rules'. Your toolbox removes it, but the server sending it deserves a look.`},HMCP006:{plain:`A tool accepts any input`,technical:`HMCP006`,explain:`A tool's inputs are loosely defined, so the AI can send fields nobody checked. Close the input list or add limits.`},HMCP007:{plain:`A server address is outside network limits`,technical:`HMCP007`,explain:`A connected server points at an address your network limits do not allow, so its calls will fail or the limits are wrong.`},HMCP008:{plain:`Retired check`,technical:`HMCP008`,explain:`This check was removed in an earlier version. Old log entries may still mention it.`},HMCP009:{plain:`Too many tools, or look-alikes`,technical:`HMCP009`,explain:`There are more tools than you can review, or two have names close enough for the AI to mix them up.`},HMCP010:{plain:`Activity log is off or weakened`,technical:`HMCP010`,explain:`The activity log is turned off, or its tamper check is off, so you could not prove what happened.`},HMCP011:{plain:`A tool changed after review`,technical:`HMCP011`,explain:`A tool's description or inputs changed since you reviewed it. It is held under Changed tools until you accept it.`},HMCP012:{plain:`A result was withheld`,technical:`HMCP012`,explain:`A tool's answer contained hidden instructions or a secret, so your toolbox kept it from the AI app.`},mcp:{plain:`MCP server`,technical:`Model Context Protocol (MCP)`,explain:`A small add-on that gives your AI app a set of tools, such as reading your files or opening GitHub issues. MCP is a shared standard, so any AI app can use any of them.`},toolbox:{plain:`Toolbox`,technical:`gateway (~/.hmcp/gateways/<name>)`,explain:`Your AI app connects to one toolbox instead of to each server. The toolbox holds your servers and checks every action before it happens. Technical pages sometimes call it a gateway.`},lockedKey:{plain:`Locked key`,technical:`~/.hmcp/secrets.json`,explain:`A password or key a server needs, kept in a file only your user account can open. Your settings refer to it by name, so the key itself is never shown here or written anywhere else.`},signIn:{plain:`Sign in`,technical:`OAuth 2.1 with PKCE`,explain:`Some services let you sign in on their own website instead of making a key. You approve access there, and the service hands your toolbox a pass that is kept in your locked keys and renewed by itself.`},publicList:{plain:`Public server list`,technical:`MCP Registry (registry.modelcontextprotocol.io)`,explain:`A public directory of MCP servers that anyone can publish to. When you search it, only the words you type are sent. Nobody has checked the servers on it, including us.`},machineCheck:{plain:`Computer check`,technical:`Asks each program which version it is`,explain:`Looks for the free programs servers use to run, such as Node.js and uv, and says which are missing. It only looks; it never installs or changes anything.`},allowedAddresses:{plain:`Allowed addresses`,technical:`egress.allow`,explain:`The web addresses your toolbox may reach when it talks to servers on the web. Anything not on the list is stopped. A server that runs on your computer is an ordinary program with your permissions: it can use the internet directly, and this list doesn't limit it. Only add servers like that if you trust them.`}},pe=[`step1KillSwitch`,`step2Customer`,`step3Limits`,`step4Unlabelled`,`step5Rule`,`step6Stance`];function me(e){return W[e]?.plain??e}var he={ok:`bg-ok-tint text-ok border-ok/25`,warn:`bg-warn-tint text-warn border-warn/25`,bad:`bg-bad-tint text-bad border-bad/25`,neutral:`bg-info-tint text-muted border-line`};function ge({tone:e=`neutral`,icon:t,children:n,className:r,title:i}){return(0,E.jsxs)(`span`,{className:R(`pill`,he[e],r),title:i,children:[t&&(0,E.jsx)(A,{name:t,size:13,strokeWidth:2.2}),n]})}function _e({decision:e,label:t}){let n=H[e],r=e===`allow`?`check`:e===`approve`?`clock`:e===`deny`?`x`:`help`;return(0,E.jsx)(ge,{tone:n?.tone??`neutral`,icon:r,children:t??n?.label??e})}function ve({decision:e}){return(0,E.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-2.5 w-2.5 shrink-0 rounded-full`,style:{background:`var(--mark-${e})`}})}var ye={read:`eye`,write:`edit`,destructive:`trash`,unknown:`help`};function be({effect:e,withLabel:t=!1}){let n=e&&e in U?e:`unknown`,r=U[n];return(0,E.jsxs)(`span`,{className:R(`inline-flex items-center gap-1.5`,n===`destructive`?`text-bad`:n===`write`?`text-warn`:n===`read`?`text-ok`:`text-soft`),title:r.explain,children:[(0,E.jsx)(A,{name:ye[n],size:16,strokeWidth:2,label:t?void 0:r.label}),t&&(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:r.label})]})}function xe({count:e,label:t}){return e<=0?null:(0,E.jsx)(`span`,{className:`tnum rounded-md bg-green-deep px-1.5 py-px text-[11px] leading-4 font-bold text-white`,"aria-label":t?`${e} ${t}`:void 0,children:e>99?`99+`:e})}function Se({columns:e,rows:t,rowKey:n,onRowClick:r,caption:i,empty:a,selectedKey:o}){if(t.length===0&&a)return(0,E.jsx)(E.Fragment,{children:a});let s=e=>t=>{r&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))};return(0,E.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-[14px]`,children:[i&&(0,E.jsx)(`caption`,{className:`sr-only`,children:i}),(0,E.jsx)(`thead`,{className:`max-sm:hidden`,children:(0,E.jsx)(`tr`,{children:e.map(e=>(0,E.jsx)(`th`,{scope:`col`,className:R(`border-b border-line px-3 pb-2.5 text-[12px] font-semibold tracking-wide text-soft uppercase first:pl-0 last:pr-0`,e.align===`right`?`text-right`:`text-left`,e.width),children:e.header},e.key))})}),(0,E.jsx)(`tbody`,{children:t.map(t=>{let i=n(t);return(0,E.jsx)(`tr`,{onClick:r?()=>r(t):void 0,onKeyDown:s(t),tabIndex:r?0:void 0,"aria-selected":o===void 0?void 0:o===i,className:R(`group max-sm:mb-3 max-sm:block max-sm:rounded-2xl max-sm:border max-sm:border-line max-sm:p-3`,r&&`cursor-pointer`,o===i&&`bg-faint`),children:e.map(e=>(0,E.jsxs)(`td`,{className:R(`border-b border-faint px-3 py-3 align-middle first:pl-0 last:pr-0 group-last:border-b-0`,r&&`group-hover:bg-faint/60`,`max-sm:flex max-sm:items-start max-sm:justify-between max-sm:gap-4 max-sm:border-0 max-sm:px-0 max-sm:py-1`,e.align===`right`&&`sm:text-right`,e.hideOnMobile&&`max-sm:hidden`),children:[(0,E.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-soft sm:hidden`,children:e.header}),(0,E.jsx)(`span`,{className:`min-w-0 max-sm:text-right`,children:e.cell(t)})]},e.key))},i)})})]})}function Ce({icon:e,iconTone:t=`neutral`,leading:n,title:r,sub:i,wrapSub:a,trailing:o,href:s,onClick:c}){let l={neutral:`bg-sunken text-muted`,ok:`bg-ok-tint text-ok`,warn:`bg-warn-tint text-warn`,bad:`bg-bad-tint text-bad`,brand:`bg-green-deep text-white`}[t],u=(0,E.jsxs)(E.Fragment,{children:[n??(e&&(0,E.jsx)(`span`,{className:R(`grid h-10 w-10 shrink-0 place-items-center rounded-full`,l),children:(0,E.jsx)(A,{name:e,size:19})})),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`span`,{className:`block truncate text-[14.5px] font-medium`,children:r}),i&&(0,E.jsx)(`span`,{className:R(`mt-0.5 block text-[12.5px] text-soft`,a?`break-words`:`truncate`),children:i})]}),o&&(0,E.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),d=`flex w-full items-center gap-3 rounded-2xl py-2.5 text-left`;return s?(0,E.jsx)(`a`,{href:s,onClick:I,className:R(d,`-mx-2 px-2 transition-colors hover:bg-faint`),children:u}):c?(0,E.jsx)(`button`,{type:`button`,onClick:c,className:R(d,`-mx-2 px-2 transition-colors hover:bg-faint`),children:u}):(0,E.jsx)(`div`,{className:d,children:u})}function we({items:e,value:t,onChange:n,label:r}){let i=(0,a.useRef)(null);return(0,E.jsx)(`div`,{ref:i,role:`tablist`,"aria-label":r,onKeyDown:r=>{let a=e.findIndex(e=>e.id===t),o=r.key===`ArrowRight`?a+1:r.key===`ArrowLeft`?a-1:r.key===`Home`?0:r.key===`End`?e.length-1:null;if(o===null)return;r.preventDefault();let s=e[(o+e.length)%e.length];n(s.id),i.current?.querySelector(`#${G(s.id)}`)?.focus()},className:`scrollbar-thin inline-flex max-w-full gap-1 overflow-x-auto rounded-full bg-sunken p-1`,children:e.map(e=>{let r=e.id===t;return(0,E.jsxs)(`button`,{id:G(e.id),role:`tab`,type:`button`,"aria-selected":r,"aria-controls":Te(e.id),tabIndex:r?0:-1,onClick:()=>n(e.id),className:R(`inline-flex h-9 shrink-0 items-center gap-2 rounded-full px-4 text-[13.5px] font-semibold transition-colors`,r?`bg-surface text-ink shadow-[var(--shadow-sm)]`:`text-soft hover:text-ink`),children:[e.label,e.count!==void 0&&(0,E.jsx)(`span`,{className:R(`tnum rounded-full px-1.5 text-[11.5px]`,r?`bg-green-deep text-white`:`bg-faint`),children:e.count})]},e.id)})})}var G=e=>`tab-${e.replace(/[^\w-]/g,`_`)}`,Te=e=>`tabpanel-${e.replace(/[^\w-]/g,`_`)}`;function Ee({icon:e=`inbox`,title:t,children:n,actions:r,compact:i,level:a}){let o=a===2?`h2`:`h3`;return(0,E.jsxs)(`div`,{className:R(`flex flex-col items-center text-center`,i?`py-6`:`py-12`),children:[(0,E.jsx)(`span`,{className:`grid h-14 w-14 place-items-center rounded-full bg-sunken text-muted`,children:(0,E.jsx)(A,{name:e,size:26})}),(0,E.jsx)(o,{className:`mt-4 text-[17px] font-medium`,children:t}),n&&(0,E.jsx)(`div`,{className:`mt-1.5 max-w-md text-[14px] text-soft`,children:n}),r&&(0,E.jsx)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-2`,children:r})]})}function De({height:e=14,width:t=`100%`,lines:n=1,className:r}){return(0,E.jsx)(`span`,{className:R(`flex flex-col gap-2`,r),"aria-hidden":!0,children:Array.from({length:n},(r,i)=>(0,E.jsx)(`span`,{className:`skeleton block`,style:{height:e,width:i===n-1&&n>1?`60%`:t}},i))})}var Oe={info:{cls:`border-line`,icon:`info`,accent:`bg-info-tint text-muted`},warn:{cls:`border-warn/40`,icon:`warning`,accent:`bg-warn-tint text-warn`},danger:{cls:`border-bad/45`,icon:`warning`,accent:`bg-bad-tint text-bad`},ok:{cls:`border-ok/40`,icon:`check`,accent:`bg-ok-tint text-ok`}};function K({tone:e=`info`,title:t,children:n,actions:r,role:i}){let a=Oe[e];return(0,E.jsxs)(`div`,{role:i,className:R(`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[18px] border-[1.5px] bg-surface px-4 py-3.5 text-ink shadow-[var(--shadow-sm)]`,a.cls),children:[(0,E.jsx)(`span`,{className:R(`grid h-9 w-9 shrink-0 place-items-center self-start rounded-full`,a.accent),children:(0,E.jsx)(A,{name:a.icon,size:18,strokeWidth:2})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 basis-60 self-center text-[14px]`,children:[t&&(0,E.jsx)(`p`,{className:`font-semibold`,children:t}),n&&(0,E.jsx)(`div`,{className:R(!!t&&`mt-0.5`,`text-muted`),children:n})]}),r&&(0,E.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:r})]})}var q=e=>e instanceof Date?e.getTime():typeof e==`string`?Date.parse(e):e;function ke(e,t=Date.now()){let n=q(e)-t,r=Math.abs(n);if(r<45e3)return n>0?`in a moment`:`just now`;let[i,a]=r<36e5?[Math.round(r/6e4),`min`]:r<864e5?[Math.round(r/36e5),`h`]:[Math.round(r/864e5),Math.round(r/864e5)===1?`day`:`days`];return n>=0?`in ${i} ${a}`:`${i} ${a} ago`}function Ae(e){return new Date(q(e)).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function je(e){return new Date(q(e)).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function J(e){let t=Math.max(0,Math.round(e));if(t<60)return`${t} s`;if(t<3600)return`${Math.round(t/60)} min`;if(t<86400){let e=Math.floor(t/3600),n=Math.round(t%3600/60);return n?`${e} h ${n} min`:`${e} h`}let n=Math.round(t/86400);return`${n} ${n===1?`day`:`days`}`}function Me(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(+(e<1e4))} s`}function Y(e){return Math.abs(e)>=1e6?new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(e):new Intl.NumberFormat().format(e)}function Ne(e,t,n=`${t}s`){return`${Y(e)} ${e===1?t:n}`}function Pe(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function Fe(e){let t=/^\s*(\d+(?:\.\d+)?)\s*(s|m|h|d)\s*$/i.exec(e);if(!t)return null;let n=Number(t[1]),r=t[2].toLowerCase();return Math.round(n*(r===`s`?1:r===`m`?60:r===`h`?3600:86400))}var Ie=(0,a.createContext)(null);function X(e){let t=(0,a.useContext)(Ie),n=(0,a.useId)();return t?e?{...t,id:e}:t:{id:e??n,invalid:!1}}function Le({label:e,help:t,error:n,optional:r,technical:i,children:o,className:s}){let c=(0,a.useId)(),l=`${c}-help`,u=`${c}-err`,d=[t&&l,n&&u].filter(Boolean).join(` `)||void 0;return(0,E.jsx)(Ie.Provider,{value:{id:c,describedBy:d,invalid:!!n},children:(0,E.jsxs)(`div`,{className:R(`flex flex-col gap-1.5`,s),children:[(0,E.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,E.jsxs)(`label`,{htmlFor:c,className:`text-[13px] font-semibold text-ink`,children:[e,r&&(0,E.jsx)(`span`,{className:`ml-2 font-normal text-soft`,children:`optional`})]}),i&&(0,E.jsx)(`code`,{"aria-hidden":!0,className:`mono text-[11.5px] font-normal text-soft`,children:i})]}),o,t&&!n&&(0,E.jsx)(`p`,{id:l,className:`text-[12.5px] text-soft`,children:t}),n&&(0,E.jsxs)(`p`,{id:u,role:`alert`,className:`flex items-center gap-1.5 text-[12.5px] font-medium text-bad`,children:[(0,E.jsx)(A,{name:`warning`,size:14,strokeWidth:2}),n]})]})})}function Re({value:e,onChange:t,type:n=`text`,autoFocus:r,onEnter:i,...a}){let o=X(a.id);return(0,E.jsx)(`input`,{id:o.id,type:n,value:e,onChange:e=>t(e.target.value),onKeyDown:i?e=>e.key===`Enter`&&i():void 0,placeholder:a.placeholder,disabled:a.disabled,"aria-label":a[`aria-label`],"aria-describedby":o.describedBy,"aria-invalid":o.invalid||void 0,autoFocus:r,className:R(`field`,a.mono&&`font-mono text-[13px]`,a.className)})}function ze({value:e,onChange:t,rows:n=3,...r}){let i=X(r.id);return(0,E.jsx)(`textarea`,{id:i.id,value:e,rows:n,onChange:e=>t(e.target.value),placeholder:r.placeholder,disabled:r.disabled,"aria-label":r[`aria-label`],"aria-describedby":i.describedBy,"aria-invalid":i.invalid||void 0,className:R(`field resize-y`,r.mono&&`font-mono text-[13px]`,r.className)})}function Be({value:e,onChange:t,min:n,max:r,step:i,unit:a,...o}){let s=X(o.id);return(0,E.jsxs)(`span`,{className:R(`relative flex items-center`,o.className),children:[(0,E.jsx)(`input`,{id:s.id,type:`number`,inputMode:`decimal`,value:e??``,min:n,max:r,step:i,onChange:e=>t(e.target.value===``?null:Number(e.target.value)),placeholder:o.placeholder,disabled:o.disabled,"aria-label":o[`aria-label`],"aria-describedby":s.describedBy,"aria-invalid":s.invalid||void 0,className:R(`field tnum`,a&&`pr-14`)}),a&&(0,E.jsx)(`span`,{className:`pointer-events-none absolute right-3 text-[13px] text-soft`,children:a})]})}function Ve({value:e,onChange:t,options:n,...r}){let i=X(r.id);return(0,E.jsxs)(`span`,{className:R(`relative flex items-center`,r.className),children:[(0,E.jsx)(`select`,{id:i.id,value:e,onChange:e=>t(e.target.value),disabled:r.disabled,"aria-label":r[`aria-label`],"aria-describedby":i.describedBy,"aria-invalid":i.invalid||void 0,className:`field appearance-none pr-9`,children:n.map(e=>(0,E.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))}),(0,E.jsx)(A,{name:`chevron`,size:16,className:`pointer-events-none absolute right-3 text-soft`})]})}function He({value:e,onChange:t,options:n,label:r,size:i=`md`}){return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":r,onKeyDown:r=>{let i=n.filter(e=>!e.disabled),a=i.findIndex(t=>t.value===e),o=r.key===`ArrowRight`||r.key===`ArrowDown`?1:r.key===`ArrowLeft`||r.key===`ArrowUp`?-1:0;if(!o)return;r.preventDefault();let s=i[(a+o+i.length)%i.length];s&&(t(s.value),r.currentTarget.querySelector(`[data-value="${CSS.escape(s.value)}"]`)?.focus())},className:`inline-flex max-w-full flex-wrap gap-1 rounded-full bg-sunken p-1`,children:n.map(n=>{let r=n.value===e;return(0,E.jsx)(`button`,{type:`button`,role:`radio`,"data-value":n.value,"aria-checked":r,tabIndex:r?0:-1,disabled:n.disabled,onClick:()=>t(n.value),className:R(`rounded-full font-semibold transition-colors disabled:opacity-40`,i===`sm`?`h-7 px-3 text-[12.5px]`:`h-8 px-4 text-[13.5px]`,r?`bg-surface text-ink shadow-[var(--shadow-sm)]`:`text-soft hover:text-ink`),children:n.label},n.value)})})}function Ue({checked:e,onChange:t,label:n,description:r,disabled:i}){let o=(0,a.useId)();return(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,E.jsxs)(`span`,{className:`min-w-0`,children:[(0,E.jsx)(`label`,{htmlFor:o,className:`block text-[14px] font-medium`,children:n}),r&&(0,E.jsx)(`span`,{className:`mt-0.5 block text-[12.5px] text-soft`,children:r})]}),(0,E.jsx)(`button`,{id:o,type:`button`,role:`switch`,"aria-checked":e,disabled:i,onClick:()=>t(!e),className:R(`relative mt-0.5 h-6 w-11 shrink-0 rounded-full transition-colors duration-150 disabled:opacity-50`,e?`bg-primary`:`bg-[var(--line)]`),children:(0,E.jsx)(`span`,{"aria-hidden":!0,className:R(`absolute top-0.5 left-0.5 h-5 w-5 rounded-full bg-white shadow-sm transition-transform duration-150 ease-[var(--ease-out)]`,e&&`translate-x-5`)})})]})}function Z({checked:e,onChange:t,label:n,description:r,disabled:i}){return(0,E.jsxs)(`label`,{className:R(`flex cursor-pointer items-start gap-3 text-[14px]`,i&&`cursor-not-allowed opacity-60`),children:[(0,E.jsxs)(`span`,{className:`relative mt-0.5 grid h-5 w-5 shrink-0 place-items-center`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:e,disabled:i,onChange:e=>t(e.target.checked),className:`peer absolute inset-0 m-0 cursor-[inherit] appearance-none rounded-md border-[1.5px] border-[var(--soft)] bg-raised checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus)]`}),(0,E.jsx)(A,{name:`check`,size:14,strokeWidth:3,className:`pointer-events-none relative text-white opacity-0 peer-checked:opacity-100`})]}),(0,E.jsxs)(`span`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:`font-medium`,children:n}),r&&(0,E.jsx)(`span`,{className:`mt-0.5 block text-[12.5px] text-soft`,children:r})]})]})}function We({value:e,onChange:t,placeholder:n=`Type and press Enter`,validate:r,mono:i=!0,...o}){let s=X(o.id),[c,l]=(0,a.useState)(``),[u,d]=(0,a.useState)(null),f=()=>{let n=c.trim();if(!n)return;if(e.includes(n))return l(``);let i=r?.(n)??null;if(i)return d(i);t([...e,n]),l(``),d(null)};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:R(`field flex min-h-[44px] flex-wrap items-center gap-1.5 py-1.5 focus-within:border-[var(--focus)]`,o.disabled&&`opacity-60`),children:[e.map(n=>(0,E.jsxs)(`span`,{className:R(`inline-flex items-center gap-1 rounded-full bg-sunken py-0.5 pr-1 pl-2.5 text-[12.5px]`,i&&`font-mono`),children:[n,(0,E.jsx)(`button`,{type:`button`,disabled:o.disabled,onClick:()=>t(e.filter(e=>e!==n)),"aria-label":`Remove ${n}`,className:`grid h-5 w-5 place-items-center rounded-full text-soft hover:bg-faint hover:text-ink`,children:(0,E.jsx)(A,{name:`x`,size:12,strokeWidth:2.4})})]},n)),(0,E.jsx)(`input`,{id:s.id,value:c,disabled:o.disabled,onChange:e=>{l(e.target.value),d(null)},onKeyDown:n=>{n.key===`Enter`||n.key===`,`?(n.preventDefault(),f()):n.key===`Backspace`&&!c&&e.length&&t(e.slice(0,-1))},onBlur:f,placeholder:e.length?``:n,"aria-label":o[`aria-label`],"aria-describedby":s.describedBy,"aria-invalid":!!u||s.invalid||void 0,className:R(`min-w-[8rem] flex-1 bg-transparent py-1 text-[14px] outline-none placeholder:text-soft`,i&&`font-mono text-[13px]`)})]}),u&&(0,E.jsx)(`p`,{role:`alert`,className:`mt-1 text-[12.5px] font-medium text-bad`,children:u})]})}var Ge=[{label:`10 min`,seconds:600},{label:`1 hour`,seconds:3600},{label:`8 hours`,seconds:28800},{label:`2 days`,seconds:172800}];function Ke({value:e,onChange:t,label:n=`How long`,max:r}){let i=Ge.find(t=>t.seconds===e),[o,s]=(0,a.useState)(!i&&e!==null),[c,l]=(0,a.useState)(e!==null&&!i?qe(e):``),u=r!==void 0&&e!==null&&e>r,d=(0,a.useId)();return(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsxs)(`div`,{role:`radiogroup`,"aria-label":n,className:`flex flex-wrap gap-1.5`,children:[Ge.map(n=>{let i=!o&&e===n.seconds;return(0,E.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:r!==void 0&&n.seconds>r,onClick:()=>{s(!1),t(n.seconds)},className:R(`h-8 rounded-full border-[1.5px] px-3.5 text-[13px] font-semibold transition-colors disabled:opacity-40`,i?`border-primary bg-primary text-white`:`border-line text-muted hover:border-[var(--soft)] hover:text-ink`),children:n.label},n.label)}),(0,E.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":o,onClick:()=>{s(!0),t(Fe(c))},className:R(`h-8 rounded-full border-[1.5px] px-3.5 text-[13px] font-semibold transition-colors`,o?`border-primary bg-primary text-white`:`border-line text-muted hover:border-[var(--soft)] hover:text-ink`),children:`Custom`})]}),o&&(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`label`,{htmlFor:d,className:`sr-only`,children:`Custom duration`}),(0,E.jsx)(`input`,{id:d,autoFocus:!0,value:c,onChange:e=>{l(e.target.value),t(Fe(e.target.value))},placeholder:`e.g. 45m, 3h, 5d`,"aria-invalid":c!==``&&e===null||u||void 0,className:`field max-w-[10rem] font-mono text-[13px]`}),(0,E.jsx)(`span`,{className:`text-[12.5px] text-soft`,children:e===null?c?`Use a number and m, h or d`:``:J(e)})]}),u&&(0,E.jsxs)(`p`,{role:`alert`,className:`text-[12.5px] font-medium text-bad`,children:[`The longest allowed is `,J(r),`.`]})]})}function qe(e){return e%86400==0?`${e/86400}d`:e%3600==0?`${e/3600}h`:`${Math.round(e/60)}m`}var Je=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function Q(e,t,n){let r=(0,a.useRef)(n);r.current=n,(0,a.useEffect)(()=>{if(!t)return;let n=document.activeElement,i=!n||n===document.body||n.id===`main`||e.current?.contains(n)?Ye??n:n,a=i?.getAttribute(`href`)??null,o=i?.textContent?.trim()??``,s=e.current;if(!s)return;$.push(s),(s.querySelector(`[autofocus],[data-autofocus]`)??s.querySelector(Je)??s).focus();let c=e=>{if($[$.length-1]!==s)return;if(e.key===`Escape`&&r.current){e.stopPropagation(),r.current();return}if(e.key!==`Tab`)return;let t=[...s.querySelectorAll(Je)].filter(e=>e.offsetParent!==null);if(t.length===0){e.preventDefault();return}let n=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),n.focus())};document.addEventListener(`keydown`,c,!0);let l=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,c,!0),$.splice($.indexOf(s),1),$.length===0&&(document.body.style.overflow=l),Xe(i,a,o)}},[t,e])}var $=[],Ye=null;if(typeof document<`u`){let e=e=>{let t=e.target?.closest?.(`a[href],button`);t instanceof HTMLElement&&!t.closest(`[role=dialog]`)&&(Ye=t)};document.addEventListener(`click`,e,!0),document.addEventListener(`keydown`,t=>(t.key===`Enter`||t.key===` `)&&e(t),!0)}function Xe(e,t,n){$.length>0?e?.isConnected&&e.focus():e&&e.isConnected&&e!==document.body&&(e.focus(),document.activeElement===e)||requestAnimationFrame(()=>{if(document.activeElement&&document.activeElement!==document.body&&document.activeElement.id!==`main`)return;let e=e=>!e.closest(`[role=dialog]`),r=(t?[...document.querySelectorAll(`a[href]`)].find(n=>e(n)&&n.getAttribute(`href`)===t):void 0)??(n?[...document.querySelectorAll(`a[href],button`)].find(t=>e(t)&&t.textContent?.trim()===n):void 0);r?r.focus():document.querySelector(`#main`)?.focus()})}function Ze({open:e,onClose:t,title:n,subtitle:r,children:i,footer:s,width:c=560}){let l=(0,a.useRef)(null),u=(0,a.useId)();return Q(l,e,t),e?(0,o.createPortal)((0,E.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,E.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:t,"aria-hidden":!0}),(0,E.jsxs)(`div`,{ref:l,role:`dialog`,"aria-modal":`true`,"aria-labelledby":u,tabIndex:-1,style:{maxWidth:c},className:`anim-drawer absolute inset-y-0 right-0 flex w-full flex-col bg-surface shadow-[var(--shadow-lg)] sm:inset-y-3 sm:right-3 sm:w-[calc(100%-24px)] sm:rounded-[var(--radius-card)]`,children:[(0,E.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-faint px-6 pt-5 pb-4`,children:[(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`h2`,{id:u,className:`text-[20px] leading-tight font-medium tracking-[-0.02em] break-words`,children:n}),r&&(0,E.jsx)(`p`,{className:`mt-1 text-[13px] text-soft`,children:r})]}),(0,E.jsx)(B,{icon:`x`,label:`Close panel`,onClick:t,size:36})]}),(0,E.jsx)(`div`,{className:`scrollbar-thin min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:i}),s&&(0,E.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-faint px-6 py-4`,children:s})]})]}),document.body):null}function Qe({open:e,onClose:t,title:n,description:r,children:i,footer:s,width:c=520,dismissable:l=!0,tone:u=`plain`}){let d=(0,a.useRef)(null),f=(0,a.useId)(),p=(0,a.useId)();return Q(d,e,l?t:void 0),e?(0,o.createPortal)((0,E.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-end justify-center p-3 sm:items-center sm:p-6`,children:[(0,E.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:l?t:void 0,"aria-hidden":!0}),(0,E.jsxs)(`div`,{ref:d,role:u===`danger`?`alertdialog`:`dialog`,"aria-modal":`true`,"aria-labelledby":f,"aria-describedby":r?p:void 0,tabIndex:-1,style:{maxWidth:c},className:`anim-dialog relative flex max-h-[calc(100dvh-24px)] w-full flex-col rounded-[var(--radius-card)] bg-surface shadow-[var(--shadow-lg)]`,children:[(0,E.jsxs)(`div`,{className:`flex items-start gap-3 px-6 pt-6`,children:[u===`danger`&&(0,E.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-bad-tint text-bad`,children:(0,E.jsx)(A,{name:`warning`,size:20,strokeWidth:2})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`h2`,{id:f,className:`text-[20px] leading-tight font-medium tracking-[-0.02em]`,children:n}),r&&(0,E.jsx)(`p`,{id:p,className:`mt-1.5 text-[14px] text-muted`,children:r})]}),l&&(0,E.jsx)(B,{icon:`x`,label:`Close dialog`,onClick:t,size:34})]}),i&&(0,E.jsx)(`div`,{className:`scrollbar-thin min-h-0 overflow-y-auto px-6 pt-4`,children:i}),(0,E.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 px-6 pt-5 pb-6`,children:s})]})]}),document.body):null}function $e({open:e,onCancel:t,onConfirm:n,title:r,children:i,consequences:o=[],confirmLabel:s,cancelLabel:c=`Don't save`,busy:l,error:u}){let[d,f]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{e&&f(!1)},[e]),(0,E.jsx)(Qe,{open:e,onClose:t,title:r,tone:`danger`,dismissable:!l,footer:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(z,{variant:`secondary`,onClick:t,disabled:l,children:c}),(0,E.jsx)(z,{variant:`danger`,onClick:n,disabled:!d,loading:l,children:s})]}),children:(0,E.jsxs)(`div`,{className:`space-y-4 text-[14px]`,children:[(0,E.jsx)(`div`,{className:`text-muted`,children:i}),o.length>0&&(0,E.jsx)(`ul`,{className:`space-y-1.5 rounded-2xl bg-bad-tint px-4 py-3`,children:o.map(e=>(0,E.jsxs)(`li`,{className:`flex gap-2`,children:[(0,E.jsx)(A,{name:`warning`,size:16,className:`mt-0.5 shrink-0 text-bad`,strokeWidth:2}),(0,E.jsx)(`span`,{children:e})]},e))}),(0,E.jsx)(Z,{checked:d,onChange:f,label:`I understand this makes my AI apps less protected.`}),u&&(0,E.jsx)(`p`,{role:`alert`,className:R(`text-[13px] font-medium text-bad`),children:u})]})})}var et=(0,a.createContext)(null);function tt({children:e}){let[t,n]=(0,a.useState)([]),r=(0,a.useRef)(1),i=(0,a.useCallback)(e=>n(t=>t.filter(t=>t.id!==e)),[]),o=(0,a.useCallback)((e,t,a)=>{let o=r.current++;n(n=>[...n.slice(-3),{id:o,tone:e,text:t,...a?{action:a}:{}}]),setTimeout(()=>i(o),e===`bad`?8e3:a?9e3:4500)},[i]),s=e=>t.filter(t=>t.tone===`bad`===e).map(e=>(0,E.jsxs)(`div`,{className:`anim-toast pointer-events-auto flex items-start gap-3 rounded-2xl bg-ink px-4 py-3 text-[14px] text-[var(--bg)] shadow-[var(--shadow-lg)]`,children:[(0,E.jsx)(`span`,{className:R(`mt-0.5 shrink-0`,e.tone===`ok`?`text-mint`:e.tone===`bad`?`text-[#f2977c]`:``),children:(0,E.jsx)(A,{name:e.tone===`ok`?`check`:e.tone===`info`?`info`:`warning`,size:18,strokeWidth:2.2})}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[e.text,e.action&&(0,E.jsx)(`a`,{href:e.action.href,onClick:t=>{I(t),i(e.id)},className:`mt-1 block font-semibold text-mint underline underline-offset-2`,children:e.action.label})]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-label":`Dismiss message`,className:`-mr-1 shrink-0 rounded-full p-0.5 opacity-70 hover:opacity-100`,children:(0,E.jsx)(A,{name:`x`,size:16})})]},e.id));return(0,E.jsxs)(et.Provider,{value:{show:o},children:[e,(0,E.jsxs)(`div`,{className:`pointer-events-none fixed right-4 bottom-4 left-4 z-[80] flex flex-col items-end gap-2 sm:left-auto sm:w-[380px]`,children:[(0,E.jsx)(`div`,{"aria-live":`polite`,role:`status`,className:`flex w-full flex-col gap-2`,children:s(!1)}),(0,E.jsx)(`div`,{"aria-live":`assertive`,role:`alert`,className:`flex w-full flex-col gap-2`,children:s(!0)})]})]})}function nt(){let e=(0,a.useContext)(et);if(!e)throw Error(`useToast needs a <ToastProvider> above it`);return e}function rt({term:e,className:t}){let n=W[e],[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)({left:0}),c=(0,a.useRef)(null),l=(0,a.useRef)(null),u=(0,a.useId)(),d=()=>{let e=l.current?.getBoundingClientRect();if(e){let t=Math.min(300,innerWidth-32),n=Math.max(16,Math.min(e.left+e.width/2-t/2,innerWidth-t-16));s(e.bottom>innerHeight-220?{left:n,bottom:innerHeight-e.top+8}:{left:n,top:e.bottom+8})}};return(0,a.useEffect)(()=>{if(!r)return;let e=e=>{c.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&(i(!1),l.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,E.jsxs)(`span`,{ref:c,className:R(`relative inline-flex align-middle`,t),children:[(0,E.jsx)(`button`,{ref:l,type:`button`,"aria-label":`What is “${n.plain}”?`,"aria-expanded":r,"aria-controls":u,onClick:()=>{r||d(),i(e=>!e)},className:`grid h-[18px] w-[18px] place-items-center rounded-full border border-line text-[11px] font-bold text-soft transition-colors hover:border-[var(--soft)] hover:text-ink`,children:`?`}),r&&(0,E.jsxs)(`span`,{id:u,role:`note`,className:R(`anim-dialog fixed z-[90] w-[min(300px,calc(100vw-32px))] rounded-2xl border border-line bg-raised p-4 text-left text-[13.5px] font-normal tracking-normal text-ink normal-case shadow-[var(--shadow-lg)]`),style:o,children:[(0,E.jsx)(`span`,{className:`block font-semibold`,children:n.plain}),(0,E.jsx)(`span`,{className:`mt-1 block leading-relaxed text-muted`,children:n.explain}),(0,E.jsx)(`code`,{className:`mono mt-2 block text-[11.5px] text-soft`,children:n.technical})]})]})}var it={allow:`ran freely`,approve:`asked you`,deny:`blocked`,unclassified:`not labelled`};function at({data:e,mode:t=`stacked`,height:n=200,label:r,unit:i=`calls`,emptyHeight:o=.42}){let[s,c]=(0,a.useState)(null),l=e=>t===`single`?e.value??0:(e.allow??0)+(e.approve??0)+(e.deny??0),u=Math.max(1,...e.map(l)),d=e.reduce((t,n,r)=>l(n)>l(e[t]??n)?r:t,0),f=e=>t===`single`?`${e.title??e.label}: ${Y(e.value??0)} ${i}`:`${e.title??e.label}: ${Y(l(e))} ${i} (${Y(e.allow??0)} ${it.allow}, ${Y(e.approve??0)} ${it.approve}, ${Y(e.deny??0)} ${it.deny})`;return(0,E.jsxs)(`figure`,{className:`relative m-0 overflow-x-clip`,children:[(0,E.jsx)(`div`,{className:`flex items-end gap-[clamp(4px,1.6vw,14px)]`,style:{height:n+28},role:`group`,"aria-label":r,children:e.map((e,r)=>{let i=l(e),a=i===0?o:Math.max(.16,i/u),p=s===r;return(0,E.jsxs)(`div`,{className:`relative flex h-full min-w-0 flex-1 flex-col items-center justify-end`,onMouseEnter:()=>c(r),onMouseLeave:()=>c(e=>e===r?null:e),children:[p&&(0,E.jsx)(ot,{children:f(e)}),(0,E.jsx)(`div`,{tabIndex:0,role:`img`,"aria-label":f(e),onFocus:()=>c(r),onBlur:()=>c(e=>e===r?null:e),className:R(`flex w-full max-w-[64px] flex-col-reverse overflow-hidden rounded-full transition-[filter] duration-150 focus-visible:outline-offset-4`,i===0&&`hatch`,p&&i>0&&`brightness-110`),style:{height:Math.round(a*n)},children:i>0&&(t===`single`?(0,E.jsx)(`span`,{className:`block h-full w-full`,style:{background:r===d?`var(--green-deep)`:`var(--seq-3)`}}):[`allow`,`approve`,`deny`].map(t=>e[t]?(0,E.jsx)(`span`,{className:`block w-full`,style:{flexGrow:e[t],background:`var(--mark-${t})`}},t):null))}),(0,E.jsx)(`span`,{className:`mt-2 h-5 w-full overflow-visible text-center text-[12px] whitespace-nowrap text-soft`,"aria-hidden":!0,children:e.label})]},`${e.label}-${r}`)})}),(0,E.jsxs)(`table`,{className:`sr-only`,children:[(0,E.jsx)(`caption`,{children:r}),(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{scope:`col`,children:`Period`}),t===`single`?(0,E.jsx)(`th`,{scope:`col`,children:i}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{scope:`col`,children:`Ran freely`}),(0,E.jsx)(`th`,{scope:`col`,children:`Asked you`}),(0,E.jsx)(`th`,{scope:`col`,children:`Blocked`})]})]})}),(0,E.jsx)(`tbody`,{children:e.map((e,n)=>(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{scope:`row`,children:e.title??e.label}),t===`single`?(0,E.jsx)(`td`,{children:e.value??0}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`td`,{children:e.allow??0}),(0,E.jsx)(`td`,{children:e.approve??0}),(0,E.jsx)(`td`,{children:e.deny??0})]})]},n))})]})]})}function ot({children:e}){return(0,E.jsx)(`span`,{role:`presentation`,className:`pointer-events-none absolute bottom-full z-10 mb-1 w-max max-w-[220px] -translate-y-1 rounded-xl bg-ink px-3 py-2 text-[12px] leading-snug font-medium text-[var(--bg)] shadow-[var(--shadow-md)]`,children:e})}function st({segments:e,center:t,caption:n,label:r}){let i=`hatch${(0,a.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,o=e.reduce((e,t)=>e+Math.max(0,t.value),0),s=1.2,c=0,l=e.map(e=>{let t=o?Math.max(0,e.value)/o*100:0,n=c;return c+=t,{s:e,share:t,dash:`${Math.max(.001,t-s)} 200`,offset:-(n+s/2)}}),u=l.filter(e=>e.share>0),d=e=>e===`hatch`?`url(#${i})`:e===`deep`?`var(--green-deep)`:`var(--mark-${e})`,f=`M 17 97 A 80 80 0 0 1 177 97`;return(0,E.jsxs)(`figure`,{className:`relative m-0 flex flex-col items-center overflow-x-clip`,children:[(0,E.jsxs)(`div`,{className:`relative w-full max-w-[300px]`,children:[(0,E.jsxs)(`svg`,{viewBox:`0 0 194 114`,className:`block w-full`,role:`img`,"aria-label":r,children:[(0,E.jsx)(`defs`,{children:(0,E.jsxs)(`pattern`,{id:i,width:`7`,height:`7`,patternUnits:`userSpaceOnUse`,patternTransform:`rotate(45)`,children:[(0,E.jsx)(`rect`,{width:`7`,height:`7`,fill:`transparent`}),(0,E.jsx)(`line`,{x1:`0`,y1:`0`,x2:`0`,y2:`7`,stroke:`var(--hatch)`,strokeWidth:`5`})]})}),o===0?(0,E.jsx)(`path`,{d:f,fill:`none`,stroke:`url(#${i})`,strokeWidth:26,strokeLinecap:`round`}):l.map(({s:e,share:t,dash:n,offset:r})=>t>0?(0,E.jsx)(`path`,{d:f,pathLength:100,fill:`none`,stroke:d(e.mark),strokeWidth:26,strokeLinecap:`butt`,strokeDasharray:n,strokeDashoffset:r},e.label):null),u.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:17,cy:97,r:13,fill:d(u[0].s.mark)}),(0,E.jsx)(`circle`,{cx:177,cy:97,r:13,fill:d(u[u.length-1].s.mark)})]})]}),(0,E.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 flex flex-col items-center`,"aria-hidden":!0,children:(0,E.jsx)(`span`,{className:`display tnum text-[44px] leading-none`,children:t})})]}),n&&(0,E.jsx)(`p`,{className:`mt-2 text-center text-[13px] text-soft`,"aria-hidden":!0,children:n}),(0,E.jsx)(`figcaption`,{className:`mt-4 flex flex-wrap justify-center gap-x-5 gap-y-2 text-[13px] text-muted`,children:e.map(e=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,E.jsx)(`span`,{"aria-hidden":!0,className:R(`inline-block h-3 w-3 rounded-full`,e.mark===`hatch`&&`hatch border border-line`),style:e.mark===`hatch`?void 0:{background:d(e.mark)}}),e.label,(0,E.jsx)(`span`,{className:`tnum font-semibold text-ink`,children:Y(e.value)})]},e.label))})]})}function ct({children:e,copy:t,maxHeight:n=360,label:r}){let[i,o]=(0,a.useState)(!1);return(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`pre`,{tabIndex:0,"aria-label":r,className:`scrollbar-thin m-0 overflow-auto rounded-2xl bg-sunken p-4 font-mono text-[12.5px] leading-relaxed text-ink`,style:{maxHeight:n},children:e}),t&&(0,E.jsx)(B,{icon:i?`check`:`copy`,label:i?`Copied`:`Copy to clipboard`,size:32,variant:`soft`,className:`absolute top-2 right-2`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)},()=>void 0)}})]})}function lt({value:e,onChange:t,label:n,rows:r=18,lineNumbers:i=!0,readOnly:o,error:s}){let c=(0,a.useRef)(null),l=(0,a.useMemo)(()=>e.split(`
|
|
1
|
+
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),t=e((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.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.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`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var j=/\/+/g;function M(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function N(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(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 P(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,P(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+M(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(j,`$&/`)+`/`),P(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(j,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+M(a,u),c+=P(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+M(a,u++),c+=P(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return P(N(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 F(e,t,n){if(e==null)return e;var r=[],i=0;return P(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ee(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}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)};function te(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function L(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else te(L.bind(null,e))}var R={map:F,forEach:function(e,t,n){F(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return F(e,function(){t++}),t},toArray:function(e){return F(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=R,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=L,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=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.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 D(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)E.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 D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ee}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=te,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{var t=n();function r(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 i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(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=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.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,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,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=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.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=d(n,t.crossOrigin);a.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=d(t.as,t.crossOrigin);a.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,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.0`})),i=e(((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=r()})),a=n(),o=i(),s=class extends Error{status;code;detail;constructor(e,t,n,r){super(n),this.status=e,this.code=t,this.detail=r}get needsLoosenAck(){return this.status===422&&this.detail?.needs===`loosens`}};function c(){return document.cookie.match(/(?:^|;\s*)hmcp_csrf=([^;]+)/)?.[1]??``}async function l(e,t={}){let n={...t.headers??{}};t.method&&t.method!==`GET`&&(n[`Content-Type`]=`application/json`,n[`X-HMCP-CSRF`]=c());let r=await fetch(e,{...t,headers:n}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok){let e=a?.error??{code:`unknown`,message:r.statusText};throw new s(r.status,e.code,e.message,e.detail)}return a}function u(e,t){return t?`${e}${e.includes(`?`)?`&`:`?`}tenant=${encodeURIComponent(t)}`:e}function d(e,t){let n=Object.entries(t).filter(e=>e[1]!==void 0);return n.length===0?e:`${e}?${new URLSearchParams(n.map(([e,t])=>[e,String(t)]))}`}var f=encodeURIComponent,p={session:e=>l(`/api/v1/session`,{method:`POST`,body:JSON.stringify({token:e})}),redaction:()=>l(`/api/v1/meta/redaction`),servers:()=>l(`/api/v1/servers`),addServer:e=>l(`/api/v1/servers`,{method:`POST`,body:JSON.stringify(e)}),removeServer:e=>l(`/api/v1/servers/${f(e)}`,{method:`DELETE`}),tenants:e=>l(`/api/v1/servers/${f(e)}/tenants`),protection:(e,t)=>l(u(`/api/v1/servers/${f(e)}/protection`,t)),tools:(e,t)=>l(u(`/api/v1/servers/${f(e)}/tools`,t)),tool:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/tools/${f(t)}`,n)),setExposure:(e,t,n,r=``,i)=>l(u(`/api/v1/servers/${f(e)}/tools/${f(t)}/exposure`,i),{method:`PUT`,body:JSON.stringify({disabled:n,reason:r})}),toolRulePreview:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule/preview`,n),{method:`POST`,body:JSON.stringify(t)}),setToolRule:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule`,n),{method:`POST`,body:JSON.stringify(t)}),clearPreview:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule/${f(t)}/preview-clear`,n)),clearToolRule:(e,t,n,r)=>l(u(`/api/v1/servers/${f(e)}/policy/tool-rule/${f(t)}?expectedDigest=${f(n)}`,r),{method:`DELETE`}),setUnclassifiedPosture:(e,t,n,r)=>l(u(`/api/v1/servers/${f(e)}/policy/unclassified`,r),{method:`PUT`,body:JSON.stringify({value:t,expectedDigest:n})}),setPolicySetting:(e,t,n,r,i,a)=>l(u(`/api/v1/servers/${f(e)}/policy/setting`,a),{method:`PUT`,body:JSON.stringify({path:t,value:n,expectedDigest:r,...i?{acknowledged:i}:{}})}),previewRules:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/preview`,n),{method:`POST`,body:JSON.stringify(t)}),setRule:(e,t,n,r,i,a)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/${f(t)}`,a),{method:`PUT`,body:JSON.stringify({rule:n,expectedDigest:r,...i?{acknowledged:i}:{}})}),addRule:(e,t,n,r,i,a)=>l(u(`/api/v1/servers/${f(e)}/policy/rules`,a),{method:`POST`,body:JSON.stringify({rule:t,expectedDigest:n,...r===void 0?{}:{index:r},...i?{acknowledged:i}:{}})}),deleteRule:(e,t,n,r,i)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/${f(t)}?expectedDigest=${f(n)}`+(r?.loosens?`&acknowledged=loosens`:``),i),{method:`DELETE`}),orderRules:(e,t,n,r,i)=>l(u(`/api/v1/servers/${f(e)}/policy/rules/order`,i),{method:`POST`,body:JSON.stringify({order:t,expectedDigest:n,...r?{acknowledged:r}:{}})}),policyFile:(e,t)=>l(u(`/api/v1/servers/${f(e)}/policy/file`,t)),previewPolicyFile:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/policy/file/preview`,n),{method:`POST`,body:JSON.stringify({text:t})}),writePolicyFile:(e,t,n,r,i)=>l(u(`/api/v1/servers/${f(e)}/policy/file`,i),{method:`PUT`,body:JSON.stringify({text:t,expectedDigest:n,...r?{acknowledged:r}:{}})}),pending:(e,t,n={})=>l(u(d(`/api/v1/servers/${f(e)}/approvals/pending`,{limit:n.limit}),t)),approvals:(e,t,n={})=>l(u(d(`/api/v1/servers/${f(e)}/approvals`,{limit:n.limit}),t)),decide:(e,t,n,r,i,a,o)=>l(u(`/api/v1/servers/${f(e)}/approvals/${f(t)}/decide`,i),{method:`POST`,body:JSON.stringify({state:n,note:r,...a?{classify:{effect:a}}:{},...o?{remember:o}:{}})}),grants:(e,t,n={})=>l(u(d(`/api/v1/servers/${f(e)}/grants`,{state:n.state===`active`?`active`:void 0,limit:n.limit}),t)),createGrant:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/grants`,n),{method:`POST`,body:JSON.stringify(t)}),previewGrant:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/grants/preview`,n),{method:`POST`,body:JSON.stringify(t)}),revokeGrant:(e,t,n)=>l(u(`/api/v1/servers/${f(e)}/grants/${f(t)}`,n),{method:`DELETE`}),audit:(e,t)=>l(`/api/v1/servers/${f(e)}/audit?${new URLSearchParams(t)}`),verify:(e,t)=>l(`/api/v1/servers/${f(e)}/audit/verify`+(t?`?expectHead=${f(t)}`:``)),combinedAudit:e=>l(`/api/v1/audit?${new URLSearchParams(e)}`),metrics:(e,t,n)=>l(`/api/v1/servers/${f(e)}/metrics?${new URLSearchParams({window:t,...n==null?{}:{tenant:n}})}`),scan:(e,t)=>l(u(`/api/v1/servers/${f(e)}/scan`,t)),scanSarif:(e,t)=>l(u(`/api/v1/servers/${f(e)}/scan?format=sarif`,t)),policy:(e,t)=>l(u(`/api/v1/servers/${f(e)}/policy`,t)),suggestions:(e,t)=>l(`/api/v1/servers/${f(e)}/suggestions`+(t?`?since=${f(t)}`:``)),status:e=>l(`/api/v1/servers/${f(e)}/status`),health:()=>l(`/api/v1/health`)};function m(){return document.cookie.match(/(?:^|;\s*)hmcp_csrf=([^;]+)/)?.[1]??``}async function h(e,t={}){let n={...t.headers??{}};t.method&&t.method!==`GET`&&(n[`Content-Type`]=`application/json`,n[`X-HMCP-CSRF`]=m());let r=await fetch(e,{...t,headers:n}),i=await r.text(),a=i?JSON.parse(i):null;if(!r.ok){let e=a?.error??{code:`unknown`,message:r.statusText},t=new s(r.status,e.code,e.message);throw e.detail!==void 0&&(t.detail=e.detail),t}return a}var g=(e,t={})=>({method:e,body:JSON.stringify(t)}),_=encodeURIComponent,v=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,r);let n=t.toString();return n?`?${n}`:``},y=new Set;function b(e){return y.add(e),()=>void y.delete(e)}function x(e){S(e)}function S(e){for(let t of[...y])try{t(e)}catch{}}var C={catalog:()=>h(`/api/v1/catalog`),catalogDraft:(e,t)=>h(`/api/v1/catalog/${_(e)}/draft${v({variant:t})}`).then(e=>(S({kind:`opened`}),e)),registrySearch:(e,t)=>h(`/api/v1/registry/search${v({q:e,cursor:t})}`),paste:e=>h(`/api/v1/paste`,g(`POST`,{text:e})),testServer:e=>(S({kind:`testing`}),h(`/api/v1/test-server`,g(`POST`,e))),install:(e,t)=>h(`/api/v1/servers/${_(e)}/gateway/install`,g(`POST`,t)).then(e=>(t.preview||S({kind:`installed`,result:e}),e)),live:e=>h(`/api/v1/servers/${_(e)}/live`),retry:(e,t)=>h(`/api/v1/servers/${_(e)}/upstreams/${_(t)}/retry`,g(`POST`)),moveSecrets:(e,t)=>h(`/api/v1/servers/${_(e)}/gateway/secrets/move`,g(`POST`,{expectedDigest:t})),secrets:()=>h(`/api/v1/secrets`),createSecret:e=>h(`/api/v1/secrets`,g(`POST`,e)),replaceSecret:(e,t)=>h(`/api/v1/secrets/${_(e)}`,g(`PUT`,{value:t})),deleteSecret:e=>h(`/api/v1/secrets/${_(e)}`,{method:`DELETE`,headers:{"X-HMCP-CSRF":m()}}),oauthStart:e=>h(`/api/v1/oauth/start`,g(`POST`,e)),oauthComplete:e=>h(`/api/v1/oauth/complete`,g(`POST`,e)),oauthFlow:e=>h(`/api/v1/oauth/flows/${_(e)}`),doctor:()=>h(`/api/v1/system/doctor`),dirs:e=>h(`/api/v1/fs/dirs${v({path:e})}`),settings:()=>h(`/api/v1/console/settings`),saveSettings:e=>h(`/api/v1/console/settings`,g(`PUT`,e)),attach:e=>h(`/api/v1/connect/attach`,g(`POST`,e))},w=e((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})),T=e(((e,t)=>{t.exports=w()})),E=T(),D={home:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M3.5 10.5 12 3.5l8.5 7`}),(0,E.jsx)(`path`,{d:`M5.5 9v10.5a1 1 0 0 0 1 1h4v-6h3v6h4a1 1 0 0 0 1-1V9`})]}),inbox:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M3.5 13.5 6 5.5a1 1 0 0 1 1-.7h10a1 1 0 0 1 1 .7l2.5 8`}),(0,E.jsx)(`path`,{d:`M3.5 13.5V19a1 1 0 0 0 1 1h15a1 1 0 0 0 1-1v-5.5h-5a3.5 3.5 0 0 1-7 0z`})]}),clock:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,E.jsx)(`path`,{d:`M12 7.5V12l3 2`})]}),tool:(0,E.jsx)(`path`,{d:`M15 4.5a4.5 4.5 0 0 0-4.3 5.8L4 17a2 2 0 0 0 3 3l6.7-6.7A4.5 4.5 0 0 0 19.5 9l-2.7 2.7-2.6-.9-.9-2.6L16 4.6a4.5 4.5 0 0 0-1-.1z`}),list:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M9 6h11M9 12h11M9 18h11`}),(0,E.jsx)(`circle`,{cx:`4.5`,cy:`6`,r:`.8`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`4.5`,cy:`12`,r:`.8`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`4.5`,cy:`18`,r:`.8`,fill:`currentColor`})]}),activity:(0,E.jsx)(`path`,{d:`M3 12h4l2.5-6 5 12 2.5-6h4`}),shield:(0,E.jsx)(`path`,{d:`M12 3 19.5 5.8v5.9c0 4.4-2.8 7.4-7.5 9.3-4.7-1.9-7.5-4.9-7.5-9.3V5.8z`}),"shield-check":(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 3 19.5 5.8v5.9c0 4.4-2.8 7.4-7.5 9.3-4.7-1.9-7.5-4.9-7.5-9.3V5.8z`}),(0,E.jsx)(`path`,{d:`m8.8 12 2.2 2.2 4.2-4.4`})]}),key:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`8`,cy:`15`,r:`4`}),(0,E.jsx)(`path`,{d:`m11 12 8.5-8.5M16.5 6.5l2.5 2.5M14.5 8.5l2 2`})]}),lightbulb:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M9 17.5h6M10 20.5h4`}),(0,E.jsx)(`path`,{d:`M12 3.5a6 6 0 0 0-3.6 10.8c.6.5 1 1.2 1 2v1.2h5.2v-1.2c0-.8.4-1.5 1-2A6 6 0 0 0 12 3.5z`})]}),sliders:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4 7h9M17 7h3M4 17h3M11 17h9`}),(0,E.jsx)(`circle`,{cx:`15`,cy:`7`,r:`2`}),(0,E.jsx)(`circle`,{cx:`9`,cy:`17`,r:`2`})]}),plug:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M9 3.5V8M15 3.5V8`}),(0,E.jsx)(`path`,{d:`M6.5 8h11v3a5.5 5.5 0 0 1-11 0z`}),(0,E.jsx)(`path`,{d:`M12 16.5v4`})]}),settings:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,E.jsx)(`path`,{d:`M12 2.8v2.4M12 18.8v2.4M21.2 12h-2.4M5.2 12H2.8M18.5 5.5l-1.7 1.7M7.2 16.8l-1.7 1.7M18.5 18.5l-1.7-1.7M7.2 7.2 5.5 5.5`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6.6`})]}),help:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,E.jsx)(`path`,{d:`M9.6 9.5a2.5 2.5 0 0 1 4.8.8c0 1.7-2.4 2.1-2.4 3.7`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`17`,r:`.6`,fill:`currentColor`})]}),search:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`11`,cy:`11`,r:`6.5`}),(0,E.jsx)(`path`,{d:`m16 16 4.5 4.5`})]}),bell:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M6 16.5V11a6 6 0 0 1 12 0v5.5l1.5 2h-15z`}),(0,E.jsx)(`path`,{d:`M10 20.5a2 2 0 0 0 4 0`})]}),sun:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,E.jsx)(`path`,{d:`M12 2.5v2M12 19.5v2M21.5 12h-2M4.5 12h-2M18.7 5.3l-1.4 1.4M6.7 17.3l-1.4 1.4M18.7 18.7l-1.4-1.4M6.7 6.7 5.3 5.3`})]}),moon:(0,E.jsx)(`path`,{d:`M19.5 14.5A7.5 7.5 0 0 1 9.5 4.5a7.5 7.5 0 1 0 10 10z`}),"arrow-up-right":(0,E.jsx)(`path`,{d:`M7 17 17 7M8.5 7H17v8.5`}),"arrow-right":(0,E.jsx)(`path`,{d:`M4.5 12h15M13.5 6l6 6-6 6`}),"arrow-left":(0,E.jsx)(`path`,{d:`M19.5 12h-15M10.5 6l-6 6 6 6`}),plus:(0,E.jsx)(`path`,{d:`M12 5v14M5 12h14`}),minus:(0,E.jsx)(`path`,{d:`M5 12h14`}),check:(0,E.jsx)(`path`,{d:`m5 12.5 4.5 4.5L19 7.5`}),x:(0,E.jsx)(`path`,{d:`M6 6l12 12M18 6 6 18`}),power:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 3v8`}),(0,E.jsx)(`path`,{d:`M7 6.3a7.5 7.5 0 1 0 10 0`})]}),play:(0,E.jsx)(`path`,{d:`M7.5 5v14l11-7z`}),stop:(0,E.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`}),pause:(0,E.jsx)(`path`,{d:`M8.5 5.5v13M15.5 5.5v13`}),refresh:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M19.5 12a7.5 7.5 0 1 1-2.2-5.3`}),(0,E.jsx)(`path`,{d:`M19.5 4v4h-4`})]}),download:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 4v11M7.5 10.5 12 15l4.5-4.5`}),(0,E.jsx)(`path`,{d:`M4.5 19.5h15`})]}),copy:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`rect`,{x:`8.5`,y:`8.5`,width:`11`,height:`11`,rx:`2`}),(0,E.jsx)(`path`,{d:`M15.5 8.5V6a1.5 1.5 0 0 0-1.5-1.5H6A1.5 1.5 0 0 0 4.5 6v8A1.5 1.5 0 0 0 6 15.5h2.5`})]}),chevron:(0,E.jsx)(`path`,{d:`m7 9.5 5 5 5-5`}),"chevron-right":(0,E.jsx)(`path`,{d:`m9.5 7 5 5-5 5`}),"chevron-left":(0,E.jsx)(`path`,{d:`m14.5 7-5 5 5 5`}),external:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M13.5 4.5h6v6M19.5 4.5 11 13`}),(0,E.jsx)(`path`,{d:`M17.5 14v4.5a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1H10`})]}),warning:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M12 4 21 19.5H3z`}),(0,E.jsx)(`path`,{d:`M12 10v4.5`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`17`,r:`.6`,fill:`currentColor`})]}),info:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`}),(0,E.jsx)(`path`,{d:`M12 11v5.5`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`8`,r:`.6`,fill:`currentColor`})]}),lock:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`rect`,{x:`5`,y:`10.5`,width:`14`,height:`10`,rx:`2`}),(0,E.jsx)(`path`,{d:`M8 10.5V8a4 4 0 0 1 8 0v2.5`})]}),eye:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),"eye-off":(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4 4l16 16`}),(0,E.jsx)(`path`,{d:`M10 5.7A9 9 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-2.7 3.4M6.5 7.2A15.6 15.6 0 0 0 2.5 12S6 18.5 12 18.5c1.4 0 2.7-.3 3.8-.9`})]}),trash:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4.5 7h15M9.5 7V4.5h5V7`}),(0,E.jsx)(`path`,{d:`M6.5 7l1 12.5a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1l1-12.5`}),(0,E.jsx)(`path`,{d:`M10 11v6M14 11v6`})]}),filter:(0,E.jsx)(`path`,{d:`M4 5h16l-6.2 7.5V19l-3.6 1.5v-8z`}),user:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`8`,r:`4`}),(0,E.jsx)(`path`,{d:`M4.5 20.5a7.5 7.5 0 0 1 15 0`})]}),users:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`9`,cy:`8.5`,r:`3.5`}),(0,E.jsx)(`path`,{d:`M2.5 20a6.5 6.5 0 0 1 13 0`}),(0,E.jsx)(`path`,{d:`M15.5 5.2a3.5 3.5 0 0 1 0 6.6M18 14.2a6.5 6.5 0 0 1 3.5 5.8`})]}),menu:(0,E.jsx)(`path`,{d:`M4 7h16M4 12h16M4 17h16`}),server:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`6.5`,rx:`2`}),(0,E.jsx)(`rect`,{x:`4`,y:`13.5`,width:`16`,height:`6.5`,rx:`2`}),(0,E.jsx)(`path`,{d:`M7.5 7.2h.01M7.5 16.7h.01`,strokeWidth:`2.4`})]}),edit:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M4.5 19.5h4l10-10a2.8 2.8 0 0 0-4-4l-10 10z`}),(0,E.jsx)(`path`,{d:`m13 7 4 4`})]}),file:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`path`,{d:`M14 3.5H7a1.5 1.5 0 0 0-1.5 1.5v14A1.5 1.5 0 0 0 7 20.5h10a1.5 1.5 0 0 0 1.5-1.5V8z`}),(0,E.jsx)(`path`,{d:`M14 3.5V8h4.5`})]}),folder:(0,E.jsx)(E.Fragment,{children:(0,E.jsx)(`path`,{d:`M3.5 7A1.5 1.5 0 0 1 5 5.5h4.2l2 2.2H19a1.5 1.5 0 0 1 1.5 1.5V17a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 17z`})}),dots:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:`6`,cy:`12`,r:`1`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`,fill:`currentColor`}),(0,E.jsx)(`circle`,{cx:`18`,cy:`12`,r:`1`,fill:`currentColor`})]})},O={wrench:`tool`},k=Object.keys(D);function A({name:e,size:t=20,strokeWidth:n=1.7,label:r,className:i}){return(0,E.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:n,strokeLinecap:`round`,strokeLinejoin:`round`,className:i,role:r?`img`:void 0,"aria-label":r,"aria-hidden":!r||void 0,focusable:`false`,children:D[e in O?O[e]:e]})}function j(){return{path:location.pathname,query:new URLSearchParams(location.search)}}var M=new Set;function N(){let e=j();for(let t of M)t(e)}typeof window<`u`&&window.addEventListener(`popstate`,N);function P(){let[e,t]=(0,a.useState)(j);return(0,a.useEffect)(()=>(M.add(t),()=>{M.delete(t)}),[]),e}function F(e){e!==location.pathname+location.search&&(history.pushState(null,``,e),N())}function ee(e){e!==location.pathname+location.search&&(history.replaceState(null,``,e),N())}function I(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.currentTarget.getAttribute(`target`);t&&t!==`_self`||(e.preventDefault(),F(e.currentTarget.getAttribute(`href`)??`/`))}function te(e,t){let n=new URLSearchParams(e.query);for(let[e,r]of Object.entries(t))r===null||r===``?n.delete(e):n.set(e,r);let r=n.toString();return r?`${e.path}?${r}`:e.path}function L(e,t,n={},r=[`server`,`tenant`]){let i=new URLSearchParams;for(let t of r){let n=e.query.get(t);n!==null&&i.set(t,n)}for(let[e,t]of Object.entries(n))i.set(e,t);let a=i.toString();return a?`${t}?${a}`:t}function R(...e){return e.filter(Boolean).join(` `)}function ne(e,t=250){let[n,r]=(0,a.useState)(e);return(0,a.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function z({variant:e=`secondary`,size:t=`md`,icon:n,iconRight:r,loading:i=!1,className:a,children:o,disabled:s,type:c=`button`,...l}){return(0,E.jsxs)(`button`,{type:c,disabled:s||i,"aria-busy":i||void 0,className:R(`btn`,`btn-${t}`,`btn-${e}`,a),...l,children:[i?(0,E.jsx)(V,{}):n&&(0,E.jsx)(A,{name:n,size:t===`sm`?16:18,strokeWidth:2}),(0,E.jsx)(`span`,{children:o}),r&&(0,E.jsx)(A,{name:r,size:t===`sm`?16:18,strokeWidth:2})]})}function re({href:e,variant:t=`secondary`,size:n=`md`,icon:r,iconRight:i,className:a,children:o,external:s}){return(0,E.jsxs)(`a`,{href:e,onClick:s?void 0:I,target:s?`_blank`:void 0,rel:s?`noreferrer`:void 0,className:R(`btn`,`btn-${n}`,`btn-${t}`,a),children:[r&&(0,E.jsx)(A,{name:r,size:n===`sm`?16:18,strokeWidth:2}),(0,E.jsx)(`span`,{children:o}),i&&(0,E.jsx)(A,{name:i,size:n===`sm`?16:18,strokeWidth:2})]})}function B({icon:e,label:t,variant:n=`ghost`,size:r=40,href:i,className:a,badge:o,...s}){let c=R(`icon-btn`,o?`relative`:void 0,`icon-btn-${n}`,a),l={width:r,height:r},u=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(A,{name:e,size:Math.round(r*.48),strokeWidth:1.8}),o?(0,E.jsx)(`span`,{"aria-hidden":!0,className:`tnum absolute -top-0.5 -right-0.5 grid h-[18px] min-w-[18px] place-items-center rounded-full bg-primary px-1 text-[11px] font-bold text-white`,children:o>99?`99+`:o}):null]}),d=o?`${o>99?`99+`:o} ${t.toLowerCase()}`:t;return i?(0,E.jsx)(`a`,{href:i,onClick:I,"aria-label":d,title:t,className:c,style:l,children:u}):(0,E.jsx)(`button`,{type:`button`,"aria-label":d,title:t,className:c,style:l,...s,children:u})}function V({size:e=16}){return(0,E.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,className:`animate-spin`,"aria-hidden":!0,children:[(0,E.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,fill:`none`,stroke:`currentColor`,strokeOpacity:`.25`,strokeWidth:`3`}),(0,E.jsx)(`path`,{d:`M21 12a9 9 0 0 0-9-9`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`})]})}function ie({title:e,actions:t,tone:n=`plain`,href:r,padded:i=!0,className:a,children:o,as:s=`section`,titleId:c,id:l}){let u=(0,E.jsxs)(E.Fragment,{children:[(e||t)&&(0,E.jsxs)(`header`,{className:`mb-4 flex min-h-8 items-center justify-between gap-3`,children:[e&&(0,E.jsx)(`h2`,{id:c,className:`text-[19px] leading-tight font-medium tracking-[-0.02em]`,children:e}),t&&(0,E.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:t})]}),o]}),d=R(`card block min-w-0`,n===`hero`&&`card-hero`,i&&`p-6`,r&&`card-link`,a);return r?(0,E.jsx)(`a`,{id:l,href:r,onClick:I,className:d,children:u}):(0,E.jsx)(s,{id:l,className:d,"aria-labelledby":c,children:u})}function ae({title:e,value:t,sub:n,delta:r,href:i,hrefLabel:a,tone:o=`plain`,loading:s,className:c}){let l=o===`hero`;return(0,E.jsxs)(`section`,{className:R(`card flex min-h-[184px] min-w-0 flex-col p-6`,l&&`card-hero`,c),children:[(0,E.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsx)(`h2`,{className:`pt-1.5 text-[17px] leading-tight font-medium tracking-[-0.015em]`,children:e}),i&&(0,E.jsx)(B,{icon:`arrow-up-right`,href:i,label:a??`Open ${e}`,variant:l?`hero`:`outline`,size:38})]}),(0,E.jsx)(`div`,{className:`display tnum mt-auto pt-4 text-[52px]`,children:s?(0,E.jsx)(`span`,{className:`skeleton inline-block h-12 w-20 align-middle`}):t}),(n||r!==void 0)&&(0,E.jsxs)(`p`,{className:R(`mt-3 flex items-center gap-2 text-[13px]`,l?`text-on-hero-soft`:`text-soft`),children:[r!==void 0&&(0,E.jsxs)(`span`,{className:R(`tnum inline-flex items-center gap-0.5 rounded-md border px-1 text-[11px] font-semibold`,l?`border-on-hero-soft/60`:`border-line`),children:[Math.abs(r),(0,E.jsx)(A,{name:r>=0?`arrow-up-right`:`chevron`,size:11,strokeWidth:2.4})]}),n]})]})}var H={allow:{label:`Runs freely`,tone:`ok`,short:`Ran`},approve:{label:`Asks you first`,tone:`warn`,short:`Asked`},deny:{label:`Blocked`,tone:`bad`,short:`Blocked`}},U={read:{label:`Looks only`,explain:`Reads information and changes nothing.`},write:{label:`Makes changes`,explain:`Creates or edits something, such as a file or a record.`},destructive:{label:`Deletes`,explain:`Removes or overwrites something that may not come back.`},unknown:{label:`Not labelled yet`,explain:`Nobody has said what this tool does, so it is treated with care.`}},oe={completed:{label:`Done`,tone:`ok`},denied:{label:`Blocked`,tone:`bad`},"pending-approval":{label:`Waiting for you`,tone:`warn`},error:{label:`Failed`,tone:`bad`},relayed:{label:`Let through`,tone:`ok`}},se={"exposure.disabled":`Tool is turned off`,"tenant.on_mismatch":`Wrong customer`,"tenant.required":`No customer named`,"defaults.on_unclassified":`Tool not labelled yet`,"defaults.mode":`How careful the toolbox is`,"gateway.unknown-tool":`Unknown tool`,rule:`A rule you set`},ce={enforce:{label:`Protecting`,explain:`Rules are applied: blocked calls stop, and some calls wait for you.`,tone:`ok`},observe:{label:`Watch-only`,explain:`Every call runs. The log records what would have been blocked or held.`,tone:`bad`}},le={"read-only":{label:`Only let it look`,explain:`Tools that look run. Anything that changes or deletes is blocked.`},"approve-writes":{label:`Ask before changes`,explain:`Tools that look run. Changes and deletes wait for you to approve.`},locked:{label:`Lock everything`,explain:`Every call is blocked unless a rule lets it through.`}};function ue(e){return H[e]?.label??e}function de(e){return U[e??`unknown`]?.label??e??U.unknown.label}function fe(e){return oe[e]?.label??e}var W={gateway:{plain:`Toolbox`,technical:`gateway`,explain:`The technical name for your toolbox: the checkpoint between your AI app and the tools it uses. Every tool call passes through it, and it decides whether the call runs, waits for you, or is blocked.`},connectedServer:{plain:`Connected server`,technical:`upstream`,explain:`A server in your toolbox, such as the Files or GitHub server. Your AI app reaches it through the toolbox.`},customer:{plain:`Customer`,technical:`tenant`,explain:`When one toolbox serves several customers, each one's approvals, pre-approvals and switches are kept apart. You choose which customer you are looking at.`},policyFile:{plain:`Protection settings file`,technical:`policy.yaml`,explain:`The file that holds every rule and setting on the Protection settings page. Your toolbox reads it when it starts and whenever it changes.`},activityLog:{plain:`Activity log`,technical:`audit log`,explain:`A record of every tool call and every change made here: who asked, what was decided, and how it ended.`},hashChain:{plain:`Tamper check`,technical:`hash chain`,explain:`Each log entry carries a fingerprint of the one before it. If anyone edits or removes an entry, the chain breaks and the integrity check says so.`},fingerprint:{plain:`Saved fingerprint`,technical:`expect-head`,explain:`A copy of the log's latest fingerprint, kept somewhere else. Comparing against it shows whether entries were cut from the end of the log.`},redaction:{plain:`Hidden values`,technical:`redaction`,explain:`Passwords, keys and similar secrets are replaced with a marker before a call is written to the log, so the log never holds them.`},preApproval:{plain:`Pre-approval`,technical:`standing grant`,explain:`Permission given in advance for a tool to run without asking you, for a limited time or number of uses. It can be revoked at any time.`},watchOnly:{plain:`Watch-only`,technical:`enforcement: observe`,explain:`Nothing is blocked and nothing waits for you; the log notes what would have happened. Use it to see what your rules would do before turning them on.`},protecting:{plain:`Protecting`,technical:`enforcement: enforce`,explain:`Rules are applied: blocked calls stop and some calls wait for your approval.`},changedTools:{plain:`Changed tools`,technical:`pins / contract change`,explain:`A tool whose name, description or inputs changed since you last reviewed it. A changed tool can mean an update, or someone slipping in new behaviour, so it is held until you accept it.`},killSwitch:{plain:`Turn off tool`,technical:`exposure.disabled`,explain:`Hides a tool from your AI app and blocks every call to it, even in watch-only mode. Turn it back on at any time.`},defaultStance:{plain:`How careful the toolbox is`,technical:`defaults.mode`,explain:`What happens to a call that no rule mentions: “Only let it look” lets reading tools run, “Ask before changes” holds changes for you, and “Lock everything” blocks it all.`},unknownTools:{plain:`Tools not labelled yet`,technical:`defaults.on_unclassified`,explain:`A tool nobody has marked as looking, changing or deleting. You choose whether such tools are blocked or wait for you.`},limits:{plain:`Input limits`,technical:`bounds / arg constraints`,explain:`Allowed values for a tool's inputs, such as which folders a file tool may touch. A call outside its limits is blocked or waits for you.`},networkLimits:{plain:`Network limits`,technical:`egress`,explain:`Which internet addresses your toolbox may reach for servers on the web (the allowed addresses), and how big or slow those requests may be. A server that runs on your computer is an ordinary program and reaches the internet itself, so these limits don't cover it.`},toolBudget:{plain:`Tool limit`,technical:`tool_budget`,explain:`The most tools your AI app is shown at once. Fewer tools are easier to review and harder to confuse.`},rule:{plain:`Rule`,technical:`policy rule`,explain:`A line in your protection settings that says what happens when a matching tool is called.`},approval:{plain:`Waiting for you`,technical:`approval request`,explain:`A call that your toolbox paused until you approve it or say no. It expires if nobody answers.`},suggestion:{plain:`Suggestion`,technical:`suggestions`,explain:`A rule proposed from what watch-only mode saw, so you can turn protection on without blocking work you rely on.`},safetyCheck:{plain:`Safety check`,technical:`scan / findings`,explain:`A review of your toolbox's tools and settings that lists weak spots, how serious each is, and how to fix it.`},step1KillSwitch:{plain:`1. Is the tool turned off?`,technical:`exposure.disabled`,explain:`A tool you turned off is blocked before anything else is checked.`},step2Customer:{plain:`2. Is it the right customer?`,technical:`tenant.on_mismatch / tenant.required`,explain:`A call for the wrong customer, or for no customer when one is required, is blocked.`},step3Limits:{plain:`3. Are the inputs within limits?`,technical:`arg constraints / on_violation`,explain:`If a rule sets input limits and the call breaks them, it is blocked or waits for you.`},step4Unlabelled:{plain:`4. Has anyone labelled the tool?`,technical:`defaults.on_unclassified`,explain:`A tool nobody has labelled is blocked or waits for you, as you choose.`},step5Rule:{plain:`5. Does a rule match?`,technical:`rules[]`,explain:`The first rule that matches the tool decides: runs freely, asks you first, or blocked.`},step6Stance:{plain:`6. How careful is the toolbox?`,technical:`defaults.mode`,explain:`If nothing else answered, it comes down to how careful the toolbox is set to be.`},HMCP001:{plain:`A change can happen without asking`,technical:`HMCP001`,explain:`A tool that makes changes or deletes can run without anyone approving it, or its input limits leave gaps. Make it ask first, or tighten its limits.`},HMCP002:{plain:`Customers are not kept apart`,technical:`HMCP002`,explain:`One customer's calls could reach another customer's data. Turn on customer separation.`},HMCP003:{plain:`A list has no size cap`,technical:`HMCP003`,explain:`A tool that lists things can return unlimited results, which can leak data or swamp the AI app. Set a maximum.`},HMCP004:{plain:`A secret is visible`,technical:`HMCP004`,explain:`A password, key or token appears in a tool's name, description or settings, where your AI app can read it.`},HMCP005:{plain:`Hidden instructions in a tool description`,technical:`HMCP005`,explain:`A tool's description contains text aimed at the AI, such as 'ignore your rules'. Your toolbox removes it, but the server sending it deserves a look.`},HMCP006:{plain:`A tool accepts any input`,technical:`HMCP006`,explain:`A tool's inputs are loosely defined, so the AI can send fields nobody checked. Close the input list or add limits.`},HMCP007:{plain:`A server address is outside network limits`,technical:`HMCP007`,explain:`A connected server points at an address your network limits do not allow, so its calls will fail or the limits are wrong.`},HMCP008:{plain:`Retired check`,technical:`HMCP008`,explain:`This check was removed in an earlier version. Old log entries may still mention it.`},HMCP009:{plain:`Too many tools, or look-alikes`,technical:`HMCP009`,explain:`There are more tools than you can review, or two have names close enough for the AI to mix them up.`},HMCP010:{plain:`Activity log is off or weakened`,technical:`HMCP010`,explain:`The activity log is turned off, or its tamper check is off, so you could not prove what happened.`},HMCP011:{plain:`A tool changed after review`,technical:`HMCP011`,explain:`A tool's description or inputs changed since you reviewed it. It is held under Changed tools until you accept it.`},HMCP012:{plain:`A result was withheld`,technical:`HMCP012`,explain:`A tool's answer contained hidden instructions or a secret, so your toolbox kept it from the AI app.`},mcp:{plain:`MCP server`,technical:`Model Context Protocol (MCP)`,explain:`A small add-on that gives your AI app a set of tools, such as reading your files or opening GitHub issues. MCP is a shared standard, so any AI app can use any of them.`},toolbox:{plain:`Toolbox`,technical:`gateway (~/.hmcp/gateways/<name>)`,explain:`Your AI app connects to one toolbox instead of to each server. The toolbox holds your servers and checks every action before it happens. Technical pages sometimes call it a gateway.`},lockedKey:{plain:`Locked key`,technical:`~/.hmcp/secrets.json`,explain:`A password or key a server needs, kept in a file only your user account can open. Your settings refer to it by name, so the key itself is never shown here or written anywhere else.`},signIn:{plain:`Sign in`,technical:`OAuth 2.1 with PKCE`,explain:`Some services let you sign in on their own website instead of making a key. You approve access there, and the service hands your toolbox a pass that is kept in your locked keys and renewed by itself.`},publicList:{plain:`Public server list`,technical:`MCP Registry (registry.modelcontextprotocol.io)`,explain:`A public directory of MCP servers that anyone can publish to. When you search it, only the words you type are sent. Nobody has checked the servers on it, including us.`},machineCheck:{plain:`Computer check`,technical:`Asks each program which version it is`,explain:`Looks for the free programs servers use to run, such as Node.js and uv, and says which are missing. It only looks; it never installs or changes anything.`},allowedAddresses:{plain:`Allowed addresses`,technical:`egress.allow`,explain:`The web addresses your toolbox may reach when it talks to servers on the web. Anything not on the list is stopped. A server that runs on your computer is an ordinary program with your permissions: it can use the internet directly, and this list doesn't limit it. Only add servers like that if you trust them.`}},pe=[`step1KillSwitch`,`step2Customer`,`step3Limits`,`step4Unlabelled`,`step5Rule`,`step6Stance`];function me(e){return W[e]?.plain??e}var he={ok:`bg-ok-tint text-ok border-ok/25`,warn:`bg-warn-tint text-warn border-warn/25`,bad:`bg-bad-tint text-bad border-bad/25`,neutral:`bg-info-tint text-muted border-line`};function ge({tone:e=`neutral`,icon:t,children:n,className:r,title:i}){return(0,E.jsxs)(`span`,{className:R(`pill`,he[e],r),title:i,children:[t&&(0,E.jsx)(A,{name:t,size:13,strokeWidth:2.2}),n]})}function _e({decision:e,label:t}){let n=H[e],r=e===`allow`?`check`:e===`approve`?`clock`:e===`deny`?`x`:`help`;return(0,E.jsx)(ge,{tone:n?.tone??`neutral`,icon:r,children:t??n?.label??e})}function ve({decision:e}){return(0,E.jsx)(`span`,{"aria-hidden":!0,className:`inline-block h-2.5 w-2.5 shrink-0 rounded-full`,style:{background:`var(--mark-${e})`}})}var ye={read:`eye`,write:`edit`,destructive:`trash`,unknown:`help`};function be({effect:e,withLabel:t=!1}){let n=e&&e in U?e:`unknown`,r=U[n];return(0,E.jsxs)(`span`,{className:R(`inline-flex items-center gap-1.5`,n===`destructive`?`text-bad`:n===`write`?`text-warn`:n===`read`?`text-ok`:`text-soft`),title:r.explain,children:[(0,E.jsx)(A,{name:ye[n],size:16,strokeWidth:2,label:t?void 0:r.label}),t&&(0,E.jsx)(`span`,{className:`text-[13px] font-medium`,children:r.label})]})}function xe({count:e,label:t}){return e<=0?null:(0,E.jsx)(`span`,{className:`tnum rounded-md bg-green-deep px-1.5 py-px text-[11px] leading-4 font-bold text-white`,"aria-label":t?`${e} ${t}`:void 0,children:e>99?`99+`:e})}function Se({columns:e,rows:t,rowKey:n,onRowClick:r,caption:i,empty:a,selectedKey:o}){if(t.length===0&&a)return(0,E.jsx)(E.Fragment,{children:a});let s=e=>t=>{r&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))};return(0,E.jsxs)(`table`,{className:`w-full border-separate border-spacing-0 text-[14px]`,children:[i&&(0,E.jsx)(`caption`,{className:`sr-only`,children:i}),(0,E.jsx)(`thead`,{className:`max-sm:hidden`,children:(0,E.jsx)(`tr`,{children:e.map(e=>(0,E.jsx)(`th`,{scope:`col`,className:R(`border-b border-line px-3 pb-2.5 text-[12px] font-semibold tracking-wide text-soft uppercase first:pl-0 last:pr-0`,e.align===`right`?`text-right`:`text-left`,e.width),children:e.header},e.key))})}),(0,E.jsx)(`tbody`,{children:t.map(t=>{let i=n(t);return(0,E.jsx)(`tr`,{onClick:r?()=>r(t):void 0,onKeyDown:s(t),tabIndex:r?0:void 0,"aria-selected":o===void 0?void 0:o===i,className:R(`group max-sm:mb-3 max-sm:block max-sm:rounded-2xl max-sm:border max-sm:border-line max-sm:p-3`,r&&`cursor-pointer`,o===i&&`bg-faint`),children:e.map(e=>(0,E.jsxs)(`td`,{className:R(`border-b border-faint px-3 py-3 align-middle first:pl-0 last:pr-0 group-last:border-b-0`,r&&`group-hover:bg-faint/60`,`max-sm:flex max-sm:items-start max-sm:justify-between max-sm:gap-4 max-sm:border-0 max-sm:px-0 max-sm:py-1`,e.align===`right`&&`sm:text-right`,e.hideOnMobile&&`max-sm:hidden`),children:[(0,E.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-soft sm:hidden`,children:e.header}),(0,E.jsx)(`span`,{className:`min-w-0 max-sm:text-right`,children:e.cell(t)})]},e.key))},i)})})]})}function Ce({icon:e,iconTone:t=`neutral`,leading:n,title:r,sub:i,wrapSub:a,trailing:o,href:s,onClick:c}){let l={neutral:`bg-sunken text-muted`,ok:`bg-ok-tint text-ok`,warn:`bg-warn-tint text-warn`,bad:`bg-bad-tint text-bad`,brand:`bg-green-deep text-white`}[t],u=(0,E.jsxs)(E.Fragment,{children:[n??(e&&(0,E.jsx)(`span`,{className:R(`grid h-10 w-10 shrink-0 place-items-center rounded-full`,l),children:(0,E.jsx)(A,{name:e,size:19})})),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`span`,{className:`block truncate text-[14.5px] font-medium`,children:r}),i&&(0,E.jsx)(`span`,{className:R(`mt-0.5 block text-[12.5px] text-soft`,a?`break-words`:`truncate`),children:i})]}),o&&(0,E.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),d=`flex w-full items-center gap-3 rounded-2xl py-2.5 text-left`;return s?(0,E.jsx)(`a`,{href:s,onClick:I,className:R(d,`-mx-2 px-2 transition-colors hover:bg-faint`),children:u}):c?(0,E.jsx)(`button`,{type:`button`,onClick:c,className:R(d,`-mx-2 px-2 transition-colors hover:bg-faint`),children:u}):(0,E.jsx)(`div`,{className:d,children:u})}function we({items:e,value:t,onChange:n,label:r}){let i=(0,a.useRef)(null);return(0,E.jsx)(`div`,{ref:i,role:`tablist`,"aria-label":r,onKeyDown:r=>{let a=e.findIndex(e=>e.id===t),o=r.key===`ArrowRight`?a+1:r.key===`ArrowLeft`?a-1:r.key===`Home`?0:r.key===`End`?e.length-1:null;if(o===null)return;r.preventDefault();let s=e[(o+e.length)%e.length];n(s.id),i.current?.querySelector(`#${G(s.id)}`)?.focus()},className:`scrollbar-thin inline-flex max-w-full gap-1 overflow-x-auto rounded-full bg-sunken p-1`,children:e.map(e=>{let r=e.id===t;return(0,E.jsxs)(`button`,{id:G(e.id),role:`tab`,type:`button`,"aria-selected":r,"aria-controls":Te(e.id),tabIndex:r?0:-1,onClick:()=>n(e.id),className:R(`inline-flex h-9 shrink-0 items-center gap-2 rounded-full px-4 text-[13.5px] font-semibold transition-colors`,r?`bg-surface text-ink shadow-[var(--shadow-sm)]`:`text-soft hover:text-ink`),children:[e.label,e.count!==void 0&&(0,E.jsx)(`span`,{className:R(`tnum rounded-full px-1.5 text-[11.5px]`,r?`bg-green-deep text-white`:`bg-faint`),children:e.count})]},e.id)})})}var G=e=>`tab-${e.replace(/[^\w-]/g,`_`)}`,Te=e=>`tabpanel-${e.replace(/[^\w-]/g,`_`)}`;function Ee({icon:e=`inbox`,title:t,children:n,actions:r,compact:i,level:a}){let o=a===2?`h2`:`h3`;return(0,E.jsxs)(`div`,{className:R(`flex flex-col items-center text-center`,i?`py-6`:`py-12`),children:[(0,E.jsx)(`span`,{className:`grid h-14 w-14 place-items-center rounded-full bg-sunken text-muted`,children:(0,E.jsx)(A,{name:e,size:26})}),(0,E.jsx)(o,{className:`mt-4 text-[17px] font-medium`,children:t}),n&&(0,E.jsx)(`div`,{className:`mt-1.5 max-w-md text-[14px] text-soft`,children:n}),r&&(0,E.jsx)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-2`,children:r})]})}function De({height:e=14,width:t=`100%`,lines:n=1,className:r}){return(0,E.jsx)(`span`,{className:R(`flex flex-col gap-2`,r),"aria-hidden":!0,children:Array.from({length:n},(r,i)=>(0,E.jsx)(`span`,{className:`skeleton block`,style:{height:e,width:i===n-1&&n>1?`60%`:t}},i))})}var Oe={info:{cls:`border-line`,icon:`info`,accent:`bg-info-tint text-muted`},warn:{cls:`border-warn/40`,icon:`warning`,accent:`bg-warn-tint text-warn`},danger:{cls:`border-bad/45`,icon:`warning`,accent:`bg-bad-tint text-bad`},ok:{cls:`border-ok/40`,icon:`check`,accent:`bg-ok-tint text-ok`}};function K({tone:e=`info`,title:t,children:n,actions:r,role:i}){let a=Oe[e];return(0,E.jsxs)(`div`,{role:i,className:R(`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-[18px] border-[1.5px] bg-surface px-4 py-3.5 text-ink shadow-[var(--shadow-sm)]`,a.cls),children:[(0,E.jsx)(`span`,{className:R(`grid h-9 w-9 shrink-0 place-items-center self-start rounded-full`,a.accent),children:(0,E.jsx)(A,{name:a.icon,size:18,strokeWidth:2})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 basis-60 self-center text-[14px]`,children:[t&&(0,E.jsx)(`p`,{className:`font-semibold`,children:t}),n&&(0,E.jsx)(`div`,{className:R(!!t&&`mt-0.5`,`text-muted`),children:n})]}),r&&(0,E.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:r})]})}var q=e=>e instanceof Date?e.getTime():typeof e==`string`?Date.parse(e):e;function ke(e,t=Date.now()){let n=q(e)-t,r=Math.abs(n);if(r<45e3)return n>0?`in a moment`:`just now`;let[i,a]=r<36e5?[Math.round(r/6e4),`min`]:r<864e5?[Math.round(r/36e5),`h`]:[Math.round(r/864e5),Math.round(r/864e5)===1?`day`:`days`];return n>=0?`in ${i} ${a}`:`${i} ${a} ago`}function Ae(e){return new Date(q(e)).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function je(e){return new Date(q(e)).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function J(e){let t=Math.max(0,Math.round(e));if(t<60)return`${t} s`;if(t<3600)return`${Math.round(t/60)} min`;if(t<86400){let e=Math.floor(t/3600),n=Math.round(t%3600/60);return n?`${e} h ${n} min`:`${e} h`}let n=Math.round(t/86400);return`${n} ${n===1?`day`:`days`}`}function Me(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(+(e<1e4))} s`}function Y(e){return Math.abs(e)>=1e6?new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}).format(e):new Intl.NumberFormat().format(e)}function Ne(e,t,n=`${t}s`){return`${Y(e)} ${e===1?t:n}`}function Pe(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function Fe(e){let t=/^\s*(\d+(?:\.\d+)?)\s*(s|m|h|d)\s*$/i.exec(e);if(!t)return null;let n=Number(t[1]),r=t[2].toLowerCase();return Math.round(n*(r===`s`?1:r===`m`?60:r===`h`?3600:86400))}var Ie=(0,a.createContext)(null);function X(e){let t=(0,a.useContext)(Ie),n=(0,a.useId)();return t?e?{...t,id:e}:t:{id:e??n,invalid:!1}}function Le({label:e,help:t,error:n,optional:r,technical:i,children:o,className:s}){let c=(0,a.useId)(),l=`${c}-help`,u=`${c}-err`,d=[t&&l,n&&u].filter(Boolean).join(` `)||void 0;return(0,E.jsx)(Ie.Provider,{value:{id:c,describedBy:d,invalid:!!n},children:(0,E.jsxs)(`div`,{className:R(`flex flex-col gap-1.5`,s),children:[(0,E.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,E.jsxs)(`label`,{htmlFor:c,className:`text-[13px] font-semibold text-ink`,children:[e,r&&(0,E.jsx)(`span`,{className:`ml-2 font-normal text-soft`,children:`optional`})]}),i&&(0,E.jsx)(`code`,{"aria-hidden":!0,className:`mono text-[11.5px] font-normal text-soft`,children:i})]}),o,t&&!n&&(0,E.jsx)(`p`,{id:l,className:`text-[12.5px] text-soft`,children:t}),n&&(0,E.jsxs)(`p`,{id:u,role:`alert`,className:`flex items-center gap-1.5 text-[12.5px] font-medium text-bad`,children:[(0,E.jsx)(A,{name:`warning`,size:14,strokeWidth:2}),n]})]})})}function Re({value:e,onChange:t,type:n=`text`,autoFocus:r,onEnter:i,...a}){let o=X(a.id);return(0,E.jsx)(`input`,{id:o.id,type:n,value:e,onChange:e=>t(e.target.value),onKeyDown:i?e=>e.key===`Enter`&&i():void 0,placeholder:a.placeholder,disabled:a.disabled,"aria-label":a[`aria-label`],"aria-describedby":o.describedBy,"aria-invalid":o.invalid||void 0,autoFocus:r,className:R(`field`,a.mono&&`font-mono text-[13px]`,a.className)})}function ze({value:e,onChange:t,rows:n=3,...r}){let i=X(r.id);return(0,E.jsx)(`textarea`,{id:i.id,value:e,rows:n,onChange:e=>t(e.target.value),placeholder:r.placeholder,disabled:r.disabled,"aria-label":r[`aria-label`],"aria-describedby":i.describedBy,"aria-invalid":i.invalid||void 0,className:R(`field resize-y`,r.mono&&`font-mono text-[13px]`,r.className)})}function Be({value:e,onChange:t,min:n,max:r,step:i,unit:a,...o}){let s=X(o.id);return(0,E.jsxs)(`span`,{className:R(`relative flex items-center`,o.className),children:[(0,E.jsx)(`input`,{id:s.id,type:`number`,inputMode:`decimal`,value:e??``,min:n,max:r,step:i,onChange:e=>t(e.target.value===``?null:Number(e.target.value)),placeholder:o.placeholder,disabled:o.disabled,"aria-label":o[`aria-label`],"aria-describedby":s.describedBy,"aria-invalid":s.invalid||void 0,className:R(`field tnum`,a&&`pr-14`)}),a&&(0,E.jsx)(`span`,{className:`pointer-events-none absolute right-3 text-[13px] text-soft`,children:a})]})}function Ve({value:e,onChange:t,options:n,...r}){let i=X(r.id);return(0,E.jsxs)(`span`,{className:R(`relative flex items-center`,r.className),children:[(0,E.jsx)(`select`,{id:i.id,value:e,onChange:e=>t(e.target.value),disabled:r.disabled,"aria-label":r[`aria-label`],"aria-describedby":i.describedBy,"aria-invalid":i.invalid||void 0,className:`field appearance-none pr-9`,children:n.map(e=>(0,E.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))}),(0,E.jsx)(A,{name:`chevron`,size:16,className:`pointer-events-none absolute right-3 text-soft`})]})}function He({value:e,onChange:t,options:n,label:r,size:i=`md`}){return(0,E.jsx)(`div`,{role:`radiogroup`,"aria-label":r,onKeyDown:r=>{let i=n.filter(e=>!e.disabled),a=i.findIndex(t=>t.value===e),o=r.key===`ArrowRight`||r.key===`ArrowDown`?1:r.key===`ArrowLeft`||r.key===`ArrowUp`?-1:0;if(!o)return;r.preventDefault();let s=i[(a+o+i.length)%i.length];s&&(t(s.value),r.currentTarget.querySelector(`[data-value="${CSS.escape(s.value)}"]`)?.focus())},className:`inline-flex max-w-full flex-wrap gap-1 rounded-full bg-sunken p-1`,children:n.map(n=>{let r=n.value===e;return(0,E.jsx)(`button`,{type:`button`,role:`radio`,"data-value":n.value,"aria-checked":r,tabIndex:r?0:-1,disabled:n.disabled,onClick:()=>t(n.value),className:R(`rounded-full font-semibold transition-colors disabled:opacity-40`,i===`sm`?`h-7 px-3 text-[12.5px]`:`h-8 px-4 text-[13.5px]`,r?`bg-surface text-ink shadow-[var(--shadow-sm)]`:`text-soft hover:text-ink`),children:n.label},n.value)})})}function Ue({checked:e,onChange:t,label:n,description:r,disabled:i}){let o=(0,a.useId)();return(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,E.jsxs)(`span`,{className:`min-w-0`,children:[(0,E.jsx)(`label`,{htmlFor:o,className:`block text-[14px] font-medium`,children:n}),r&&(0,E.jsx)(`span`,{className:`mt-0.5 block text-[12.5px] text-soft`,children:r})]}),(0,E.jsx)(`button`,{id:o,type:`button`,role:`switch`,"aria-checked":e,disabled:i,onClick:()=>t(!e),className:R(`relative mt-0.5 h-6 w-11 shrink-0 rounded-full transition-colors duration-150 disabled:opacity-50`,e?`bg-primary`:`bg-[var(--line)]`),children:(0,E.jsx)(`span`,{"aria-hidden":!0,className:R(`absolute top-0.5 left-0.5 h-5 w-5 rounded-full bg-white shadow-sm transition-transform duration-150 ease-[var(--ease-out)]`,e&&`translate-x-5`)})})]})}function Z({checked:e,onChange:t,label:n,description:r,disabled:i}){return(0,E.jsxs)(`label`,{className:R(`flex cursor-pointer items-start gap-3 text-[14px]`,i&&`cursor-not-allowed opacity-60`),children:[(0,E.jsxs)(`span`,{className:`relative mt-0.5 grid h-5 w-5 shrink-0 place-items-center`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:e,disabled:i,onChange:e=>t(e.target.checked),className:`peer absolute inset-0 m-0 cursor-[inherit] appearance-none rounded-md border-[1.5px] border-[var(--soft)] bg-raised checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus)]`}),(0,E.jsx)(A,{name:`check`,size:14,strokeWidth:3,className:`pointer-events-none relative text-white opacity-0 peer-checked:opacity-100`})]}),(0,E.jsxs)(`span`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:`font-medium`,children:n}),r&&(0,E.jsx)(`span`,{className:`mt-0.5 block text-[12.5px] text-soft`,children:r})]})]})}function We({value:e,onChange:t,placeholder:n=`Type and press Enter`,validate:r,mono:i=!0,...o}){let s=X(o.id),[c,l]=(0,a.useState)(``),[u,d]=(0,a.useState)(null),f=()=>{let n=c.trim();if(!n)return;if(e.includes(n))return l(``);let i=r?.(n)??null;if(i)return d(i);t([...e,n]),l(``),d(null)};return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:R(`field flex min-h-[44px] flex-wrap items-center gap-1.5 py-1.5 focus-within:border-[var(--focus)]`,o.disabled&&`opacity-60`),children:[e.map(n=>(0,E.jsxs)(`span`,{className:R(`inline-flex items-center gap-1 rounded-full bg-sunken py-0.5 pr-1 pl-2.5 text-[12.5px]`,i&&`font-mono`),children:[n,(0,E.jsx)(`button`,{type:`button`,disabled:o.disabled,onClick:()=>t(e.filter(e=>e!==n)),"aria-label":`Remove ${n}`,className:`grid h-5 w-5 place-items-center rounded-full text-soft hover:bg-faint hover:text-ink`,children:(0,E.jsx)(A,{name:`x`,size:12,strokeWidth:2.4})})]},n)),(0,E.jsx)(`input`,{id:s.id,value:c,disabled:o.disabled,onChange:e=>{l(e.target.value),d(null)},onKeyDown:n=>{n.key===`Enter`||n.key===`,`?(n.preventDefault(),f()):n.key===`Backspace`&&!c&&e.length&&t(e.slice(0,-1))},onBlur:f,placeholder:e.length?``:n,"aria-label":o[`aria-label`],"aria-describedby":s.describedBy,"aria-invalid":!!u||s.invalid||void 0,className:R(`min-w-[8rem] flex-1 bg-transparent py-1 text-[14px] outline-none placeholder:text-soft`,i&&`font-mono text-[13px]`)})]}),u&&(0,E.jsx)(`p`,{role:`alert`,className:`mt-1 text-[12.5px] font-medium text-bad`,children:u})]})}var Ge=[{label:`10 min`,seconds:600},{label:`1 hour`,seconds:3600},{label:`8 hours`,seconds:28800},{label:`2 days`,seconds:172800}];function Ke({value:e,onChange:t,label:n=`How long`,max:r}){let i=Ge.find(t=>t.seconds===e),[o,s]=(0,a.useState)(!i&&e!==null),[c,l]=(0,a.useState)(e!==null&&!i?qe(e):``),u=r!==void 0&&e!==null&&e>r,d=(0,a.useId)();return(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsxs)(`div`,{role:`radiogroup`,"aria-label":n,className:`flex flex-wrap gap-1.5`,children:[Ge.map(n=>{let i=!o&&e===n.seconds;return(0,E.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:r!==void 0&&n.seconds>r,onClick:()=>{s(!1),t(n.seconds)},className:R(`h-8 rounded-full border-[1.5px] px-3.5 text-[13px] font-semibold transition-colors disabled:opacity-40`,i?`border-primary bg-primary text-white`:`border-line text-muted hover:border-[var(--soft)] hover:text-ink`),children:n.label},n.label)}),(0,E.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":o,onClick:()=>{s(!0),t(Fe(c))},className:R(`h-8 rounded-full border-[1.5px] px-3.5 text-[13px] font-semibold transition-colors`,o?`border-primary bg-primary text-white`:`border-line text-muted hover:border-[var(--soft)] hover:text-ink`),children:`Custom`})]}),o&&(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`label`,{htmlFor:d,className:`sr-only`,children:`Custom duration`}),(0,E.jsx)(`input`,{id:d,autoFocus:!0,value:c,onChange:e=>{l(e.target.value),t(Fe(e.target.value))},placeholder:`e.g. 45m, 3h, 5d`,"aria-invalid":c!==``&&e===null||u||void 0,className:`field max-w-[10rem] font-mono text-[13px]`}),(0,E.jsx)(`span`,{className:`text-[12.5px] text-soft`,children:e===null?c?`Use a number and m, h or d`:``:J(e)})]}),u&&(0,E.jsxs)(`p`,{role:`alert`,className:`text-[12.5px] font-medium text-bad`,children:[`The longest allowed is `,J(r),`.`]})]})}function qe(e){return e%86400==0?`${e/86400}d`:e%3600==0?`${e/3600}h`:`${Math.round(e/60)}m`}var Je=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function Q(e,t,n){let r=(0,a.useRef)(n);r.current=n,(0,a.useEffect)(()=>{if(!t)return;let n=document.activeElement,i=!n||n===document.body||n.id===`main`||e.current?.contains(n)?Ye??n:n,a=i?.getAttribute(`href`)??null,o=i?.textContent?.trim()??``,s=e.current;if(!s)return;$.push(s),(s.querySelector(`[autofocus],[data-autofocus]`)??s.querySelector(Je)??s).focus();let c=e=>{if($[$.length-1]!==s)return;if(e.key===`Escape`&&r.current){e.stopPropagation(),r.current();return}if(e.key!==`Tab`)return;let t=[...s.querySelectorAll(Je)].filter(e=>e.offsetParent!==null);if(t.length===0){e.preventDefault();return}let n=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),n.focus())};document.addEventListener(`keydown`,c,!0);let l=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.removeEventListener(`keydown`,c,!0),$.splice($.indexOf(s),1),$.length===0&&(document.body.style.overflow=l),Xe(i,a,o)}},[t,e])}var $=[],Ye=null;if(typeof document<`u`){let e=e=>{let t=e.target?.closest?.(`a[href],button`);t instanceof HTMLElement&&!t.closest(`[role=dialog]`)&&(Ye=t)};document.addEventListener(`click`,e,!0),document.addEventListener(`keydown`,t=>(t.key===`Enter`||t.key===` `)&&e(t),!0)}function Xe(e,t,n){$.length>0?e?.isConnected&&e.focus():e&&e.isConnected&&e!==document.body&&(e.focus(),document.activeElement===e)||requestAnimationFrame(()=>{if(document.activeElement&&document.activeElement!==document.body&&document.activeElement.id!==`main`)return;let e=e=>!e.closest(`[role=dialog]`),r=(t?[...document.querySelectorAll(`a[href]`)].find(n=>e(n)&&n.getAttribute(`href`)===t):void 0)??(n?[...document.querySelectorAll(`a[href],button`)].find(t=>e(t)&&t.textContent?.trim()===n):void 0);r?r.focus():document.querySelector(`#main`)?.focus()})}function Ze({open:e,onClose:t,title:n,subtitle:r,children:i,footer:s,width:c=560}){let l=(0,a.useRef)(null),u=(0,a.useId)();return Q(l,e,t),e?(0,o.createPortal)((0,E.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,E.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:t,"aria-hidden":!0}),(0,E.jsxs)(`div`,{ref:l,role:`dialog`,"aria-modal":`true`,"aria-labelledby":u,tabIndex:-1,style:{maxWidth:c},className:`anim-drawer absolute inset-y-0 right-0 flex w-full flex-col bg-surface shadow-[var(--shadow-lg)] sm:inset-y-3 sm:right-3 sm:w-[calc(100%-24px)] sm:rounded-[var(--radius-card)]`,children:[(0,E.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-faint px-6 pt-5 pb-4`,children:[(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`h2`,{id:u,className:`text-[20px] leading-tight font-medium tracking-[-0.02em] break-words`,children:n}),r&&(0,E.jsx)(`p`,{className:`mt-1 text-[13px] text-soft`,children:r})]}),(0,E.jsx)(B,{icon:`x`,label:`Close panel`,onClick:t,size:36})]}),(0,E.jsx)(`div`,{className:`scrollbar-thin min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:i}),s&&(0,E.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-faint px-6 py-4`,children:s})]})]}),document.body):null}function Qe({open:e,onClose:t,title:n,description:r,children:i,footer:s,width:c=520,dismissable:l=!0,tone:u=`plain`}){let d=(0,a.useRef)(null),f=(0,a.useId)(),p=(0,a.useId)();return Q(d,e,l?t:void 0),e?(0,o.createPortal)((0,E.jsxs)(`div`,{className:`fixed inset-0 z-[60] flex items-end justify-center p-3 sm:items-center sm:p-6`,children:[(0,E.jsx)(`div`,{className:`anim-overlay absolute inset-0 bg-[var(--scrim)]`,onClick:l?t:void 0,"aria-hidden":!0}),(0,E.jsxs)(`div`,{ref:d,role:u===`danger`?`alertdialog`:`dialog`,"aria-modal":`true`,"aria-labelledby":f,"aria-describedby":r?p:void 0,tabIndex:-1,style:{maxWidth:c},className:`anim-dialog relative flex max-h-[calc(100dvh-24px)] w-full flex-col rounded-[var(--radius-card)] bg-surface shadow-[var(--shadow-lg)]`,children:[(0,E.jsxs)(`div`,{className:`flex items-start gap-3 px-6 pt-6`,children:[u===`danger`&&(0,E.jsx)(`span`,{className:`grid h-10 w-10 shrink-0 place-items-center rounded-full bg-bad-tint text-bad`,children:(0,E.jsx)(A,{name:`warning`,size:20,strokeWidth:2})}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`h2`,{id:f,className:`text-[20px] leading-tight font-medium tracking-[-0.02em]`,children:n}),r&&(0,E.jsx)(`p`,{id:p,className:`mt-1.5 text-[14px] text-muted`,children:r})]}),l&&(0,E.jsx)(B,{icon:`x`,label:`Close dialog`,onClick:t,size:34})]}),i&&(0,E.jsx)(`div`,{className:`scrollbar-thin min-h-0 overflow-y-auto px-6 pt-4`,children:i}),(0,E.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 px-6 pt-5 pb-6`,children:s})]})]}),document.body):null}function $e({open:e,onCancel:t,onConfirm:n,title:r,children:i,consequences:o=[],confirmLabel:s,cancelLabel:c=`Don't save`,busy:l,error:u}){let[d,f]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{e&&f(!1)},[e]),(0,E.jsx)(Qe,{open:e,onClose:t,title:r,tone:`danger`,dismissable:!l,footer:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(z,{variant:`secondary`,onClick:t,disabled:l,children:c}),(0,E.jsx)(z,{variant:`danger`,onClick:n,disabled:!d,loading:l,children:s})]}),children:(0,E.jsxs)(`div`,{className:`space-y-4 text-[14px]`,children:[(0,E.jsx)(`div`,{className:`text-muted`,children:i}),o.length>0&&(0,E.jsx)(`ul`,{className:`space-y-1.5 rounded-2xl bg-bad-tint px-4 py-3`,children:o.map(e=>(0,E.jsxs)(`li`,{className:`flex gap-2`,children:[(0,E.jsx)(A,{name:`warning`,size:16,className:`mt-0.5 shrink-0 text-bad`,strokeWidth:2}),(0,E.jsx)(`span`,{children:e})]},e))}),(0,E.jsx)(Z,{checked:d,onChange:f,label:`I understand this makes my AI apps less protected.`}),u&&(0,E.jsx)(`p`,{role:`alert`,className:R(`text-[13px] font-medium text-bad`),children:u})]})})}var et=(0,a.createContext)(null);function tt({children:e}){let[t,n]=(0,a.useState)([]),r=(0,a.useRef)(1),i=(0,a.useCallback)(e=>n(t=>t.filter(t=>t.id!==e)),[]),o=(0,a.useCallback)((e,t,a)=>{let o=r.current++;n(n=>[...n.slice(-3),{id:o,tone:e,text:t,...a?{action:a}:{}}]),setTimeout(()=>i(o),e===`bad`?8e3:a?9e3:4500)},[i]),s=e=>t.filter(t=>t.tone===`bad`===e).map(e=>(0,E.jsxs)(`div`,{className:`anim-toast pointer-events-auto flex items-start gap-3 rounded-2xl bg-ink px-4 py-3 text-[14px] text-[var(--bg)] shadow-[var(--shadow-lg)]`,children:[(0,E.jsx)(`span`,{className:R(`mt-0.5 shrink-0`,e.tone===`ok`?`text-mint`:e.tone===`bad`?`text-[#f2977c]`:``),children:(0,E.jsx)(A,{name:e.tone===`ok`?`check`:e.tone===`info`?`info`:`warning`,size:18,strokeWidth:2.2})}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[e.text,e.action&&(0,E.jsx)(`a`,{href:e.action.href,onClick:t=>{I(t),i(e.id)},className:`mt-1 block font-semibold text-mint underline underline-offset-2`,children:e.action.label})]}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-label":`Dismiss message`,className:`-mr-1 shrink-0 rounded-full p-0.5 opacity-70 hover:opacity-100`,children:(0,E.jsx)(A,{name:`x`,size:16})})]},e.id));return(0,E.jsxs)(et.Provider,{value:{show:o},children:[e,(0,E.jsxs)(`div`,{className:`pointer-events-none fixed right-4 bottom-4 left-4 z-[80] flex flex-col items-end gap-2 sm:left-auto sm:w-[380px]`,children:[(0,E.jsx)(`div`,{"aria-live":`polite`,role:`status`,className:`flex w-full flex-col gap-2`,children:s(!1)}),(0,E.jsx)(`div`,{"aria-live":`assertive`,role:`alert`,className:`flex w-full flex-col gap-2`,children:s(!0)})]})]})}function nt(){let e=(0,a.useContext)(et);if(!e)throw Error(`useToast needs a <ToastProvider> above it`);return e}function rt({term:e,className:t}){let n=W[e],[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)({left:0}),c=(0,a.useRef)(null),l=(0,a.useRef)(null),u=(0,a.useId)(),d=()=>{let e=l.current?.getBoundingClientRect();if(e){let t=Math.min(300,innerWidth-32),n=Math.max(16,Math.min(e.left+e.width/2-t/2,innerWidth-t-16));s(e.bottom>innerHeight-220?{left:n,bottom:innerHeight-e.top+8}:{left:n,top:e.bottom+8})}};return(0,a.useEffect)(()=>{if(!r)return;let e=e=>{c.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&(i(!1),l.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,E.jsxs)(`span`,{ref:c,className:R(`relative inline-flex align-middle`,t),children:[(0,E.jsx)(`button`,{ref:l,type:`button`,"aria-label":`What is “${n.plain}”?`,"aria-expanded":r,"aria-controls":u,onClick:()=>{r||d(),i(e=>!e)},className:`grid h-[18px] w-[18px] place-items-center rounded-full border border-line text-[11px] font-bold text-soft transition-colors hover:border-[var(--soft)] hover:text-ink`,children:`?`}),r&&(0,E.jsxs)(`span`,{id:u,role:`note`,className:R(`anim-dialog fixed z-[90] w-[min(300px,calc(100vw-32px))] rounded-2xl border border-line bg-raised p-4 text-left text-[13.5px] font-normal tracking-normal text-ink normal-case shadow-[var(--shadow-lg)]`),style:o,children:[(0,E.jsx)(`span`,{className:`block font-semibold`,children:n.plain}),(0,E.jsx)(`span`,{className:`mt-1 block leading-relaxed text-muted`,children:n.explain}),(0,E.jsx)(`code`,{className:`mono mt-2 block text-[11.5px] text-soft`,children:n.technical})]})]})}var it={allow:`ran freely`,approve:`asked you`,deny:`blocked`,unclassified:`not labelled`};function at({data:e,mode:t=`stacked`,height:n=200,label:r,unit:i=`calls`,emptyHeight:o=.42}){let[s,c]=(0,a.useState)(null),l=e=>t===`single`?e.value??0:(e.allow??0)+(e.approve??0)+(e.deny??0),u=Math.max(1,...e.map(l)),d=e.reduce((t,n,r)=>l(n)>l(e[t]??n)?r:t,0),f=e=>t===`single`?`${e.title??e.label}: ${Y(e.value??0)} ${i}`:`${e.title??e.label}: ${Y(l(e))} ${i} (${Y(e.allow??0)} ${it.allow}, ${Y(e.approve??0)} ${it.approve}, ${Y(e.deny??0)} ${it.deny})`;return(0,E.jsxs)(`figure`,{className:`relative m-0 overflow-x-clip`,children:[(0,E.jsx)(`div`,{className:`flex items-end gap-[clamp(4px,1.6vw,14px)]`,style:{height:n+28},role:`group`,"aria-label":r,children:e.map((e,r)=>{let i=l(e),a=i===0?o:Math.max(.16,i/u),p=s===r;return(0,E.jsxs)(`div`,{className:`relative flex h-full min-w-0 flex-1 flex-col items-center justify-end`,onMouseEnter:()=>c(r),onMouseLeave:()=>c(e=>e===r?null:e),children:[p&&(0,E.jsx)(ot,{children:f(e)}),(0,E.jsx)(`div`,{tabIndex:0,role:`img`,"aria-label":f(e),onFocus:()=>c(r),onBlur:()=>c(e=>e===r?null:e),className:R(`flex w-full max-w-[64px] flex-col-reverse overflow-hidden rounded-full transition-[filter] duration-150 focus-visible:outline-offset-4`,i===0&&`hatch`,p&&i>0&&`brightness-110`),style:{height:Math.round(a*n)},children:i>0&&(t===`single`?(0,E.jsx)(`span`,{className:`block h-full w-full`,style:{background:r===d?`var(--green-deep)`:`var(--seq-3)`}}):[`allow`,`approve`,`deny`].map(t=>e[t]?(0,E.jsx)(`span`,{className:`block w-full`,style:{flexGrow:e[t],background:`var(--mark-${t})`}},t):null))}),(0,E.jsx)(`span`,{className:`mt-2 h-5 w-full overflow-visible text-center text-[12px] whitespace-nowrap text-soft`,"aria-hidden":!0,children:e.label})]},`${e.label}-${r}`)})}),(0,E.jsxs)(`table`,{className:`sr-only`,children:[(0,E.jsx)(`caption`,{children:r}),(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{scope:`col`,children:`Period`}),t===`single`?(0,E.jsx)(`th`,{scope:`col`,children:i}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`th`,{scope:`col`,children:`Ran freely`}),(0,E.jsx)(`th`,{scope:`col`,children:`Asked you`}),(0,E.jsx)(`th`,{scope:`col`,children:`Blocked`})]})]})}),(0,E.jsx)(`tbody`,{children:e.map((e,n)=>(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{scope:`row`,children:e.title??e.label}),t===`single`?(0,E.jsx)(`td`,{children:e.value??0}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`td`,{children:e.allow??0}),(0,E.jsx)(`td`,{children:e.approve??0}),(0,E.jsx)(`td`,{children:e.deny??0})]})]},n))})]})]})}function ot({children:e}){return(0,E.jsx)(`span`,{role:`presentation`,className:`pointer-events-none absolute bottom-full z-10 mb-1 w-max max-w-[220px] -translate-y-1 rounded-xl bg-ink px-3 py-2 text-[12px] leading-snug font-medium text-[var(--bg)] shadow-[var(--shadow-md)]`,children:e})}function st({segments:e,center:t,caption:n,label:r}){let i=`hatch${(0,a.useId)().replace(/[^a-zA-Z0-9]/g,``)}`,o=e.reduce((e,t)=>e+Math.max(0,t.value),0),s=1.2,c=0,l=e.map(e=>{let t=o?Math.max(0,e.value)/o*100:0,n=c;return c+=t,{s:e,share:t,dash:`${Math.max(.001,t-s)} 200`,offset:-(n+s/2)}}),u=l.filter(e=>e.share>0),d=e=>e===`hatch`?`url(#${i})`:e===`deep`?`var(--green-deep)`:`var(--mark-${e})`,f=`M 17 97 A 80 80 0 0 1 177 97`;return(0,E.jsxs)(`figure`,{className:`relative m-0 flex flex-col items-center overflow-x-clip`,children:[(0,E.jsxs)(`div`,{className:`relative w-full max-w-[300px]`,children:[(0,E.jsxs)(`svg`,{viewBox:`0 0 194 114`,className:`block w-full`,role:`img`,"aria-label":r,children:[(0,E.jsx)(`defs`,{children:(0,E.jsxs)(`pattern`,{id:i,width:`7`,height:`7`,patternUnits:`userSpaceOnUse`,patternTransform:`rotate(45)`,children:[(0,E.jsx)(`rect`,{width:`7`,height:`7`,fill:`transparent`}),(0,E.jsx)(`line`,{x1:`0`,y1:`0`,x2:`0`,y2:`7`,stroke:`var(--hatch)`,strokeWidth:`5`})]})}),o===0?(0,E.jsx)(`path`,{d:f,fill:`none`,stroke:`url(#${i})`,strokeWidth:26,strokeLinecap:`round`}):l.map(({s:e,share:t,dash:n,offset:r})=>t>0?(0,E.jsx)(`path`,{d:f,pathLength:100,fill:`none`,stroke:d(e.mark),strokeWidth:26,strokeLinecap:`butt`,strokeDasharray:n,strokeDashoffset:r},e.label):null),u.length>0&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`circle`,{cx:17,cy:97,r:13,fill:d(u[0].s.mark)}),(0,E.jsx)(`circle`,{cx:177,cy:97,r:13,fill:d(u[u.length-1].s.mark)})]})]}),(0,E.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 flex flex-col items-center`,"aria-hidden":!0,children:(0,E.jsx)(`span`,{className:`display tnum text-[44px] leading-none`,children:t})})]}),n&&(0,E.jsx)(`p`,{className:`mt-2 text-center text-[13px] text-soft`,"aria-hidden":!0,children:n}),(0,E.jsx)(`figcaption`,{className:`mt-4 flex flex-wrap justify-center gap-x-5 gap-y-2 text-[13px] text-muted`,children:e.map(e=>(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,E.jsx)(`span`,{"aria-hidden":!0,className:R(`inline-block h-3 w-3 rounded-full`,e.mark===`hatch`&&`hatch border border-line`),style:e.mark===`hatch`?void 0:{background:d(e.mark)}}),e.label,(0,E.jsx)(`span`,{className:`tnum font-semibold text-ink`,children:Y(e.value)})]},e.label))})]})}function ct({children:e,copy:t,maxHeight:n=360,label:r}){let[i,o]=(0,a.useState)(!1);return(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`pre`,{tabIndex:0,"aria-label":r,className:`scrollbar-thin m-0 overflow-auto rounded-2xl bg-sunken p-4 font-mono text-[12.5px] leading-relaxed text-ink`,style:{maxHeight:n},children:e}),t&&(0,E.jsx)(B,{icon:i?`check`:`copy`,label:i?`Copied`:`Copy to clipboard`,size:32,variant:`soft`,className:`absolute top-2 right-2`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)},()=>void 0)}})]})}function lt({value:e,onChange:t,label:n,rows:r=18,lineNumbers:i=!0,readOnly:o,error:s}){let c=(0,a.useRef)(null),l=(0,a.useMemo)(()=>e.split(`
|
|
2
2
|
`).length,[e]);return(0,E.jsxs)(`div`,{children:[(0,E.jsxs)(`div`,{className:R(`flex overflow-hidden rounded-2xl border-[1.5px] bg-sunken focus-within:border-[var(--focus)] focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-[var(--focus)] focus-within:outline`,s?`border-bad`:`border-line`),children:[i&&(0,E.jsx)(`div`,{ref:c,"aria-hidden":!0,className:`tnum shrink-0 overflow-hidden border-r border-line py-3 pr-2 pl-3 text-right font-mono text-[12.5px] leading-[1.6] text-soft select-none`,style:{height:`calc(${r} * 1.6 * 12.5px + 24px)`},children:Array.from({length:l},(e,t)=>(0,E.jsx)(`div`,{children:t+1},t))}),(0,E.jsx)(`textarea`,{"aria-label":n,"aria-invalid":!!s||void 0,value:e,readOnly:o,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,wrap:`off`,onChange:e=>t(e.target.value),onScroll:e=>{c.current&&(c.current.scrollTop=e.currentTarget.scrollTop)},onKeyDown:n=>{if(n.key===`Tab`&&!n.shiftKey&&!o&&!n.currentTarget.dataset.escaped){n.preventDefault();let r=n.currentTarget,{selectionStart:i,selectionEnd:a}=r;t(e.slice(0,i)+` `+e.slice(a)),requestAnimationFrame(()=>r.setSelectionRange(i+2,i+2))}n.key===`Escape`?n.currentTarget.dataset.escaped=`1`:n.key!==`Tab`&&delete n.currentTarget.dataset.escaped},className:`scrollbar-thin min-w-0 flex-1 resize-none bg-transparent px-3 py-3 font-mono text-[12.5px] leading-[1.6] text-ink outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--focus)]`,style:{height:`calc(${r} * 1.6 * 12.5px + 24px)`}})]}),s&&(0,E.jsx)(`p`,{role:`alert`,className:`mt-2 font-mono text-[12.5px] whitespace-pre-wrap text-bad`,children:s})]})}function ut(e,t){let n=e.split(`
|
|
3
3
|
`),r=t.split(`
|
|
4
4
|
`),i=n.length,a=r.length;if(i*a>4e6)return[...n.map((e,t)=>({kind:`del`,text:e,a:t+1})),...r.map((e,t)=>({kind:`add`,text:e,b:t+1}))];let o=Array.from({length:i+1},()=>new Uint32Array(a+1));for(let e=i-1;e>=0;e--)for(let t=a-1;t>=0;t--)o[e][t]=n[e]===r[t]?o[e+1][t+1]+1:Math.max(o[e+1][t],o[e][t+1]);let s=[],c=0,l=0;for(;c<i&&l<a;)n[c]===r[l]?s.push({kind:`same`,text:n[c],a:++c,b:++l}):o[c+1][l]>=o[c][l+1]?s.push({kind:`del`,text:n[c],a:++c}):s.push({kind:`add`,text:r[l],b:++l});for(;c<i;)s.push({kind:`del`,text:n[c],a:++c});for(;l<a;)s.push({kind:`add`,text:r[l],b:++l});return s}function dt({before:e,after:t,context:n=3,label:r=`Changes`}){let i=(0,a.useMemo)(()=>ft(ut(e,t),n),[e,t,n]);return i.some(e=>`kind`in e&&e.kind!==`same`)?(0,E.jsx)(`div`,{role:`region`,"aria-label":r,tabIndex:0,className:`scrollbar-thin max-h-[420px] overflow-auto rounded-2xl border border-line bg-sunken py-2 font-mono text-[12.5px] leading-[1.6]`,children:i.map((e,t)=>`skip`in e?(0,E.jsxs)(`div`,{className:`px-4 py-1 font-sans text-[12px] text-soft`,children:[e.skip,` unchanged `,e.skip===1?`line`:`lines`]},t):(0,E.jsxs)(`div`,{className:R(`flex min-w-max`,e.kind===`add`&&`bg-ok-tint text-ink`,e.kind===`del`&&`bg-bad-tint text-ink`),children:[(0,E.jsx)(`span`,{className:`tnum w-10 shrink-0 pr-2 text-right text-soft select-none`,children:e.a??``}),(0,E.jsx)(`span`,{className:`tnum w-10 shrink-0 pr-2 text-right text-soft select-none`,children:e.b??``}),(0,E.jsx)(`span`,{className:R(`w-5 shrink-0 text-center font-bold select-none`,e.kind===`add`?`text-ok`:e.kind===`del`?`text-bad`:`text-soft`),"aria-label":e.kind===`add`?`added`:e.kind===`del`?`removed`:void 0,children:e.kind===`add`?`+`:e.kind===`del`?`−`:` `}),(0,E.jsx)(`span`,{className:`pr-4 whitespace-pre`,children:e.text||` `})]},t))}):(0,E.jsx)(`p`,{className:`rounded-2xl bg-sunken p-4 text-[13.5px] text-soft`,children:`No changes.`})}function ft(e,t){let n=[],r=[],i=(e,i)=>{let a=e?0:t,o=i?0:t;r.length>a+o+1?n.push(...r.slice(0,a),{skip:r.length-a-o},...r.slice(r.length-o)):n.push(...r),r=[]},a=!1;for(let t of e)t.kind===`same`?r.push(t):(i(!a,!1),a=!0,n.push(t));return i(!a,!0),n}function pt({lines:e,height:t=320,label:n=`Log`,empty:r=`Nothing logged yet.`}){let i=(0,a.useRef)(null),[o,s]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{o&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[e,o]),(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(`div`,{ref:i,role:`log`,"aria-label":n,"aria-live":`off`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;s(t.scrollHeight-t.scrollTop-t.clientHeight<24)},className:`scrollbar-thin overflow-auto rounded-2xl bg-[#1c1916] p-4 font-mono text-[12.5px] leading-[1.6] text-[#e1dad7]`,style:{height:t},children:e.length===0?(0,E.jsx)(`p`,{className:`font-sans text-[#a39c97]`,children:r}):e.map((e,t)=>(0,E.jsx)(`div`,{className:`whitespace-pre-wrap break-all`,children:e},t))}),!o&&(0,E.jsx)(`button`,{type:`button`,onClick:()=>s(!0),className:`absolute right-3 bottom-3 rounded-full bg-[#faf8f7] px-3 py-1 text-[12px] font-semibold text-[#2b2622] shadow`,children:`Jump to newest`})]})}function mt({steps:e,current:t}){return(0,E.jsx)(`ol`,{className:`flex w-full items-center gap-2`,"aria-label":`Progress`,children:e.map((n,r)=>{let i=r<t,a=r===t;return(0,E.jsxs)(`li`,{className:R(`flex min-w-0 items-center gap-2`,r<e.length-1&&`flex-1`),"aria-current":a?`step`:void 0,children:[(0,E.jsx)(`span`,{className:R(`tnum grid h-8 w-8 shrink-0 place-items-center rounded-full text-[13px] font-bold`,i&&`bg-primary text-white`,a&&`border-2 border-[var(--primary)] text-ink`,!i&&!a&&`border-[1.5px] border-line text-soft`),children:i?(0,E.jsx)(A,{name:`check`,size:15,strokeWidth:2.6}):r+1}),(0,E.jsxs)(`span`,{className:R(`truncate text-[13px] font-semibold max-md:sr-only`,a?`text-ink`:`text-soft`),children:[n,i&&(0,E.jsx)(`span`,{className:`sr-only`,children:` (done)`})]}),r<e.length-1&&(0,E.jsx)(`span`,{"aria-hidden":!0,className:R(`h-0.5 min-w-4 flex-1 rounded-full`,i?`bg-primary`:`bg-line`)})]},n)})})}function ht({steps:e,step:t,onStep:n,canNext:r=!0,nextLabel:i=`Continue`,finishLabel:a,onFinish:o,busy:s,children:c}){let l=t===e.length-1;return(0,E.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,E.jsx)(mt,{steps:e,current:t}),(0,E.jsx)(`h3`,{className:`text-[18px] font-medium md:sr-only`,children:e[t]}),(0,E.jsx)(`div`,{children:c}),(0,E.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-2 border-t border-faint pt-5`,children:[(0,E.jsx)(z,{variant:`ghost`,icon:`arrow-left`,onClick:()=>n(t-1),disabled:t===0||s,children:`Back`}),l?(0,E.jsx)(z,{variant:`primary`,onClick:o,disabled:!r,loading:s,children:a}):(0,E.jsx)(z,{variant:`primary`,iconRight:`arrow-right`,onClick:()=>n(t+1),disabled:!r||s,children:i})]})]})}function gt({title:e,subtitle:t,actions:n,meta:r}){return(0,E.jsxs)(`header`,{className:`mb-6 flex flex-wrap items-end justify-between gap-x-6 gap-y-4 md:mb-8`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`h1`,{className:`display text-[32px] md:text-[42px]`,children:e}),t&&(0,E.jsx)(`p`,{className:`mt-2 max-w-2xl text-[15px] text-soft`,children:t}),r&&(0,E.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:r})]}),n&&(0,E.jsx)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:n})]})}function _t(e,t,n){let[r,i]=(0,a.useState)(null),[o,s]=(0,a.useState)(null),[c,l]=(0,a.useState)(!0),[u,d]=(0,a.useState)(0),f=(0,a.useRef)(e);return f.current=e,(0,a.useEffect)(()=>{let e=!0;return l(!0),f.current().then(t=>{e&&(i(t),s(null))}).catch(t=>e&&s(t.message)).finally(()=>e&&l(!1)),()=>{e=!1}},[...t,u]),(0,a.useEffect)(()=>{if(!n)return;let e=setInterval(()=>{document.hidden||d(e=>e+1)},n);return()=>clearInterval(e)},[n]),{data:r,error:o,loading:c,reload:()=>d(e=>e+1)}}function vt(e){let t=[],n=/`([^`\n]+)`|\*\*([^*\n]+)\*\*/g,r=0;for(let i=n.exec(e);i;i=n.exec(e))i.index>r&&t.push({kind:`text`,text:e.slice(r,i.index)}),t.push(i[1]===void 0?{kind:`bold`,text:i[2]}:{kind:`code`,text:i[1]}),r=i.index+i[0].length;return r<e.length&&t.push({kind:`text`,text:e.slice(r)}),t}function yt(e){return e.split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean)}function bt(e){let t=/^[A-Za-z]:[\\/]/.test(e)||e.includes(`\\`),n=t?`\\`:`/`,r=e.split(/[\\/]+/).filter(Boolean),i=[];t||i.push({label:`/`,path:`/`});let a=``;for(let[e,o]of r.entries())a=t?e===0?`${o}${n}`:`${a.replace(/[\\]+$/,``)}${n}${o}`:`${a}/${o}`,i.push({label:o,path:a});return i}function xt(e){let t=e.split(/(?<=_)(?!_)/);return t.length===1?e:t.map((e,n)=>n<t.length-1?[e,(0,a.createElement)(`wbr`,{key:n})]:e)}function St({text:e,className:t}){return(0,E.jsx)(`span`,{className:t,children:vt(e).map((e,t)=>e.kind===`bold`?(0,E.jsx)(`strong`,{className:`font-semibold text-ink`,children:e.text},t):e.kind===`code`?(0,E.jsx)(`code`,{className:`mono rounded-md bg-sunken px-1.5 py-0.5 text-[12.5px] break-all text-ink`,children:e.text},t):(0,E.jsx)(a.Fragment,{children:e.text},t))})}function Ct(e){let{steps:t,title:n=`How to set it up`}=e;return t.length===0?null:(0,E.jsxs)(`section`,{"aria-label":n,className:R(`rounded-[18px] bg-sunken/60 p-5`,e.className),children:[(0,E.jsx)(`h3`,{className:`text-[15px] font-semibold`,children:n}),(0,E.jsx)(`ol`,{className:`mt-4 flex flex-col gap-5`,children:t.map((e,t)=>(0,E.jsxs)(`li`,{className:`flex gap-3.5`,children:[(0,E.jsx)(`span`,{className:`tnum grid h-8 w-8 shrink-0 place-items-center rounded-full bg-ok-tint text-[13.5px] font-bold text-ok`,"aria-hidden":!0,children:t+1}),(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsxs)(`p`,{className:`text-[14.5px] font-medium`,children:[(0,E.jsxs)(`span`,{className:`sr-only`,children:[`Step `,t+1,`: `]}),e.title]}),yt(e.body).map((e,t)=>(0,E.jsx)(`p`,{className:`mt-1 text-[13.5px] text-muted`,children:(0,E.jsx)(St,{text:e})},t)),e.link&&/^https?:\/\//.test(e.link.url)&&(0,E.jsxs)(`a`,{href:e.link.url,target:`_blank`,rel:`noreferrer noopener`,className:`btn btn-sm btn-secondary mt-2.5`,children:[(0,E.jsx)(`span`,{children:e.link.label}),(0,E.jsx)(A,{name:`external`,size:16,strokeWidth:2}),(0,E.jsx)(`span`,{className:`sr-only`,children:`(opens in a new tab)`})]})]})]},`${t}-${e.title}`))})]})}function wt(e){let t=(0,a.useId)(),n=e.id??t,[r,i]=(0,a.useState)(!1),[o,s]=(0,a.useState)(!1);return e.storedAs&&!o?(0,E.jsxs)(`div`,{className:`field flex min-h-[44px] items-center gap-3 py-1.5`,children:[(0,E.jsx)(A,{name:`lock`,size:17,className:`shrink-0 text-ok`}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1 text-[14px]`,children:[`Saved in your locked keys`,(0,E.jsx)(`code`,{className:`mono ml-2 text-[11.5px] text-soft`,children:e.storedAs})]}),(0,E.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>s(!0),children:`Replace`})]}):(0,E.jsxs)(`span`,{className:`relative flex items-center`,children:[(0,E.jsx)(`input`,{id:n,type:r?`text`:`password`,value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:e.placeholder??`Paste it here`,autoComplete:`off`,spellCheck:!1,"aria-label":e[`aria-label`],"aria-describedby":e[`aria-describedby`],"aria-invalid":e.invalid||void 0,className:`field pr-24 font-mono text-[13px]`}),(0,E.jsxs)(`span`,{className:`absolute right-1.5 flex items-center gap-1`,children:[e.storedAs&&(0,E.jsx)(B,{icon:`x`,size:30,label:`Keep the saved key`,onClick:()=>{e.onChange(``),s(!1)}}),(0,E.jsx)(B,{icon:r?`eye-off`:`eye`,size:32,label:r?`Hide the key`:`Show the key`,"aria-pressed":r,onClick:()=>i(!r)})]})]})}function Tt(e){let{value:t,onChange:n,multiple:r}=e,[i,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{e.openNonce&&o(!0)},[e.openNonce]),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,"aria-describedby":e[`aria-describedby`],children:[t.length>0&&(0,E.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,E.jsxs)(`li`,{className:`flex items-center gap-2 rounded-2xl bg-sunken/60 py-1.5 pr-1.5 pl-3`,children:[(0,E.jsx)(A,{name:`folder`,size:16,className:`shrink-0 text-muted`}),(0,E.jsx)(`code`,{className:`mono min-w-0 flex-1 text-[12.5px] break-all`,children:e}),(0,E.jsx)(B,{icon:`x`,size:30,label:`Remove ${e}`,onClick:()=>n(t.filter(t=>t!==e))})]},e))}),(0,E.jsx)(`div`,{children:(0,E.jsx)(z,{id:e.id,size:`sm`,icon:t.length?r?`plus`:`refresh`:`search`,onClick:()=>o(!0),children:t.length===0?r?`Choose folders`:`Choose a folder`:r?`Add another folder`:`Choose a different folder`})}),(0,E.jsx)(Et,{open:i,multiple:!!r,start:t[t.length-1],onClose:()=>o(!1),onPick:e=>{n(r?[...t,...e.filter(e=>!t.includes(e))]:e.slice(0,1)),o(!1)}})]})}function Et({open:e,multiple:t,start:n,onClose:r,onPick:i}){let[o,s]=(0,a.useState)(n),[c,l]=(0,a.useState)(null),[u,d]=(0,a.useState)(null),[f,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)([]);(0,a.useEffect)(()=>{e&&(s(n),h([]))},[e]),(0,a.useEffect)(()=>{if(!e||n||o!==void 0||!c)return;let t=c.shortcuts.find(e=>e.label===`Documents`);t&&t.path!==c.path&&s(t.path)},[e,c,n,o]),(0,a.useEffect)(()=>{if(!e)return;let t=!0;return p(!0),d(null),C.dirs(o).then(e=>t&&l(e)).catch(e=>t&&d(e.message)).finally(()=>t&&p(!1)),()=>{t=!1}},[e,o]);let g=c?.path,_=g?bt(g).at(-1)?.label??g:``,v=(e,t)=>h(t?[...m,e]:m.filter(t=>t!==e)),y=t&&m.length?m:g?[g]:[],b=!!c?.warning&&!(t&&m.length),x=(0,a.useRef)(null),S=t&&m.length?`Use ${m.length} ticked ${m.length===1?`folder`:`folders`}`:`Use ${_?`“${_}”`:`this folder`}${c?.warning?` anyway`:``}`;return(0,E.jsx)(Qe,{open:e,onClose:r,title:t?`Choose folders`:`Choose a folder`,description:t?`Open the folder you want and press its Use button, or tick several. Only the folders you choose are shared with this server, so pick the smallest one that has what you need.`:`Open the folder you want, then press its Use button. Only that folder is shared with this server, so pick the smallest one that has what you need.`,width:640,footer:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(z,{variant:`secondary`,onClick:r,children:`Cancel`}),b?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(z,{variant:`secondary`,disabled:y.length===0,onClick:()=>i(y),children:S}),(0,E.jsx)(z,{variant:`primary`,icon:`folder`,onClick:()=>x.current?.querySelector(`button[data-dir]`)?.focus(),children:`Choose a smaller folder`})]}):(0,E.jsx)(z,{variant:`primary`,icon:`check`,disabled:y.length===0,onClick:()=>i(y),children:S})]}),children:(0,E.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c&&c.shortcuts.length>0&&(0,E.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,role:`group`,"aria-label":`Shortcuts`,children:c.shortcuts.map(e=>(0,E.jsx)(z,{size:`sm`,variant:e.path===g?`primary`:`secondary`,onClick:()=>s(e.path),children:e.label},e.path))}),g&&(0,E.jsx)(`nav`,{"aria-label":`Folder path`,className:`flex flex-wrap items-center gap-0.5 text-[13px]`,children:bt(g).map((e,t,n)=>(0,E.jsxs)(a.Fragment,{children:[t>0&&e.label!==`/`&&(0,E.jsx)(A,{name:`chevron-right`,size:14,className:`text-soft`}),t===n.length-1?(0,E.jsx)(`span`,{"aria-current":`location`,className:`mono rounded-md px-1.5 py-0.5 font-semibold`,children:e.label}):(0,E.jsx)(`button`,{type:`button`,onClick:()=>s(e.path),className:`mono rounded-md px-1.5 py-0.5 text-soft hover:bg-faint hover:text-ink`,children:e.label})]},e.path))}),c?.warning&&(0,E.jsx)(K,{tone:`danger`,role:`status`,title:`This folder shares too much`,children:c.warning}),u?(0,E.jsx)(K,{tone:`danger`,role:`alert`,title:`This folder could not be opened`,actions:c?.parent?(0,E.jsx)(z,{size:`sm`,onClick:()=>s(c.parent),children:`Go up`}):void 0,children:u}):!c&&f?(0,E.jsx)(De,{lines:6,height:20}):c?(0,E.jsxs)(`div`,{className:`rounded-[18px] border border-line`,children:[(0,E.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:f?`Opening folder`:`${c.dirs.length} folders in ${c.path}`}),(0,E.jsxs)(`ul`,{ref:x,className:`scrollbar-thin max-h-[46vh] overflow-y-auto p-1.5`,children:[c.parent&&(0,E.jsx)(`li`,{children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>s(c.parent),className:`flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2 text-left text-[14px] text-muted hover:bg-faint`,children:[(0,E.jsx)(A,{name:`arrow-left`,size:16}),` Up one folder`]})}),c.dirs.length===0&&(0,E.jsx)(`li`,{className:`px-3 py-4 text-[13.5px] text-soft`,children:`No folders inside this one.`}),c.dirs.map(e=>(0,E.jsxs)(`li`,{className:`flex items-center gap-1 rounded-xl hover:bg-faint`,children:[t&&(0,E.jsx)(`span`,{className:`pl-2.5`,children:(0,E.jsx)(Z,{checked:m.includes(e.path),onChange:t=>v(e.path,t),label:(0,E.jsxs)(`span`,{className:`sr-only`,children:[`Choose `,e.name]})})}),(0,E.jsxs)(`button`,{type:`button`,"data-dir":!0,onClick:()=>s(e.path),className:`flex min-w-0 flex-1 items-center gap-2.5 px-2.5 py-2 text-left text-[14px]`,children:[(0,E.jsx)(A,{name:`folder`,size:16,className:`shrink-0 text-muted`}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.symlinkTo&&(0,E.jsxs)(`span`,{className:`truncate text-[12px] text-muted`,children:[`points to `,e.symlinkTo]}),(0,E.jsx)(A,{name:`chevron-right`,size:16,className:`shrink-0 text-soft`})]})]},e.path))]}),c.truncated&&(0,E.jsx)(`p`,{className:`border-t border-faint px-4 py-2 text-[12.5px] text-soft`,children:`Only the first 500 folders are shown.`})]}):null,f&&c&&(0,E.jsxs)(`span`,{className:`flex items-center gap-2 text-[12.5px] text-soft`,children:[(0,E.jsx)(V,{size:14}),` Opening…`]})]})})}var Dt={connected:{label:`Working`,color:`var(--mark-allow)`},connecting:{label:`Starting`,color:`var(--mark-approve)`,pulse:!0},failed:{label:`Not working`,color:`var(--mark-deny)`},"needs-sign-in":{label:`Sign in again`,color:`var(--mark-approve)`},stopped:{label:`Stopped`,color:`var(--mark-unclassified)`},unknown:{label:`Not running yet`,color:`var(--mark-unclassified)`}};function Ot(e){let t=Dt[e.state]??Dt.unknown;return(0,E.jsxs)(`span`,{className:R(`inline-flex items-center gap-1.5 text-[13px] font-medium`,e.className),children:[(0,E.jsx)(`span`,{"aria-hidden":!0,className:R(`inline-block h-2.5 w-2.5 shrink-0 rounded-full`,t.pulse&&`animate-pulse`),style:{background:t.color}}),e.label??t.label]})}export{ge as $,We as A,C as At,Ne as B,Q as C,L as Ct,Be as D,k as Dt,Le as E,te as Et,je as F,i as Ft,De as G,K as H,Ae as I,n as It,G as J,Se as K,J as L,e as Lt,Re as M,b as Mt,Ue as N,s as Nt,He as O,A as Ot,Pe as P,p as Pt,ve as Q,Me as R,Ze as S,I as St,Ke as T,P as Tt,Ee as U,ke as V,Ce as W,xe as X,Te as Y,be as Z,rt as _,re as _t,Ot as a,ce as at,$e as b,ne as bt,gt as c,se as ct,ct as d,fe as dt,_e as et,dt as f,me as ft,st as g,B as gt,at as h,z as ht,wt as i,W as it,ze as j,x as jt,Ve as k,T as kt,mt as l,ue as lt,lt as m,ae as mt,Ct as n,pe as nt,xt as o,oe as ot,pt as p,ie as pt,we as q,St as r,U as rt,_t as s,le as st,Tt as t,H as tt,ht as u,de as ut,tt as v,V as vt,Z as w,ee as wt,Qe as x,F as xt,nt as y,R as yt,Y as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={fs:`files`,gh:`GitHub`,github:`GitHub`,gitlab:`GitLab`,db:`database`,pg:`Postgres`,mcp:`MCP`,api:`API`,ai:`AI`,aws:`AWS`,gcp:`GCP`,sql:`SQL`,http:`HTTP`,url:`URL`,ui:`UI`};function t(t){let n=t.split(/[-_.\s]+/).filter(Boolean);if(n.length===0)return t;let r=n.map(t=>e[t.toLowerCase()]??t).join(` `);return r[0].toUpperCase()+r.slice(1)}function n(e,n){let r=n?.[e];return r&&r.trim()?r:t(e)}function r(e,t){return e.toLowerCase()!==t.toLowerCase()}export{t as n,n as r,r as t};
|
package/dist-ui/index.html
CHANGED
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
type="font/woff2"
|
|
42
42
|
crossorigin="anonymous"
|
|
43
43
|
/>
|
|
44
|
-
<script type="module" crossorigin src="/assets/index-
|
|
45
|
-
<link rel="modulepreload" crossorigin href="/assets/kit-
|
|
44
|
+
<script type="module" crossorigin src="/assets/index-Cm4wG2zz.js"></script>
|
|
45
|
+
<link rel="modulepreload" crossorigin href="/assets/kit-BHB_ha4i.js">
|
|
46
|
+
<link rel="modulepreload" crossorigin href="/assets/server-name-D9u6r07i.js">
|
|
46
47
|
<link rel="stylesheet" crossorigin href="/assets/index-CvZ3niHA.css">
|
|
47
48
|
</head>
|
|
48
49
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hmcp-web",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "The hardened-mcp review console: what each gateway exposes, and why.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Aditya Das",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"lint:ui": "eslint --config ui/eslint.config.js --max-warnings 0 ui/src"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"hmcp-core": "0.2.
|
|
54
|
-
"hmcp-scanner": "0.2.
|
|
53
|
+
"hmcp-core": "0.2.3",
|
|
54
|
+
"hmcp-scanner": "0.2.3",
|
|
55
55
|
"commander": "^15.0.0",
|
|
56
|
-
"hmcp-gateway": "0.2.
|
|
56
|
+
"hmcp-gateway": "0.2.3",
|
|
57
57
|
"yaml": "^2.7.0",
|
|
58
58
|
"zod": "^4.0.0"
|
|
59
59
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,E as r,Et as i,G as a,H as o,I as s,It as c,M as l,O as u,Ot as d,P as f,Pt as p,R as m,S as h,St as g,U as _,V as v,Z as y,_ as b,bt as x,c as ee,d as S,dt as C,et as w,gt as T,ht as E,k as D,kt as O,lt as k,ot as A,pt as j,s as M,tt as te,ut as N,w as ne,wt as re,x as P,y as F,yt as I,z as L}from"./kit-DRVm92_t.js";import{Ct as ie,Dt as R,Et as z,Ot as B,St as ae,Tt as V,_t as oe,bt as H,gt as se,kt as U,s as W,un as ce,vt as G,wt as le,xt as K,yt as q}from"./index-CTvq_isK.js";var J=c(),Y=O();function ue({open:e,onClose:n,serverId:i}){let s=F(),[c,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(null),[ee,S]=(0,J.useState)(!1),C=()=>{h(!0),f(null),p.verify(i).then(u).catch(e=>f(e.message)).finally(()=>h(!1))};(0,J.useEffect)(()=>{e&&(u(null),y(null),x(null),C())},[e,i]);let w=g.trim().toLowerCase(),D=/^[0-9a-f]{16,128}$/.test(w),O=()=>{D&&(S(!0),x(null),p.verify(i,w).then(e=>y({head:w,result:e})).catch(e=>x(e.message)).finally(()=>S(!1)))},k=async e=>{let t=await q(e);s.show(t?`ok`:`bad`,t?`Fingerprint copied`:`The browser did not allow copying`)};return(0,Y.jsx)(P,{open:e,onClose:n,title:`Check log integrity`,description:`Reads every entry in the activity log and checks that each still matches its fingerprint.`,width:600,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(E,{variant:`ghost`,icon:`refresh`,onClick:C,loading:m,children:`Check again`}),(0,Y.jsx)(E,{variant:`primary`,onClick:n,children:`Close`})]}),children:(0,Y.jsxs)(`div`,{className:`space-y-5 pb-1 text-[14px]`,children:[d&&(0,Y.jsx)(o,{tone:`danger`,title:`The check could not run`,actions:(0,Y.jsx)(E,{size:`sm`,onClick:C,children:`Try again`}),children:d}),!c&&!d&&(0,Y.jsx)(a,{lines:3,height:18}),c&&(0,Y.jsxs)(Y.Fragment,{children:[c.ok?(0,Y.jsx)(o,{tone:`ok`,role:`status`,title:`All ${L(c.count)} entries are intact`,children:`No entry has been edited, removed or put out of order.`}):(0,Y.jsxs)(o,{tone:`danger`,role:`alert`,title:`${t(c.problems.length,`problem`)} found in ${t(c.count,`entry`,`entries`)}`,children:[(0,Y.jsx)(`ul`,{className:`mt-1 space-y-1`,children:c.problems.slice(0,8).map(e=>(0,Y.jsxs)(`li`,{children:[(0,Y.jsxs)(`span`,{className:`font-semibold`,children:[`Entry `,e.line,`:`]}),` `,de(e.message),` `,(0,Y.jsxs)(`span`,{className:`mono text-[11.5px] opacity-80`,children:[`(`,e.message,`)`]})]},`${e.line}-${e.message}`))}),c.problems.length>8&&(0,Y.jsxs)(`p`,{className:`mt-1`,children:[`And `,c.problems.length-8,` more.`]})]}),c.head?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`mb-1.5 text-[13px] font-semibold`,children:`Fingerprint of the latest entry`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl bg-sunken py-2 pr-2 pl-4`,children:[(0,Y.jsx)(`code`,{className:`mono min-w-0 flex-1 text-[12px] break-all`,children:c.head}),(0,Y.jsx)(T,{icon:`copy`,label:`Copy fingerprint`,variant:`soft`,size:36,onClick:()=>k(c.head)})]}),(0,Y.jsx)(`p`,{className:`mt-2 text-[13px] text-soft`,children:`Save this somewhere the toolbox cannot reach, such as a note or a ticket. The check above catches an entry that was edited or removed, but not the newest entries being cut off the end, because what is left still checks out. A fingerprint you saved earlier can prove nothing was cut.`})]}):(0,Y.jsx)(`p`,{className:`text-soft`,children:`The log has no entries yet, so there is no fingerprint to save.`}),(0,Y.jsxs)(`div`,{className:`border-t border-faint pt-5`,children:[(0,Y.jsx)(r,{label:`Compare with a fingerprint you saved earlier`,help:`Paste the fingerprint exactly as you saved it.`,error:g.trim()&&!D?`That does not look like a fingerprint. It is a long run of letters a–f and digits.`:null,children:(0,Y.jsx)(l,{value:g,onChange:_,mono:!0,onEnter:O,placeholder:`e.g. 3f9a…`})}),(0,Y.jsx)(`div`,{className:`mt-3`,children:(0,Y.jsx)(E,{onClick:O,disabled:!D,loading:ee,icon:`search`,children:`Compare fingerprint`})}),b&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-3 text-[13px] font-medium text-bad`,children:b}),v&&(0,Y.jsx)(`div`,{className:`mt-4`,children:v.result.headPosition===void 0?(0,Y.jsx)(o,{tone:`danger`,role:`alert`,title:`Not found in this log`,children:`The log may have been cut short or replaced, or the fingerprint came from a different toolbox's log. Treat this as something to look into.`}):(0,Y.jsxs)(o,{tone:`ok`,role:`status`,title:`Found at entry ${L(v.result.headPosition+1)} of ${L(v.result.count)}`,children:[`Everything up to that entry is still in the log, so nothing written before you saved the fingerprint was lost.`,` `,v.result.count-v.result.headPosition-1>0?`${t(v.result.count-v.result.headPosition-1,`entry has`,`entries have`)} been added since.`:`No entries have been added since.`]})})]})]})]})})}function de(e){return/^record altered/.test(e)?`This entry was changed after it was written.`:/^sequence gap/.test(e)?`An entry before this one was removed, or entries were put out of order.`:/^chain break/.test(e)?`This entry doesn't follow on from the one before it: something was removed or put in between.`:/^unparseable JSON/.test(e)?`This entry can't be read; the file was edited or cut short.`:e}function fe({record:t,onClose:r,nav:a,redaction:o}){let c=F();if(!t)return null;let l=t,u=K(l),p=l.rule_id===`gateway.unknown-tool`,g=p?null:U(l),_=A[l.outcome]?.tone??`neutral`;return(0,Y.jsx)(h,{open:!0,onClose:r,title:u?u.title:(0,Y.jsxs)(Y.Fragment,{children:[G(l),` `,(0,Y.jsx)(`span`,{className:`mono text-[17px]`,children:l.tool})]}),subtitle:`Entry ${L(l.seq)} · ${s(l.ts)}`,width:620,footer:(0,Y.jsx)(E,{icon:`copy`,onClick:async()=>{let e=await q(`${location.origin}${i(a,{seq:String(l.seq)})}`);c.show(e?`ok`:`bad`,e?`Link to this entry copied`:`The browser did not allow copying`)},children:`Copy link to entry`}),children:(0,Y.jsxs)(`div`,{className:`space-y-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[p?(0,Y.jsx)(e,{tone:`warn`,children:`No such tool: your AI app asked for a tool this toolbox doesn't have`}):(0,Y.jsx)(w,{decision:l.decision}),!p&&C(l.outcome)!==k(l.decision)&&(0,Y.jsx)(e,{tone:_,children:V(l)?`You said no`:C(l.outcome)}),l.grant_id&&(0,Y.jsx)(e,{icon:`key`,children:`Released by a pre-approval`})]}),g&&(0,Y.jsxs)(`p`,{className:`flex gap-2 rounded-2xl bg-warn-tint px-4 py-3 text-[14px] text-ink`,children:[(0,Y.jsx)(d,{name:`eye`,size:18,className:`mt-0.5 shrink-0 text-warn`}),(0,Y.jsxs)(`span`,{children:[g,`. `,(0,Y.jsx)(b,{term:`watchOnly`})]})]}),(0,Y.jsxs)(X,{title:`What happened`,children:[(0,Y.jsx)(Z,{label:`Tool`,children:(0,Y.jsx)(`span`,{className:`mono text-[13px] break-all`,children:l.tool})}),(0,Y.jsx)(Z,{label:`What the tool does`,children:l.effect?(0,Y.jsx)(y,{effect:l.effect,withLabel:!0}):(0,Y.jsx)($,{children:N(null)})}),(0,Y.jsxs)(Z,{label:`Decided by`,children:[H(l),` `,(0,Y.jsx)(Q,{children:l.rule_id})]}),(0,Y.jsx)(Z,{label:`Reason`,children:l.reason||(0,Y.jsx)($,{children:`None recorded`})}),(0,Y.jsx)(Z,{label:`Took`,children:l.duration_ms===null?(0,Y.jsx)($,{children:`Not timed`}):m(l.duration_ms)}),l.error&&(0,Y.jsx)(Z,{label:`Error`,children:(0,Y.jsx)(`span`,{className:`text-bad`,children:l.error})})]}),(0,Y.jsxs)(X,{title:`Who asked`,children:[(0,Y.jsx)(Z,{label:`Asked by`,children:(0,Y.jsx)(`span`,{className:`break-all`,children:l.actor})}),(0,Y.jsx)(Z,{label:`Session`,children:(0,Y.jsx)(Q,{children:l.session})}),(0,Y.jsx)(Z,{label:`Written by`,children:(0,Y.jsx)(Q,{children:l.component})}),l.tenant!==null&&(0,Y.jsx)(Z,{label:(0,Y.jsxs)(Y.Fragment,{children:[`Customer `,(0,Y.jsx)(b,{term:`customer`})]}),children:l.tenant===``?(0,Y.jsx)($,{children:`None`}):l.tenant})]}),l.upstream&&(0,Y.jsxs)(X,{title:`Request to the connected server`,children:[(0,Y.jsx)(Z,{label:`Request`,children:(0,Y.jsxs)(`span`,{className:`mono text-[12.5px] break-all`,children:[l.upstream.method??`?`,` `,l.upstream.host??``,l.upstream.path??``]})}),(0,Y.jsx)(Z,{label:`Answer`,children:l.upstream.status===null?(0,Y.jsx)($,{children:`No status`}):(0,Y.jsx)(`span`,{className:`tnum`,children:l.upstream.status})}),l.upstream.bytes!==null&&(0,Y.jsx)(Z,{label:`Size`,children:f(l.upstream.bytes)})]}),(l.approval_id||l.grant_id)&&(0,Y.jsxs)(X,{title:`Linked`,children:[l.approval_id&&(0,Y.jsx)(Z,{label:`Approval request`,children:(0,Y.jsx)(me,{href:n(a,`/approvals`,{id:l.approval_id}),children:l.approval_id})}),l.grant_id&&(0,Y.jsx)(Z,{label:(0,Y.jsxs)(Y.Fragment,{children:[`Pre-approval `,(0,Y.jsx)(b,{term:`preApproval`})]}),children:(0,Y.jsx)(me,{href:n(a,`/pre-approvals`,{id:l.grant_id}),children:l.grant_id})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h3`,{className:`mb-2 flex items-center gap-2 text-[15px] font-semibold`,children:[`Inputs, as recorded `,(0,Y.jsx)(b,{term:`redaction`})]}),l.args_redacted===null?(0,Y.jsx)(`p`,{className:`text-[14px] text-soft`,children:`This toolbox does not record call inputs.`}):(0,Y.jsx)(S,{label:`Inputs as recorded`,maxHeight:260,children:JSON.stringify(l.args_redacted,null,2)}),o&&l.args_redacted!==null&&(0,Y.jsxs)(`details`,{className:`mt-3 rounded-2xl border border-faint px-4 py-3 text-[13px]`,children:[(0,Y.jsx)(`summary`,{className:`cursor-pointer font-semibold`,children:`What the hidden-value markers mean`}),(0,Y.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:o.markers.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap gap-x-3`,children:[(0,Y.jsx)(Q,{children:e.marker}),(0,Y.jsxs)(`span`,{className:`text-muted`,children:[pe(e.meaning),`.`]})]},e.marker))}),(0,Y.jsx)(`p`,{className:`mt-2 text-soft`,children:`Inputs are hidden by their name as well as their content, so a harmless value can still be hidden. The original values were never written down, so they cannot be recovered from the log.`})]})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h3`,{className:`mb-2 flex items-center gap-2 text-[15px] font-semibold`,children:[`Tamper check `,(0,Y.jsx)(b,{term:`hashChain`})]}),(0,Y.jsxs)(`ol`,{className:`space-y-2 text-[13px]`,children:[(0,Y.jsx)(he,{label:`Fingerprint of the entry before`,value:l.prev_hash}),(0,Y.jsx)(`li`,{"aria-hidden":!0,className:`pl-4 text-soft`,children:(0,Y.jsx)(d,{name:`chevron`,size:16})}),(0,Y.jsx)(he,{label:`Fingerprint of this entry`,value:l.hash,strong:!0})]}),(0,Y.jsx)(`p`,{className:`mt-2 text-[13px] text-soft`,children:`This entry's fingerprint covers its contents and the one before it, so editing or removing any earlier entry breaks every fingerprint after it.`}),(0,Y.jsxs)(`p`,{className:`mt-3 text-[12.5px] text-soft`,children:[`Fingerprint of the inputs: `,(0,Y.jsx)(Q,{children:l.args_hash})]})]})]})})}var pe=e=>e.charAt(0).toUpperCase()+e.slice(1);function X({title:e,children:t}){return(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`mb-2 text-[15px] font-semibold`,children:e}),(0,Y.jsx)(`dl`,{className:`divide-y divide-faint rounded-2xl border border-faint px-4`,children:t})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`grid gap-1 py-2.5 sm:grid-cols-[160px_1fr] sm:gap-4`,children:[(0,Y.jsx)(`dt`,{className:`flex items-center gap-1.5 text-[13px] text-soft`,children:e}),(0,Y.jsx)(`dd`,{className:`min-w-0 text-[14px]`,children:t})]})}var Q=({children:e})=>(0,Y.jsx)(`code`,{className:`mono text-[12px] break-all text-soft`,children:e}),$=({children:e})=>(0,Y.jsx)(`span`,{className:`text-soft`,children:e});function me({href:e,children:t}){return(0,Y.jsx)(`a`,{href:e,onClick:g,className:`mono text-[12.5px] break-all text-ok underline underline-offset-2`,children:t})}function he({label:e,value:t,strong:n}){return(0,Y.jsxs)(`li`,{className:n?`rounded-2xl bg-sunken px-4 py-3`:`rounded-2xl border border-faint px-4 py-3`,children:[(0,Y.jsx)(`span`,{className:`block text-[12.5px] text-soft`,children:e}),(0,Y.jsx)(`code`,{className:`mono mt-1 block text-[12px] break-all text-ink`,children:t})]})}function ge(){let{serverId:e,server:n,tenant:a,tenantInfo:s,nav:c}=ce(),[d,f]=(0,J.useState)(()=>le(c)),[m,h]=(0,J.useState)(()=>Date.now()),[g,_]=(0,J.useState)([]),[v,y]=(0,J.useState)(),[b,S]=(0,J.useState)(null),[w,T]=(0,J.useState)(!1),[O,N]=(0,J.useState)(!1),[P=``,F=``,I=``]=x([d.tool,d.actor,d.component].join(`\0`),300).split(`\0`),R={...d,tool:P,actor:F,component:I};(0,J.useEffect)(()=>{re(i(c,{...ae(R),seq:b?String(b.seq):null}))},[JSON.stringify(R),b?.seq]);let z=oe(R,a,m),B=JSON.stringify(z),V=M(()=>p.audit(e,v===void 0?z:{...z,cursor:String(v)}),[e,B,v],v===void 0?5e3:void 0),H=M(()=>p.redaction(),[]),U=v===void 0?V.data?.records??[]:[...g,...V.data?.records??[]],W=V.loading&&!V.data;function G(e){f(t=>({...t,...e})),y(void 0),_([]),e.range!==void 0&&h(Date.now())}let K=()=>{y(void 0),_([]),h(Date.now()),V.reload()},[q,de]=(0,J.useState)(()=>c.query.get(`seq`));(0,J.useEffect)(()=>{if(!q)return;let t=Number(q);if(de(null),!Number.isInteger(t)||t<0)return;let n={limit:`1`,cursor:String(t+1)};!d.allTenants&&a!==null&&(n.tenant=a),p.audit(e,n).then(e=>{let n=e.records.find(e=>e.seq===t);n&&S(n)}).catch(()=>void 0)},[q]);let pe=(0,J.useMemo)(()=>[{value:``,label:`Any decision`},...(H.data?.decisions??Object.keys(te).map(e=>({value:e,label:e}))).map(e=>({value:e.value,label:k(e.value)}))],[H.data]),X=(0,J.useMemo)(()=>[{value:``,label:`Any result`},...(H.data?.outcomes??Object.keys(A).map(e=>({value:e,label:e}))).map(e=>({value:e.value,label:C(e.value)}))],[H.data]),Z=s?.configured?s.tenants.filter(e=>e!==``):[];return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ee,{title:`Activity`,subtitle:`Every call your AI made through this toolbox, and what happened. Each entry is chained to the one before it, so edits can be detected.`,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(E,{variant:`primary`,icon:`shield-check`,onClick:()=>T(!0),children:`Check log integrity`}),(0,Y.jsx)(E,{icon:`download`,onClick:()=>N(!0),disabled:U.length===0,children:`Download log`})]})}),(0,Y.jsxs)(`div`,{className:`space-y-5`,children:[(0,Y.jsxs)(j,{title:`Filters`,actions:ie(d)&&(0,Y.jsx)(E,{size:`sm`,variant:`ghost`,icon:`x`,onClick:()=>G(se),children:`Clear filters`}),children:[(0,Y.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,Y.jsx)(r,{label:`Result`,children:(0,Y.jsx)(D,{value:d.outcome,onChange:e=>G({outcome:e}),options:X})}),(0,Y.jsx)(r,{label:`Decision`,children:(0,Y.jsx)(D,{value:d.decision,onChange:e=>G({decision:e}),options:pe})}),(0,Y.jsx)(r,{label:`Tool`,help:`Use * to match any text, like files.*`,children:(0,Y.jsx)(l,{value:d.tool,onChange:e=>G({tool:e}),mono:!0,placeholder:`Any tool`})}),(0,Y.jsx)(r,{label:`Who asked`,children:(0,Y.jsx)(l,{value:d.actor,onChange:e=>G({actor:e}),placeholder:`Anyone`})}),Z.length>0&&(0,Y.jsx)(r,{label:`Customer`,children:(0,Y.jsx)(D,{value:d.allTenants?`*`:a??``,onChange:e=>{e===`*`?G({allTenants:!0}):e===a?G({allTenants:!1}):re(i(c,{tenant:e,allTenants:null}))},options:[...a===null?[{value:``,label:`Choose a customer`}]:[],...Z.map(e=>({value:e,label:e})),{value:`*`,label:`All customers`}]})}),d.component&&(0,Y.jsx)(r,{label:`Written by`,technical:`component`,children:(0,Y.jsx)(l,{value:d.component,onChange:e=>G({component:e}),mono:!0})})]}),(0,Y.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-end justify-between gap-4 border-t border-faint pt-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-[13px] font-semibold text-soft`,"aria-hidden":!0,children:`When`}),(0,Y.jsx)(u,{label:`Time range`,value:d.range,onChange:e=>G({range:e}),options:[{value:``,label:`Any time`},{value:`1h`,label:`Last hour`},{value:`24h`,label:`Last 24 hours`},{value:`7d`,label:`Last 7 days`},{value:`custom`,label:`Custom`}]})]}),(0,Y.jsx)(ne,{checked:d.noteworthy,onChange:e=>G({noteworthy:e}),label:`Only problems`,description:`Blocked, failed or still waiting.`})]}),d.range===`custom`&&(0,Y.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Y.jsx)(xe,{label:`From`,value:d.since,onChange:e=>G({since:e})}),(0,Y.jsx)(xe,{label:`Until`,value:d.until,onChange:e=>G({until:e}),help:`Leave empty for up to now.`})]})]}),V.data&&V.data.malformed>0&&(0,Y.jsxs)(o,{tone:`warn`,title:`${t(V.data.malformed,`line`)} could not be read`,children:[`Of the `,L(V.data.scanned),` lines read for this list, `,L(V.data.malformed),` were damaged and skipped. Run the integrity check to see where.`]}),(0,Y.jsxs)(j,{title:W?`Entries`:`${t(U.length,`entry`,`entries`)}${V.data?.nextCursor==null?``:` so far`}`,actions:(0,Y.jsx)(E,{size:`sm`,variant:`ghost`,icon:`refresh`,onClick:K,loading:V.loading&&!!V.data,children:`Refresh list`}),children:[(0,Y.jsx)(_e,{loading:W,error:V.error,onRetry:V.reload,records:U,filtered:ie(d),onClear:()=>G(se),onOpen:S,mixedCustomers:d.allTenants}),V.data?.nextCursor!=null&&(0,Y.jsx)(`div`,{className:`mt-5 flex flex-wrap items-center gap-3`,children:(0,Y.jsx)(E,{icon:`chevron`,loading:V.loading,onClick:()=>{_(U),y(V.data.nextCursor)},children:`Load older entries`})})]})]}),(0,Y.jsx)(fe,{record:b,onClose:()=>S(null),nav:c,redaction:H.data}),(0,Y.jsx)(ue,{open:w,onClose:()=>T(!1),serverId:e}),(0,Y.jsx)(Se,{open:O,onClose:()=>N(!1),records:U,stem:`activity-${n.id}-${new Date().toISOString().slice(0,10)}`})]})}function _e({loading:e,error:t,onRetry:n,records:r,filtered:i,onClear:s,onOpen:c,mixedCustomers:l}){return t?(0,Y.jsx)(o,{tone:`danger`,title:`The activity log could not be read`,actions:(0,Y.jsx)(E,{size:`sm`,onClick:n,children:`Try again`}),children:t}):e?(0,Y.jsx)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[0,1,2,3,4].map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`skeleton h-10 w-10 shrink-0 rounded-full`}),(0,Y.jsx)(a,{lines:2})]},e))}):r.length===0?i?(0,Y.jsx)(_,{icon:`filter`,title:`No entries match these filters`,actions:(0,Y.jsx)(E,{onClick:s,children:`Clear filters`}),children:`The whole log was searched. Try a wider time range or fewer filters.`}):(0,Y.jsx)(_,{icon:`activity`,title:`No activity yet`,children:`Calls appear here as soon as an AI app connected to this toolbox uses a tool.`}):(0,Y.jsx)(`ul`,{className:`-mx-2`,children:r.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(be,{record:e,onOpen:()=>c(e),showCustomer:l})},`${e.seq}-${e.id}`))})}var ve={ok:`bg-ok-tint text-ok`,warn:`bg-warn-tint text-warn`,bad:`bg-bad-tint text-bad`,neutral:`bg-sunken text-muted`};function ye(e,t){if(!t&&(e.actor===`agent`||!e.actor))return`Your AI app`;if(e.actor===`gateway`)return`The toolbox`;let n=e.args_redacted?.origin;return t&&(n===`console`||e.component===`hmcp-web`||e.rule_id===`approval.decide`||e.tool?.startsWith(`(`))?e.actor&&e.actor!==`console`?`You (${e.actor})`:`You`:e.actor}function be({record:t,onOpen:n,showCustomer:r}){let i=K(t),a=t.rule_id===`gateway.unknown-tool`,o=a?null:U(t),c=A[t.outcome]?.tone??`neutral`,l=i?`neutral`:a?`warn`:t.outcome===`error`?`bad`:te[t.decision]?.tone??`neutral`,u=i?.icon??(t.decision===`deny`?`x`:t.decision===`approve`?`clock`:`check`);return(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`flex w-full flex-wrap items-center gap-x-3 gap-y-2 rounded-2xl px-2 py-3 text-left transition-colors hover:bg-faint focus-visible:bg-faint`,children:[(0,Y.jsx)(`span`,{className:I(`grid h-10 w-10 shrink-0 place-items-center rounded-full`,ve[l]),children:(0,Y.jsx)(d,{name:u,size:18,strokeWidth:2})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 basis-56`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-[14.5px] font-medium`,children:i?(0,Y.jsxs)(Y.Fragment,{children:[i.title,t.tool&&!t.tool.startsWith(`(`)&&(0,Y.jsx)(`span`,{className:`ml-1.5 text-soft`,title:t.tool,children:W(t.tool).label})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-soft`,children:G(t)}),` `,(0,Y.jsx)(`span`,{title:t.tool,children:W(t.tool).label})]})}),(0,Y.jsxs)(`span`,{className:`mt-0.5 block truncate text-[12.5px] text-soft`,children:[(0,Y.jsx)(`time`,{dateTime:t.ts,title:s(t.ts),children:v(t.ts)}),` · `,ye(t,i!==null),r&&t.tenant?` · ${t.tenant}`:``,!i&&(0,Y.jsxs)(Y.Fragment,{children:[` · `,H(t)]})]}),o&&(0,Y.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 text-[12.5px] font-medium text-warn`,children:[(0,Y.jsx)(d,{name:`eye`,size:14,strokeWidth:2}),o]})]}),(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 max-sm:pl-[52px] sm:shrink-0`,children:[a?(0,Y.jsx)(e,{tone:`warn`,children:`No such tool`}):!i&&(0,Y.jsx)(w,{decision:t.decision}),!a&&(i||C(t.outcome)!==k(t.decision))&&(0,Y.jsx)(e,{tone:c,children:V(t)?`You said no`:C(t.outcome)}),(0,Y.jsx)(d,{name:`chevron-right`,size:18,className:`text-soft max-sm:hidden`})]})]})}function xe({label:e,value:t,onChange:n,help:i}){return(0,Y.jsx)(r,{label:e,help:i,children:(0,Y.jsx)(`input`,{type:`datetime-local`,value:t,onChange:e=>n(e.target.value),className:`field`})})}function Se({open:e,onClose:n,records:r,stem:i}){let[a,o]=(0,J.useState)(`jsonl`);return(0,Y.jsx)(P,{open:e,onClose:n,title:`Download log`,description:`Saves the ${t(r.length,`entry`,`entries`)} listed now, with the filters you set. Load older entries first to include more.`,footer:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(E,{variant:`ghost`,onClick:n,children:`Cancel`}),(0,Y.jsx)(E,{variant:`primary`,icon:`download`,onClick:()=>{a===`jsonl`?z(`${i}.jsonl`,`application/x-ndjson`,B(r)):z(`${i}.csv`,`text/csv`,R(r)),n()},children:`Download file`})]}),children:(0,Y.jsxs)(`fieldset`,{className:`space-y-3`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:`File format`}),(0,Y.jsx)(Ce,{checked:a===`jsonl`,onSelect:()=>o(`jsonl`),title:`Exact log entries (JSONL)`,children:`One entry per line, exactly as written, fingerprints included. Use this to keep a copy or to check it later.`}),(0,Y.jsx)(Ce,{checked:a===`csv`,onSelect:()=>o(`csv`),title:`Spreadsheet (CSV)`,children:`The main columns, for sorting and counting in a spreadsheet. Fingerprints are left out.`})]})})}function Ce({checked:e,onSelect:t,title:n,children:r}){return(0,Y.jsxs)(`label`,{className:I(`flex cursor-pointer gap-3 rounded-2xl border-[1.5px] px-4 py-3 transition-colors`,e?`border-[var(--primary)] bg-ok-tint/40`:`border-line hover:bg-faint`),children:[(0,Y.jsx)(`input`,{type:`radio`,name:`log-format`,checked:e,onChange:t,className:`mt-1 accent-[var(--primary)]`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block text-[14px] font-semibold`,children:n}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-[13px] text-soft`,children:r})]})]})}export{ge as ActivityPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,D as r,E as i,Et as a,F as o,G as s,H as c,I as l,It as u,J as d,K as f,M as p,Nt as m,Ot as h,Pt as g,T as _,U as v,V as ee,Y as te,Z as y,_ as b,_t as x,c as S,gt as ne,ht as C,j as w,kt as T,mt as E,pt as D,q as O,rt as k,s as A,w as j,wt as M,x as re,y as ie,yt as N}from"./kit-DRVm92_t.js";import{a as P,c as ae,l as F,n as oe,o as I,r as L,s as R,t as se,u as z,un as ce}from"./index-CTvq_isK.js";var B=u(),V=T(),H=/^\[redacted:([^\]]+)\]$/,U=/…\[truncated (\d+) chars\]$/,W=/^\[truncated (\d+) items\]$/;function G(e){if(typeof e!=`string`)return null;let t=H.exec(e);return t?t[1]===`key`||t[1]===`circular`||t[1]===`max-depth`?t[1]:`pattern`:U.test(e)?`chars`:W.test(e)?`items`:null}function K(e,t,n=0){if(n>20)return;let r=G(e);r&&t.add(r),Array.isArray(e)?e.forEach(e=>K(e,t,n+1)):e&&typeof e==`object`&&Object.values(e).forEach(e=>K(e,t,n+1))}var q={key:`[redacted:key]`,pattern:`[redacted:<pattern>]`,circular:`[redacted:circular]`,"max-depth":`[redacted:max-depth]`,chars:`…[truncated N chars]`,items:`[truncated N items]`},J={key:`Hidden`,pattern:`Hidden`,circular:`Hidden`,"max-depth":`Hidden`,chars:`Cut short`,items:`Cut short`};function Y({args:e,error:t,meta:n}){let r=new Set;K(e,r);let i=e=>n?.markers.find(t=>t.marker===q[e])?.meaning,a=e&&typeof e==`object`&&!Array.isArray(e)?Object.entries(e):null;return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[t&&(0,V.jsx)(c,{tone:`warn`,title:`Some inputs could not be read back`,children:t}),a===null?e==null?!t&&(0,V.jsx)(`p`,{className:`text-[13.5px] text-soft`,children:`The inputs were not recorded.`}):(0,V.jsx)(X,{value:e,meaning:i}):a.length===0?(0,V.jsx)(`p`,{className:`text-[13.5px] text-soft`,children:`This call sent no inputs.`}):(0,V.jsx)(`dl`,{className:`divide-y divide-faint overflow-hidden rounded-2xl bg-sunken/60`,children:a.map(([e,t])=>(0,V.jsxs)(`div`,{className:`grid gap-1 px-4 py-2.5 sm:grid-cols-[minmax(6rem,10rem)_minmax(0,1fr)] sm:gap-4`,children:[(0,V.jsx)(`dt`,{className:`mono pt-px text-[12.5px] break-all text-soft`,children:e}),(0,V.jsx)(`dd`,{className:`min-w-0`,children:(0,V.jsx)(X,{value:t,meaning:i})})]},e))}),r.size>0&&(0,V.jsxs)(`div`,{className:`flex gap-2 text-[12.5px] text-soft`,children:[(0,V.jsx)(h,{name:`eye-off`,size:15,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,V.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium text-muted`,children:[`Some values are hidden or cut short in the record `,(0,V.jsx)(b,{term:`redaction`})]}),[...r].map(e=>(0,V.jsxs)(`p`,{children:[(0,V.jsx)(`code`,{className:`mono text-[11.5px]`,children:q[e]}),`: `,i(e)??`not shown in full`]},e))]})]})]})}function X({value:t,meaning:n}){let r=G(t);if(r&&r!==`chars`)return(0,V.jsx)(e,{tone:`neutral`,icon:`eye-off`,title:n(r),children:J[r]});if(typeof t==`string`){let r=U.exec(t),i=r?t.slice(0,r.index):t;return(0,V.jsxs)(`p`,{className:`scrollbar-thin max-h-40 overflow-y-auto text-[13.5px] break-words whitespace-pre-wrap`,children:[i===``?(0,V.jsx)(`span`,{className:`text-soft`,children:`(empty)`}):i,r&&(0,V.jsxs)(e,{tone:`neutral`,className:`ml-1.5 align-middle`,title:n(`chars`),children:[r[1],` more characters not recorded`]})]})}return typeof t==`number`||typeof t==`boolean`||t===null?(0,V.jsx)(`span`,{className:`mono text-[13px]`,children:String(t)}):(0,V.jsx)(`pre`,{className:`scrollbar-thin mono max-h-48 overflow-auto rounded-xl bg-surface px-3 py-2 text-[12px] leading-relaxed whitespace-pre-wrap break-words`,children:JSON.stringify(t,null,2)})}var Z=e=>e instanceof m&&(e.status===409||e.status===404);function le({approval:e,meta:t,now:n,serverId:a,tenant:s,selecting:u,selected:d,onSelect:f,locked:h,onDecided:v,onRemembered:te}){let x=ie(),[S,ne]=(0,B.useState)(``),[w,T]=(0,B.useState)(null),[E,D]=(0,B.useState)(!1),[O,A]=(0,B.useState)(t?.rememberDefaults.ttlSeconds??3600),[M,re]=(0,B.useState)(t?.rememberDefaults.maxUses??20),[F,oe]=(0,B.useState)(!1),[ce,H]=(0,B.useState)(null),U=R(e.tool),W=e.expiresAt-n,G=L(e),K=t?.grantTtlMaxSeconds,q=h||w!==null;async function J(t,n={}){T(n.remember?`remember`:n.classify?`classify-${n.classify}`:t),H(null);let r;try{r=await g.decide(a,e.id,t,S.trim(),s,n.classify,n.remember)}catch(e){T(null),Z(e)?(x.show(`warn`,`This call was already answered, or it ran out of time.`),v()):n.remember&&e instanceof m&&e.status===422?H(I(e.message)):x.show(`bad`,I(e.message));return}T(null),t===`denied`?x.show(`ok`,`You said no. ${U.label} will not run, and the AI is told you said no.`):r.remembered?(x.show(`ok`,`Approved. Similar calls won't ask until ${ae(r.remembered.expiresAt)}.`),te(r.remembered,e.tool)):r.classifyWarning?x.show(`warn`,I(r.classifyWarning)):r.classified&&n.classify?x.show(`ok`,`Approved, and ${U.label} is now labelled "${k[n.classify].label}". Its calls still ask you.`):x.show(`ok`,`Approved. The call can go ahead.`),v()}let X=O!==null&&(K===void 0||O<=K)&&(F||M!==null&&M>=1);return(0,V.jsxs)(`article`,{"aria-labelledby":`apr-${e.id}`,className:N(`card flex min-w-0 flex-col gap-5 p-5 sm:p-6`,d&&`outline-2 outline-offset-2 outline-[var(--primary)]`),children:[(0,V.jsxs)(`header`,{className:`flex items-start gap-3`,children:[u&&(0,V.jsx)(`span`,{className:`pt-2.5`,children:(0,V.jsx)(j,{checked:d,onChange:f,disabled:q,label:(0,V.jsxs)(`span`,{className:`sr-only`,children:[`Select `,U.label]})})}),(0,V.jsx)(`span`,{className:`grid h-11 w-11 shrink-0 place-items-center rounded-full bg-sunken`,children:(0,V.jsx)(y,{effect:e.effect})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h3`,{id:`apr-${e.id}`,tabIndex:-1,className:`text-[18px] outline-none focus-visible:outline-2 focus-visible:outline-[var(--focus)] leading-snug font-medium tracking-[-0.015em] break-words`,children:U.label}),(0,V.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-soft`,children:[U.server&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{children:U.server}),(0,V.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}),(0,V.jsx)(y,{effect:e.effect,withLabel:!0})]})]})]}),(0,V.jsxs)(`section`,{"aria-label":`What it wants to do`,className:`space-y-2.5`,children:[(0,V.jsx)(`p`,{className:`text-[15px] leading-relaxed [overflow-wrap:anywhere]`,children:se(e)}),(0,V.jsx)(`p`,{className:`text-[14px] text-muted`,children:z(e)}),e.violations.length>0&&(0,V.jsx)(`ul`,{className:`space-y-1.5 rounded-2xl bg-warn-tint px-4 py-3 text-[13.5px]`,children:e.violations.map(t=>(0,V.jsxs)(`li`,{className:`flex gap-2`,children:[(0,V.jsx)(`span`,{className:`mt-[7px] h-1.5 w-1.5 shrink-0 rounded-full bg-warn`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`min-w-0 break-words`,children:P(t,e.args)})]},t))}),(0,V.jsx)(`p`,{className:`text-[13px] text-soft`,children:W>0?`If you don't answer by ${o(e.expiresAt)}, it doesn't run. The AI can ask again.`:`This request ran out of time, so it doesn't run. The AI can ask again.`})]}),(0,V.jsxs)(`section`,{"aria-label":`The details it would send`,className:`space-y-2`,children:[(0,V.jsx)(`h4`,{className:`eyebrow`,children:`The details it would send`}),(0,V.jsx)(Y,{args:e.args,error:e.argsError,meta:t})]}),(0,V.jsxs)(`details`,{className:`group text-[12.5px] text-soft`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer select-none font-medium text-muted`,children:`Details`}),(0,V.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1`,children:[(0,V.jsx)(`dt`,{children:`Tool`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`code`,{className:`mono break-all`,children:e.tool})}),(0,V.jsx)(`dt`,{children:`Asked by`}),(0,V.jsxs)(`dd`,{children:[e.actor,` `,(0,V.jsx)(`span`,{title:l(e.createdAt),children:ee(e.createdAt,n)})]}),(0,V.jsx)(`dt`,{children:`Session`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`code`,{className:`mono break-all`,children:e.session})}),e.ruleId&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Rule`}),(0,V.jsx)(`dd`,{children:(0,V.jsx)(`code`,{className:`mono break-all`,children:e.ruleId})})]}),(0,V.jsx)(`dt`,{children:`Request`}),(0,V.jsxs)(`dd`,{children:[(0,V.jsx)(`code`,{className:`mono break-all`,children:e.id}),`, expires `,l(e.expiresAt)]})]})]}),(0,V.jsxs)(`div`,{className:`mt-auto space-y-3 border-t border-faint pt-4`,children:[(0,V.jsx)(i,{label:`Note for the activity log`,optional:!0,children:(0,V.jsx)(p,{value:S,onChange:ne,placeholder:`Why you said yes or no`,disabled:q})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(C,{variant:`primary`,icon:`check`,onClick:()=>J(`granted`),loading:w===`granted`,disabled:q,children:`Approve`}),(0,V.jsx)(C,{variant:`secondary`,icon:`x`,onClick:()=>J(`denied`),loading:w===`denied`,disabled:q,children:`Say no`}),e.rememberAllowed&&!G&&(0,V.jsx)(C,{variant:`ghost`,icon:E?`chevron`:`chevron-right`,"aria-expanded":E,"aria-controls":`remember-${e.id}`,onClick:()=>D(e=>!e),disabled:q,children:`Approve and don't ask again`})]}),G&&(0,V.jsxs)(`div`,{className:`space-y-2.5 rounded-2xl bg-sunken/70 p-4`,children:[(0,V.jsx)(`p`,{className:`text-[13.5px] font-semibold`,children:`Approve and remember this tool as:`}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":`Approve and say what this tool does`,children:[`read`,`write`,`destructive`].map(e=>(0,V.jsx)(C,{size:`sm`,variant:`secondary`,onClick:()=>J(`granted`,{classify:e}),loading:w===`classify-${e}`,disabled:q,title:k[e].explain,children:k[e].label},e))}),(0,V.jsx)(`p`,{className:`text-[12.5px] text-soft`,children:`This approves the call and saves what the tool does in your protection settings. Its calls still ask you; once it is labelled you can set a rule for it on the Tools page.`})]}),E&&e.rememberAllowed&&(0,V.jsxs)(`div`,{id:`remember-${e.id}`,className:`space-y-4 rounded-2xl bg-sunken/70 p-4`,children:[(0,V.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[14px] font-semibold`,children:[`Approve and don't ask again `,(0,V.jsx)(b,{term:`preApproval`})]}),(0,V.jsx)(i,{label:`For how long`,children:(0,V.jsx)(_,{value:O,onChange:A,label:`For how long`,max:K})}),(0,V.jsx)(i,{label:`Up to how many calls`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,V.jsx)(r,{value:F?null:M,onChange:re,min:1,step:1,unit:`calls`,disabled:F||q,className:`w-40`}),(0,V.jsx)(j,{checked:F,onChange:oe,label:`No limit`,disabled:q})]})}),(0,V.jsx)(`p`,{className:`text-[13px] text-muted`,children:`For the time you choose, your AI can make this same request again without asking. Anything different still asks you, including a list with items changed, repeated or left out. You can take it back any time on the Pre-approvals page.`}),ce&&(0,V.jsx)(c,{tone:`danger`,title:`Nothing was approved`,role:`alert`,children:ce}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(C,{variant:`primary`,icon:`check`,disabled:!X||q,loading:w===`remember`,onClick:()=>J(`granted`,{remember:{ttlSeconds:O,maxUses:F?null:M}}),children:`Approve and remember`}),(0,V.jsx)(C,{variant:`ghost`,onClick:()=>D(!1),disabled:w!==null,children:`Cancel`})]})]})]})]})}var ue={elicit:`On this toolbox your AI app asks you in its own window, so calls usually do not wait here.`,cli:`On this toolbox every call that needs your OK waits here until you answer it.`,both:`Your AI app asks you in its own window when it can. When it cannot, the call waits here.`,deny:`On this toolbox calls that would need your OK are blocked instead, so nothing waits here.`};function Q(){let{serverId:e,tenant:r,nav:i,reload:o}=ce(),l=ie(),u=F(1e3),f=A(()=>g.pending(e,r),[e,r],2e3),p=A(()=>g.approvals(e,r,{limit:200}),[e,r],15e3),h=A(()=>g.redaction(),[]),_=A(()=>g.protection(e,r),[e,r],3e4),y=i.query.get(`id`),b=y!==null&&(f.data??[]).some(e=>e.id===y),T=i.query.get(`tab`)===`history`||y!==null&&f.data!==null&&!b?`history`:`waiting`,k=e=>M(a(i,{tab:e===`waiting`?null:e})),j=(0,B.useMemo)(()=>[...f.data??[]].filter(e=>e.expiresAt>u).sort((e,t)=>e.createdAt-t.createdAt),[f.data,u]),N=(0,B.useMemo)(()=>(p.data??[]).filter(e=>e.state!==`pending`).sort((e,t)=>(t.decidedAt??t.expiresAt)-(e.decidedAt??e.expiresAt)),[p.data]),[P,L]=(0,B.useState)(!1),[se,z]=(0,B.useState)([]),H=new Set(j.map(e=>e.id)),U=se.filter(e=>H.has(e)),[W,G]=(0,B.useState)(null),[K,q]=(0,B.useState)(``),[J,Y]=(0,B.useState)(!1),[X,Z]=(0,B.useState)(null),Q=(0,B.useRef)(!1),de=(0,B.useRef)(null),fe=(0,B.useRef)(null);(0,B.useEffect)(()=>{Q.current&&f.data!==null&&(Q.current=!1,(de.current?.querySelector(`article h3[tabindex]`)??fe.current)?.focus())},[f.data]);let me=()=>{f.reload(),p.reload(),_.reload(),o()};async function he(n){Y(!0);let i=0,a=0,o=[];for(let t of U)try{await g.decide(e,t,n,K.trim(),r),i++}catch(e){e instanceof m&&(e.status===409||e.status===404)?a++:o.push(I(e.message))}Y(!1),G(null),q(``),z([]),L(!1),me();let s=[`${n===`granted`?`Approved`:`Denied`} ${t(i,`call`)}.`];a&&s.push(`${t(a,`call`)} had already been answered or ran out of time.`),o.length&&s.push(`${o.length} failed: ${o[0]}`),l.show(o.length?`bad`:a?`warn`:`ok`,s.join(` `))}let $=_.data?.approvals,ge=$?ue[$.mode]:void 0,_e=j.reduce((e,t)=>e===null||t.expiresAt<e?t.expiresAt:e,null),ve=j[0];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(S,{title:`Waiting for you`,subtitle:`Your AI wanted to do these things. Nothing happens until you decide.`,actions:(0,V.jsx)(C,{variant:P?`primary`:`secondary`,icon:P?`x`:`list`,"aria-pressed":P,disabled:!P&&j.length<2,onClick:()=>{L(e=>!e),z([])},children:P?`Stop selecting`:`Select several`})}),(0,V.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2 xl:grid-cols-3`,children:[(0,V.jsx)(E,{tone:`hero`,title:`Waiting now`,loading:f.data===null&&!f.error,value:j.length,sub:ve?`Oldest asked ${ee(ve.createdAt,u)}`:`Nothing needs you`}),(0,V.jsxs)(`div`,{className:`contents max-sm:hidden`,children:[(0,V.jsx)(E,{title:`Expires next`,loading:f.data===null&&!f.error,value:_e===null?`None`:oe(_e-u),sub:_e===null?`Nothing is waiting`:`A request nobody answers doesn't run`}),(0,V.jsx)(E,{title:`Pre-approvals in use`,loading:_.data===null&&!_.error,value:$?.activeGrantCount??`–`,sub:`Calls they cover skip this page`,href:n(i,`/pre-approvals`),hrefLabel:`Open pre-approvals`})]})]}),(0,V.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[$&&$.pendingElsewhere>0&&(0,V.jsxs)(c,{tone:`info`,title:`${t($.pendingElsewhere,`call`)} ${$.pendingElsewhere===1?`is`:`are`} waiting for a different customer`,children:[`Choose that customer at the top of the page to answer `,$.pendingElsewhere===1?`it`:`them`,`.`]}),X&&(0,V.jsxs)(c,{tone:`ok`,title:`Pre-approval created`,role:`status`,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(x,{size:`sm`,variant:`secondary`,href:n(i,`/pre-approvals`,{grant:X.grant.id}),children:`Open pre-approval`}),(0,V.jsx)(ne,{icon:`x`,label:`Dismiss message`,size:32,onClick:()=>Z(null)})]}),children:[`Calls like this one to `,R(X.tool).label,` won't ask until `,ae(X.grant.expiresAt),X.grant.maxUses===null?``:`, for up to ${t(X.grant.maxUses,`call`)}`,`.`]})]}),(0,V.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,V.jsx)(O,{label:`Calls`,value:T,onChange:k,items:[{id:`waiting`,label:`Waiting`,count:j.length},{id:`history`,label:`Decided earlier`,count:N.length}]}),T===`waiting`&&j.length>0&&(0,V.jsx)(`p`,{className:`text-[13px] text-soft`,children:`Oldest first: the call at the top runs out soonest.`})]}),(0,V.jsx)(`div`,{role:`tabpanel`,id:te(T),"aria-labelledby":d(T),className:`mt-5`,children:T===`waiting`?(0,V.jsxs)(V.Fragment,{children:[P&&j.length>0&&(0,V.jsx)(D,{className:`mb-5`,padded:!1,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 px-5 py-4`,children:[(0,V.jsxs)(`p`,{className:`min-w-0 flex-1 text-[14px]`,children:[(0,V.jsx)(`span`,{className:`tnum font-semibold`,children:U.length}),` of `,t(j.length,`call`),` selected`]}),(0,V.jsx)(C,{size:`sm`,variant:`ghost`,onClick:()=>z(U.length===j.length?[]:j.map(e=>e.id)),children:U.length===j.length?`Clear selection`:`Select all`}),(0,V.jsx)(C,{size:`sm`,variant:`primary`,icon:`check`,disabled:U.length===0,onClick:()=>G(`granted`),children:`Approve all`}),(0,V.jsx)(C,{size:`sm`,variant:`secondary`,icon:`x`,disabled:U.length===0,onClick:()=>G(`denied`),children:`Deny all`})]})}),f.error&&(0,V.jsx)(`div`,{className:`mb-5`,children:(0,V.jsx)(c,{tone:`danger`,title:`Could not load the calls waiting for you`,role:`alert`,actions:(0,V.jsx)(C,{size:`sm`,icon:`refresh`,onClick:f.reload,children:`Try again`}),children:I(f.error)})}),f.data===null?!f.error&&(0,V.jsx)(`div`,{className:`grid gap-5 xl:grid-cols-2`,children:[0,1].map(e=>(0,V.jsxs)(D,{children:[(0,V.jsx)(s,{height:22,width:`45%`}),(0,V.jsx)(`div`,{className:`mt-5`,children:(0,V.jsx)(s,{lines:4})})]},e))}):j.length===0?(0,V.jsx)(D,{children:(0,V.jsx)(`div`,{ref:fe,tabIndex:-1,className:`outline-none`,children:(0,V.jsxs)(v,{icon:`inbox`,title:`Nothing is waiting for you.`,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(C,{variant:`secondary`,onClick:()=>k(`history`),children:`Show decided calls`}),(0,V.jsx)(x,{variant:`secondary`,href:n(i,`/pre-approvals`),children:`Manage pre-approvals`})]}),children:[`When your AI tries something that needs your OK, it appears here and this page updates by itself.`,` `,ge]})})}):(0,V.jsx)(`div`,{ref:de,className:`grid items-start gap-5 xl:grid-cols-2`,children:j.map(t=>(0,V.jsx)(`div`,{className:t.id===y?`rounded-[22px] ring-2 ring-[var(--focus)] ring-offset-2 ring-offset-[var(--bg)]`:void 0,children:(0,V.jsx)(le,{approval:t,meta:h.data,now:u,serverId:e,tenant:r,selecting:P,selected:P&&U.includes(t.id),onSelect:e=>z(n=>e?[...new Set([...n,t.id])]:n.filter(e=>e!==t.id)),locked:J,onDecided:()=>{Q.current=!0,me()},onRemembered:(e,t)=>Z({grant:e,tool:t})})},t.id))})]}):(0,V.jsx)(pe,{rows:N,error:p.error,loading:p.data===null,retry:p.reload,now:u,focusId:y})}),(0,V.jsxs)(re,{open:W!==null,onClose:()=>!J&&G(null),dismissable:!J,title:W===`granted`?`Approve ${t(U.length,`call`)}?`:`Deny ${t(U.length,`call`)}?`,description:W===`granted`?`Each call runs with exactly the inputs shown on its card. Nothing else is approved.`:`None of these calls will run. Your AI is told they were denied.`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(C,{variant:`secondary`,onClick:()=>G(null),disabled:J,children:`Go back`}),(0,V.jsx)(C,{variant:W===`granted`?`primary`:`danger`,loading:J,onClick:()=>W&&he(W),children:W===`granted`?`Approve all`:`Deny all`})]}),children:[(0,V.jsx)(`ul`,{className:`mb-4 max-h-48 space-y-1 overflow-y-auto text-[14px]`,children:j.filter(e=>U.includes(e.id)).map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:R(e.tool).label}),(0,V.jsx)(`code`,{className:`mono text-[12px] text-soft`,children:e.tool})]},e.id))}),(0,V.jsx)(w,{value:K,onChange:q,rows:2,"aria-label":`Note for the activity log, for every selected call`,placeholder:`Note for the activity log (optional)`})]})]})}function de(t){return t.decidedBy?.startsWith(`standing-grant:`)?(0,V.jsx)(e,{tone:`ok`,icon:`key`,children:`Let through by a pre-approval`}):t.state===`granted`||t.state===`used`?(0,V.jsx)(e,{tone:`ok`,icon:`check`,children:`Approved`}):t.state===`denied`?(0,V.jsx)(e,{tone:`bad`,icon:`x`,children:`Denied`}):t.state===`expired`?(0,V.jsx)(e,{tone:`neutral`,icon:`clock`,children:`Expired`}):(0,V.jsx)(e,{children:t.state})}function fe(e){return e.decidedBy?e.decidedBy.startsWith(`standing-grant:`)?(0,V.jsxs)(`span`,{children:[`Pre-approval `,(0,V.jsx)(`code`,{className:`mono text-[12px] text-soft`,children:e.decidedBy.slice(15)})]}):e.decidedBy:(0,V.jsx)(`span`,{className:`text-soft`,children:e.state===`expired`?`Nobody answered`:`Not recorded`})}function pe({rows:e,error:t,loading:n,retry:r,now:i,focusId:a}){let o=[{key:`call`,header:`Call`,cell:e=>(0,V.jsxs)(`span`,{className:`block min-w-0`,children:[(0,V.jsx)(`span`,{className:`block font-medium`,children:R(e.tool).label}),(0,V.jsx)(`code`,{className:`mono block text-[12px] break-all text-soft`,children:e.tool})]})},{key:`result`,header:`Result`,cell:de},{key:`who`,header:`Decided by`,cell:fe},{key:`when`,header:`When`,cell:e=>{let t=e.decidedAt??e.expiresAt;return(0,V.jsx)(`span`,{title:l(t),children:ee(t,i)})}},{key:`note`,header:`Note`,cell:e=>e.decisionNote?(0,V.jsx)(`span`,{className:`break-words`,children:e.decisionNote}):(0,V.jsx)(`span`,{className:`text-soft`,children:`None`}),hideOnMobile:!1}];return(0,V.jsxs)(D,{children:[t&&(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsx)(c,{tone:`danger`,title:`Could not load decided calls`,actions:(0,V.jsx)(C,{size:`sm`,icon:`refresh`,onClick:r,children:`Try again`}),children:I(t)})}),n?!t&&(0,V.jsx)(s,{lines:5,height:18}):(0,V.jsx)(f,{caption:`Calls decided earlier`,columns:o,rows:e,rowKey:e=>e.id,selectedKey:a,empty:(0,V.jsx)(v,{icon:`clock`,title:`No calls decided yet`,compact:!0,children:`Calls you approve or deny, and calls that run out of time, are listed here.`})})]})}export{Q as ApprovalsPage};
|