@suveren/gateway 0.6.2 → 0.6.4
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/content/integrations/calendar.json +6 -3
- package/content/integrations/crm.json +6 -3
- package/content/integrations/deploy-github.json +5 -1
- package/content/integrations/gmail.json +16 -6
- package/content/integrations/linkedin.json +75 -16
- package/content/integrations/records.json +76 -14
- package/dist/mcp-server/http.mjs +215 -28
- package/dist/ui/assets/index-DIcuh0I4.css +1 -0
- package/dist/ui/assets/index-Dl5isaOV.js +105 -0
- package/dist/ui/index.html +2 -2
- package/dist/ui/mockups/audit-and-header.html +192 -0
- package/node_modules/@hap/core/dist/index.d.mts +139 -6
- package/node_modules/@hap/core/dist/index.d.ts +139 -6
- package/node_modules/@hap/core/dist/index.js +93 -0
- package/node_modules/@hap/core/dist/index.mjs +88 -0
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/content-binding.ts +168 -0
- package/node_modules/@hap/core/src/types.ts +85 -5
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +8 -0
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +1 -1
- package/node_modules/jose/dist/webapi/jwks/local.js +3 -3
- package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +3 -3
- package/node_modules/jose/dist/webapi/key/generate_secret.js +2 -2
- package/node_modules/jose/dist/webapi/lib/asn1.js +3 -3
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +6 -15
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -5
- package/node_modules/jose/dist/webapi/lib/key.js +1 -1
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +8 -8
- package/node_modules/jose/package.json +1 -1
- package/package.json +2 -2
- package/profiles/deploy/0.7.profile.json +2 -1
- package/profiles/email/0.5.profile.json +200 -0
- package/profiles/index.json +1 -0
- package/dist/ui/assets/index-DoZvxHLN.js +0 -105
- package/dist/ui/assets/index-JHaCddDE.css +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
var Qf=Object.defineProperty;var Jf=(e,t,n)=>t in e?Qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Oa=(e,t,n)=>Jf(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var eu={exports:{}},wa={},tu={exports:{}},ae={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var as=Symbol.for("react.element"),Xf=Symbol.for("react.portal"),qf=Symbol.for("react.fragment"),Zf=Symbol.for("react.strict_mode"),ep=Symbol.for("react.profiler"),tp=Symbol.for("react.provider"),np=Symbol.for("react.context"),rp=Symbol.for("react.forward_ref"),sp=Symbol.for("react.suspense"),ap=Symbol.for("react.memo"),op=Symbol.for("react.lazy"),Nl=Symbol.iterator;function ip(e){return e===null||typeof e!="object"?null:(e=Nl&&e[Nl]||e["@@iterator"],typeof e=="function"?e:null)}var nu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ru=Object.assign,su={};function dr(e,t,n){this.props=e,this.context=t,this.refs=su,this.updater=n||nu}dr.prototype.isReactComponent={};dr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};dr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function au(){}au.prototype=dr.prototype;function ji(e,t,n){this.props=e,this.context=t,this.refs=su,this.updater=n||nu}var ki=ji.prototype=new au;ki.constructor=ji;ru(ki,dr.prototype);ki.isPureReactComponent=!0;var El=Array.isArray,ou=Object.prototype.hasOwnProperty,bi={current:null},iu={key:!0,ref:!0,__self:!0,__source:!0};function lu(e,t,n){var r,s={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)ou.call(t,r)&&!iu.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:as,type:e,key:o,ref:i,props:s,_owner:bi.current}}function lp(e,t){return{$$typeof:as,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ci(e){return typeof e=="object"&&e!==null&&e.$$typeof===as}function cp(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Tl=/\/+/g;function Ba(e,t){return typeof e=="object"&&e!==null&&e.key!=null?cp(""+e.key):t.toString(36)}function Rs(e,t,n,r,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case as:case Xf:i=!0}}if(i)return i=e,s=s(i),e=r===""?"."+Ba(i,0):r,El(s)?(n="",e!=null&&(n=e.replace(Tl,"$&/")+"/"),Rs(s,t,n,"",function(d){return d})):s!=null&&(Ci(s)&&(s=lp(s,n+(!s.key||i&&i.key===s.key?"":(""+s.key).replace(Tl,"$&/")+"/")+e)),t.push(s)),1;if(i=0,r=r===""?".":r+":",El(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+Ba(o,l);i+=Rs(o,t,n,c,s)}else if(c=ip(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+Ba(o,l++),i+=Rs(o,t,n,c,s);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function fs(e,t,n){if(e==null)return e;var r=[],s=0;return Rs(e,r,"","",function(o){return t.call(n,o,s++)}),r}function up(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Xe={current:null},_s={transition:null},dp={ReactCurrentDispatcher:Xe,ReactCurrentBatchConfig:_s,ReactCurrentOwner:bi};function cu(){throw Error("act(...) is not supported in production builds of React.")}ae.Children={map:fs,forEach:function(e,t,n){fs(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return fs(e,function(){t++}),t},toArray:function(e){return fs(e,function(t){return t})||[]},only:function(e){if(!Ci(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ae.Component=dr;ae.Fragment=qf;ae.Profiler=ep;ae.PureComponent=ji;ae.StrictMode=Zf;ae.Suspense=sp;ae.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dp;ae.act=cu;ae.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=ru({},e.props),s=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=bi.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)ou.call(t,c)&&!iu.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:as,type:e.type,key:s,ref:o,props:r,_owner:i}};ae.createContext=function(e){return e={$$typeof:np,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tp,_context:e},e.Consumer=e};ae.createElement=lu;ae.createFactory=function(e){var t=lu.bind(null,e);return t.type=e,t};ae.createRef=function(){return{current:null}};ae.forwardRef=function(e){return{$$typeof:rp,render:e}};ae.isValidElement=Ci;ae.lazy=function(e){return{$$typeof:op,_payload:{_status:-1,_result:e},_init:up}};ae.memo=function(e,t){return{$$typeof:ap,type:e,compare:t===void 0?null:t}};ae.startTransition=function(e){var t=_s.transition;_s.transition={};try{e()}finally{_s.transition=t}};ae.unstable_act=cu;ae.useCallback=function(e,t){return Xe.current.useCallback(e,t)};ae.useContext=function(e){return Xe.current.useContext(e)};ae.useDebugValue=function(){};ae.useDeferredValue=function(e){return Xe.current.useDeferredValue(e)};ae.useEffect=function(e,t){return Xe.current.useEffect(e,t)};ae.useId=function(){return Xe.current.useId()};ae.useImperativeHandle=function(e,t,n){return Xe.current.useImperativeHandle(e,t,n)};ae.useInsertionEffect=function(e,t){return Xe.current.useInsertionEffect(e,t)};ae.useLayoutEffect=function(e,t){return Xe.current.useLayoutEffect(e,t)};ae.useMemo=function(e,t){return Xe.current.useMemo(e,t)};ae.useReducer=function(e,t,n){return Xe.current.useReducer(e,t,n)};ae.useRef=function(e){return Xe.current.useRef(e)};ae.useState=function(e){return Xe.current.useState(e)};ae.useSyncExternalStore=function(e,t,n){return Xe.current.useSyncExternalStore(e,t,n)};ae.useTransition=function(){return Xe.current.useTransition()};ae.version="18.3.1";tu.exports=ae;var u=tu.exports;/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var fp=u,pp=Symbol.for("react.element"),mp=Symbol.for("react.fragment"),hp=Object.prototype.hasOwnProperty,gp=fp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,vp={key:!0,ref:!0,__self:!0,__source:!0};function uu(e,t,n){var r,s={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)hp.call(t,r)&&!vp.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:pp,type:e,key:o,ref:i,props:s,_owner:gp.current}}wa.Fragment=mp;wa.jsx=uu;wa.jsxs=uu;eu.exports=wa;var a=eu.exports,du={exports:{}},ft={},fu={exports:{}},pu={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t($,_){var W=$.length;$.push(_);e:for(;0<W;){var R=W-1>>>1,D=$[R];if(0<s(D,_))$[R]=_,$[W]=D,W=R;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var _=$[0],W=$.pop();if(W!==_){$[0]=W;e:for(var R=0,D=$.length,L=D>>>1;R<L;){var U=2*(R+1)-1,ee=$[U],q=U+1,pe=$[q];if(0>s(ee,W))q<D&&0>s(pe,ee)?($[R]=pe,$[q]=W,R=q):($[R]=ee,$[U]=W,R=U);else if(q<D&&0>s(pe,W))$[R]=pe,$[q]=W,R=q;else break e}}return _}function s($,_){var W=$.sortIndex-_.sortIndex;return W!==0?W:$.id-_.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],d=[],f=1,h=null,m=3,x=!1,w=!1,y=!1,j=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v($){for(var _=n(d);_!==null;){if(_.callback===null)r(d);else if(_.startTime<=$)r(d),_.sortIndex=_.expirationTime,t(c,_);else break;_=n(d)}}function S($){if(y=!1,v($),!w)if(n(c)!==null)w=!0,J(k);else{var _=n(d);_!==null&&ne(S,_.startTime-$)}}function k($,_){w=!1,y&&(y=!1,g(P),P=-1),x=!0;var W=m;try{for(v(_),h=n(c);h!==null&&(!(h.expirationTime>_)||$&&!O());){var R=h.callback;if(typeof R=="function"){h.callback=null,m=h.priorityLevel;var D=R(h.expirationTime<=_);_=e.unstable_now(),typeof D=="function"?h.callback=D:h===n(c)&&r(c),v(_)}else r(c);h=n(c)}if(h!==null)var L=!0;else{var U=n(d);U!==null&&ne(S,U.startTime-_),L=!1}return L}finally{h=null,m=W,x=!1}}var I=!1,T=null,P=-1,b=5,N=-1;function O(){return!(e.unstable_now()-N<b)}function Y(){if(T!==null){var $=e.unstable_now();N=$;var _=!0;try{_=T(!0,$)}finally{_?V():(I=!1,T=null)}}else I=!1}var V;if(typeof p=="function")V=function(){p(Y)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,C=H.port2;H.port1.onmessage=Y,V=function(){C.postMessage(null)}}else V=function(){j(Y,0)};function J($){T=$,I||(I=!0,V())}function ne($,_){P=j(function(){$(e.unstable_now())},_)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_continueExecution=function(){w||x||(w=!0,J(k))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):b=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(m){case 1:case 2:case 3:var _=3;break;default:_=m}var W=m;m=_;try{return $()}finally{m=W}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,_){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var W=m;m=$;try{return _()}finally{m=W}},e.unstable_scheduleCallback=function($,_,W){var R=e.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?R+W:R):W=R,$){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=W+D,$={id:f++,callback:_,priorityLevel:$,startTime:W,expirationTime:D,sortIndex:-1},W>R?($.sortIndex=W,t(d,$),n(c)===null&&$===n(d)&&(y?(g(P),P=-1):y=!0,ne(S,W-R))):($.sortIndex=D,t(c,$),w||x||(w=!0,J(k))),$},e.unstable_shouldYield=O,e.unstable_wrapCallback=function($){var _=m;return function(){var W=m;m=_;try{return $.apply(this,arguments)}finally{m=W}}}})(pu);fu.exports=pu;var yp=fu.exports;/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var xp=u,dt=yp;function F(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var mu=new Set,Dr={};function Ln(e,t){sr(e,t),sr(e+"Capture",t)}function sr(e,t){for(Dr[e]=t,e=0;e<t.length;e++)mu.add(t[e])}var Kt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),So=Object.prototype.hasOwnProperty,wp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,zl={},Il={};function Sp(e){return So.call(Il,e)?!0:So.call(zl,e)?!1:wp.test(e)?Il[e]=!0:(zl[e]=!0,!1)}function jp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function kp(e,t,n,r){if(t===null||typeof t>"u"||jp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function qe(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Ue={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ue[e]=new qe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ue[t]=new qe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ue[e]=new qe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ue[e]=new qe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Ue[e]=new qe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ue[e]=new qe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ue[e]=new qe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ue[e]=new qe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ue[e]=new qe(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ni=/[\-:]([a-z])/g;function Ei(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Ni,Ei);Ue[t]=new qe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Ni,Ei);Ue[t]=new qe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Ni,Ei);Ue[t]=new qe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ue[e]=new qe(e,1,!1,e.toLowerCase(),null,!1,!1)});Ue.xlinkHref=new qe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ue[e]=new qe(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ti(e,t,n,r){var s=Ue.hasOwnProperty(t)?Ue[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(kp(t,n,s,r)&&(n=null),r||s===null?Sp(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Xt=xp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ps=Symbol.for("react.element"),Bn=Symbol.for("react.portal"),Dn=Symbol.for("react.fragment"),zi=Symbol.for("react.strict_mode"),jo=Symbol.for("react.profiler"),hu=Symbol.for("react.provider"),gu=Symbol.for("react.context"),Ii=Symbol.for("react.forward_ref"),ko=Symbol.for("react.suspense"),bo=Symbol.for("react.suspense_list"),Pi=Symbol.for("react.memo"),en=Symbol.for("react.lazy"),vu=Symbol.for("react.offscreen"),Pl=Symbol.iterator;function vr(e){return e===null||typeof e!="object"?null:(e=Pl&&e[Pl]||e["@@iterator"],typeof e=="function"?e:null)}var Ne=Object.assign,Da;function Nr(e){if(Da===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Da=t&&t[1]||""}return`
|
|
34
|
+
`+Da+e}var Ua=!1;function Wa(e,t){if(!e||Ua)return"";Ua=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
|
|
35
|
+
`),o=r.stack.split(`
|
|
36
|
+
`),i=s.length-1,l=o.length-1;1<=i&&0<=l&&s[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(s[i]!==o[l]){if(i!==1||l!==1)do if(i--,l--,0>l||s[i]!==o[l]){var c=`
|
|
37
|
+
`+s[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{Ua=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Nr(e):""}function bp(e){switch(e.tag){case 5:return Nr(e.type);case 16:return Nr("Lazy");case 13:return Nr("Suspense");case 19:return Nr("SuspenseList");case 0:case 2:case 15:return e=Wa(e.type,!1),e;case 11:return e=Wa(e.type.render,!1),e;case 1:return e=Wa(e.type,!0),e;default:return""}}function Co(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Dn:return"Fragment";case Bn:return"Portal";case jo:return"Profiler";case zi:return"StrictMode";case ko:return"Suspense";case bo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gu:return(e.displayName||"Context")+".Consumer";case hu:return(e._context.displayName||"Context")+".Provider";case Ii:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pi:return t=e.displayName||null,t!==null?t:Co(e.type)||"Memo";case en:t=e._payload,e=e._init;try{return Co(e(t))}catch{}}return null}function Cp(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Co(t);case 8:return t===zi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function gn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Np(e){var t=yu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ms(e){e._valueTracker||(e._valueTracker=Np(e))}function xu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=yu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Gs(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function No(e,t){var n=t.checked;return Ne({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Rl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=gn(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function wu(e,t){t=t.checked,t!=null&&Ti(e,"checked",t,!1)}function Eo(e,t){wu(e,t);var n=gn(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?To(e,t.type,n):t.hasOwnProperty("defaultValue")&&To(e,t.type,gn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _l(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function To(e,t,n){(t!=="number"||Gs(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Er=Array.isArray;function qn(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+gn(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function zo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(F(91));return Ne({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Al(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(F(92));if(Er(n)){if(1<n.length)throw Error(F(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:gn(n)}}function Su(e,t){var n=gn(t.value),r=gn(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function $l(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function ju(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Io(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?ju(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var hs,ku=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(hs=hs||document.createElement("div"),hs.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=hs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ur(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ep=["Webkit","ms","Moz","O"];Object.keys(Pr).forEach(function(e){Ep.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Pr[t]=Pr[e]})});function bu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Pr.hasOwnProperty(e)&&Pr[e]?(""+t).trim():t+"px"}function Cu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=bu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var Tp=Ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Po(e,t){if(t){if(Tp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(F(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(F(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(F(61))}if(t.style!=null&&typeof t.style!="object")throw Error(F(62))}}function Ro(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _o=null;function Ri(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ao=null,Zn=null,er=null;function Ll(e){if(e=ls(e)){if(typeof Ao!="function")throw Error(F(280));var t=e.stateNode;t&&(t=Ca(t),Ao(e.stateNode,e.type,t))}}function Nu(e){Zn?er?er.push(e):er=[e]:Zn=e}function Eu(){if(Zn){var e=Zn,t=er;if(er=Zn=null,Ll(e),t)for(e=0;e<t.length;e++)Ll(t[e])}}function Tu(e,t){return e(t)}function zu(){}var Ha=!1;function Iu(e,t,n){if(Ha)return e(t,n);Ha=!0;try{return Tu(e,t,n)}finally{Ha=!1,(Zn!==null||er!==null)&&(zu(),Eu())}}function Wr(e,t){var n=e.stateNode;if(n===null)return null;var r=Ca(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(F(231,t,typeof n));return n}var $o=!1;if(Kt)try{var yr={};Object.defineProperty(yr,"passive",{get:function(){$o=!0}}),window.addEventListener("test",yr,yr),window.removeEventListener("test",yr,yr)}catch{$o=!1}function zp(e,t,n,r,s,o,i,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var Rr=!1,Ys=null,Qs=!1,Lo=null,Ip={onError:function(e){Rr=!0,Ys=e}};function Pp(e,t,n,r,s,o,i,l,c){Rr=!1,Ys=null,zp.apply(Ip,arguments)}function Rp(e,t,n,r,s,o,i,l,c){if(Pp.apply(this,arguments),Rr){if(Rr){var d=Ys;Rr=!1,Ys=null}else throw Error(F(198));Qs||(Qs=!0,Lo=d)}}function Mn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Pu(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ml(e){if(Mn(e)!==e)throw Error(F(188))}function _p(e){var t=e.alternate;if(!t){if(t=Mn(e),t===null)throw Error(F(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var o=s.alternate;if(o===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===n)return Ml(s),e;if(o===r)return Ml(s),t;o=o.sibling}throw Error(F(188))}if(n.return!==r.return)n=s,r=o;else{for(var i=!1,l=s.child;l;){if(l===n){i=!0,n=s,r=o;break}if(l===r){i=!0,r=s,n=o;break}l=l.sibling}if(!i){for(l=o.child;l;){if(l===n){i=!0,n=o,r=s;break}if(l===r){i=!0,r=o,n=s;break}l=l.sibling}if(!i)throw Error(F(189))}}if(n.alternate!==r)throw Error(F(190))}if(n.tag!==3)throw Error(F(188));return n.stateNode.current===n?e:t}function Ru(e){return e=_p(e),e!==null?_u(e):null}function _u(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=_u(e);if(t!==null)return t;e=e.sibling}return null}var Au=dt.unstable_scheduleCallback,Fl=dt.unstable_cancelCallback,Ap=dt.unstable_shouldYield,$p=dt.unstable_requestPaint,Ie=dt.unstable_now,Lp=dt.unstable_getCurrentPriorityLevel,_i=dt.unstable_ImmediatePriority,$u=dt.unstable_UserBlockingPriority,Js=dt.unstable_NormalPriority,Mp=dt.unstable_LowPriority,Lu=dt.unstable_IdlePriority,Sa=null,Mt=null;function Fp(e){if(Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(Sa,e,void 0,(e.current.flags&128)===128)}catch{}}var Tt=Math.clz32?Math.clz32:Dp,Op=Math.log,Bp=Math.LN2;function Dp(e){return e>>>=0,e===0?32:31-(Op(e)/Bp|0)|0}var gs=64,vs=4194304;function Tr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Xs(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~s;l!==0?r=Tr(l):(o&=i,o!==0&&(r=Tr(o)))}else i=n&~s,i!==0?r=Tr(i):o!==0&&(r=Tr(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Tt(t),s=1<<n,r|=e[n],t&=~s;return r}function Up(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-Tt(o),l=1<<i,c=s[i];c===-1?(!(l&n)||l&r)&&(s[i]=Up(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Mo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Mu(){var e=gs;return gs<<=1,!(gs&4194240)&&(gs=64),e}function Va(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function os(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function Hp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-Tt(n),o=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~o}}function Ai(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Tt(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var fe=0;function Fu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ou,$i,Bu,Du,Uu,Fo=!1,ys=[],ln=null,cn=null,un=null,Hr=new Map,Vr=new Map,rn=[],Vp="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Ol(e,t){switch(e){case"focusin":case"focusout":ln=null;break;case"dragenter":case"dragleave":cn=null;break;case"mouseover":case"mouseout":un=null;break;case"pointerover":case"pointerout":Hr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vr.delete(t.pointerId)}}function xr(e,t,n,r,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[s]},t!==null&&(t=ls(t),t!==null&&$i(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function Kp(e,t,n,r,s){switch(t){case"focusin":return ln=xr(ln,e,t,n,r,s),!0;case"dragenter":return cn=xr(cn,e,t,n,r,s),!0;case"mouseover":return un=xr(un,e,t,n,r,s),!0;case"pointerover":var o=s.pointerId;return Hr.set(o,xr(Hr.get(o)||null,e,t,n,r,s)),!0;case"gotpointercapture":return o=s.pointerId,Vr.set(o,xr(Vr.get(o)||null,e,t,n,r,s)),!0}return!1}function Wu(e){var t=Cn(e.target);if(t!==null){var n=Mn(t);if(n!==null){if(t=n.tag,t===13){if(t=Pu(n),t!==null){e.blockedOn=t,Uu(e.priority,function(){Bu(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function As(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Oo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);_o=r,n.target.dispatchEvent(r),_o=null}else return t=ls(n),t!==null&&$i(t),e.blockedOn=n,!1;t.shift()}return!0}function Bl(e,t,n){As(e)&&n.delete(t)}function Gp(){Fo=!1,ln!==null&&As(ln)&&(ln=null),cn!==null&&As(cn)&&(cn=null),un!==null&&As(un)&&(un=null),Hr.forEach(Bl),Vr.forEach(Bl)}function wr(e,t){e.blockedOn===t&&(e.blockedOn=null,Fo||(Fo=!0,dt.unstable_scheduleCallback(dt.unstable_NormalPriority,Gp)))}function Kr(e){function t(s){return wr(s,e)}if(0<ys.length){wr(ys[0],e);for(var n=1;n<ys.length;n++){var r=ys[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ln!==null&&wr(ln,e),cn!==null&&wr(cn,e),un!==null&&wr(un,e),Hr.forEach(t),Vr.forEach(t),n=0;n<rn.length;n++)r=rn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<rn.length&&(n=rn[0],n.blockedOn===null);)Wu(n),n.blockedOn===null&&rn.shift()}var tr=Xt.ReactCurrentBatchConfig,qs=!0;function Yp(e,t,n,r){var s=fe,o=tr.transition;tr.transition=null;try{fe=1,Li(e,t,n,r)}finally{fe=s,tr.transition=o}}function Qp(e,t,n,r){var s=fe,o=tr.transition;tr.transition=null;try{fe=4,Li(e,t,n,r)}finally{fe=s,tr.transition=o}}function Li(e,t,n,r){if(qs){var s=Oo(e,t,n,r);if(s===null)to(e,t,r,Zs,n),Ol(e,r);else if(Kp(s,e,t,n,r))r.stopPropagation();else if(Ol(e,r),t&4&&-1<Vp.indexOf(e)){for(;s!==null;){var o=ls(s);if(o!==null&&Ou(o),o=Oo(e,t,n,r),o===null&&to(e,t,r,Zs,n),o===s)break;s=o}s!==null&&r.stopPropagation()}else to(e,t,r,null,n)}}var Zs=null;function Oo(e,t,n,r){if(Zs=null,e=Ri(r),e=Cn(e),e!==null)if(t=Mn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Pu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Zs=e,null}function Hu(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Lp()){case _i:return 1;case $u:return 4;case Js:case Mp:return 16;case Lu:return 536870912;default:return 16}default:return 16}}var an=null,Mi=null,$s=null;function Vu(){if($s)return $s;var e,t=Mi,n=t.length,r,s="value"in an?an.value:an.textContent,o=s.length;for(e=0;e<n&&t[e]===s[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===s[o-r];r++);return $s=s.slice(e,1<r?1-r:void 0)}function Ls(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function xs(){return!0}function Dl(){return!1}function pt(e){function t(n,r,s,o,i){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?xs:Dl,this.isPropagationStopped=Dl,this}return Ne(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=xs)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=xs)},persist:function(){},isPersistent:xs}),t}var fr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fi=pt(fr),is=Ne({},fr,{view:0,detail:0}),Jp=pt(is),Ka,Ga,Sr,ja=Ne({},is,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Sr&&(Sr&&e.type==="mousemove"?(Ka=e.screenX-Sr.screenX,Ga=e.screenY-Sr.screenY):Ga=Ka=0,Sr=e),Ka)},movementY:function(e){return"movementY"in e?e.movementY:Ga}}),Ul=pt(ja),Xp=Ne({},ja,{dataTransfer:0}),qp=pt(Xp),Zp=Ne({},is,{relatedTarget:0}),Ya=pt(Zp),em=Ne({},fr,{animationName:0,elapsedTime:0,pseudoElement:0}),tm=pt(em),nm=Ne({},fr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rm=pt(nm),sm=Ne({},fr,{data:0}),Wl=pt(sm),am={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},om={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},im={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=im[e])?!!t[e]:!1}function Oi(){return lm}var cm=Ne({},is,{key:function(e){if(e.key){var t=am[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ls(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?om[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oi,charCode:function(e){return e.type==="keypress"?Ls(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ls(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),um=pt(cm),dm=Ne({},ja,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hl=pt(dm),fm=Ne({},is,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oi}),pm=pt(fm),mm=Ne({},fr,{propertyName:0,elapsedTime:0,pseudoElement:0}),hm=pt(mm),gm=Ne({},ja,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),vm=pt(gm),ym=[9,13,27,32],Bi=Kt&&"CompositionEvent"in window,_r=null;Kt&&"documentMode"in document&&(_r=document.documentMode);var xm=Kt&&"TextEvent"in window&&!_r,Ku=Kt&&(!Bi||_r&&8<_r&&11>=_r),Vl=" ",Kl=!1;function Gu(e,t){switch(e){case"keyup":return ym.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Un=!1;function wm(e,t){switch(e){case"compositionend":return Yu(t);case"keypress":return t.which!==32?null:(Kl=!0,Vl);case"textInput":return e=t.data,e===Vl&&Kl?null:e;default:return null}}function Sm(e,t){if(Un)return e==="compositionend"||!Bi&&Gu(e,t)?(e=Vu(),$s=Mi=an=null,Un=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ku&&t.locale!=="ko"?null:t.data;default:return null}}var jm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Gl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jm[e.type]:t==="textarea"}function Qu(e,t,n,r){Nu(r),t=ea(t,"onChange"),0<t.length&&(n=new Fi("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ar=null,Gr=null;function km(e){od(e,0)}function ka(e){var t=Vn(e);if(xu(t))return e}function bm(e,t){if(e==="change")return t}var Ju=!1;if(Kt){var Qa;if(Kt){var Ja="oninput"in document;if(!Ja){var Yl=document.createElement("div");Yl.setAttribute("oninput","return;"),Ja=typeof Yl.oninput=="function"}Qa=Ja}else Qa=!1;Ju=Qa&&(!document.documentMode||9<document.documentMode)}function Ql(){Ar&&(Ar.detachEvent("onpropertychange",Xu),Gr=Ar=null)}function Xu(e){if(e.propertyName==="value"&&ka(Gr)){var t=[];Qu(t,Gr,e,Ri(e)),Iu(km,t)}}function Cm(e,t,n){e==="focusin"?(Ql(),Ar=t,Gr=n,Ar.attachEvent("onpropertychange",Xu)):e==="focusout"&&Ql()}function Nm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ka(Gr)}function Em(e,t){if(e==="click")return ka(t)}function Tm(e,t){if(e==="input"||e==="change")return ka(t)}function zm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var It=typeof Object.is=="function"?Object.is:zm;function Yr(e,t){if(It(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!So.call(t,s)||!It(e[s],t[s]))return!1}return!0}function Jl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xl(e,t){var n=Jl(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jl(n)}}function qu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zu(){for(var e=window,t=Gs();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Gs(e.document)}return t}function Di(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Im(e){var t=Zu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&qu(n.ownerDocument.documentElement,n)){if(r!==null&&Di(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=Xl(n,o);var i=Xl(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Pm=Kt&&"documentMode"in document&&11>=document.documentMode,Wn=null,Bo=null,$r=null,Do=!1;function ql(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Do||Wn==null||Wn!==Gs(r)||(r=Wn,"selectionStart"in r&&Di(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),$r&&Yr($r,r)||($r=r,r=ea(Bo,"onSelect"),0<r.length&&(t=new Fi("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Wn)))}function ws(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Hn={animationend:ws("Animation","AnimationEnd"),animationiteration:ws("Animation","AnimationIteration"),animationstart:ws("Animation","AnimationStart"),transitionend:ws("Transition","TransitionEnd")},Xa={},ed={};Kt&&(ed=document.createElement("div").style,"AnimationEvent"in window||(delete Hn.animationend.animation,delete Hn.animationiteration.animation,delete Hn.animationstart.animation),"TransitionEvent"in window||delete Hn.transitionend.transition);function ba(e){if(Xa[e])return Xa[e];if(!Hn[e])return e;var t=Hn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ed)return Xa[e]=t[n];return e}var td=ba("animationend"),nd=ba("animationiteration"),rd=ba("animationstart"),sd=ba("transitionend"),ad=new Map,Zl="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function yn(e,t){ad.set(e,t),Ln(t,[e])}for(var qa=0;qa<Zl.length;qa++){var Za=Zl[qa],Rm=Za.toLowerCase(),_m=Za[0].toUpperCase()+Za.slice(1);yn(Rm,"on"+_m)}yn(td,"onAnimationEnd");yn(nd,"onAnimationIteration");yn(rd,"onAnimationStart");yn("dblclick","onDoubleClick");yn("focusin","onFocus");yn("focusout","onBlur");yn(sd,"onTransitionEnd");sr("onMouseEnter",["mouseout","mouseover"]);sr("onMouseLeave",["mouseout","mouseover"]);sr("onPointerEnter",["pointerout","pointerover"]);sr("onPointerLeave",["pointerout","pointerover"]);Ln("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ln("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ln("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ln("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ln("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ln("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Am=new Set("cancel close invalid load scroll toggle".split(" ").concat(zr));function ec(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Rp(r,t,void 0,e),e.currentTarget=null}function od(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==o&&s.isPropagationStopped())break e;ec(s,l,d),o=c}else for(i=0;i<r.length;i++){if(l=r[i],c=l.instance,d=l.currentTarget,l=l.listener,c!==o&&s.isPropagationStopped())break e;ec(s,l,d),o=c}}}if(Qs)throw e=Lo,Qs=!1,Lo=null,e}function xe(e,t){var n=t[Ko];n===void 0&&(n=t[Ko]=new Set);var r=e+"__bubble";n.has(r)||(id(t,e,2,!1),n.add(r))}function eo(e,t,n){var r=0;t&&(r|=4),id(n,e,r,t)}var Ss="_reactListening"+Math.random().toString(36).slice(2);function Qr(e){if(!e[Ss]){e[Ss]=!0,mu.forEach(function(n){n!=="selectionchange"&&(Am.has(n)||eo(n,!1,e),eo(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ss]||(t[Ss]=!0,eo("selectionchange",!1,t))}}function id(e,t,n,r){switch(Hu(t)){case 1:var s=Yp;break;case 4:s=Qp;break;default:s=Li}n=s.bind(null,t,n,e),s=void 0,!$o||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function to(e,t,n,r,s){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;i=i.return}for(;l!==null;){if(i=Cn(l),i===null)return;if(c=i.tag,c===5||c===6){r=o=i;continue e}l=l.parentNode}}r=r.return}Iu(function(){var d=o,f=Ri(n),h=[];e:{var m=ad.get(e);if(m!==void 0){var x=Fi,w=e;switch(e){case"keypress":if(Ls(n)===0)break e;case"keydown":case"keyup":x=um;break;case"focusin":w="focus",x=Ya;break;case"focusout":w="blur",x=Ya;break;case"beforeblur":case"afterblur":x=Ya;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":x=Ul;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=qp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=pm;break;case td:case nd:case rd:x=tm;break;case sd:x=hm;break;case"scroll":x=Jp;break;case"wheel":x=vm;break;case"copy":case"cut":case"paste":x=rm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=Hl}var y=(t&4)!==0,j=!y&&e==="scroll",g=y?m!==null?m+"Capture":null:m;y=[];for(var p=d,v;p!==null;){v=p;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,g!==null&&(S=Wr(p,g),S!=null&&y.push(Jr(p,S,v)))),j)break;p=p.return}0<y.length&&(m=new x(m,w,null,n,f),h.push({event:m,listeners:y}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",m&&n!==_o&&(w=n.relatedTarget||n.fromElement)&&(Cn(w)||w[Gt]))break e;if((x||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,x?(w=n.relatedTarget||n.toElement,x=d,w=w?Cn(w):null,w!==null&&(j=Mn(w),w!==j||w.tag!==5&&w.tag!==6)&&(w=null)):(x=null,w=d),x!==w)){if(y=Ul,S="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(y=Hl,S="onPointerLeave",g="onPointerEnter",p="pointer"),j=x==null?m:Vn(x),v=w==null?m:Vn(w),m=new y(S,p+"leave",x,n,f),m.target=j,m.relatedTarget=v,S=null,Cn(f)===d&&(y=new y(g,p+"enter",w,n,f),y.target=v,y.relatedTarget=j,S=y),j=S,x&&w)t:{for(y=x,g=w,p=0,v=y;v;v=On(v))p++;for(v=0,S=g;S;S=On(S))v++;for(;0<p-v;)y=On(y),p--;for(;0<v-p;)g=On(g),v--;for(;p--;){if(y===g||g!==null&&y===g.alternate)break t;y=On(y),g=On(g)}y=null}else y=null;x!==null&&tc(h,m,x,y,!1),w!==null&&j!==null&&tc(h,j,w,y,!0)}}e:{if(m=d?Vn(d):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var k=bm;else if(Gl(m))if(Ju)k=Tm;else{k=Nm;var I=Cm}else(x=m.nodeName)&&x.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(k=Em);if(k&&(k=k(e,d))){Qu(h,k,n,f);break e}I&&I(e,m,d),e==="focusout"&&(I=m._wrapperState)&&I.controlled&&m.type==="number"&&To(m,"number",m.value)}switch(I=d?Vn(d):window,e){case"focusin":(Gl(I)||I.contentEditable==="true")&&(Wn=I,Bo=d,$r=null);break;case"focusout":$r=Bo=Wn=null;break;case"mousedown":Do=!0;break;case"contextmenu":case"mouseup":case"dragend":Do=!1,ql(h,n,f);break;case"selectionchange":if(Pm)break;case"keydown":case"keyup":ql(h,n,f)}var T;if(Bi)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Un?Gu(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(Ku&&n.locale!=="ko"&&(Un||P!=="onCompositionStart"?P==="onCompositionEnd"&&Un&&(T=Vu()):(an=f,Mi="value"in an?an.value:an.textContent,Un=!0)),I=ea(d,P),0<I.length&&(P=new Wl(P,e,null,n,f),h.push({event:P,listeners:I}),T?P.data=T:(T=Yu(n),T!==null&&(P.data=T)))),(T=xm?wm(e,n):Sm(e,n))&&(d=ea(d,"onBeforeInput"),0<d.length&&(f=new Wl("onBeforeInput","beforeinput",null,n,f),h.push({event:f,listeners:d}),f.data=T))}od(h,t)})}function Jr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ea(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Wr(e,n),o!=null&&r.unshift(Jr(e,o,s)),o=Wr(e,t),o!=null&&r.push(Jr(e,o,s))),e=e.return}return r}function On(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function tc(e,t,n,r,s){for(var o=t._reactName,i=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=Wr(n,o),c!=null&&i.unshift(Jr(n,c,l))):s||(c=Wr(n,o),c!=null&&i.push(Jr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var $m=/\r\n?/g,Lm=/\u0000|\uFFFD/g;function nc(e){return(typeof e=="string"?e:""+e).replace($m,`
|
|
38
|
+
`).replace(Lm,"")}function js(e,t,n){if(t=nc(t),nc(e)!==t&&n)throw Error(F(425))}function ta(){}var Uo=null,Wo=null;function Ho(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Vo=typeof setTimeout=="function"?setTimeout:void 0,Mm=typeof clearTimeout=="function"?clearTimeout:void 0,rc=typeof Promise=="function"?Promise:void 0,Fm=typeof queueMicrotask=="function"?queueMicrotask:typeof rc<"u"?function(e){return rc.resolve(null).then(e).catch(Om)}:Vo;function Om(e){setTimeout(function(){throw e})}function no(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Kr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Kr(t)}function dn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function sc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var pr=Math.random().toString(36).slice(2),$t="__reactFiber$"+pr,Xr="__reactProps$"+pr,Gt="__reactContainer$"+pr,Ko="__reactEvents$"+pr,Bm="__reactListeners$"+pr,Dm="__reactHandles$"+pr;function Cn(e){var t=e[$t];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gt]||n[$t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=sc(e);e!==null;){if(n=e[$t])return n;e=sc(e)}return t}e=n,n=e.parentNode}return null}function ls(e){return e=e[$t]||e[Gt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Vn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(F(33))}function Ca(e){return e[Xr]||null}var Go=[],Kn=-1;function xn(e){return{current:e}}function we(e){0>Kn||(e.current=Go[Kn],Go[Kn]=null,Kn--)}function ve(e,t){Kn++,Go[Kn]=e.current,e.current=t}var vn={},Ge=xn(vn),rt=xn(!1),Pn=vn;function ar(e,t){var n=e.type.contextTypes;if(!n)return vn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function st(e){return e=e.childContextTypes,e!=null}function na(){we(rt),we(Ge)}function ac(e,t,n){if(Ge.current!==vn)throw Error(F(168));ve(Ge,t),ve(rt,n)}function ld(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(F(108,Cp(e)||"Unknown",s));return Ne({},n,r)}function ra(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vn,Pn=Ge.current,ve(Ge,e),ve(rt,rt.current),!0}function oc(e,t,n){var r=e.stateNode;if(!r)throw Error(F(169));n?(e=ld(e,t,Pn),r.__reactInternalMemoizedMergedChildContext=e,we(rt),we(Ge),ve(Ge,e)):we(rt),ve(rt,n)}var Ut=null,Na=!1,ro=!1;function cd(e){Ut===null?Ut=[e]:Ut.push(e)}function Um(e){Na=!0,cd(e)}function wn(){if(!ro&&Ut!==null){ro=!0;var e=0,t=fe;try{var n=Ut;for(fe=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ut=null,Na=!1}catch(s){throw Ut!==null&&(Ut=Ut.slice(e+1)),Au(_i,wn),s}finally{fe=t,ro=!1}}return null}var Gn=[],Yn=0,sa=null,aa=0,ht=[],gt=0,Rn=null,Wt=1,Ht="";function jn(e,t){Gn[Yn++]=aa,Gn[Yn++]=sa,sa=e,aa=t}function ud(e,t,n){ht[gt++]=Wt,ht[gt++]=Ht,ht[gt++]=Rn,Rn=e;var r=Wt;e=Ht;var s=32-Tt(r)-1;r&=~(1<<s),n+=1;var o=32-Tt(t)+s;if(30<o){var i=s-s%5;o=(r&(1<<i)-1).toString(32),r>>=i,s-=i,Wt=1<<32-Tt(t)+s|n<<s|r,Ht=o+e}else Wt=1<<o|n<<s|r,Ht=e}function Ui(e){e.return!==null&&(jn(e,1),ud(e,1,0))}function Wi(e){for(;e===sa;)sa=Gn[--Yn],Gn[Yn]=null,aa=Gn[--Yn],Gn[Yn]=null;for(;e===Rn;)Rn=ht[--gt],ht[gt]=null,Ht=ht[--gt],ht[gt]=null,Wt=ht[--gt],ht[gt]=null}var ut=null,ct=null,Se=!1,Et=null;function dd(e,t){var n=vt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function ic(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,ut=e,ct=dn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ut=e,ct=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Rn!==null?{id:Wt,overflow:Ht}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=vt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ut=e,ct=null,!0):!1;default:return!1}}function Yo(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Qo(e){if(Se){var t=ct;if(t){var n=t;if(!ic(e,t)){if(Yo(e))throw Error(F(418));t=dn(n.nextSibling);var r=ut;t&&ic(e,t)?dd(r,n):(e.flags=e.flags&-4097|2,Se=!1,ut=e)}}else{if(Yo(e))throw Error(F(418));e.flags=e.flags&-4097|2,Se=!1,ut=e}}}function lc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ut=e}function ks(e){if(e!==ut)return!1;if(!Se)return lc(e),Se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ho(e.type,e.memoizedProps)),t&&(t=ct)){if(Yo(e))throw fd(),Error(F(418));for(;t;)dd(e,t),t=dn(t.nextSibling)}if(lc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(F(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ct=dn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ct=null}}else ct=ut?dn(e.stateNode.nextSibling):null;return!0}function fd(){for(var e=ct;e;)e=dn(e.nextSibling)}function or(){ct=ut=null,Se=!1}function Hi(e){Et===null?Et=[e]:Et.push(e)}var Wm=Xt.ReactCurrentBatchConfig;function jr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(F(309));var r=n.stateNode}if(!r)throw Error(F(147,e));var s=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var l=s.refs;i===null?delete l[o]:l[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(F(284));if(!n._owner)throw Error(F(290,e))}return e}function bs(e,t){throw e=Object.prototype.toString.call(t),Error(F(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function cc(e){var t=e._init;return t(e._payload)}function pd(e){function t(g,p){if(e){var v=g.deletions;v===null?(g.deletions=[p],g.flags|=16):v.push(p)}}function n(g,p){if(!e)return null;for(;p!==null;)t(g,p),p=p.sibling;return null}function r(g,p){for(g=new Map;p!==null;)p.key!==null?g.set(p.key,p):g.set(p.index,p),p=p.sibling;return g}function s(g,p){return g=hn(g,p),g.index=0,g.sibling=null,g}function o(g,p,v){return g.index=v,e?(v=g.alternate,v!==null?(v=v.index,v<p?(g.flags|=2,p):v):(g.flags|=2,p)):(g.flags|=1048576,p)}function i(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,p,v,S){return p===null||p.tag!==6?(p=uo(v,g.mode,S),p.return=g,p):(p=s(p,v),p.return=g,p)}function c(g,p,v,S){var k=v.type;return k===Dn?f(g,p,v.props.children,S,v.key):p!==null&&(p.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===en&&cc(k)===p.type)?(S=s(p,v.props),S.ref=jr(g,p,v),S.return=g,S):(S=Ws(v.type,v.key,v.props,null,g.mode,S),S.ref=jr(g,p,v),S.return=g,S)}function d(g,p,v,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==v.containerInfo||p.stateNode.implementation!==v.implementation?(p=fo(v,g.mode,S),p.return=g,p):(p=s(p,v.children||[]),p.return=g,p)}function f(g,p,v,S,k){return p===null||p.tag!==7?(p=In(v,g.mode,S,k),p.return=g,p):(p=s(p,v),p.return=g,p)}function h(g,p,v){if(typeof p=="string"&&p!==""||typeof p=="number")return p=uo(""+p,g.mode,v),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case ps:return v=Ws(p.type,p.key,p.props,null,g.mode,v),v.ref=jr(g,null,p),v.return=g,v;case Bn:return p=fo(p,g.mode,v),p.return=g,p;case en:var S=p._init;return h(g,S(p._payload),v)}if(Er(p)||vr(p))return p=In(p,g.mode,v,null),p.return=g,p;bs(g,p)}return null}function m(g,p,v,S){var k=p!==null?p.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return k!==null?null:l(g,p,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ps:return v.key===k?c(g,p,v,S):null;case Bn:return v.key===k?d(g,p,v,S):null;case en:return k=v._init,m(g,p,k(v._payload),S)}if(Er(v)||vr(v))return k!==null?null:f(g,p,v,S,null);bs(g,v)}return null}function x(g,p,v,S,k){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(v)||null,l(p,g,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ps:return g=g.get(S.key===null?v:S.key)||null,c(p,g,S,k);case Bn:return g=g.get(S.key===null?v:S.key)||null,d(p,g,S,k);case en:var I=S._init;return x(g,p,v,I(S._payload),k)}if(Er(S)||vr(S))return g=g.get(v)||null,f(p,g,S,k,null);bs(p,S)}return null}function w(g,p,v,S){for(var k=null,I=null,T=p,P=p=0,b=null;T!==null&&P<v.length;P++){T.index>P?(b=T,T=null):b=T.sibling;var N=m(g,T,v[P],S);if(N===null){T===null&&(T=b);break}e&&T&&N.alternate===null&&t(g,T),p=o(N,p,P),I===null?k=N:I.sibling=N,I=N,T=b}if(P===v.length)return n(g,T),Se&&jn(g,P),k;if(T===null){for(;P<v.length;P++)T=h(g,v[P],S),T!==null&&(p=o(T,p,P),I===null?k=T:I.sibling=T,I=T);return Se&&jn(g,P),k}for(T=r(g,T);P<v.length;P++)b=x(T,g,P,v[P],S),b!==null&&(e&&b.alternate!==null&&T.delete(b.key===null?P:b.key),p=o(b,p,P),I===null?k=b:I.sibling=b,I=b);return e&&T.forEach(function(O){return t(g,O)}),Se&&jn(g,P),k}function y(g,p,v,S){var k=vr(v);if(typeof k!="function")throw Error(F(150));if(v=k.call(v),v==null)throw Error(F(151));for(var I=k=null,T=p,P=p=0,b=null,N=v.next();T!==null&&!N.done;P++,N=v.next()){T.index>P?(b=T,T=null):b=T.sibling;var O=m(g,T,N.value,S);if(O===null){T===null&&(T=b);break}e&&T&&O.alternate===null&&t(g,T),p=o(O,p,P),I===null?k=O:I.sibling=O,I=O,T=b}if(N.done)return n(g,T),Se&&jn(g,P),k;if(T===null){for(;!N.done;P++,N=v.next())N=h(g,N.value,S),N!==null&&(p=o(N,p,P),I===null?k=N:I.sibling=N,I=N);return Se&&jn(g,P),k}for(T=r(g,T);!N.done;P++,N=v.next())N=x(T,g,P,N.value,S),N!==null&&(e&&N.alternate!==null&&T.delete(N.key===null?P:N.key),p=o(N,p,P),I===null?k=N:I.sibling=N,I=N);return e&&T.forEach(function(Y){return t(g,Y)}),Se&&jn(g,P),k}function j(g,p,v,S){if(typeof v=="object"&&v!==null&&v.type===Dn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ps:e:{for(var k=v.key,I=p;I!==null;){if(I.key===k){if(k=v.type,k===Dn){if(I.tag===7){n(g,I.sibling),p=s(I,v.props.children),p.return=g,g=p;break e}}else if(I.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===en&&cc(k)===I.type){n(g,I.sibling),p=s(I,v.props),p.ref=jr(g,I,v),p.return=g,g=p;break e}n(g,I);break}else t(g,I);I=I.sibling}v.type===Dn?(p=In(v.props.children,g.mode,S,v.key),p.return=g,g=p):(S=Ws(v.type,v.key,v.props,null,g.mode,S),S.ref=jr(g,p,v),S.return=g,g=S)}return i(g);case Bn:e:{for(I=v.key;p!==null;){if(p.key===I)if(p.tag===4&&p.stateNode.containerInfo===v.containerInfo&&p.stateNode.implementation===v.implementation){n(g,p.sibling),p=s(p,v.children||[]),p.return=g,g=p;break e}else{n(g,p);break}else t(g,p);p=p.sibling}p=fo(v,g.mode,S),p.return=g,g=p}return i(g);case en:return I=v._init,j(g,p,I(v._payload),S)}if(Er(v))return w(g,p,v,S);if(vr(v))return y(g,p,v,S);bs(g,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,p!==null&&p.tag===6?(n(g,p.sibling),p=s(p,v),p.return=g,g=p):(n(g,p),p=uo(v,g.mode,S),p.return=g,g=p),i(g)):n(g,p)}return j}var ir=pd(!0),md=pd(!1),oa=xn(null),ia=null,Qn=null,Vi=null;function Ki(){Vi=Qn=ia=null}function Gi(e){var t=oa.current;we(oa),e._currentValue=t}function Jo(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function nr(e,t){ia=e,Vi=Qn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(nt=!0),e.firstContext=null)}function xt(e){var t=e._currentValue;if(Vi!==e)if(e={context:e,memoizedValue:t,next:null},Qn===null){if(ia===null)throw Error(F(308));Qn=e,ia.dependencies={lanes:0,firstContext:e}}else Qn=Qn.next=e;return t}var Nn=null;function Yi(e){Nn===null?Nn=[e]:Nn.push(e)}function hd(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Yi(t)):(n.next=s.next,s.next=n),t.interleaved=n,Yt(e,r)}function Yt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var tn=!1;function Qi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gd(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ie&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Yt(e,n)}return s=r.interleaved,s===null?(t.next=t,Yi(r)):(t.next=s.next,s.next=t),r.interleaved=t,Yt(e,n)}function Ms(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ai(e,n)}}function uc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function la(e,t,n,r){var s=e.updateQueue;tn=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,i===null?o=d:i.next=d,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==i&&(l===null?f.firstBaseUpdate=d:l.next=d,f.lastBaseUpdate=c))}if(o!==null){var h=s.baseState;i=0,f=d=c=null,l=o;do{var m=l.lane,x=l.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:x,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var w=e,y=l;switch(m=t,x=n,y.tag){case 1:if(w=y.payload,typeof w=="function"){h=w.call(x,h,m);break e}h=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=y.payload,m=typeof w=="function"?w.call(x,h,m):w,m==null)break e;h=Ne({},h,m);break e;case 2:tn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else x={eventTime:x,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(d=f=x,c=h):f=f.next=x,i|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(f===null&&(c=h),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);An|=i,e.lanes=i,e.memoizedState=h}}function dc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(F(191,s));s.call(r)}}}var cs={},Ft=xn(cs),qr=xn(cs),Zr=xn(cs);function En(e){if(e===cs)throw Error(F(174));return e}function Ji(e,t){switch(ve(Zr,t),ve(qr,e),ve(Ft,cs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Io(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Io(t,e)}we(Ft),ve(Ft,t)}function lr(){we(Ft),we(qr),we(Zr)}function vd(e){En(Zr.current);var t=En(Ft.current),n=Io(t,e.type);t!==n&&(ve(qr,e),ve(Ft,n))}function Xi(e){qr.current===e&&(we(Ft),we(qr))}var be=xn(0);function ca(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=[];function qi(){for(var e=0;e<so.length;e++)so[e]._workInProgressVersionPrimary=null;so.length=0}var Fs=Xt.ReactCurrentDispatcher,ao=Xt.ReactCurrentBatchConfig,_n=0,Ce=null,_e=null,Me=null,ua=!1,Lr=!1,es=0,Hm=0;function He(){throw Error(F(321))}function Zi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!It(e[n],t[n]))return!1;return!0}function el(e,t,n,r,s,o){if(_n=o,Ce=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Fs.current=e===null||e.memoizedState===null?Ym:Qm,e=n(r,s),Lr){o=0;do{if(Lr=!1,es=0,25<=o)throw Error(F(301));o+=1,Me=_e=null,t.updateQueue=null,Fs.current=Jm,e=n(r,s)}while(Lr)}if(Fs.current=da,t=_e!==null&&_e.next!==null,_n=0,Me=_e=Ce=null,ua=!1,t)throw Error(F(300));return e}function tl(){var e=es!==0;return es=0,e}function _t(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Me===null?Ce.memoizedState=Me=e:Me=Me.next=e,Me}function wt(){if(_e===null){var e=Ce.alternate;e=e!==null?e.memoizedState:null}else e=_e.next;var t=Me===null?Ce.memoizedState:Me.next;if(t!==null)Me=t,_e=e;else{if(e===null)throw Error(F(310));_e=e,e={memoizedState:_e.memoizedState,baseState:_e.baseState,baseQueue:_e.baseQueue,queue:_e.queue,next:null},Me===null?Ce.memoizedState=Me=e:Me=Me.next=e}return Me}function ts(e,t){return typeof t=="function"?t(e):t}function oo(e){var t=wt(),n=t.queue;if(n===null)throw Error(F(311));n.lastRenderedReducer=e;var r=_e,s=r.baseQueue,o=n.pending;if(o!==null){if(s!==null){var i=s.next;s.next=o.next,o.next=i}r.baseQueue=s=o,n.pending=null}if(s!==null){o=s.next,r=r.baseState;var l=i=null,c=null,d=o;do{var f=d.lane;if((_n&f)===f)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var h={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=h,i=r):c=c.next=h,Ce.lanes|=f,An|=f}d=d.next}while(d!==null&&d!==o);c===null?i=r:c.next=l,It(r,t.memoizedState)||(nt=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do o=s.lane,Ce.lanes|=o,An|=o,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function io(e){var t=wt(),n=t.queue;if(n===null)throw Error(F(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,o=t.memoizedState;if(s!==null){n.pending=null;var i=s=s.next;do o=e(o,i.action),i=i.next;while(i!==s);It(o,t.memoizedState)||(nt=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function yd(){}function xd(e,t){var n=Ce,r=wt(),s=t(),o=!It(r.memoizedState,s);if(o&&(r.memoizedState=s,nt=!0),r=r.queue,nl(jd.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Me!==null&&Me.memoizedState.tag&1){if(n.flags|=2048,ns(9,Sd.bind(null,n,r,s,t),void 0,null),Fe===null)throw Error(F(349));_n&30||wd(n,t,s)}return s}function wd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Sd(e,t,n,r){t.value=n,t.getSnapshot=r,kd(t)&&bd(e)}function jd(e,t,n){return n(function(){kd(t)&&bd(e)})}function kd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!It(e,n)}catch{return!0}}function bd(e){var t=Yt(e,1);t!==null&&zt(t,e,1,-1)}function fc(e){var t=_t();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:e},t.queue=e,e=e.dispatch=Gm.bind(null,Ce,e),[t.memoizedState,e]}function ns(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ce.updateQueue,t===null?(t={lastEffect:null,stores:null},Ce.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Cd(){return wt().memoizedState}function Os(e,t,n,r){var s=_t();Ce.flags|=e,s.memoizedState=ns(1|t,n,void 0,r===void 0?null:r)}function Ea(e,t,n,r){var s=wt();r=r===void 0?null:r;var o=void 0;if(_e!==null){var i=_e.memoizedState;if(o=i.destroy,r!==null&&Zi(r,i.deps)){s.memoizedState=ns(t,n,o,r);return}}Ce.flags|=e,s.memoizedState=ns(1|t,n,o,r)}function pc(e,t){return Os(8390656,8,e,t)}function nl(e,t){return Ea(2048,8,e,t)}function Nd(e,t){return Ea(4,2,e,t)}function Ed(e,t){return Ea(4,4,e,t)}function Td(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function zd(e,t,n){return n=n!=null?n.concat([e]):null,Ea(4,4,Td.bind(null,t,e),n)}function rl(){}function Id(e,t){var n=wt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Zi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Pd(e,t){var n=wt();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Zi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Rd(e,t,n){return _n&21?(It(n,t)||(n=Mu(),Ce.lanes|=n,An|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,nt=!0),e.memoizedState=n)}function Vm(e,t){var n=fe;fe=n!==0&&4>n?n:4,e(!0);var r=ao.transition;ao.transition={};try{e(!1),t()}finally{fe=n,ao.transition=r}}function _d(){return wt().memoizedState}function Km(e,t,n){var r=mn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ad(e))$d(t,n);else if(n=hd(e,t,n,r),n!==null){var s=Je();zt(n,e,r,s),Ld(n,t,r)}}function Gm(e,t,n){var r=mn(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ad(e))$d(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,n);if(s.hasEagerState=!0,s.eagerState=l,It(l,i)){var c=t.interleaved;c===null?(s.next=s,Yi(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=hd(e,t,s,r),n!==null&&(s=Je(),zt(n,e,r,s),Ld(n,t,r))}}function Ad(e){var t=e.alternate;return e===Ce||t!==null&&t===Ce}function $d(e,t){Lr=ua=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ld(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ai(e,n)}}var da={readContext:xt,useCallback:He,useContext:He,useEffect:He,useImperativeHandle:He,useInsertionEffect:He,useLayoutEffect:He,useMemo:He,useReducer:He,useRef:He,useState:He,useDebugValue:He,useDeferredValue:He,useTransition:He,useMutableSource:He,useSyncExternalStore:He,useId:He,unstable_isNewReconciler:!1},Ym={readContext:xt,useCallback:function(e,t){return _t().memoizedState=[e,t===void 0?null:t],e},useContext:xt,useEffect:pc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Os(4194308,4,Td.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Os(4194308,4,e,t)},useInsertionEffect:function(e,t){return Os(4,2,e,t)},useMemo:function(e,t){var n=_t();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=_t();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Km.bind(null,Ce,e),[r.memoizedState,e]},useRef:function(e){var t=_t();return e={current:e},t.memoizedState=e},useState:fc,useDebugValue:rl,useDeferredValue:function(e){return _t().memoizedState=e},useTransition:function(){var e=fc(!1),t=e[0];return e=Vm.bind(null,e[1]),_t().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ce,s=_t();if(Se){if(n===void 0)throw Error(F(407));n=n()}else{if(n=t(),Fe===null)throw Error(F(349));_n&30||wd(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,pc(jd.bind(null,r,o,e),[e]),r.flags|=2048,ns(9,Sd.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=_t(),t=Fe.identifierPrefix;if(Se){var n=Ht,r=Wt;n=(r&~(1<<32-Tt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=es++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Hm++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Qm={readContext:xt,useCallback:Id,useContext:xt,useEffect:nl,useImperativeHandle:zd,useInsertionEffect:Nd,useLayoutEffect:Ed,useMemo:Pd,useReducer:oo,useRef:Cd,useState:function(){return oo(ts)},useDebugValue:rl,useDeferredValue:function(e){var t=wt();return Rd(t,_e.memoizedState,e)},useTransition:function(){var e=oo(ts)[0],t=wt().memoizedState;return[e,t]},useMutableSource:yd,useSyncExternalStore:xd,useId:_d,unstable_isNewReconciler:!1},Jm={readContext:xt,useCallback:Id,useContext:xt,useEffect:nl,useImperativeHandle:zd,useInsertionEffect:Nd,useLayoutEffect:Ed,useMemo:Pd,useReducer:io,useRef:Cd,useState:function(){return io(ts)},useDebugValue:rl,useDeferredValue:function(e){var t=wt();return _e===null?t.memoizedState=e:Rd(t,_e.memoizedState,e)},useTransition:function(){var e=io(ts)[0],t=wt().memoizedState;return[e,t]},useMutableSource:yd,useSyncExternalStore:xd,useId:_d,unstable_isNewReconciler:!1};function Ct(e,t){if(e&&e.defaultProps){t=Ne({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Xo(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ne({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ta={isMounted:function(e){return(e=e._reactInternals)?Mn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Je(),s=mn(e),o=Vt(r,s);o.payload=t,n!=null&&(o.callback=n),t=fn(e,o,s),t!==null&&(zt(t,e,s,r),Ms(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Je(),s=mn(e),o=Vt(r,s);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=fn(e,o,s),t!==null&&(zt(t,e,s,r),Ms(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Je(),r=mn(e),s=Vt(n,r);s.tag=2,t!=null&&(s.callback=t),t=fn(e,s,r),t!==null&&(zt(t,e,r,n),Ms(t,e,r))}};function mc(e,t,n,r,s,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Yr(n,r)||!Yr(s,o):!0}function Md(e,t,n){var r=!1,s=vn,o=t.contextType;return typeof o=="object"&&o!==null?o=xt(o):(s=st(t)?Pn:Ge.current,r=t.contextTypes,o=(r=r!=null)?ar(e,s):vn),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ta,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function hc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ta.enqueueReplaceState(t,t.state,null)}function qo(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Qi(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=xt(o):(o=st(t)?Pn:Ge.current,s.context=ar(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Xo(e,t,o,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Ta.enqueueReplaceState(s,s.state,null),la(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function cr(e,t){try{var n="",r=t;do n+=bp(r),r=r.return;while(r);var s=n}catch(o){s=`
|
|
39
|
+
Error generating stack: `+o.message+`
|
|
40
|
+
`+o.stack}return{value:e,source:t,stack:s,digest:null}}function lo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Zo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Xm=typeof WeakMap=="function"?WeakMap:Map;function Fd(e,t,n){n=Vt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){pa||(pa=!0,ci=r),Zo(e,t)},n}function Od(e,t,n){n=Vt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Zo(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Zo(e,t),typeof r!="function"&&(pn===null?pn=new Set([this]):pn.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function gc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Xm;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=dh.bind(null,e,t,n),t.then(e,e))}function vc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function yc(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Vt(-1,1),t.tag=2,fn(n,t,1))),n.lanes|=1),e)}var qm=Xt.ReactCurrentOwner,nt=!1;function Ye(e,t,n,r){t.child=e===null?md(t,null,n,r):ir(t,e.child,n,r)}function xc(e,t,n,r,s){n=n.render;var o=t.ref;return nr(t,s),r=el(e,t,n,r,o,s),n=tl(),e!==null&&!nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Qt(e,t,s)):(Se&&n&&Ui(t),t.flags|=1,Ye(e,t,r,s),t.child)}function wc(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!dl(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Bd(e,t,o,r,s)):(e=Ws(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Yr,n(i,r)&&e.ref===t.ref)return Qt(e,t,s)}return t.flags|=1,e=hn(o,r),e.ref=t.ref,e.return=t,t.child=e}function Bd(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(Yr(o,r)&&e.ref===t.ref)if(nt=!1,t.pendingProps=r=o,(e.lanes&s)!==0)e.flags&131072&&(nt=!0);else return t.lanes=e.lanes,Qt(e,t,s)}return ei(e,t,n,r,s)}function Dd(e,t,n){var r=t.pendingProps,s=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ve(Xn,lt),lt|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,ve(Xn,lt),lt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,ve(Xn,lt),lt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,ve(Xn,lt),lt|=r;return Ye(e,t,s,n),t.child}function Ud(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function ei(e,t,n,r,s){var o=st(n)?Pn:Ge.current;return o=ar(t,o),nr(t,s),n=el(e,t,n,r,o,s),r=tl(),e!==null&&!nt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Qt(e,t,s)):(Se&&r&&Ui(t),t.flags|=1,Ye(e,t,n,s),t.child)}function Sc(e,t,n,r,s){if(st(n)){var o=!0;ra(t)}else o=!1;if(nr(t,s),t.stateNode===null)Bs(e,t),Md(t,n,r),qo(t,n,r,s),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,d=n.contextType;typeof d=="object"&&d!==null?d=xt(d):(d=st(n)?Pn:Ge.current,d=ar(t,d));var f=n.getDerivedStateFromProps,h=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function";h||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==d)&&hc(t,i,r,d),tn=!1;var m=t.memoizedState;i.state=m,la(t,r,i,s),c=t.memoizedState,l!==r||m!==c||rt.current||tn?(typeof f=="function"&&(Xo(t,n,f,r),c=t.memoizedState),(l=tn||mc(t,n,l,r,m,c,d))?(h||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=d,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,gd(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Ct(t.type,l),i.props=d,h=t.pendingProps,m=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=xt(c):(c=st(n)?Pn:Ge.current,c=ar(t,c));var x=n.getDerivedStateFromProps;(f=typeof x=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==h||m!==c)&&hc(t,i,r,c),tn=!1,m=t.memoizedState,i.state=m,la(t,r,i,s);var w=t.memoizedState;l!==h||m!==w||rt.current||tn?(typeof x=="function"&&(Xo(t,n,x,r),w=t.memoizedState),(d=tn||mc(t,n,d,r,m,w,c)||!1)?(f||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,w,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,w,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),i.props=r,i.state=w,i.context=c,r=d):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return ti(e,t,n,r,o,s)}function ti(e,t,n,r,s,o){Ud(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return s&&oc(t,n,!1),Qt(e,t,o);r=t.stateNode,qm.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=ir(t,e.child,null,o),t.child=ir(t,null,l,o)):Ye(e,t,l,o),t.memoizedState=r.state,s&&oc(t,n,!0),t.child}function Wd(e){var t=e.stateNode;t.pendingContext?ac(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ac(e,t.context,!1),Ji(e,t.containerInfo)}function jc(e,t,n,r,s){return or(),Hi(s),t.flags|=256,Ye(e,t,n,r),t.child}var ni={dehydrated:null,treeContext:null,retryLane:0};function ri(e){return{baseLanes:e,cachePool:null,transitions:null}}function Hd(e,t,n){var r=t.pendingProps,s=be.current,o=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),ve(be,s&1),e===null)return Qo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=Pa(i,r,0,null),e=In(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ri(n),t.memoizedState=ni,e):sl(t,i));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Zm(e,t,i,r,l,s,n);if(o){o=r.fallback,i=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=hn(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=hn(l,o):(o=In(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?ri(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=ni,r}return o=e.child,e=o.sibling,r=hn(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function sl(e,t){return t=Pa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Cs(e,t,n,r){return r!==null&&Hi(r),ir(t,e.child,null,n),e=sl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zm(e,t,n,r,s,o,i){if(n)return t.flags&256?(t.flags&=-257,r=lo(Error(F(422))),Cs(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=Pa({mode:"visible",children:r.children},s,0,null),o=In(o,s,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&ir(t,e.child,null,i),t.child.memoizedState=ri(i),t.memoizedState=ni,o);if(!(t.mode&1))return Cs(e,t,i,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(F(419)),r=lo(o,r,void 0),Cs(e,t,i,r)}if(l=(i&e.childLanes)!==0,nt||l){if(r=Fe,r!==null){switch(i&-i){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|i)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,Yt(e,s),zt(r,e,s,-1))}return ul(),r=lo(Error(F(421))),Cs(e,t,i,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=fh.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,ct=dn(s.nextSibling),ut=t,Se=!0,Et=null,e!==null&&(ht[gt++]=Wt,ht[gt++]=Ht,ht[gt++]=Rn,Wt=e.id,Ht=e.overflow,Rn=t),t=sl(t,r.children),t.flags|=4096,t)}function kc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Jo(e.return,t,n)}function co(e,t,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s)}function Vd(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(Ye(e,t,r.children,n),r=be.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kc(e,n,t);else if(e.tag===19)kc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(ve(be,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&ca(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),co(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&ca(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}co(t,!0,n,null,o);break;case"together":co(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Bs(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Qt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),An|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(F(153));if(t.child!==null){for(e=t.child,n=hn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eh(e,t,n){switch(t.tag){case 3:Wd(t),or();break;case 5:vd(t);break;case 1:st(t.type)&&ra(t);break;case 4:Ji(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;ve(oa,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ve(be,be.current&1),t.flags|=128,null):n&t.child.childLanes?Hd(e,t,n):(ve(be,be.current&1),e=Qt(e,t,n),e!==null?e.sibling:null);ve(be,be.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Vd(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),ve(be,be.current),r)break;return null;case 22:case 23:return t.lanes=0,Dd(e,t,n)}return Qt(e,t,n)}var Kd,si,Gd,Yd;Kd=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};si=function(){};Gd=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,En(Ft.current);var o=null;switch(n){case"input":s=No(e,s),r=No(e,r),o=[];break;case"select":s=Ne({},s,{value:void 0}),r=Ne({},r,{value:void 0}),o=[];break;case"textarea":s=zo(e,s),r=zo(e,r),o=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ta)}Po(n,r);var i;n=null;for(d in s)if(!r.hasOwnProperty(d)&&s.hasOwnProperty(d)&&s[d]!=null)if(d==="style"){var l=s[d];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Dr.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(i in l)!l.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in c)c.hasOwnProperty(i)&&l[i]!==c[i]&&(n||(n={}),n[i]=c[i])}else n||(o||(o=[]),o.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Dr.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&xe("scroll",e),o||l===c||(o=[])):(o=o||[]).push(d,c))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};Yd=function(e,t,n,r){n!==r&&(t.flags|=4)};function kr(e,t){if(!Se)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function th(e,t,n){var r=t.pendingProps;switch(Wi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ve(t),null;case 1:return st(t.type)&&na(),Ve(t),null;case 3:return r=t.stateNode,lr(),we(rt),we(Ge),qi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ks(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Et!==null&&(fi(Et),Et=null))),si(e,t),Ve(t),null;case 5:Xi(t);var s=En(Zr.current);if(n=t.type,e!==null&&t.stateNode!=null)Gd(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(F(166));return Ve(t),null}if(e=En(Ft.current),ks(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[$t]=t,r[Xr]=o,e=(t.mode&1)!==0,n){case"dialog":xe("cancel",r),xe("close",r);break;case"iframe":case"object":case"embed":xe("load",r);break;case"video":case"audio":for(s=0;s<zr.length;s++)xe(zr[s],r);break;case"source":xe("error",r);break;case"img":case"image":case"link":xe("error",r),xe("load",r);break;case"details":xe("toggle",r);break;case"input":Rl(r,o),xe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},xe("invalid",r);break;case"textarea":Al(r,o),xe("invalid",r)}Po(n,o),s=null;for(var i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&js(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&js(r.textContent,l,e),s=["children",""+l]):Dr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&xe("scroll",r)}switch(n){case"input":ms(r),_l(r,o,!0);break;case"textarea":ms(r),$l(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=ta)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=ju(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[$t]=t,e[Xr]=r,Kd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Ro(n,r),n){case"dialog":xe("cancel",e),xe("close",e),s=r;break;case"iframe":case"object":case"embed":xe("load",e),s=r;break;case"video":case"audio":for(s=0;s<zr.length;s++)xe(zr[s],e);s=r;break;case"source":xe("error",e),s=r;break;case"img":case"image":case"link":xe("error",e),xe("load",e),s=r;break;case"details":xe("toggle",e),s=r;break;case"input":Rl(e,r),s=No(e,r),xe("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Ne({},r,{value:void 0}),xe("invalid",e);break;case"textarea":Al(e,r),s=zo(e,r),xe("invalid",e);break;default:s=r}Po(n,s),l=s;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?Cu(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&ku(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ur(e,c):typeof c=="number"&&Ur(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Dr.hasOwnProperty(o)?c!=null&&o==="onScroll"&&xe("scroll",e):c!=null&&Ti(e,o,c,i))}switch(n){case"input":ms(e),_l(e,r,!1);break;case"textarea":ms(e),$l(e);break;case"option":r.value!=null&&e.setAttribute("value",""+gn(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?qn(e,!!r.multiple,o,!1):r.defaultValue!=null&&qn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=ta)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ve(t),null;case 6:if(e&&t.stateNode!=null)Yd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(F(166));if(n=En(Zr.current),En(Ft.current),ks(t)){if(r=t.stateNode,n=t.memoizedProps,r[$t]=t,(o=r.nodeValue!==n)&&(e=ut,e!==null))switch(e.tag){case 3:js(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&js(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[$t]=t,t.stateNode=r}return Ve(t),null;case 13:if(we(be),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Se&&ct!==null&&t.mode&1&&!(t.flags&128))fd(),or(),t.flags|=98560,o=!1;else if(o=ks(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(F(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(F(317));o[$t]=t}else or(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ve(t),o=!1}else Et!==null&&(fi(Et),Et=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||be.current&1?Ae===0&&(Ae=3):ul())),t.updateQueue!==null&&(t.flags|=4),Ve(t),null);case 4:return lr(),si(e,t),e===null&&Qr(t.stateNode.containerInfo),Ve(t),null;case 10:return Gi(t.type._context),Ve(t),null;case 17:return st(t.type)&&na(),Ve(t),null;case 19:if(we(be),o=t.memoizedState,o===null)return Ve(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)kr(o,!1);else{if(Ae!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=ca(e),i!==null){for(t.flags|=128,kr(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return ve(be,be.current&1|2),t.child}e=e.sibling}o.tail!==null&&Ie()>ur&&(t.flags|=128,r=!0,kr(o,!1),t.lanes=4194304)}else{if(!r)if(e=ca(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Se)return Ve(t),null}else 2*Ie()-o.renderingStartTime>ur&&n!==1073741824&&(t.flags|=128,r=!0,kr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ie(),t.sibling=null,n=be.current,ve(be,r?n&1|2:n&1),t):(Ve(t),null);case 22:case 23:return cl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?lt&1073741824&&(Ve(t),t.subtreeFlags&6&&(t.flags|=8192)):Ve(t),null;case 24:return null;case 25:return null}throw Error(F(156,t.tag))}function nh(e,t){switch(Wi(t),t.tag){case 1:return st(t.type)&&na(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lr(),we(rt),we(Ge),qi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Xi(t),null;case 13:if(we(be),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));or()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return we(be),null;case 4:return lr(),null;case 10:return Gi(t.type._context),null;case 22:case 23:return cl(),null;case 24:return null;default:return null}}var Ns=!1,Ke=!1,rh=typeof WeakSet=="function"?WeakSet:Set,G=null;function Jn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Te(e,t,r)}else n.current=null}function ai(e,t,n){try{n()}catch(r){Te(e,t,r)}}var bc=!1;function sh(e,t){if(Uo=qs,e=Zu(),Di(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,l=-1,c=-1,d=0,f=0,h=e,m=null;t:for(;;){for(var x;h!==n||s!==0&&h.nodeType!==3||(l=i+s),h!==o||r!==0&&h.nodeType!==3||(c=i+r),h.nodeType===3&&(i+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++d===s&&(l=i),m===o&&++f===r&&(c=i),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wo={focusedElem:e,selectionRange:n},qs=!1,G=t;G!==null;)if(t=G,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var y=w.memoizedProps,j=w.memoizedState,g=t.stateNode,p=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:Ct(t.type,y),j);g.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(S){Te(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return w=bc,bc=!1,w}function Mr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&ai(t,n,o)}s=s.next}while(s!==r)}}function za(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function oi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Qd(e){var t=e.alternate;t!==null&&(e.alternate=null,Qd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[$t],delete t[Xr],delete t[Ko],delete t[Bm],delete t[Dm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Jd(e){return e.tag===5||e.tag===3||e.tag===4}function Cc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ii(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ta));else if(r!==4&&(e=e.child,e!==null))for(ii(e,t,n),e=e.sibling;e!==null;)ii(e,t,n),e=e.sibling}function li(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(li(e,t,n),e=e.sibling;e!==null;)li(e,t,n),e=e.sibling}var Be=null,Nt=!1;function Zt(e,t,n){for(n=n.child;n!==null;)Xd(e,t,n),n=n.sibling}function Xd(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(Sa,n)}catch{}switch(n.tag){case 5:Ke||Jn(n,t);case 6:var r=Be,s=Nt;Be=null,Zt(e,t,n),Be=r,Nt=s,Be!==null&&(Nt?(e=Be,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Be.removeChild(n.stateNode));break;case 18:Be!==null&&(Nt?(e=Be,n=n.stateNode,e.nodeType===8?no(e.parentNode,n):e.nodeType===1&&no(e,n),Kr(e)):no(Be,n.stateNode));break;case 4:r=Be,s=Nt,Be=n.stateNode.containerInfo,Nt=!0,Zt(e,t,n),Be=r,Nt=s;break;case 0:case 11:case 14:case 15:if(!Ke&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&ai(n,t,i),s=s.next}while(s!==r)}Zt(e,t,n);break;case 1:if(!Ke&&(Jn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Te(n,t,l)}Zt(e,t,n);break;case 21:Zt(e,t,n);break;case 22:n.mode&1?(Ke=(r=Ke)||n.memoizedState!==null,Zt(e,t,n),Ke=r):Zt(e,t,n);break;default:Zt(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rh),t.forEach(function(r){var s=ph.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function bt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var o=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Be=l.stateNode,Nt=!1;break e;case 3:Be=l.stateNode.containerInfo,Nt=!0;break e;case 4:Be=l.stateNode.containerInfo,Nt=!0;break e}l=l.return}if(Be===null)throw Error(F(160));Xd(o,i,s),Be=null,Nt=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Te(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)qd(t,e),t=t.sibling}function qd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(bt(t,e),Rt(e),r&4){try{Mr(3,e,e.return),za(3,e)}catch(y){Te(e,e.return,y)}try{Mr(5,e,e.return)}catch(y){Te(e,e.return,y)}}break;case 1:bt(t,e),Rt(e),r&512&&n!==null&&Jn(n,n.return);break;case 5:if(bt(t,e),Rt(e),r&512&&n!==null&&Jn(n,n.return),e.flags&32){var s=e.stateNode;try{Ur(s,"")}catch(y){Te(e,e.return,y)}}if(r&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,i=n!==null?n.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&wu(s,o),Ro(l,i);var d=Ro(l,o);for(i=0;i<c.length;i+=2){var f=c[i],h=c[i+1];f==="style"?Cu(s,h):f==="dangerouslySetInnerHTML"?ku(s,h):f==="children"?Ur(s,h):Ti(s,f,h,d)}switch(l){case"input":Eo(s,o);break;case"textarea":Su(s,o);break;case"select":var m=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var x=o.value;x!=null?qn(s,!!o.multiple,x,!1):m!==!!o.multiple&&(o.defaultValue!=null?qn(s,!!o.multiple,o.defaultValue,!0):qn(s,!!o.multiple,o.multiple?[]:"",!1))}s[Xr]=o}catch(y){Te(e,e.return,y)}}break;case 6:if(bt(t,e),Rt(e),r&4){if(e.stateNode===null)throw Error(F(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(y){Te(e,e.return,y)}}break;case 3:if(bt(t,e),Rt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Kr(t.containerInfo)}catch(y){Te(e,e.return,y)}break;case 4:bt(t,e),Rt(e);break;case 13:bt(t,e),Rt(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(il=Ie())),r&4&&Nc(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Ke=(d=Ke)||f,bt(t,e),Ke=d):bt(t,e),Rt(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(G=e,f=e.child;f!==null;){for(h=G=f;G!==null;){switch(m=G,x=m.child,m.tag){case 0:case 11:case 14:case 15:Mr(4,m,m.return);break;case 1:Jn(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(y){Te(r,n,y)}}break;case 5:Jn(m,m.return);break;case 22:if(m.memoizedState!==null){Tc(h);continue}}x!==null?(x.return=m,G=x):Tc(h)}f=f.sibling}e:for(f=null,h=e;;){if(h.tag===5){if(f===null){f=h;try{s=h.stateNode,d?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=h.stateNode,c=h.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=bu("display",i))}catch(y){Te(e,e.return,y)}}}else if(h.tag===6){if(f===null)try{h.stateNode.nodeValue=d?"":h.memoizedProps}catch(y){Te(e,e.return,y)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;f===h&&(f=null),h=h.return}f===h&&(f=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:bt(t,e),Rt(e),r&4&&Nc(e);break;case 21:break;default:bt(t,e),Rt(e)}}function Rt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Jd(n)){var r=n;break e}n=n.return}throw Error(F(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Ur(s,""),r.flags&=-33);var o=Cc(e);li(e,o,s);break;case 3:case 4:var i=r.stateNode.containerInfo,l=Cc(e);ii(e,l,i);break;default:throw Error(F(161))}}catch(c){Te(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ah(e,t,n){G=e,Zd(e)}function Zd(e,t,n){for(var r=(e.mode&1)!==0;G!==null;){var s=G,o=s.child;if(s.tag===22&&r){var i=s.memoizedState!==null||Ns;if(!i){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Ke;l=Ns;var d=Ke;if(Ns=i,(Ke=c)&&!d)for(G=s;G!==null;)i=G,c=i.child,i.tag===22&&i.memoizedState!==null?zc(s):c!==null?(c.return=i,G=c):zc(s);for(;o!==null;)G=o,Zd(o),o=o.sibling;G=s,Ns=l,Ke=d}Ec(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,G=o):Ec(e)}}function Ec(e){for(;G!==null;){var t=G;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ke||za(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ke)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Ct(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&dc(t,o,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}dc(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var h=f.dehydrated;h!==null&&Kr(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(F(163))}Ke||t.flags&512&&oi(t)}catch(m){Te(t,t.return,m)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function Tc(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function zc(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{za(4,t)}catch(c){Te(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Te(t,s,c)}}var o=t.return;try{oi(t)}catch(c){Te(t,o,c)}break;case 5:var i=t.return;try{oi(t)}catch(c){Te(t,i,c)}}}catch(c){Te(t,t.return,c)}if(t===e){G=null;break}var l=t.sibling;if(l!==null){l.return=t.return,G=l;break}G=t.return}}var oh=Math.ceil,fa=Xt.ReactCurrentDispatcher,al=Xt.ReactCurrentOwner,yt=Xt.ReactCurrentBatchConfig,ie=0,Fe=null,Re=null,De=0,lt=0,Xn=xn(0),Ae=0,rs=null,An=0,Ia=0,ol=0,Fr=null,tt=null,il=0,ur=1/0,Dt=null,pa=!1,ci=null,pn=null,Es=!1,on=null,ma=0,Or=0,ui=null,Ds=-1,Us=0;function Je(){return ie&6?Ie():Ds!==-1?Ds:Ds=Ie()}function mn(e){return e.mode&1?ie&2&&De!==0?De&-De:Wm.transition!==null?(Us===0&&(Us=Mu()),Us):(e=fe,e!==0||(e=window.event,e=e===void 0?16:Hu(e.type)),e):1}function zt(e,t,n,r){if(50<Or)throw Or=0,ui=null,Error(F(185));os(e,n,r),(!(ie&2)||e!==Fe)&&(e===Fe&&(!(ie&2)&&(Ia|=n),Ae===4&&sn(e,De)),at(e,r),n===1&&ie===0&&!(t.mode&1)&&(ur=Ie()+500,Na&&wn()))}function at(e,t){var n=e.callbackNode;Wp(e,t);var r=Xs(e,e===Fe?De:0);if(r===0)n!==null&&Fl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Fl(n),t===1)e.tag===0?Um(Ic.bind(null,e)):cd(Ic.bind(null,e)),Fm(function(){!(ie&6)&&wn()}),n=null;else{switch(Fu(r)){case 1:n=_i;break;case 4:n=$u;break;case 16:n=Js;break;case 536870912:n=Lu;break;default:n=Js}n=lf(n,ef.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ef(e,t){if(Ds=-1,Us=0,ie&6)throw Error(F(327));var n=e.callbackNode;if(rr()&&e.callbackNode!==n)return null;var r=Xs(e,e===Fe?De:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ha(e,r);else{t=r;var s=ie;ie|=2;var o=nf();(Fe!==e||De!==t)&&(Dt=null,ur=Ie()+500,zn(e,t));do try{ch();break}catch(l){tf(e,l)}while(!0);Ki(),fa.current=o,ie=s,Re!==null?t=0:(Fe=null,De=0,t=Ae)}if(t!==0){if(t===2&&(s=Mo(e),s!==0&&(r=s,t=di(e,s))),t===1)throw n=rs,zn(e,0),sn(e,r),at(e,Ie()),n;if(t===6)sn(e,r);else{if(s=e.current.alternate,!(r&30)&&!ih(s)&&(t=ha(e,r),t===2&&(o=Mo(e),o!==0&&(r=o,t=di(e,o))),t===1))throw n=rs,zn(e,0),sn(e,r),at(e,Ie()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(F(345));case 2:kn(e,tt,Dt);break;case 3:if(sn(e,r),(r&130023424)===r&&(t=il+500-Ie(),10<t)){if(Xs(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Je(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Vo(kn.bind(null,e,tt,Dt),t);break}kn(e,tt,Dt);break;case 4:if(sn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var i=31-Tt(r);o=1<<i,i=t[i],i>s&&(s=i),r&=~o}if(r=s,r=Ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*oh(r/1960))-r,10<r){e.timeoutHandle=Vo(kn.bind(null,e,tt,Dt),r);break}kn(e,tt,Dt);break;case 5:kn(e,tt,Dt);break;default:throw Error(F(329))}}}return at(e,Ie()),e.callbackNode===n?ef.bind(null,e):null}function di(e,t){var n=Fr;return e.current.memoizedState.isDehydrated&&(zn(e,t).flags|=256),e=ha(e,t),e!==2&&(t=tt,tt=n,t!==null&&fi(t)),e}function fi(e){tt===null?tt=e:tt.push.apply(tt,e)}function ih(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],o=s.getSnapshot;s=s.value;try{if(!It(o(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function sn(e,t){for(t&=~ol,t&=~Ia,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tt(t),r=1<<n;e[n]=-1,t&=~r}}function Ic(e){if(ie&6)throw Error(F(327));rr();var t=Xs(e,0);if(!(t&1))return at(e,Ie()),null;var n=ha(e,t);if(e.tag!==0&&n===2){var r=Mo(e);r!==0&&(t=r,n=di(e,r))}if(n===1)throw n=rs,zn(e,0),sn(e,t),at(e,Ie()),n;if(n===6)throw Error(F(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,kn(e,tt,Dt),at(e,Ie()),null}function ll(e,t){var n=ie;ie|=1;try{return e(t)}finally{ie=n,ie===0&&(ur=Ie()+500,Na&&wn())}}function $n(e){on!==null&&on.tag===0&&!(ie&6)&&rr();var t=ie;ie|=1;var n=yt.transition,r=fe;try{if(yt.transition=null,fe=1,e)return e()}finally{fe=r,yt.transition=n,ie=t,!(ie&6)&&wn()}}function cl(){lt=Xn.current,we(Xn)}function zn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Mm(n)),Re!==null)for(n=Re.return;n!==null;){var r=n;switch(Wi(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&na();break;case 3:lr(),we(rt),we(Ge),qi();break;case 5:Xi(r);break;case 4:lr();break;case 13:we(be);break;case 19:we(be);break;case 10:Gi(r.type._context);break;case 22:case 23:cl()}n=n.return}if(Fe=e,Re=e=hn(e.current,null),De=lt=t,Ae=0,rs=null,ol=Ia=An=0,tt=Fr=null,Nn!==null){for(t=0;t<Nn.length;t++)if(n=Nn[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,o=n.pending;if(o!==null){var i=o.next;o.next=s,r.next=i}n.pending=r}Nn=null}return e}function tf(e,t){do{var n=Re;try{if(Ki(),Fs.current=da,ua){for(var r=Ce.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ua=!1}if(_n=0,Me=_e=Ce=null,Lr=!1,es=0,al.current=null,n===null||n.return===null){Ae=1,rs=t,Re=null;break}e:{var o=e,i=n.return,l=n,c=t;if(t=De,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,f=l,h=f.tag;if(!(f.mode&1)&&(h===0||h===11||h===15)){var m=f.alternate;m?(f.updateQueue=m.updateQueue,f.memoizedState=m.memoizedState,f.lanes=m.lanes):(f.updateQueue=null,f.memoizedState=null)}var x=vc(i);if(x!==null){x.flags&=-257,yc(x,i,l,o,t),x.mode&1&&gc(o,d,t),t=x,c=d;var w=t.updateQueue;if(w===null){var y=new Set;y.add(c),t.updateQueue=y}else w.add(c);break e}else{if(!(t&1)){gc(o,d,t),ul();break e}c=Error(F(426))}}else if(Se&&l.mode&1){var j=vc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),yc(j,i,l,o,t),Hi(cr(c,l));break e}}o=c=cr(c,l),Ae!==4&&(Ae=2),Fr===null?Fr=[o]:Fr.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var g=Fd(o,c,t);uc(o,g);break e;case 1:l=c;var p=o.type,v=o.stateNode;if(!(o.flags&128)&&(typeof p.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(pn===null||!pn.has(v)))){o.flags|=65536,t&=-t,o.lanes|=t;var S=Od(o,l,t);uc(o,S);break e}}o=o.return}while(o!==null)}sf(n)}catch(k){t=k,Re===n&&n!==null&&(Re=n=n.return);continue}break}while(!0)}function nf(){var e=fa.current;return fa.current=da,e===null?da:e}function ul(){(Ae===0||Ae===3||Ae===2)&&(Ae=4),Fe===null||!(An&268435455)&&!(Ia&268435455)||sn(Fe,De)}function ha(e,t){var n=ie;ie|=2;var r=nf();(Fe!==e||De!==t)&&(Dt=null,zn(e,t));do try{lh();break}catch(s){tf(e,s)}while(!0);if(Ki(),ie=n,fa.current=r,Re!==null)throw Error(F(261));return Fe=null,De=0,Ae}function lh(){for(;Re!==null;)rf(Re)}function ch(){for(;Re!==null&&!Ap();)rf(Re)}function rf(e){var t=of(e.alternate,e,lt);e.memoizedProps=e.pendingProps,t===null?sf(e):Re=t,al.current=null}function sf(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=nh(n,t),n!==null){n.flags&=32767,Re=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ae=6,Re=null;return}}else if(n=th(n,t,lt),n!==null){Re=n;return}if(t=t.sibling,t!==null){Re=t;return}Re=t=e}while(t!==null);Ae===0&&(Ae=5)}function kn(e,t,n){var r=fe,s=yt.transition;try{yt.transition=null,fe=1,uh(e,t,n,r)}finally{yt.transition=s,fe=r}return null}function uh(e,t,n,r){do rr();while(on!==null);if(ie&6)throw Error(F(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(F(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Hp(e,o),e===Fe&&(Re=Fe=null,De=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Es||(Es=!0,lf(Js,function(){return rr(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=yt.transition,yt.transition=null;var i=fe;fe=1;var l=ie;ie|=4,al.current=null,sh(e,n),qd(n,e),Im(Wo),qs=!!Uo,Wo=Uo=null,e.current=n,ah(n),$p(),ie=l,fe=i,yt.transition=o}else e.current=n;if(Es&&(Es=!1,on=e,ma=s),o=e.pendingLanes,o===0&&(pn=null),Fp(n.stateNode),at(e,Ie()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(pa)throw pa=!1,e=ci,ci=null,e;return ma&1&&e.tag!==0&&rr(),o=e.pendingLanes,o&1?e===ui?Or++:(Or=0,ui=e):Or=0,wn(),null}function rr(){if(on!==null){var e=Fu(ma),t=yt.transition,n=fe;try{if(yt.transition=null,fe=16>e?16:e,on===null)var r=!1;else{if(e=on,on=null,ma=0,ie&6)throw Error(F(331));var s=ie;for(ie|=4,G=e.current;G!==null;){var o=G,i=o.child;if(G.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(G=d;G!==null;){var f=G;switch(f.tag){case 0:case 11:case 15:Mr(8,f,o)}var h=f.child;if(h!==null)h.return=f,G=h;else for(;G!==null;){f=G;var m=f.sibling,x=f.return;if(Qd(f),f===d){G=null;break}if(m!==null){m.return=x,G=m;break}G=x}}}var w=o.alternate;if(w!==null){var y=w.child;if(y!==null){w.child=null;do{var j=y.sibling;y.sibling=null,y=j}while(y!==null)}}G=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,G=i;else e:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Mr(9,o,o.return)}var g=o.sibling;if(g!==null){g.return=o.return,G=g;break e}G=o.return}}var p=e.current;for(G=p;G!==null;){i=G;var v=i.child;if(i.subtreeFlags&2064&&v!==null)v.return=i,G=v;else e:for(i=p;G!==null;){if(l=G,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:za(9,l)}}catch(k){Te(l,l.return,k)}if(l===i){G=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,G=S;break e}G=l.return}}if(ie=s,wn(),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Sa,e)}catch{}r=!0}return r}finally{fe=n,yt.transition=t}}return!1}function Pc(e,t,n){t=cr(n,t),t=Fd(e,t,1),e=fn(e,t,1),t=Je(),e!==null&&(os(e,1,t),at(e,t))}function Te(e,t,n){if(e.tag===3)Pc(e,e,n);else for(;t!==null;){if(t.tag===3){Pc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(pn===null||!pn.has(r))){e=cr(n,e),e=Od(t,e,1),t=fn(t,e,1),e=Je(),t!==null&&(os(t,1,e),at(t,e));break}}t=t.return}}function dh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Je(),e.pingedLanes|=e.suspendedLanes&n,Fe===e&&(De&n)===n&&(Ae===4||Ae===3&&(De&130023424)===De&&500>Ie()-il?zn(e,0):ol|=n),at(e,t)}function af(e,t){t===0&&(e.mode&1?(t=vs,vs<<=1,!(vs&130023424)&&(vs=4194304)):t=1);var n=Je();e=Yt(e,t),e!==null&&(os(e,t,n),at(e,n))}function fh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),af(e,n)}function ph(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(F(314))}r!==null&&r.delete(t),af(e,n)}var of;of=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||rt.current)nt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return nt=!1,eh(e,t,n);nt=!!(e.flags&131072)}else nt=!1,Se&&t.flags&1048576&&ud(t,aa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Bs(e,t),e=t.pendingProps;var s=ar(t,Ge.current);nr(t,n),s=el(null,t,r,e,s,n);var o=tl();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,st(r)?(o=!0,ra(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Qi(t),s.updater=Ta,t.stateNode=s,s._reactInternals=t,qo(t,r,e,n),t=ti(null,t,r,!0,o,n)):(t.tag=0,Se&&o&&Ui(t),Ye(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Bs(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=hh(r),e=Ct(r,e),s){case 0:t=ei(null,t,r,e,n);break e;case 1:t=Sc(null,t,r,e,n);break e;case 11:t=xc(null,t,r,e,n);break e;case 14:t=wc(null,t,r,Ct(r.type,e),n);break e}throw Error(F(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ct(r,s),ei(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ct(r,s),Sc(e,t,r,s,n);case 3:e:{if(Wd(t),e===null)throw Error(F(387));r=t.pendingProps,o=t.memoizedState,s=o.element,gd(e,t),la(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=cr(Error(F(423)),t),t=jc(e,t,r,n,s);break e}else if(r!==s){s=cr(Error(F(424)),t),t=jc(e,t,r,n,s);break e}else for(ct=dn(t.stateNode.containerInfo.firstChild),ut=t,Se=!0,Et=null,n=md(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(or(),r===s){t=Qt(e,t,n);break e}Ye(e,t,r,n)}t=t.child}return t;case 5:return vd(t),e===null&&Qo(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,Ho(r,s)?i=null:o!==null&&Ho(r,o)&&(t.flags|=32),Ud(e,t),Ye(e,t,i,n),t.child;case 6:return e===null&&Qo(t),null;case 13:return Hd(e,t,n);case 4:return Ji(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ir(t,null,r,n):Ye(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ct(r,s),xc(e,t,r,s,n);case 7:return Ye(e,t,t.pendingProps,n),t.child;case 8:return Ye(e,t,t.pendingProps.children,n),t.child;case 12:return Ye(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,ve(oa,r._currentValue),r._currentValue=i,o!==null)if(It(o.value,i)){if(o.children===s.children&&!rt.current){t=Qt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=Vt(-1,n&-n),c.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?c.next=c:(c.next=f.next,f.next=c),d.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Jo(o.return,n,t),l.lanes|=n;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(F(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Jo(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}Ye(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,nr(t,n),s=xt(s),r=r(s),t.flags|=1,Ye(e,t,r,n),t.child;case 14:return r=t.type,s=Ct(r,t.pendingProps),s=Ct(r.type,s),wc(e,t,r,s,n);case 15:return Bd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ct(r,s),Bs(e,t),t.tag=1,st(r)?(e=!0,ra(t)):e=!1,nr(t,n),Md(t,r,s),qo(t,r,s,n),ti(null,t,r,!0,e,n);case 19:return Vd(e,t,n);case 22:return Dd(e,t,n)}throw Error(F(156,t.tag))};function lf(e,t){return Au(e,t)}function mh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vt(e,t,n,r){return new mh(e,t,n,r)}function dl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hh(e){if(typeof e=="function")return dl(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ii)return 11;if(e===Pi)return 14}return 2}function hn(e,t){var n=e.alternate;return n===null?(n=vt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ws(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")dl(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Dn:return In(n.children,s,o,t);case zi:i=8,s|=8;break;case jo:return e=vt(12,n,t,s|2),e.elementType=jo,e.lanes=o,e;case ko:return e=vt(13,n,t,s),e.elementType=ko,e.lanes=o,e;case bo:return e=vt(19,n,t,s),e.elementType=bo,e.lanes=o,e;case vu:return Pa(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case hu:i=10;break e;case gu:i=9;break e;case Ii:i=11;break e;case Pi:i=14;break e;case en:i=16,r=null;break e}throw Error(F(130,e==null?e:typeof e,""))}return t=vt(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function In(e,t,n,r){return e=vt(7,e,r,t),e.lanes=n,e}function Pa(e,t,n,r){return e=vt(22,e,r,t),e.elementType=vu,e.lanes=n,e.stateNode={isHidden:!1},e}function uo(e,t,n){return e=vt(6,e,null,t),e.lanes=n,e}function fo(e,t,n){return t=vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gh(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Va(0),this.expirationTimes=Va(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Va(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function fl(e,t,n,r,s,o,i,l,c){return e=new gh(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=vt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qi(o),e}function vh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Bn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function cf(e){if(!e)return vn;e=e._reactInternals;e:{if(Mn(e)!==e||e.tag!==1)throw Error(F(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(st(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(F(171))}if(e.tag===1){var n=e.type;if(st(n))return ld(e,n,t)}return t}function uf(e,t,n,r,s,o,i,l,c){return e=fl(n,r,!0,e,s,o,i,l,c),e.context=cf(null),n=e.current,r=Je(),s=mn(n),o=Vt(r,s),o.callback=t??null,fn(n,o,s),e.current.lanes=s,os(e,s,r),at(e,r),e}function Ra(e,t,n,r){var s=t.current,o=Je(),i=mn(s);return n=cf(n),t.context===null?t.context=n:t.pendingContext=n,t=Vt(o,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=fn(s,t,i),e!==null&&(zt(e,s,i,o),Ms(e,s,i)),i}function ga(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Rc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pl(e,t){Rc(e,t),(e=e.alternate)&&Rc(e,t)}function yh(){return null}var df=typeof reportError=="function"?reportError:function(e){console.error(e)};function ml(e){this._internalRoot=e}_a.prototype.render=ml.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(F(409));Ra(e,t,null,null)};_a.prototype.unmount=ml.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;$n(function(){Ra(null,e,null,null)}),t[Gt]=null}};function _a(e){this._internalRoot=e}_a.prototype.unstable_scheduleHydration=function(e){if(e){var t=Du();e={blockedOn:null,target:e,priority:t};for(var n=0;n<rn.length&&t!==0&&t<rn[n].priority;n++);rn.splice(n,0,e),n===0&&Wu(e)}};function hl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Aa(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function _c(){}function xh(e,t,n,r,s){if(s){if(typeof r=="function"){var o=r;r=function(){var d=ga(i);o.call(d)}}var i=uf(t,r,e,0,null,!1,!1,"",_c);return e._reactRootContainer=i,e[Gt]=i.current,Qr(e.nodeType===8?e.parentNode:e),$n(),i}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=ga(c);l.call(d)}}var c=fl(e,0,!1,null,null,!1,!1,"",_c);return e._reactRootContainer=c,e[Gt]=c.current,Qr(e.nodeType===8?e.parentNode:e),$n(function(){Ra(t,c,n,r)}),c}function $a(e,t,n,r,s){var o=n._reactRootContainer;if(o){var i=o;if(typeof s=="function"){var l=s;s=function(){var c=ga(i);l.call(c)}}Ra(t,i,e,s)}else i=xh(n,t,e,s,r);return ga(i)}Ou=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Tr(t.pendingLanes);n!==0&&(Ai(t,n|1),at(t,Ie()),!(ie&6)&&(ur=Ie()+500,wn()))}break;case 13:$n(function(){var r=Yt(e,1);if(r!==null){var s=Je();zt(r,e,1,s)}}),pl(e,1)}};$i=function(e){if(e.tag===13){var t=Yt(e,134217728);if(t!==null){var n=Je();zt(t,e,134217728,n)}pl(e,134217728)}};Bu=function(e){if(e.tag===13){var t=mn(e),n=Yt(e,t);if(n!==null){var r=Je();zt(n,e,t,r)}pl(e,t)}};Du=function(){return fe};Uu=function(e,t){var n=fe;try{return fe=e,t()}finally{fe=n}};Ao=function(e,t,n){switch(t){case"input":if(Eo(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Ca(r);if(!s)throw Error(F(90));xu(r),Eo(r,s)}}}break;case"textarea":Su(e,n);break;case"select":t=n.value,t!=null&&qn(e,!!n.multiple,t,!1)}};Tu=ll;zu=$n;var wh={usingClientEntryPoint:!1,Events:[ls,Vn,Ca,Nu,Eu,ll]},br={findFiberByHostInstance:Cn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Sh={bundleType:br.bundleType,version:br.version,rendererPackageName:br.rendererPackageName,rendererConfig:br.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Xt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ru(e),e===null?null:e.stateNode},findFiberByHostInstance:br.findFiberByHostInstance||yh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ts=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ts.isDisabled&&Ts.supportsFiber)try{Sa=Ts.inject(Sh),Mt=Ts}catch{}}ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wh;ft.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hl(t))throw Error(F(200));return vh(e,t,null,n)};ft.createRoot=function(e,t){if(!hl(e))throw Error(F(299));var n=!1,r="",s=df;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=fl(e,1,!1,null,null,n,!1,r,s),e[Gt]=t.current,Qr(e.nodeType===8?e.parentNode:e),new ml(t)};ft.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(F(188)):(e=Object.keys(e).join(","),Error(F(268,e)));return e=Ru(t),e=e===null?null:e.stateNode,e};ft.flushSync=function(e){return $n(e)};ft.hydrate=function(e,t,n){if(!Aa(t))throw Error(F(200));return $a(null,e,t,!0,n)};ft.hydrateRoot=function(e,t,n){if(!hl(e))throw Error(F(405));var r=n!=null&&n.hydratedSources||null,s=!1,o="",i=df;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=uf(t,null,e,1,n??null,s,!1,o,i),e[Gt]=t.current,Qr(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new _a(t)};ft.render=function(e,t,n){if(!Aa(t))throw Error(F(200));return $a(null,e,t,!1,n)};ft.unmountComponentAtNode=function(e){if(!Aa(e))throw Error(F(40));return e._reactRootContainer?($n(function(){$a(null,null,e,!1,function(){e._reactRootContainer=null,e[Gt]=null})}),!0):!1};ft.unstable_batchedUpdates=ll;ft.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Aa(n))throw Error(F(200));if(e==null||e._reactInternals===void 0)throw Error(F(38));return $a(e,t,n,!1,r)};ft.version="18.3.1-next-f1338f8080-20240426";function ff(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ff)}catch(e){console.error(e)}}ff(),du.exports=ft;var pf=du.exports,mf,Ac=pf;mf=Ac.createRoot,Ac.hydrateRoot;/**
|
|
41
|
+
* react-router v7.13.1
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/var $c="popstate";function Lc(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jh(e={}){function t(r,s){var d;let o=(d=s.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=o||r.location;return pi("",{pathname:i,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:ss(s)}return bh(t,n,null,e)}function je(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function St(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kh(){return Math.random().toString(36).substring(2,10)}function Mc(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function pi(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?mr(t):t,state:n,key:t&&t.key||r||kh(),unstable_mask:s}}function ss({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function mr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function bh(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:o=!1}=r,i=s.history,l="POP",c=null,d=f();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function f(){return(i.state||{idx:null}).idx}function h(){l="POP";let j=f(),g=j==null?null:j-d;d=j,c&&c({action:l,location:y.location,delta:g})}function m(j,g){l="PUSH";let p=Lc(j)?j:pi(y.location,j,g);d=f()+1;let v=Mc(p,d),S=y.createHref(p.unstable_mask||p);try{i.pushState(v,"",S)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;s.location.assign(S)}o&&c&&c({action:l,location:y.location,delta:1})}function x(j,g){l="REPLACE";let p=Lc(j)?j:pi(y.location,j,g);d=f();let v=Mc(p,d),S=y.createHref(p.unstable_mask||p);i.replaceState(v,"",S),o&&c&&c({action:l,location:y.location,delta:0})}function w(j){return Ch(j)}let y={get action(){return l},get location(){return e(s,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener($c,h),c=j,()=>{s.removeEventListener($c,h),c=null}},createHref(j){return t(s,j)},createURL:w,encodeLocation(j){let g=w(j);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:m,replace:x,go(j){return i.go(j)}};return y}function Ch(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),je(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:ss(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function hf(e,t,n="/"){return Nh(e,t,n,!1)}function Nh(e,t,n,r){let s=typeof t=="string"?mr(t):t,o=Jt(s.pathname||"/",n);if(o==null)return null;let i=gf(e);Eh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let d=Fh(o);l=Lh(i[c],d,r)}return l}function gf(e,t=[],n=[],r="",s=!1){let o=(i,l,c=s,d)=>{let f={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;je(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let h=Ot([r,f.relativePath]),m=n.concat(f);i.children&&i.children.length>0&&(je(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),gf(i.children,t,m,h,c)),!(i.path==null&&!i.index)&&t.push({path:h,score:Ah(h,i.index),routesMeta:m})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let d of vf(i.path))o(i,l,!0,d)}),t}function vf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return s?[o,""]:[o];let i=vf(r.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),s&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Eh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:$h(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Th=/^:[\w-]+$/,zh=3,Ih=2,Ph=1,Rh=10,_h=-2,Fc=e=>e==="*";function Ah(e,t){let n=e.split("/"),r=n.length;return n.some(Fc)&&(r+=_h),t&&(r+=Ih),n.filter(s=>!Fc(s)).reduce((s,o)=>s+(Th.test(o)?zh:o===""?Ph:Rh),r)}function $h(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function Lh(e,t,n=!1){let{routesMeta:r}=e,s={},o="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,f=o==="/"?t:t.slice(o.length)||"/",h=va({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},f),m=c.route;if(!h&&d&&n&&!r[r.length-1].route.index&&(h=va({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!h)return null;Object.assign(s,h.params),i.push({params:s,pathname:Ot([o,h.pathname]),pathnameBase:Uh(Ot([o,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(o=Ot([o,h.pathnameBase]))}return i}function va(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Mh(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((d,{paramName:f,isOptional:h},m)=>{if(f==="*"){let w=l[m]||"";i=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const x=l[m];return h&&!x?d[f]=void 0:d[f]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function Mh(e,t=!1,n=!0){St(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,d,f)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let h=f.charAt(d+i.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function Fh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return St(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Jt(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var Oh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Bh(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?mr(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=Oc(n.substring(1),"/"):o=Oc(n,t)):o=t,{pathname:o,search:Wh(r),hash:Hh(s)}}function Oc(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function po(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Dh(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function gl(e){let t=Dh(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function La(e,t,n,r=!1){let s;typeof e=="string"?s=mr(e):(s={...e},je(!s.pathname||!s.pathname.includes("?"),po("?","pathname","search",s)),je(!s.pathname||!s.pathname.includes("#"),po("#","pathname","hash",s)),je(!s.search||!s.search.includes("#"),po("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,l;if(i==null)l=n;else{let h=t.length-1;if(!r&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),h-=1;s.pathname=m.join("/")}l=h>=0?t[h]:"/"}let c=Bh(s,l),d=i&&i!=="/"&&i.endsWith("/"),f=(o||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}var Ot=e=>e.join("/").replace(/\/\/+/g,"/"),Uh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Wh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Hh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Vh=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Kh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Gh(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var yf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xf(e,t){let n=e;if(typeof n!="string"||!Oh.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(yf)try{let o=new URL(window.location.href),i=n.startsWith("//")?new URL(o.protocol+n):new URL(n),l=Jt(i.pathname,t);i.origin===o.origin&&l!=null?n=l+i.search+i.hash:s=!0}catch{St(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var wf=["POST","PUT","PATCH","DELETE"];new Set(wf);var Yh=["GET",...wf];new Set(Yh);var hr=u.createContext(null);hr.displayName="DataRouter";var Ma=u.createContext(null);Ma.displayName="DataRouterState";var Qh=u.createContext(!1),Sf=u.createContext({isTransitioning:!1});Sf.displayName="ViewTransition";var Jh=u.createContext(new Map);Jh.displayName="Fetchers";var Xh=u.createContext(null);Xh.displayName="Await";var mt=u.createContext(null);mt.displayName="Navigation";var us=u.createContext(null);us.displayName="Location";var Pt=u.createContext({outlet:null,matches:[],isDataRoute:!1});Pt.displayName="Route";var vl=u.createContext(null);vl.displayName="RouteError";var jf="REACT_ROUTER_ERROR",qh="REDIRECT",Zh="ROUTE_ERROR_RESPONSE";function eg(e){if(e.startsWith(`${jf}:${qh}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function tg(e){if(e.startsWith(`${jf}:${Zh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Vh(t.status,t.statusText,t.data)}catch{}}function ng(e,{relative:t}={}){je(gr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=u.useContext(mt),{hash:s,pathname:o,search:i}=ds(e,{relative:t}),l=o;return n!=="/"&&(l=o==="/"?n:Ot([n,o])),r.createHref({pathname:l,search:i,hash:s})}function gr(){return u.useContext(us)!=null}function jt(){return je(gr(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(us).location}var kf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function bf(e){u.useContext(mt).static||u.useLayoutEffect(e)}function qt(){let{isDataRoute:e}=u.useContext(Pt);return e?vg():rg()}function rg(){je(gr(),"useNavigate() may be used only in the context of a <Router> component.");let e=u.useContext(hr),{basename:t,navigator:n}=u.useContext(mt),{matches:r}=u.useContext(Pt),{pathname:s}=jt(),o=JSON.stringify(gl(r)),i=u.useRef(!1);return bf(()=>{i.current=!0}),u.useCallback((c,d={})=>{if(St(i.current,kf),!i.current)return;if(typeof c=="number"){n.go(c);return}let f=La(c,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Ot([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,o,s,e])}var sg=u.createContext(null);function ag(e){let t=u.useContext(Pt).outlet;return u.useMemo(()=>t&&u.createElement(sg.Provider,{value:e},t),[t,e])}function ds(e,{relative:t}={}){let{matches:n}=u.useContext(Pt),{pathname:r}=jt(),s=JSON.stringify(gl(n));return u.useMemo(()=>La(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function og(e,t){return Cf(e,t)}function Cf(e,t,n){var j;je(gr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=u.useContext(mt),{matches:s}=u.useContext(Pt),o=s[s.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",d=o&&o.route;{let g=d&&d.path||"";Ef(l,!d||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${g}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
+
|
|
51
|
+
Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let f=jt(),h;if(t){let g=typeof t=="string"?mr(t):t;je(c==="/"||((j=g.pathname)==null?void 0:j.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${g.pathname}" was given in the \`location\` prop.`),h=g}else h=f;let m=h.pathname||"/",x=m;if(c!=="/"){let g=c.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(g.length).join("/")}let w=hf(e,{pathname:x});St(d||w!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),St(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=dg(w&&w.map(g=>Object.assign({},g,{params:Object.assign({},i,g.params),pathname:Ot([c,r.encodeLocation?r.encodeLocation(g.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?c:Ot([c,r.encodeLocation?r.encodeLocation(g.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),s,n);return t&&y?u.createElement(us.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},y):y}function ig(){let e=gg(),t=Kh(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=u.createElement(u.Fragment,null,u.createElement("p",null,"💿 Hey developer 👋"),u.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",u.createElement("code",{style:o},"ErrorBoundary")," or"," ",u.createElement("code",{style:o},"errorElement")," prop on your route.")),u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},t),n?u.createElement("pre",{style:s},n):null,i)}var lg=u.createElement(ig,null),Nf=class extends u.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=tg(e.digest);n&&(e=n)}let t=e!==void 0?u.createElement(Pt.Provider,{value:this.props.routeContext},u.createElement(vl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?u.createElement(cg,{error:e},t):t}};Nf.contextType=Qh;var mo=new WeakMap;function cg({children:e,error:t}){let{basename:n}=u.useContext(mt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=eg(t.digest);if(r){let s=mo.get(t);if(s)throw s;let o=xf(r.location,n);if(yf&&!mo.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw mo.set(t,i),i}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function ug({routeContext:e,match:t,children:n}){let r=u.useContext(hr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),u.createElement(Pt.Provider,{value:e},n)}function dg(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,o=r==null?void 0:r.errors;if(o!=null){let f=s.findIndex(h=>h.route.id&&(o==null?void 0:o[h.route.id])!==void 0);je(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,f+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let f=0;f<s.length;f++){let h=s[f];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=f),h.route.id){let{loaderData:m,errors:x}=r,w=h.route.loader&&!m.hasOwnProperty(h.route.id)&&(!x||x[h.route.id]===void 0);if(h.route.lazy||w){n.isStatic&&(i=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=n==null?void 0:n.onError,d=r&&c?(f,h)=>{var m,x;c(f,{location:r.location,params:((x=(m=r.matches)==null?void 0:m[0])==null?void 0:x.params)??{},unstable_pattern:Gh(r.matches),errorInfo:h})}:void 0;return s.reduceRight((f,h,m)=>{let x,w=!1,y=null,j=null;r&&(x=o&&h.route.id?o[h.route.id]:void 0,y=h.route.errorElement||lg,i&&(l<0&&m===0?(Ef("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,j=null):l===m&&(w=!0,j=h.route.hydrateFallbackElement||null)));let g=t.concat(s.slice(0,m+1)),p=()=>{let v;return x?v=y:w?v=j:h.route.Component?v=u.createElement(h.route.Component,null):h.route.element?v=h.route.element:v=f,u.createElement(ug,{match:h,routeContext:{outlet:f,matches:g,isDataRoute:r!=null},children:v})};return r&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?u.createElement(Nf,{location:r.location,revalidation:r.revalidation,component:y,error:x,children:p(),routeContext:{outlet:null,matches:g,isDataRoute:!0},onError:d}):p()},null)}function yl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fg(e){let t=u.useContext(hr);return je(t,yl(e)),t}function pg(e){let t=u.useContext(Ma);return je(t,yl(e)),t}function mg(e){let t=u.useContext(Pt);return je(t,yl(e)),t}function xl(e){let t=mg(e),n=t.matches[t.matches.length-1];return je(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hg(){return xl("useRouteId")}function gg(){var r;let e=u.useContext(vl),t=pg("useRouteError"),n=xl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function vg(){let{router:e}=fg("useNavigate"),t=xl("useNavigate"),n=u.useRef(!1);return bf(()=>{n.current=!0}),u.useCallback(async(s,o={})=>{St(n.current,kf),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var Bc={};function Ef(e,t,n){!t&&!Bc[e]&&(Bc[e]=!0,St(!1,n))}u.memo(yg);function yg({routes:e,future:t,state:n,isStatic:r,onError:s}){return Cf(e,void 0,{state:n,isStatic:r,onError:s})}function nn({to:e,replace:t,state:n,relative:r}){je(gr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=u.useContext(mt);St(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=u.useContext(Pt),{pathname:i}=jt(),l=qt(),c=La(e,gl(o),i,r==="path"),d=JSON.stringify(c);return u.useEffect(()=>{l(JSON.parse(d),{replace:t,state:n,relative:r})},[l,d,r,t,n]),null}function xg(e){return ag(e.context)}function Le(e){je(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function wg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:o=!1,unstable_useTransitions:i}){je(!gr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=u.useMemo(()=>({basename:l,navigator:s,static:o,unstable_useTransitions:i,future:{}}),[l,s,o,i]);typeof n=="string"&&(n=mr(n));let{pathname:d="/",search:f="",hash:h="",state:m=null,key:x="default",unstable_mask:w}=n,y=u.useMemo(()=>{let j=Jt(d,l);return j==null?null:{location:{pathname:j,search:f,hash:h,state:m,key:x,unstable_mask:w},navigationType:r}},[l,d,f,h,m,x,r,w]);return St(y!=null,`<Router basename="${l}"> is not able to match the URL "${d}${f}${h}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:u.createElement(mt.Provider,{value:c},u.createElement(us.Provider,{children:t,value:y}))}function Sg({children:e,location:t}){return og(mi(e),t)}function mi(e,t=[]){let n=[];return u.Children.forEach(e,(r,s)=>{if(!u.isValidElement(r))return;let o=[...t,s];if(r.type===u.Fragment){n.push.apply(n,mi(r.props.children,o));return}je(r.type===Le,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),je(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=mi(r.props.children,o)),n.push(i)}),n}var Hs="get",Vs="application/x-www-form-urlencoded";function Fa(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jg(e){return Fa(e)&&e.tagName.toLowerCase()==="button"}function kg(e){return Fa(e)&&e.tagName.toLowerCase()==="form"}function bg(e){return Fa(e)&&e.tagName.toLowerCase()==="input"}function Cg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ng(e,t){return e.button===0&&(!t||t==="_self")&&!Cg(e)}function hi(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function Eg(e,t){let n=hi(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var zs=null;function Tg(){if(zs===null)try{new FormData(document.createElement("form"),0),zs=!1}catch{zs=!0}return zs}var zg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ho(e){return e!=null&&!zg.has(e)?(St(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vs}"`),null):e}function Ig(e,t){let n,r,s,o,i;if(kg(e)){let l=e.getAttribute("action");r=l?Jt(l,t):null,n=e.getAttribute("method")||Hs,s=ho(e.getAttribute("enctype"))||Vs,o=new FormData(e)}else if(jg(e)||bg(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?Jt(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Hs,s=ho(e.getAttribute("formenctype"))||ho(l.getAttribute("enctype"))||Vs,o=new FormData(l,e),!Tg()){let{name:d,type:f,value:h}=e;if(f==="image"){let m=d?`${d}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else d&&o.append(d,h)}}else{if(Fa(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Hs,r=null,s=Vs,i=e}return o&&s==="text/plain"&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function wl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Pg(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&Jt(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function Rg(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function _g(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Ag(e,t,n){let r=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let i=await Rg(o,n);return i.links?i.links():[]}return[]}));return Fg(r.flat(1).filter(_g).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Dc(e,t,n,r,s,o){let i=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>{var f;return n[d].pathname!==c.pathname||((f=n[d].route.path)==null?void 0:f.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return o==="assets"?t.filter((c,d)=>i(c,d)||l(c,d)):o==="data"?t.filter((c,d)=>{var h;let f=r.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(i(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let m=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function $g(e,t,{includeHydrateFallback:n}={}){return Lg(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function Lg(e){return[...new Set(e)]}function Mg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Fg(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let o=JSON.stringify(Mg(s));return n.has(o)||(n.add(o),r.push({key:o,link:s})),r},[])}function Tf(){let e=u.useContext(hr);return wl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Og(){let e=u.useContext(Ma);return wl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Sl=u.createContext(void 0);Sl.displayName="FrameworkContext";function zf(){let e=u.useContext(Sl);return wl(e,"You must render this element inside a <HydratedRouter> element"),e}function Bg(e,t){let n=u.useContext(Sl),[r,s]=u.useState(!1),[o,i]=u.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:f,onTouchStart:h}=t,m=u.useRef(null);u.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let y=g=>{g.forEach(p=>{i(p.isIntersecting)})},j=new IntersectionObserver(y,{threshold:.5});return m.current&&j.observe(m.current),()=>{j.disconnect()}}},[e]),u.useEffect(()=>{if(r){let y=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(y)}}},[r]);let x=()=>{s(!0)},w=()=>{s(!1),i(!1)};return n?e!=="intent"?[o,m,{}]:[o,m,{onFocus:Cr(l,x),onBlur:Cr(c,w),onMouseEnter:Cr(d,x),onMouseLeave:Cr(f,w),onTouchStart:Cr(h,x)}]:[!1,m,{}]}function Cr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Dg({page:e,...t}){let{router:n}=Tf(),r=u.useMemo(()=>hf(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?u.createElement(Wg,{page:e,matches:r,...t}):null}function Ug(e){let{manifest:t,routeModules:n}=zf(),[r,s]=u.useState([]);return u.useEffect(()=>{let o=!1;return Ag(e,t,n).then(i=>{o||s(i)}),()=>{o=!0}},[e,t,n]),r}function Wg({page:e,matches:t,...n}){let r=jt(),{future:s,manifest:o,routeModules:i}=zf(),{basename:l}=Tf(),{loaderData:c,matches:d}=Og(),f=u.useMemo(()=>Dc(e,t,d,o,r,"data"),[e,t,d,o,r]),h=u.useMemo(()=>Dc(e,t,d,o,r,"assets"),[e,t,d,o,r]),m=u.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let y=new Set,j=!1;if(t.forEach(p=>{var S;let v=o.routes[p.route.id];!v||!v.hasLoader||(!f.some(k=>k.route.id===p.route.id)&&p.route.id in c&&((S=i[p.route.id])!=null&&S.shouldRevalidate)||v.hasClientLoader?j=!0:y.add(p.route.id))}),y.size===0)return[];let g=Pg(e,l,s.unstable_trailingSlashAwareDataRequests,"data");return j&&y.size>0&&g.searchParams.set("_routes",t.filter(p=>y.has(p.route.id)).map(p=>p.route.id).join(",")),[g.pathname+g.search]},[l,s.unstable_trailingSlashAwareDataRequests,c,r,o,f,t,e,i]),x=u.useMemo(()=>$g(h,o),[h,o]),w=Ug(h);return u.createElement(u.Fragment,null,m.map(y=>u.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...n})),x.map(y=>u.createElement("link",{key:y,rel:"modulepreload",href:y,...n})),w.map(({key:y,link:j})=>u.createElement("link",{key:y,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function Hg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Vg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Vg&&(window.__reactRouterVersion="7.13.1")}catch{}function Kg({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=u.useRef();s.current==null&&(s.current=jh({window:r,v5Compat:!0}));let o=s.current,[i,l]=u.useState({action:o.action,location:o.location}),c=u.useCallback(d=>{n===!1?l(d):u.startTransition(()=>l(d))},[n]);return u.useLayoutEffect(()=>o.listen(c),[o,c]),u.createElement(wg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,unstable_useTransitions:n})}var If=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qe=u.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:o,replace:i,unstable_mask:l,state:c,target:d,to:f,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:x,...w},y){let{basename:j,navigator:g,unstable_useTransitions:p}=u.useContext(mt),v=typeof f=="string"&&If.test(f),S=xf(f,j);f=S.to;let k=ng(f,{relative:s}),I=jt(),T=null;if(l){let C=La(l,[],I.unstable_mask?I.unstable_mask.pathname:"/",!0);j!=="/"&&(C.pathname=C.pathname==="/"?j:Ot([j,C.pathname])),T=g.createHref(C)}let[P,b,N]=Bg(r,w),O=Qg(f,{replace:i,unstable_mask:l,state:c,target:d,preventScrollReset:h,relative:s,viewTransition:m,unstable_defaultShouldRevalidate:x,unstable_useTransitions:p});function Y(C){t&&t(C),C.defaultPrevented||O(C)}let V=!(S.isExternal||o),H=u.createElement("a",{...w,...N,href:(V?T:void 0)||S.absoluteURL||k,onClick:V?Y:t,ref:Hg(y,b),target:d,"data-discover":!v&&n==="render"?"true":void 0});return P&&!v?u.createElement(u.Fragment,null,H,u.createElement(Dg,{page:k})):H});Qe.displayName="Link";var jl=u.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:o,to:i,viewTransition:l,children:c,...d},f){let h=ds(i,{relative:d.relative}),m=jt(),x=u.useContext(Ma),{navigator:w,basename:y}=u.useContext(mt),j=x!=null&&ev(h)&&l===!0,g=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,p=m.pathname,v=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(p=p.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&y&&(v=Jt(v,y)||v);const S=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let k=p===g||!s&&p.startsWith(g)&&p.charAt(S)==="/",I=v!=null&&(v===g||!s&&v.startsWith(g)&&v.charAt(g.length)==="/"),T={isActive:k,isPending:I,isTransitioning:j},P=k?t:void 0,b;typeof r=="function"?b=r(T):b=[r,k?"active":null,I?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let N=typeof o=="function"?o(T):o;return u.createElement(Qe,{...d,"aria-current":P,className:b,ref:f,style:N,to:i,viewTransition:l},typeof c=="function"?c(T):c)});jl.displayName="NavLink";var Gg=u.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:o,method:i=Hs,action:l,onSubmit:c,relative:d,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:m,...x},w)=>{let{unstable_useTransitions:y}=u.useContext(mt),j=qg(),g=Zg(l,{relative:d}),p=i.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&If.test(l),S=k=>{if(c&&c(k),k.defaultPrevented)return;k.preventDefault();let I=k.nativeEvent.submitter,T=(I==null?void 0:I.getAttribute("formmethod"))||i,P=()=>j(I||k.currentTarget,{fetcherKey:t,method:T,navigate:n,replace:s,state:o,relative:d,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:m});y&&n!==!1?u.startTransition(()=>P()):P()};return u.createElement("form",{ref:w,method:p,action:g,onSubmit:r?c:S,...x,"data-discover":!v&&e==="render"?"true":void 0})});Gg.displayName="Form";function Yg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pf(e){let t=u.useContext(hr);return je(t,Yg(e)),t}function Qg(e,{target:t,replace:n,unstable_mask:r,state:s,preventScrollReset:o,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:d}={}){let f=qt(),h=jt(),m=ds(e,{relative:i});return u.useCallback(x=>{if(Ng(x,t)){x.preventDefault();let w=n!==void 0?n:ss(h)===ss(m),y=()=>f(e,{replace:w,unstable_mask:r,state:s,preventScrollReset:o,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});d?u.startTransition(()=>y()):y()}},[h,f,m,n,r,s,t,e,o,i,l,c,d])}function Rf(e){St(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=u.useRef(hi(e)),n=u.useRef(!1),r=jt(),s=u.useMemo(()=>Eg(r.search,n.current?null:t.current),[r.search]),o=qt(),i=u.useCallback((l,c)=>{const d=hi(typeof l=="function"?l(new URLSearchParams(s)):l);n.current=!0,o("?"+d,c)},[o,s]);return[s,i]}var Jg=0,Xg=()=>`__${String(++Jg)}__`;function qg(){let{router:e}=Pf("useSubmit"),{basename:t}=u.useContext(mt),n=hg(),r=e.fetch,s=e.navigate;return u.useCallback(async(o,i={})=>{let{action:l,method:c,encType:d,formData:f,body:h}=Ig(o,t);if(i.navigate===!1){let m=i.fetcherKey||Xg();await r(m,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:f,body:h,formMethod:i.method||c,formEncType:i.encType||d,flushSync:i.flushSync})}else await s(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:f,body:h,formMethod:i.method||c,formEncType:i.encType||d,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,s,t,n])}function Zg(e,{relative:t}={}){let{basename:n}=u.useContext(mt),r=u.useContext(Pt);je(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),o={...ds(e||".",{relative:t})},i=jt();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),c=l.getAll("index");if(c.some(f=>f==="")){l.delete("index"),c.filter(h=>h).forEach(h=>l.append("index",h));let f=l.toString();o.search=f?`?${f}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Ot([n,o.pathname])),ss(o)}function ev(e,{relative:t}={}){let n=u.useContext(Sf);je(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Pf("useViewTransitionState"),s=ds(e,{relative:t});if(!n.isTransitioning)return!1;let o=Jt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Jt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return va(s.pathname,i)!=null||va(s.pathname,o)!=null}class _f extends Error{constructor(n){super("different_account");Oa(this,"summary");this.name="DifferentAccountError",this.summary=n}}class tv{constructor(){Oa(this,"apiKey",null)}setApiKey(t){this.apiKey=t}clearApiKey(){this.apiKey=null}getApiKey(){return this.apiKey}async fetch(t,n){return globalThis.fetch(t,{...n,headers:{"Content-Type":"application/json",...this.apiKey?{"X-API-Key":this.apiKey}:{},...n==null?void 0:n.headers}})}async login(t,n={}){const r=await this.fetch("/auth/login",{method:"POST",headers:{"X-API-Key":t,"Content-Type":"application/json"},body:JSON.stringify({confirmWipe:n.confirmWipe===!0})});if(r.status===409){const o=await r.json().catch(()=>({}));if(o!=null&&o.wouldWipe)throw new _f(o.summary??{credentialCount:0,serviceCount:0,credentialIds:[]})}if(!r.ok){const o=await r.json().catch(()=>({error:"Invalid API key"}));throw new Error(o.error||`Login failed: ${r.status}`)}return(await r.json()).user}async logout(){await this.fetch("/auth/logout",{method:"POST"})}async getGroups(){const t=await this.fetch("/api/groups");if(!t.ok)throw new Error(`Failed to fetch groups: ${t.status}`);const n=await t.json();return n.groups??n}async listProfiles(){const t=await this.fetch("/api/profiles");if(!t.ok)throw new Error(`Failed to fetch profiles: ${t.status}`);return(await t.json()).profiles}async getProfile(t){const n=await this.fetch(`/api/profiles/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch profile: ${n.status}`);return n.json()}async attest(t){const n=await this.fetch("/api/as/attest",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Attest failed: ${n.status}`)}return n.json()}async getPending(t){const n=await this.fetch(`/api/attestations/pending?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch pending: ${n.status}`);const r=await n.json();return r.pending??r}async getMyAttestations(t){const n=t?`?status=${encodeURIComponent(t)}`:"",r=await this.fetch(`/api/attestations/mine${n}`);if(!r.ok)throw new Error(`Failed to fetch attestations: ${r.status}`);return((await r.json()).attestations??[]).map(o=>{var i,l;return{authorization_id:o.authorization_id,profile_id:o.profileId,path:o.path,title:o.title??null,sp_status:o.status??null,frame:o.bounds??o.frame??{},required_domains:o.requiredDomains??[],attested_domains:o.attestedDomains??[],missing_domains:(o.requiredDomains??[]).filter(c=>!(o.attestedDomains??[]).includes(c)),deferred_commitment_domains:o.deferredCommitmentDomains??[],approvers_frozen:o.approversFrozen??[],above_cap:o.aboveCap??!1,created_at:o.createdAt?new Date(o.createdAt*1e3).toISOString():"",earliest_expiry:(i=o.attestations)!=null&&i.length?new Date(Math.min(...o.attestations.map(c=>c.expiresAt))*1e3).toISOString():null,remaining_seconds:(l=o.attestations)!=null&&l.length?Math.max(0,Math.min(...o.attestations.map(c=>c.expiresAt))-Math.floor(Date.now()/1e3)):null}})}async getDenials(t){const n=new URLSearchParams;t!=null&&t.since&&n.set("since",String(t.since)),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString()?`?${n.toString()}`:"",s=await this.fetch(`/denials${r}`);if(!s.ok)throw new Error(`Failed to fetch denials: ${s.status}`);return s.json()}async getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),s=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!s.ok)throw new Error(`Failed to fetch receipts: ${s.status}`);return(await s.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/authorizations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(s.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?authorization_id=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch attestations: ${n.status}`);return n.json()}async getGroupById(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch group: ${n.status}`);return n.json()}async createGroup(t){const n=await this.fetch("/api/groups",{method:"POST",body:JSON.stringify({name:t})});if(!n.ok){const o=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||`Create group failed: ${n.status}`)}const r=await n.json(),s=r.group||r;return{id:s.id,name:s.name,myDomains:s.myDomains||[],isAdmin:!0}}async joinGroup(t){const n=await this.fetch("/api/groups/join",{method:"POST",body:JSON.stringify({inviteCode:t})});if(!n.ok){const o=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||`Join group failed: ${n.status}`)}const r=await n.json(),s=r.group||r;return{id:s.id,name:s.name,myDomains:s.myDomains||[],isAdmin:s.isAdmin||!1}}async inviteToGroup(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/invite`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Invite failed: ${n.status}`)}return n.json()}async getMyTeam(){const t=await this.fetch("/api/groups/me");if(!t.ok)return null;const n=await t.json();return n.group?{group:n.group,membership:n.membership}:null}async listUsers(){const t=await this.fetch("/api/users");return t.ok?(await t.json()).users??[]:[]}async setPubkey(t){const n=await this.fetch("/api/users/me/pubkey",{method:"PUT",body:JSON.stringify({pubkey:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to set pubkey"}));throw new Error(r.error||`setPubkey failed: ${n.status}`)}}async getPubkey(t){const n=await this.fetch(`/api/users/${encodeURIComponent(t)}/pubkey`);return n.status===404||!n.ok?null:(await n.json()).pubkey??null}async leaveTeam(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/leave`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to leave team"}));throw new Error(r.error||`Leave failed: ${n.status}`)}}async getVaultStatus(){const t=await this.fetch("/vault/status");if(!t.ok)throw new Error(`Failed to fetch vault status: ${t.status}`);return t.json()}async getCredential(t){const n=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to check credential: ${n.status}`);return n.json()}async setCredential(t,n){const r=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to save credential: ${r.status}`)}async testCredential(t){const n=await this.fetch(`/vault/test/${encodeURIComponent(t)}`,{method:"POST"});if(!n.ok)throw new Error(`Test failed: ${n.status}`);return n.json()}async aiAssist(t){const n=await this.fetch("/ai/assist",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error,disclaimer:"AI surfaces reality. You supply intent."}}async aiIntentReview(t){const n=await this.fetch("/ai/intent-review",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error}}async aiTest(t){const n=await this.fetch("/ai/test",{method:"POST",body:JSON.stringify(t??{})});if(!n.ok)throw new Error(`AI test failed: ${n.status}`);return n.json()}async aiModels(t){const n=await this.fetch("/ai/models",{method:"POST",body:JSON.stringify(t??{})});if(!n.ok)throw new Error(`Model list failed: ${n.status}`);return n.json()}async getMcpHealth(){const t=await this.fetch("/mcp/health");if(!t.ok)throw new Error(`MCP server unreachable: ${t.status}`);return t.json()}async getMcpIntegrations(){const t=await this.fetch("/mcp/integrations");if(!t.ok)throw new Error(`Failed to fetch integrations: ${t.status}`);return t.json()}async getOAuthHealth(t){try{const n=await this.fetch(`/auth/oauth/${encodeURIComponent(t)}/health`);return n.ok?await n.json():{status:"unverified"}}catch{return{status:"unverified"}}}async getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const s=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(s.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async setReadPolicy(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/read-policy`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({readAgeDays:n})});if(!r.ok){const s=await r.json().catch(()=>({error:`HTTP ${r.status}`}));throw new Error(s.error)}}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const s=await r.json();return(s==null?void 0:s.config)??null}async setTeamProfileConfig(t,n,r){const s=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!s.ok){const o=await s.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(o.error||`setTeamProfileConfig failed: ${s.status}`)}}async encryptIntent(t,n){const r=await this.fetch("/api/encrypt-intent",{method:"POST",body:JSON.stringify({intent:t,recipients:n})});if(!r.ok){const s=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(s.error||`encryptIntent failed: ${r.status}`)}return r.json()}async getApproversPubkeys(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}/approvers/pubkeys`);return r.ok?(await r.json()).approvers??[]:[]}async deleteTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(s.error||`deleteTeamProfileConfig failed: ${r.status}`)}}async getProposals(t){const n=await this.fetch(`/api/proposals?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals??[]}async resolveProposal(t,n,r){const s=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!s.ok){const o=await s.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`Failed: ${s.status}`)}return s.json()}async getProposalsForApprover(){const t=await this.fetch("/api/proposals?approver=me");if(!t.ok)throw new Error(`Failed to fetch approver proposals: ${t.status}`);return(await t.json()).proposals??[]}async approveProposal(t){const n=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/approve`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`approveProposal failed: ${n.status}`)}return n.json()}async rejectProposal(t,n){const r=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/reject`,{method:"POST",body:JSON.stringify({reason:n})});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed"}));throw new Error(s.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/authorizations/${encodeURIComponent(t)}/intent`);return n.status===404||n.status===403||!n.ok?null:n.json()}async decryptIntent(t){const n=await this.fetch("/api/decrypt-intent",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const s=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(s.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const s=await r.json().catch(()=>({error:"Failed"}));throw new Error(s.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(s=>{var l,c;const o=s.owner??{userId:""};return{authorization_id:s.authorization_id??s.authorizationId,profile_id:s.profileId??s.profile_id,path:s.path??"",title:s.title??null,sp_status:s.status??s.sp_status??null,frame:s.bounds??s.frame??{},required_domains:s.requiredDomains??s.required_domains??[],attested_domains:s.attestedDomains??s.attested_domains??[],missing_domains:(s.requiredDomains??s.required_domains??[]).filter(d=>!(s.attestedDomains??s.attested_domains??[]).includes(d)),deferred_commitment_domains:s.deferredCommitmentDomains??s.deferred_commitment_domains??[],approvers_frozen:s.approversFrozen??s.approvers_frozen??[],above_cap:s.aboveCap??s.above_cap??!1,created_at:s.createdAt?new Date(s.createdAt*1e3).toISOString():s.created_at??"",earliest_expiry:(l=s.attestations)!=null&&l.length?new Date(Math.min(...s.attestations.map(d=>d.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=s.attestations)!=null&&c.length?Math.max(0,Math.min(...s.attestations.map(d=>d.expiresAt))-Math.floor(Date.now()/1e3)):null,owner:o}})}async listTeamReceipts(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts`);if(!n.ok)throw new Error(`Failed to fetch team receipts: ${n.status}`);return(await n.json()).receipts??[]}async getMyReceiptsPage(t){const n=new URLSearchParams;t!=null&&t.before&&n.set("before",t.before),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),s=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!s.ok)throw new Error(`Failed to fetch receipts: ${s.status}`);const o=await s.json();return{receipts:o.receipts??[],nextBefore:o.nextBefore??null}}async listTeamReceiptsPage(t,n){const r=new URLSearchParams;n!=null&&n.before&&r.set("before",n.before),n!=null&&n.profile&&r.set("profile",n.profile),n!=null&&n.limit&&r.set("limit",String(n.limit));const s=r.toString(),o=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts${s?"?"+s:""}`);if(!o.ok)throw new Error(`Failed to fetch team receipts: ${o.status}`);const i=await o.json();return{receipts:i.receipts??[],nextBefore:i.nextBefore??null}}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",s=t.domain||"owner",o=await this.getProposals(s);let i=[];if(r==="all"){const l=[],c=new Date;for(let f=0;f<n;f++){const h=new Date(c);h.setUTCDate(c.getUTCDate()-f),l.push(h.toISOString().slice(0,10))}i=(await Promise.all(l.map(f=>this.getMyReceipts({date:f,profile:t.profile})))).flat()}return{proposals:o,receipts:i}}async getAutostart(){const t=await this.fetch("/autostart");if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async setAutostart(t){const n=await this.fetch("/autostart",{method:t?"POST":"DELETE"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.message||`HTTP ${n.status}`)}}async getGateContent(t){const n=await this.fetch(`/gate-content?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch gate content: ${n.status}`);return(await n.json()).entry??null}async resyncGates(){const t=await this.fetch("/resync-gates",{method:"POST"});if(!t.ok)throw new Error(`Failed to resync gates: ${t.status}`)}async getEnrichedAuthorizations(){const t=await this.fetch("/active-authorizations");if(!t.ok)throw new Error(`Failed to fetch authorizations: ${t.status}`);return(await t.json()).authorizations??[]}async pushGateContent(t){const n=await this.fetch("/gate-content",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to push gate content"}));throw new Error(r.error||`Push gate content failed: ${n.status}`)}}async getAgentContext(){const t=await this.fetch("/agent-brief/context");if(!t.ok)throw new Error(`Failed to fetch agent context: ${t.status}`);return(await t.json()).content}async saveAgentContext(t){const n=await this.fetch("/agent-brief/context",{method:"PUT",body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save agent context"}));throw new Error(r.error||`Save failed: ${n.status}`)}}async aiChat(t){const n=await this.fetch("/ai/chat",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI chat failed"}))).error||`Chat failed: ${n.status}`}}async getAIPrompts(){const t=await this.fetch("/ai-prompts");if(!t.ok)throw new Error(`Failed to load AI prompts: ${t.status}`);return t.json()}async setAIPrompt(t,n){const r=await this.fetch(`/ai-prompts/${t}`,{method:"PUT",body:JSON.stringify({value:n})});if(!r.ok){const s=await r.json().catch(()=>({error:"Save failed"}));throw new Error(s.error||`Save failed: ${r.status}`)}}}const A=new tv,Af=u.createContext(null);function nv({children:e}){const[t,n]=u.useState(null),[r,s]=u.useState("personal"),[o,i]=u.useState(null),[l,c]=u.useState(""),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,w]=u.useState(!1),[y,j]=u.useState(""),g=u.useRef(!1),p=u.useRef(null),v=u.useCallback(async()=>{if(g.current)try{const P=await A.getMyTeam();if(P){const{group:b,membership:N}=P;f(b),m(N),s("team"),i(b);const O=p.current??N.domains[0]??"owner";c(O)}else f(null),m(null),s("personal")}catch{}},[]);u.useEffect(()=>{const P=()=>{document.visibilityState==="visible"&&v()};return document.addEventListener("visibilitychange",P),()=>document.removeEventListener("visibilitychange",P)},[v]);const S=u.useCallback(async(P,b={})=>{w(!0),j("");try{A.setApiKey(P),g.current=!0;const N=await A.login(P,b);n(N),p.current=N.id;const O=await A.getGroups(),Y=O.find(V=>V.isPersonal)??O[0]??null;i(Y),c("owner"),await v()}catch(N){throw A.clearApiKey(),g.current=!1,j(N instanceof Error?N.message:"Login failed"),N}finally{w(!1)}},[v]),k=u.useCallback(async()=>{await A.logout(),A.clearApiKey(),g.current=!1,p.current=null,n(null),i(null),c(""),f(null),m(null),s("personal"),j("")},[]),I=u.useCallback(()=>j(""),[]),T=u.useCallback((P,b)=>{i(P),c(b)},[]);return a.jsx(Af.Provider,{value:{user:t,mode:r,group:o,domain:l,groupId:(o==null?void 0:o.id)??null,activeTeam:d,activeMembership:h,isLoading:x,error:y,login:S,logout:k,clearError:I,activeGroup:o,activeDomain:l,groups:o?[o]:[],setActiveContext:T,refreshGroups:v},children:e})}function We(){const e=u.useContext(Af);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const $f=u.createContext(null);function rv({children:e}){const{user:t}=We(),n=u.useRef(null),[r,s]=u.useState(!1),o=u.useRef(new Map),i=u.useCallback((l,c)=>{const d=o.current;return d.has(l)||d.set(l,new Set),d.get(l).add(c),()=>{var f;(f=d.get(l))==null||f.delete(c)}},[]);return u.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,s(!1));return}if(n.current)return;const l=A.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>s(!0),c.onerror=()=>s(!1);const d=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const f of d)c.addEventListener(f,h=>{let m;try{m=JSON.parse(h.data)}catch{m=null}const x=o.current.get(f);if(x)for(const w of x)try{w(m)}catch(y){console.error(`[EventSource] handler for "${f}" threw:`,y)}});return()=>{c.close(),n.current=null,s(!1)}},[t]),a.jsx($f.Provider,{value:{connected:r,addListener:i},children:e})}function ke(e,t){const n=u.useContext($f);if(!n)return;const{addListener:r}=n;u.useEffect(()=>r(e,t),[e,t,r])}const Br="suveren-theme",Uc="hap-theme";function Is(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(Uc);t!==null&&localStorage.getItem(Br)===null&&localStorage.setItem(Br,t),t!==null&&localStorage.removeItem(Uc)})();function Lf(){const[e,t]=u.useState(()=>{const o=localStorage.getItem(Br);return o==="light"||o==="dark"?o:"system"}),[n,r]=u.useState(()=>Is(e));u.useEffect(()=>{const o=document.documentElement,i=Is(e);o.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Br):localStorage.setItem(Br,e),r(Is(e))},[e]),u.useEffect(()=>{if(e!=="system")return;const o=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(Is("system"));return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]);const s=u.useCallback(()=>{t(o=>o==="system"?"light":o==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:s}}const sv=5*60*1e3,av=2e3;function kl(){const[e,t]=u.useState(!1),[n,r]=u.useState("docker"),[s,o]=u.useState(""),[i,l]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState(!1),[m,x]=u.useState(!1),w=u.useRef(null);return u.useEffect(()=>{let y=!1;const j=(v=!1)=>{fetch(v?"/health?refresh=1":"/health").then(S=>S.json()).then(S=>{y||(S.installMethod&&r(S.installMethod),typeof S.latestVersion<"u"&&l(S.latestVersion),S.updateAvailable&&t(!0),S.version&&(o(S.version),w.current===null?w.current=S.version:S.version!==w.current&&S.version!=="dev"&&d(!0)))}).catch(()=>{})};j(!0);const g=setInterval(()=>j(!1),m?av:sv),p=()=>{document.visibilityState==="visible"&&j(!1)};return document.addEventListener("visibilitychange",p),window.addEventListener("focus",p),()=>{y=!0,clearInterval(g),document.removeEventListener("visibilitychange",p),window.removeEventListener("focus",p)}},[m]),{updateAvailable:e&&!f,installMethod:n,version:s,latestVersion:i,serverRestarted:c,startFastPolling:()=>x(!0),dismiss:()=>h(!0)}}function ov(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Wc={system:"◑",light:"☀",dark:"☾"};function bl({onMenuToggle:e}){const{user:t,logout:n}=We(),{theme:r,toggle:s}=Lf(),{version:o,updateAvailable:i,latestVersion:l}=kl(),c=ov(o);return a.jsx("nav",{className:"top-nav",children:a.jsxs("div",{className:"top-nav-inner",children:[a.jsxs("div",{className:"logo-group",children:[a.jsx("span",{className:"logo",children:"Suveren"}),a.jsx("span",{className:"version-badge",children:"Local Gateway"}),c&&a.jsxs("span",{className:"gw-version",title:i&&l?`Running v${c} — v${l} is available`:"Running gateway version","data-stale":i?"true":void 0,children:["v",c,i&&l?` → ${l}`:""]})]}),a.jsx("div",{className:"nav-spacer"}),a.jsx("div",{className:"nav-actions nav-actions-desktop",children:t?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"user-chip",children:a.jsx("strong",{children:t.name})}),a.jsx("button",{className:"theme-toggle",onClick:s,title:`Theme: ${r}`,children:Wc[r]}),a.jsx("button",{className:"nav-logout",onClick:n,children:"Logout"})]}):a.jsx("button",{className:"theme-toggle",onClick:s,title:`Theme: ${r}`,children:Wc[r]})}),t&&e&&a.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function At(e,t){var n;if((n=t==null?void 0:t.revokedSet)!=null&&n.has(e.authorization_id))return"revoked";switch(e.sp_status){case"revoked":return"revoked";case"expired":return"expired";case"active":return"active";case"pending":return"pending"}return e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function Mf(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[At(r,t)].push(r);return n}function Lt(e,t,n){const r=u.useRef(e);r.current=e,u.useEffect(()=>{let s=null;const o=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{o()&&r.current()},l=()=>{s===null&&(s=setInterval(i,t))},c=()=>{s!==null&&(clearInterval(s),s=null)},d=()=>{o()?(r.current(),l()):c()};return o()&&(r.current(),l()),document.addEventListener("visibilitychange",d),()=>{c(),document.removeEventListener("visibilitychange",d)}},[t,n])}const Ff=u.createContext(null),iv=3e4,lv=5e3,cv=3e5;function uv(e,t,n){return t===0?"loading":e!=null&&e.running?"running":e!=null&&e.error?"error":e&&n?"starting":"not-running"}function dv({children:e}){const[t,n]=u.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0,authHealth:{}}),r=u.useRef(null),s=u.useCallback(async()=>{let d=!1;const[f,h]=await Promise.all([A.getIntegrationManifests().catch(()=>(d=!0,{manifests:[]})),A.getMcpHealth().catch(()=>null)]);n(x=>({...x,manifests:f.manifests,integrations:(h==null?void 0:h.integrations)??x.integrations,activeSessions:(h==null?void 0:h.activeSessions)??x.activeSessions,mcpServerUp:!!h,manifestsError:d,fetchCount:x.fetchCount+1}));const m=f.manifests.filter(x=>x.oauth);if(m.length>0){const x=await Promise.all(m.map(async w=>[w.id,await A.getOAuthHealth(w.id)]));n(w=>({...w,authHealth:Object.fromEntries(x)}))}},[]),o=t.fetchCount>0&&t.manifests.some(d=>{const f=t.integrations.find(h=>h.id===d.id);return f&&!f.running});ke("integration-changed",s),Lt(s,o?lv:cv);const i=u.useMemo(()=>{const d=new Map(t.integrations.map(m=>[m.id,m])),f=Date.now();o&&r.current===null?r.current=f:o||(r.current=null);const h=r.current!==null&&f-r.current<iv;return t.manifests.map(m=>{const x=d.get(m.id),w=uv(x,t.fetchCount,h),y=t.authHealth[m.id];return{id:m.id,manifest:m,integration:x,state:w,authStatus:y==null?void 0:y.status,authAccount:y==null?void 0:y.account,authError:y==null?void 0:y.error}})},[t,o]),l=u.useMemo(()=>i.filter(d=>d.state==="not-running"||d.state==="error"||d.authStatus==="failed").length,[i]),c={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,manifestsError:t.manifestsError,entries:i,attentionCount:l,activeSessions:t.activeSessions,refresh:s};return a.jsx(Ff.Provider,{value:c,children:e})}function Cl(){const e=u.useContext(Ff);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const fv=[{to:"/",icon:"□",label:"Dashboard"},{to:"/proposals",icon:"▷",label:"Pending Approvals",statusKey:"proposals"},{to:"/authorizations",icon:"☰",label:"Authorizations",statusKey:"authorizations"},{to:"/agent-brief",icon:"▤",label:"Agent Brief",statusKey:"brief"},{to:"/audit",icon:"▣",label:"Receipts"},{to:"/groups",icon:"◉",label:"Team",teamOnly:!0},{to:"/integrations",icon:"⧗",label:"Integrations",statusKey:"integrations"},{to:"/settings",icon:"⚙",label:"AI Assistant",statusKey:"assistant"}];function pv(){const{activeDomain:e}=We(),[t,n]=u.useState({}),r=u.useCallback(async()=>{try{const[s,o,i,l,c]=await Promise.all([A.getCredential("ai-config").catch(()=>null),A.getMyAttestations().catch(()=>null),A.getProposals(e||"owner").catch(()=>null),A.getProposalsForApprover().catch(()=>null),A.getAgentContext().catch(()=>"")]),d={};if(s&&!s.configured&&(d.assistant=1),o){const x=Mf(o).expired.length;x>0&&(d.authorizations=x)}const f=(i==null?void 0:i.length)??0,h=(l==null?void 0:l.length)??0,m=f+h;m>0&&(d.proposals=m),(!c||!c.trim())&&(d.brief=1),n(d)}catch{}},[e]);return ke("attestation-changed",r),ke("proposal-added",r),ke("proposal-resolved",r),ke("proposal-approved",r),ke("proposal-rejected",r),ke("team-membership-changed",r),Lt(r,3e5,e),t}const mv={marginLeft:"auto",minWidth:"1.25rem",height:"1.25rem",padding:"0 0.375rem",borderRadius:"0.625rem",background:"var(--warning)",color:"var(--bg-elevated)",fontSize:"0.7rem",fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},hv={position:"fixed",bottom:"1.5rem",left:"50%",transform:"translateX(-50%)",background:"var(--bg-elevated, #1e1e2e)",color:"var(--text-primary, #e2e8f0)",border:"1px solid var(--border)",borderRadius:"0.5rem",padding:"0.625rem 1rem",fontSize:"0.85rem",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",zIndex:9999,whiteSpace:"nowrap",pointerEvents:"none"};function gv(){const{mode:e,group:t,domain:n,activeTeam:r}=We(),s=pv(),{attentionCount:o}=Cl(),i={...s};o>0&&(i.integrations=o);const l=fv.filter(m=>!m.teamOnly||e==="team"),c=u.useRef(null),[d,f]=u.useState(null),h=jt();return u.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?f(`You are now acting in team context — ${r.name}`):e==="personal"&&f("You have left the team — back to personal context"),c.current=e)},[e,r]),u.useEffect(()=>{f(null)},[h.pathname]),a.jsxs("div",{className:"sidebar",children:[a.jsx("ul",{className:"sidebar-nav",children:l.map(m=>{const x=m.statusKey?i[m.statusKey]:0;return a.jsx("li",{children:a.jsxs(jl,{to:m.to,end:m.to==="/",className:({isActive:w})=>`sidebar-item${w?" active":""}`,children:[a.jsx("span",{className:"icon",children:m.icon}),m.label,x?a.jsx("span",{style:mv,children:x}):null]})},m.to)})}),a.jsxs("div",{className:"sidebar-context",children:[a.jsx("div",{className:"ctx-label",children:"Active context"}),a.jsx("div",{className:"ctx-value",children:e==="personal"?"personal":t?`${t.name} / ${n}`:n})]}),d&&a.jsx("div",{style:hv,role:"status","aria-live":"polite",children:d})]})}const go="suveren:updatedTo";function vv(e){return e==="npm"?"npm install -g @suveren/gateway@latest && suveren-gateway restart":e==="dev"?"git pull && pnpm install":"docker rm -f suveren-gateway 2>/dev/null; docker ps -q --filter publish=7400 --filter publish=7430 | xargs -r docker rm -f; docker pull ghcr.io/suverenai/suveren-gateway:latest && docker run -d --name suveren-gateway -p 7400:3000 -p 7430:3030 -v $HOME/.suveren:/app/data ghcr.io/suverenai/suveren-gateway"}function yv(){const e=document.querySelectorAll('[role="dialog"], .modal-overlay, .modal');for(const n of e)if(!n.closest(".update-overlay"))return!0;const t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)){const n=t.value;if(n&&n.trim())return!0}return!1}function Of(){const{updateAvailable:e,installMethod:t,version:n,latestVersion:r,serverRestarted:s,startFastPolling:o,dismiss:i}=kl(),[l,c]=u.useState(!1),[d,f]=u.useState(!1),[h,m]=u.useState(()=>{try{const v=sessionStorage.getItem(go);if(v)return sessionStorage.removeItem(go),v}catch{}return null}),x=vv(t),w=u.useRef(null),y=v=>{try{sessionStorage.setItem(go,v||r||"✓")}catch{}window.location.reload()};u.useEffect(()=>{if(!h)return;const v=setTimeout(()=>m(null),6e3);return()=>clearTimeout(v)},[h]),u.useEffect(()=>{if(!l||!s)return;const v=()=>yv()?!1:(y(n),!0);if(v())return;const S=setInterval(v,1500);return()=>clearInterval(S)},[l,s,n]),u.useEffect(()=>(document.body.classList.toggle("is-updating",l),()=>document.body.classList.remove("is-updating")),[l]);const j=e&&!l&&!h||!!h&&!l;u.useEffect(()=>{if(!j){document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner");return}document.body.classList.add("has-update-banner");const v=()=>{var I;const k=((I=w.current)==null?void 0:I.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${k}px`)};v();const S=new ResizeObserver(v);return w.current&&S.observe(w.current),()=>{S.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[j]);const g=()=>{c(!0),o()},p=async()=>{try{await navigator.clipboard.writeText(x),f(!0),setTimeout(()=>f(!1),1800)}catch{}};return a.jsxs(a.Fragment,{children:[h&&!l&&a.jsx("div",{ref:w,className:"update-banner is-live",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"update-banner-row",children:[a.jsxs("span",{className:"update-banner-text",children:["✓"," You","’","re on the latest version",h&&h!=="✓"?` — ${h} is live`:" — now live","."]}),a.jsx("button",{className:"update-banner-x",onClick:()=>m(null),"aria-label":"Dismiss",children:"×"})]})}),e&&!l&&!h&&a.jsx("div",{ref:w,className:"update-banner",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"update-banner-row",children:[a.jsx("span",{className:"update-banner-text",children:"Update available."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.jsx("button",{className:"btn btn-sm btn-secondary",onClick:g,children:"Update"}),a.jsx("button",{className:"update-banner-x",onClick:i,"aria-label":"Dismiss",children:"×"})]})]})}),l&&a.jsx("div",{className:"update-overlay",children:a.jsxs("div",{className:"update-overlay-card",role:"dialog","aria-modal":"true","aria-label":"Finishing the update",children:[a.jsx("div",{className:"update-spinner"}),a.jsxs("h2",{children:["Finishing the update","…"]}),a.jsxs("p",{children:["Copy this command and run it in your terminal. The gateway will restart, and"," ",a.jsx("strong",{children:"this page updates automatically"})," when it comes back ","—"," no need to refresh."]}),a.jsxs("div",{className:"update-cmd-row",children:[a.jsx("code",{className:"update-cmd",children:x}),a.jsx("button",{className:"btn btn-sm btn-primary",onClick:p,children:d?"Copied":"Copy"})]}),a.jsxs("div",{className:"update-status",children:[a.jsx("span",{className:"update-pulse"})," Waiting for the gateway to restart","…"]}),a.jsxs("div",{className:"update-overlay-actions",children:[a.jsx("button",{className:"btn btn-primary",onClick:()=>y(n),children:"Reload now"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const xv={system:"◑",light:"☀",dark:"☾"},wv=[{to:"/",icon:"□",label:"Dashboard"},{to:"/proposals",icon:"▷",label:"Pending Approvals"},{to:"/authorizations",icon:"☰",label:"Authorizations"},{to:"/agent-brief",icon:"▤",label:"Agent Brief"},{to:"/audit",icon:"▣",label:"Receipts"},{to:"/groups",icon:"◉",label:"Team"},{to:"/integrations",icon:"⧗",label:"Integrations"},{to:"/settings",icon:"⚙",label:"AI Assistant"}];function Sv({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:s,logout:o}=We(),{theme:i,toggle:l}=Lf(),c=jt();return u.useEffect(()=>{t()},[c.pathname]),e?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mobile-menu-backdrop",onClick:t}),a.jsxs("div",{className:"mobile-menu-panel",children:[n&&a.jsxs("div",{className:"mobile-menu-header",children:[a.jsx("strong",{children:n.name}),a.jsx("span",{style:{fontSize:"0.8rem",color:"var(--text-secondary)"},children:r?`${r.name} / ${s}`:s||"personal"})]}),a.jsx("nav",{className:"mobile-menu-nav",children:wv.map(d=>a.jsxs(jl,{to:d.to,end:d.to==="/",className:({isActive:f})=>`mobile-menu-item${f?" active":""}`,onClick:t,children:[a.jsx("span",{className:"icon",children:d.icon}),d.label]},d.to))}),a.jsxs("div",{className:"mobile-menu-footer",children:[a.jsxs("button",{className:"mobile-menu-action",onClick:()=>{l()},children:[a.jsx("span",{className:"icon",children:xv[i]}),"Theme: ",i]}),a.jsx("button",{className:"mobile-menu-action",onClick:()=>{o(),t()},children:"Logout"})]})]})]}):null}function jv(){const[e,t]=u.useState(!1);return a.jsxs(dv,{children:[a.jsx(bl,{onMenuToggle:()=>t(!e)}),a.jsx(Of,{}),a.jsx(gv,{}),a.jsx(Sv,{open:e,onClose:()=>t(!1)}),a.jsx("div",{className:"main-content",children:a.jsx("div",{className:"page-inner",children:a.jsx(xg,{})})})]})}function kv(){const[e,t]=u.useState(""),{login:n,isLoading:r,error:s,clearError:o}=We(),[i,l]=u.useState(null),c=async()=>{if(e.trim()){o();try{await n(e)}catch(h){if(h instanceof _f){l(h.summary);return}}}},d=async()=>{l(null),o();try{await n(e,{confirmWipe:!0})}catch{}},f=()=>{l(null)};return a.jsxs(a.Fragment,{children:[a.jsx(bl,{}),a.jsx(Of,{}),a.jsxs("div",{className:"login-split",children:[a.jsx("div",{className:"login-split-left",children:a.jsxs("div",{style:{maxWidth:"28rem"},children:[a.jsx("h1",{style:{fontSize:"clamp(2.25rem, 4vw, 3.25rem)",letterSpacing:"-0.03em",lineHeight:1.1,marginBottom:"1.25rem"},children:"Your agents, your intent, your rules."}),a.jsx("p",{style:{fontSize:"1.125rem",color:"var(--text-secondary)",lineHeight:1.6,marginBottom:"3rem"},children:"The gateway runs on your machine, between your agents and the tools they use. Your signature. Your bounds. Your receipts."})]})}),a.jsx("div",{className:"login-split-right",children:a.jsxs("div",{style:{width:"100%",maxWidth:"24rem"},children:[a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem"},children:"Sign In"}),a.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text-secondary)",lineHeight:1.5},children:"Enter your API key to manage authorizations."})]}),s&&a.jsx("div",{className:"error-message",children:s}),a.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[a.jsx("label",{className:"form-label",children:"API Key"}),a.jsx("input",{className:"form-input",type:"password",placeholder:"hap_sk_...",value:e,onChange:h=>t(h.target.value),onKeyDown:h=>h.key==="Enter"&&c(),disabled:r,style:{padding:"0.75rem"}}),a.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),a.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),a.jsx("div",{className:"login-divider",children:"New here?"}),a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",a.jsx("br",{}),"then come back to sign in."]}),a.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-full",style:{textDecoration:"none"},children:"Create Account"})]}),a.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[a.jsxs(a.Fragment,{children:["Create an account at ",a.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)"},children:"Suveren"})]}),"Join or create a team to get domain authority","Sign in here with your API key to start authorizing agents"].map((h,m)=>a.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:m<2?"0.5rem":0},children:[a.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[m+1,"."]}),h]},m))})]})]})})]}),i&&a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"wipe-warning-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},onClick:f,children:a.jsxs("div",{className:"card",onClick:h=>h.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[a.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),a.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["This gateway already holds data for another account. Signing in with this API key will ",a.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),a.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[a.jsxs("li",{children:[i.credentialCount," stored service credential",i.credentialCount===1?"":"s",i.credentialIds.length>0&&a.jsxs("span",{style:{color:"var(--text-tertiary)",fontSize:"0.825rem"},children:[" ","(",i.credentialIds.slice(0,5).join(", "),i.credentialIds.length>5?`, +${i.credentialIds.length-5} more`:"",")"]})]}),a.jsxs("li",{children:[i.serviceCount," configured integration",i.serviceCount===1?"":"s"]}),a.jsx("li",{children:"The local E2EE keypair (a new one will be generated for this account)"}),a.jsx("li",{children:"Any unsynchronised gate content stored locally"})]}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Authorizations and receipts on the Service Provider are NOT affected — only this gateway's local state is wiped."}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-tertiary)",marginBottom:"1rem"},children:"If this isn't what you wanted, cancel and sign back in with the original API key, or use a different gateway instance for this account."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:f,disabled:r,children:"Cancel"}),a.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:d,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function bv(){const{setActiveContext:e}=We(),t=qt(),[n,r]=u.useState(""),[s,o]=u.useState(""),[i,l]=u.useState(""),[c,d]=u.useState(!1),f=async()=>{if(n.trim()){d(!0),l("");try{const m=await A.joinGroup(n.trim());e(m,m.myDomains[0]||""),t("/")}catch(m){l(m instanceof Error?m.message:"Failed to join group")}finally{d(!1)}}},h=async()=>{if(s.trim()){d(!0),l("");try{const m=await A.createGroup(s.trim());e(m,m.myDomains[0]||""),t("/")}catch(m){l(m instanceof Error?m.message:"Failed to create group")}finally{d(!1)}}};return a.jsxs(a.Fragment,{children:[a.jsx(bl,{}),a.jsx("div",{className:"main-content no-sidebar",style:{marginTop:"var(--nav-height)"},children:a.jsxs("div",{style:{maxWidth:"30rem",margin:"3rem auto",padding:"0 1rem"},children:[a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsx("h2",{style:{fontSize:"1.5rem",marginBottom:"0.5rem"},children:"Join Your Team"}),a.jsx("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",lineHeight:1.6},children:"Join an existing team or create a new one to share authority across domains."})]}),i&&a.jsx("div",{className:"error-message",children:i}),a.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[a.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Join an existing group"}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Ask your team admin for an invite code."}),a.jsxs("div",{className:"invite-input-row",children:[a.jsx("input",{className:"form-input",placeholder:"Paste invite code...",value:n,onChange:m=>r(m.target.value),onKeyDown:m=>m.key==="Enter"&&f(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),a.jsx("button",{className:"btn btn-primary",onClick:f,disabled:c,children:"Join"})]})]}),a.jsxs("div",{className:"card",children:[a.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Create a new group"}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Start a new team and invite members. Assign domains after creation."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("input",{className:"form-input",placeholder:"Group name (e.g., Acme Corp)",value:s,onChange:m=>o(m.target.value),onKeyDown:m=>m.key==="Enter"&&h(),style:{flex:1},disabled:c}),a.jsx("button",{className:"btn btn-secondary",onClick:h,disabled:c,children:"Create"})]})]})]})})]})}const gi="suveren-setup-ai-skipped",vi="suveren-setup-agent-done",yi="suveren-setup-dismissed",Cv={"hap-setup-ai-skipped":gi,"hap-setup-agent-done":vi,"hap-setup-dismissed":yi};function Nv(){for(const[e,t]of Object.entries(Cv)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}Nv();const vo={"claude-code":{label:"Claude Code",snippet:e=>JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)},"claude-desktop":{label:"Claude Desktop",snippet:e=>`Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
|
|
52
|
+
|
|
53
|
+
${JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)}`},other:{label:"Other",snippet:e=>`Streamable HTTP: POST ${e}/mcp
|
|
54
|
+
SSE transport: GET ${e}/sse
|
|
55
|
+
Health check: GET ${e}/health`}};function Ev({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:s}){const[o,i]=u.useState(()=>localStorage.getItem(gi)==="true"),[l,c]=u.useState(()=>localStorage.getItem(vi)==="true"),[d,f]=u.useState(()=>localStorage.getItem(yi)==="true"),[h,m]=u.useState(null),[x,w]=u.useState("claude-code"),[y,j]=u.useState(!1),g=[{label:"AI Assistant",detail:"A trusted AI helps you think through authorizations — surfacing risks and asking the right questions.",to:"/settings",status:e?"done":o?"skipped":"pending",optional:!0},{label:"Connect a service",to:"/integrations",status:t?"done":"pending"},{label:"Authorize your agent",to:"/agent/new",status:n?"done":"pending"},{label:"Connect your agent",status:r||l?"done":"pending"}],p=g.filter(b=>b.status==="done"||b.status==="skipped").length,v=p===g.length,S=u.useCallback(()=>{localStorage.setItem(gi,"true"),i(!0)},[]),k=u.useCallback(()=>{localStorage.setItem(vi,"true"),c(!0),m(null)},[]),I=u.useCallback(()=>{localStorage.setItem(yi,"true"),f(!0)},[]),T=u.useCallback(async b=>{try{await navigator.clipboard.writeText(b),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(d||v)return null;const P=g.findIndex(b=>b.status==="pending");return a.jsxs("div",{style:{border:"2px solid var(--accent)",borderRadius:"0.75rem",padding:"1.5rem",marginBottom:"1.5rem",background:"var(--bg-elevated)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.25rem"},children:[a.jsx("h2",{style:{fontSize:"1.1rem",fontWeight:700,margin:0},children:"Get Started"}),a.jsx("button",{onClick:I,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"1.1rem",padding:"0 0.25rem",lineHeight:1},title:"Hide setup guide",children:"×"})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:g.map((b,N)=>{const O=N===P,Y=b.status==="done"||b.status==="skipped"?"●":"○",V=b.status==="done"?"var(--success)":b.status==="skipped"?"var(--text-tertiary)":O?"var(--accent)":"var(--text-tertiary)";return a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:O?"0.75rem":"0.25rem 0",borderRadius:O?"0.5rem":void 0,background:O?"var(--accent-subtle)":void 0},children:[a.jsx("span",{style:{color:V,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:Y}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[b.to&&b.status==="pending"?a.jsx(Qe,{to:b.to,style:{fontSize:"0.9rem",fontWeight:O?600:500,color:O?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:b.label}):b.status==="pending"&&N===3?a.jsx("button",{onClick:()=>m(h===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:O?600:500,color:O?"var(--accent)":"var(--text-primary)"},children:b.label}):a.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:b.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:b.label}),b.optional&&b.status==="pending"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),b.status==="skipped"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),b.detail&&b.status==="pending"&&O&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:b.detail})]}),b.optional&&b.status==="pending"&&a.jsx("button",{onClick:S,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"0.75rem",padding:"0.125rem 0.5rem",flexShrink:0},children:"Skip"}),b.to&&b.status==="pending"&&a.jsx(Qe,{to:b.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),N===3&&h===3&&a.jsxs("div",{style:{marginTop:"0.75rem",marginLeft:"1.5rem",padding:"1rem",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"0.5rem"},children:[a.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.75rem",color:"var(--text-primary)"},children:"MCP Endpoint"}),a.jsx("div",{style:{fontFamily:"monospace",fontSize:"0.85rem",padding:"0.5rem 0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",marginBottom:"1rem",wordBreak:"break-all"},children:s}),a.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(vo).map(([H,C])=>a.jsx("button",{onClick:()=>w(H),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:x===H?600:400,background:x===H?"var(--accent-subtle)":"transparent",color:x===H?"var(--accent)":"var(--text-secondary)",border:`1px solid ${x===H?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:C.label},H))}),a.jsx("pre",{style:{fontFamily:"monospace",fontSize:"0.78rem",lineHeight:1.6,padding:"0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",overflow:"auto",whiteSpace:"pre-wrap",margin:0,marginBottom:"0.75rem"},children:vo[x].snippet(s)}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>T(vo[x].snippet(s)),children:y?"Copied":"Copy"}),a.jsx("button",{className:"btn btn-primary btn-sm",onClick:k,children:"Done"})]})]})]},N)})}),a.jsxs("div",{style:{marginTop:"1.25rem"},children:[a.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"2px",overflow:"hidden"},children:a.jsx("div",{style:{height:"100%",width:`${p/g.length*100}%`,background:"var(--accent)",borderRadius:"2px",transition:"width 0.3s ease"}})}),a.jsxs("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.375rem"},children:[p," of ",g.length," complete"]})]})]})}function Tn({variant:e="base",style:t,className:n,...r}){const s=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return a.jsx("span",{className:`${s}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function yo(){return a.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[a.jsx(Tn,{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",flexShrink:0}}),a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"0.35rem"},children:[a.jsx(Tn,{variant:"line",style:{width:"35%"}}),a.jsx(Tn,{variant:"line-sm",style:{width:"65%"}})]})]})}const Tv={gmail:"Gmail",calendar:"Google Calendar",crm:"CRM",linkedin:"LinkedIn",records:"Records",mollie:"Mollie"},Bf=e=>Tv[e]??e,zv={resource:{chip:"Restricted",sev:"warn"},spam:{chip:"Spam / Trash",sev:"info"},age:{chip:"Too old",sev:"warn"},unset_age:{chip:"Needs setup",sev:"act",fixTo:"/integrations"},read_gate:{chip:"Not granted",sev:"act",fixTo:"/authorizations"},ungoverned:{chip:"Unconfigured",sev:"act"},query_unsafe:{chip:"Unsafe search",sev:"info"}};function Iv(e){return zv[e]??{chip:"Blocked",sev:"info"}}function Pv(e){const t=Bf(e.integrationId);switch(e.reason){case"resource":return e.integrationId==="calendar"?a.jsxs(a.Fragment,{children:["Tried to read your ",a.jsx("b",{children:e.target??"restricted"})," calendar"]}):a.jsxs(a.Fragment,{children:["Tried to read a restricted location in ",t]});case"spam":return a.jsxs(a.Fragment,{children:["Tried to open a message in ",a.jsx("b",{children:"spam or trash"})]});case"age":return a.jsxs(a.Fragment,{children:["Tried to read ",t," older than your read window"]});case"unset_age":return a.jsxs(a.Fragment,{children:["Your ",t," has ",a.jsx("b",{children:"no read window set"}),", so reads are blocked"]});case"read_gate":return a.jsxs(a.Fragment,{children:["Read access isn't granted on your ",t," authorization"]});case"ungoverned":return a.jsxs(a.Fragment,{children:["A ",t," tool isn't configured for safe reading"]});case"query_unsafe":return a.jsx(a.Fragment,{children:"A search couldn't be safely limited and was refused"});default:return a.jsx(a.Fragment,{children:e.detail})}}function Rv(e,t){const n=Math.max(0,(t-e)/1e3);if(n<60)return"Just now";if(n<3600)return`${Math.floor(n/60)} min ago`;if(n<86400)return`${Math.floor(n/3600)} hr ago`;const r=Math.floor(n/86400);return r===1?"Yesterday":`${r} days ago`}const _v=5;function Av(){const[e,t]=u.useState(null),[n,r]=u.useState(0),[s,o]=u.useState(!1),[i,l]=u.useState(!1),c=u.useCallback(()=>{A.getDenials({limit:s?200:_v}).then(({count:f,records:h})=>{r(f),t(h),l(!1)}).catch(()=>l(!0))},[s]);if(u.useEffect(()=>{c()},[c]),Lt(c,12e4),i||e===null)return null;const d=(f,h)=>{const m=Iv(f.reason);return a.jsxs("div",{className:"rb-row",children:[a.jsx("span",{className:`rb-dot ${m.sev==="act"?"act":m.sev==="info"?"info":""}`,"aria-hidden":"true"}),a.jsxs("div",{className:"rb-body",children:[a.jsx("div",{className:"rb-line",children:Pv(f)}),a.jsxs("div",{className:"rb-meta",children:[a.jsx("span",{className:`rb-chip ${m.sev==="act"?"act":m.sev==="warn"?"warn":""}`,children:m.chip}),a.jsx("span",{className:"rb-via",children:Bf(f.integrationId)})]}),m.fixTo&&a.jsx(Qe,{className:"rb-fix",to:m.fixTo,children:"Set a read window →"})]}),a.jsx("div",{className:"rb-when",children:Rv(f.ts,Date.now())})]},`${f.ts}-${h}`)};return a.jsxs("section",{className:"card recent-blocks","aria-label":"Recent blocks",style:{marginTop:"1.5rem"},children:[a.jsxs("div",{className:"card-header",children:[a.jsx("h2",{className:"card-title",children:"Recent blocks"}),n>0&&a.jsx("span",{className:"rb-count",children:n})]}),e.length===0?a.jsxs("div",{className:"rb-empty",children:[a.jsx("span",{className:"rb-mark","aria-hidden":"true",children:a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M20 6 9 17l-5-5"})})}),a.jsx("h3",{children:"Nothing blocked"}),a.jsx("p",{children:"Your agent has stayed within every limit you set."})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"rb-sub",children:"Limits you set that stopped your agent. Seeing them here means the gateway is doing its job."}),a.jsx("div",{className:"rb-rows",children:e.map(d)}),!s&&n>e.length&&a.jsx("div",{className:"rb-foot",children:a.jsxs("button",{className:"rb-viewall",type:"button",onClick:()=>o(!0),children:["View all ",n," blocks"]})})]})]})}const $v=30*60;function xo(e){return e.replace(/@.*$/,"").split("/").pop()??e}function Lv(){var H;const{domain:e}=We(),[t,n]=u.useState([]),[r,s]=u.useState([]),[o,i]=u.useState([]),[l,c]=u.useState(!0),[d,f]=u.useState(!1),[h,m]=u.useState(!1),[x,w]=u.useState(!1),{entries:y,activeSessions:j,loading:g}=Cl(),p=!g,v=u.useCallback(()=>{A.getMyAttestations().then(C=>{n(C),f(!0)}).catch(()=>f(!0)),A.getProposals(e||"owner").then(C=>{s(C),m(!0)}).catch(()=>m(!0)),A.getProposalsForApprover().then(C=>i(C)).catch(()=>i([])),A.getCredential("ai-config").then(C=>{c(C.configured),w(!0)}).catch(()=>w(!0))},[e]);ke("attestation-changed",v),ke("proposal-added",v),ke("proposal-resolved",v),ke("proposal-approved",v),ke("proposal-rejected",v),Lt(v,3e5,e);const S=d&&h&&x&&p,k=Mf(t),I=k.active,T=k.expired,P=I.filter(C=>C.remaining_seconds!==null&&C.remaining_seconds<=$v),b=r.filter(C=>C.status==="pending"),N=y.filter(C=>C.state==="running"),O=y.filter(C=>C.state==="starting"),Y=y.filter(C=>C.state==="not-running"||C.state==="error"),V=[];for(const C of o)V.push({label:"Approval needed",detail:`${C.tool} — above-cap action under ${xo(C.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const C of b)V.push({label:"Approval pending",detail:`${C.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const C of P){const J=Math.ceil((C.remaining_seconds??0)/60);V.push({label:"Expiring soon",detail:`${C.title??xo(C.profile_id)} — ${J} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const C of T)V.push({label:"Expired",detail:C.title??xo(C.profile_id),to:"/authorizations",color:"var(--danger)"});for(const C of Y)V.push({label:C.state==="error"?"Integration error":"Integration stopped",detail:C.state==="error"&&((H=C.integration)!=null&&H.error)?`${C.manifest.name}: ${C.integration.error}`:`${C.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const C of O)V.push({label:"Integration starting",detail:`${C.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});for(const C of y)C.authStatus==="failed"&&C.state!=="not-running"&&C.state!=="error"&&V.push({label:"Reconnect needed",detail:`${C.manifest.name}: authorization expired — reconnect to restore access`,to:"/integrations",color:"var(--danger)"});return l||V.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"page-header",children:a.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&a.jsx(Ev,{aiConfigured:l,hasRunningIntegration:N.length>0,hasActiveAuth:I.length>0,hasAgentConnected:j>0,mcpEndpoint:`http://localhost:${window.location.port==="3400"?"3430":"7430"}`}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(8rem, 1fr))",gap:"0.75rem",marginBottom:"1.5rem"},children:[a.jsx(Qe,{to:"/authorizations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[d?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:I.length>0?"var(--success)":"var(--text-tertiary)"},children:I.length}):a.jsx(Tn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),a.jsx(Qe,{to:"/proposals",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[h?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:b.length>0?"var(--warning)":"var(--text-tertiary)"},children:b.length}):a.jsx(Tn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),a.jsx(Qe,{to:"/authorizations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[d?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--danger)":"var(--text-tertiary)"},children:T.length}):a.jsx(Tn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),a.jsx(Qe,{to:"/integrations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[p?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:N.length>0?"var(--success)":"var(--text-tertiary)"},children:N.length}):a.jsx(Tn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),V.length>0?a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:V.map((C,J)=>a.jsx(Qe,{to:C.to,style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem"},children:[a.jsx("span",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",background:C.color,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--text-primary)"},children:C.label}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:C.detail})]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},J))}):S?a.jsx("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:a.jsx("div",{style:{fontSize:"0.9rem",color:"var(--text-secondary)"},children:"All clear. Nothing needs your attention."})}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[a.jsx(yo,{}),a.jsx(yo,{}),a.jsx(yo,{})]}),a.jsx(Av,{})]})}const Mv=["Scope & Limits","Intent","Authorize"];function Df({currentStep:e,onStepClick:t}){const n=qt();return a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",marginBottom:"2.5rem"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,overflow:"hidden"},children:Mv.map((r,s)=>{const o=s+2,i=o<e,l=o===e;return a.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[s>0&&a.jsx("div",{style:{width:"1.5rem",height:"2px",background:i?"var(--accent)":"var(--border)",flexShrink:1}}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[a.jsx("div",{className:`step-circle${i?" completed":""}${l?" current":""}`,onClick:i&&t?()=>t(o):void 0,style:i&&t?{cursor:"pointer"}:void 0,children:i?"✓":s+1}),a.jsx("span",{className:"step-label-text",style:{fontSize:"0.6rem",marginTop:"0.3rem",color:l?"var(--accent)":i?"var(--text-secondary)":"var(--text-tertiary)",fontWeight:l?600:400,textAlign:"center"},children:r})]})]},o)})}),a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/agent/new"),style:{flexShrink:0,fontSize:"0.8rem",marginTop:"0.15rem"},children:"Cancel"})]})}const Fv=40;function $e(e,t){const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,s=r.indexOf("@"),o=s>=0?r.slice(0,s):r;return(o.charAt(0).toUpperCase()+o.slice(1)).slice(0,Fv)}function Ov({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:s}){return a.jsxs("div",{className:"context-strip",children:[n&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"context-strip-label",children:"Team:"}),a.jsxs("span",{children:[a.jsx("strong",{children:n}),r?` / ${r}`:""]})]}),e&&a.jsxs("span",{children:[a.jsx("strong",{children:"Profile:"})," ",$e(e)]}),t&&a.jsxs("span",{children:[a.jsx("strong",{children:"Bounds:"})," ",t]}),s&&a.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:s,children:"Switch"})]})}function Bv({integrationId:e,field:t,value:n,onChange:r,disabled:s,onLabels:o}){const[i,l]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(!0);u.useEffect(()=>{let w=!1;return A.discoverScopeField(e,t).then(y=>{var j;w||(l(y.options),h(!1),(j=y.options)!=null&&j.length&&(o==null||o(Object.fromEntries(y.options.map(g=>[g.value,g.label])))))}).catch(y=>{w||(d(y instanceof Error?y.message:String(y)),h(!1))}),()=>{w=!0}},[e,t]);const m=new Set(n.split(",").map(w=>w.trim()).filter(Boolean)),x=w=>{const y=new Set(m);y.has(w)?y.delete(w):y.add(w),r(Array.from(y).join(","))};return f?a.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):c||!i?a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--warning)",marginBottom:"0.5rem"},children:["Couldn't fetch options (",c??"no response","). Enter values manually, separated by commas."]}),a.jsx("input",{className:"form-input",type:"text",value:n,onChange:w=>r(w.target.value),disabled:s})]}):i.length===0?a.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["No options available from ",e," for this field."]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:i.map(w=>{const y=w.extras??{},j=typeof y.access=="string"?y.access:void 0,g=j==="reader",p=y.primary===!0;return a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:g?"var(--text-tertiary)":"var(--text-primary)",cursor:s||g?"not-allowed":"pointer"},title:g?"Read-only — you can authorize list/read but not writes":void 0,children:[a.jsx("input",{type:"checkbox",checked:m.has(String(w.value)),onChange:()=>x(String(w.value)),disabled:s||g}),a.jsx("span",{children:w.label||w.value}),p&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),j&&a.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",j]})]},w.value)})})}function Dv(e){return e.replace(/@.*$/,"").split("/").pop()??e}function Uv(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Wv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function Hv(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Hc(e,t){const n=e.trim();return n?t==="email"?n.includes("@")&&n.indexOf(".",n.indexOf("@"))>-1:t==="domain"?n.includes(".")&&!n.includes("@"):!0:!1}function Vv(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function Kv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function Gv(e){return e?e==="minutes"?[{value:15,label:"15m"},{value:30,label:"30m"},{value:60,label:"1h"},{value:120,label:"2h"},{value:240,label:"4h"}]:e==="hours"?[{value:1,label:"1h"},{value:4,label:"4h"},{value:8,label:"8h"},{value:24,label:"1d"}]:e==="days"?[{value:1,label:"1d"},{value:7,label:"1w"},{value:30,label:"1mo"},{value:90,label:"3mo"}]:e==="percent"?[{value:10,label:"10%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:100,label:"100%"}]:e.startsWith("currency:")?[{value:10,label:"10"},{value:50,label:"50"},{value:100,label:"100"},{value:500,label:"500"},{value:1e3,label:"1k"}]:[]:[]}function Yv(e,t){if(!e||!t)return"";const n=Number(e);if(!Number.isFinite(n)||n<=0)return"";if(t==="minutes"&&n>=60){const r=Math.floor(n/60),s=n%60;return s===0?`${r} hour${r!==1?"s":""}`:`${r}h ${s}m`}if(t==="hours"&&n>=24&&n%24===0){const r=n/24;return`${r} day${r!==1?"s":""}`}if(t==="days"){if(n>=30&&n%30===0)return`${n/30} month${n/30!==1?"s":""}`;if(n>=7&&n%7===0)return`${n/7} week${n/7!==1?"s":""}`}return""}function Qv({id:e,value:t,onChange:n,disabled:r,placeholder:s,unit:o}){const i=Kv(o),l=Gv(o),c=Vv(o),d=Yv(t,o),f=t===""?null:Number(t),h=()=>{const x=t===""?0:Number(t),w=x%i,y=w===0?x+i:x+(i-w);n(String(y))},m=()=>{const x=t===""?0:Number(t);if(x<=0)return;const w=x%i,y=w===0?x-i:x-w;n(String(Math.max(0,y)))};return a.jsxs("div",{className:"bounded-input",children:[a.jsxs("div",{className:"bounded-input-field",children:[a.jsx("button",{type:"button",className:"stepper-btn stepper-decrement",onClick:m,disabled:r||t===""||Number(t)<=0,"aria-label":"Decrease",children:"−"}),a.jsx("input",{id:e,className:"stepper-input",type:"number",min:0,step:i,value:t,placeholder:s??"0",onChange:x=>n(x.target.value),onFocus:x=>x.target.select(),disabled:r}),a.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:h,disabled:r,"aria-label":"Increase",children:"+"}),c&&a.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:c})]}),l.length>0&&!r&&a.jsx("div",{className:"bounded-input-presets",role:"group","aria-label":"Quick presets",children:l.map(x=>a.jsx("button",{type:"button",className:`preset-chip${f===x.value?" preset-chip-selected":""}`,onClick:()=>n(String(x.value)),children:x.label},x.value))}),d&&a.jsxs("div",{className:"bounded-input-echo",children:["≈ ",d]})]})}function Vc({htmlFor:e,label:t,description:n}){const[r,s]=u.useState(!1);return a.jsxs("div",{className:"field-label-with-tip",children:[a.jsx("label",{className:"form-label",htmlFor:e,children:t}),n&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"field-tip-trigger","aria-label":`What does "${t}" mean?`,"aria-expanded":r,onClick:()=>s(o=>!o),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onBlur:()=>s(!1),children:"i"}),r&&a.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function Jv({id:e,value:t,onChange:n,disabled:r,format:s,placeholder:o}){const[i,l]=u.useState(""),[c,d]=u.useState(!1),f=u.useRef(null),h=t?t.split(",").map(g=>g.trim()).filter(Boolean):[],m=g=>{const p=g.trim();if(!p)return;if(!Hc(p,s)){d(!0);return}d(!1);const v=h.includes(p)?h:[...h,p];n(v.join(",")),l("")},x=g=>{const p=h.filter((v,S)=>S!==g);n(p.join(","))},w=g=>{g.key==="Enter"||g.key===","||g.key==="Tab"?i.trim()&&(g.preventDefault(),m(i)):g.key==="Backspace"&&!i&&h.length>0&&x(h.length-1)},y=g=>{const p=g.clipboardData.getData("text");if(p.includes(",")){g.preventDefault();const S=p.split(",").map(I=>I.trim()).filter(Boolean).filter(I=>Hc(I,s)),k=[...new Set([...h,...S])];n(k.join(",")),l(""),d(!1)}},j=s==="email"?"Type email and press Enter...":"Type domain and press Enter...";return a.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var g;return(g=f.current)==null?void 0:g.focus()},children:[h.map((g,p)=>a.jsxs("span",{className:"tag-pill",children:[g,!r&&a.jsx("button",{type:"button",className:"tag-remove",onClick:v=>{v.stopPropagation(),x(p)},"aria-label":`Remove ${g}`,children:"×"})]},g)),!r&&a.jsx("input",{ref:f,id:e,className:"tag-input-field",type:"text",value:i,onChange:g=>{l(g.target.value),d(!1)},onKeyDown:w,onPaste:y,onBlur:()=>{i.trim()&&m(i)},placeholder:h.length===0?o??j:""})]})}function Xv({id:e,options:t,value:n,onChange:r,disabled:s}){const o=n?n.split(",").map(l=>l.trim()).filter(Boolean):[],i=l=>{const c=o.includes(l)?o.filter(d=>d!==l):[...o,l];r(c.join(","))};return a.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>a.jsxs("label",{className:`checkbox-pill${o.includes(l)?" checkbox-pill-selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:o.includes(l),onChange:()=>i(l),disabled:s}),a.jsx("span",{children:l})]},l))})}function Kc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:s,readOnly:o,twoColumn:i,discoveryIntegrationId:l,onLabels:c}){const d=Uv(e,t),f=`${s}-field-${e}`,h=a.jsx(a.Fragment,{children:Hv(t)?a.jsx(Xv,{id:f,options:t.enum,value:n,onChange:m=>r(e,m),disabled:o}):(()=>{const m=t.boundType;return(m==null?void 0:m.kind)==="enum"&&Array.isArray(m.values)})()?a.jsxs("select",{id:f,className:"form-select",value:n,onChange:m=>r(e,m.target.value),disabled:o,children:[a.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(m=>a.jsx("option",{value:m,children:m},m))]}):"enum"in t&&t.enum?a.jsxs("select",{id:f,className:"form-select",value:n,onChange:m=>r(e,m.target.value),disabled:o,children:[a.jsx("option",{value:"",children:"Select..."}),t.enum.map(m=>a.jsx("option",{value:m,children:m},m))]}):t.type==="number"?a.jsx(Qv,{id:f,value:n,onChange:m=>r(e,m),disabled:o,unit:t.unit}):Wv(t)?a.jsx(Jv,{id:f,value:n,onChange:m=>r(e,m),disabled:o,format:t.format}):l?a.jsx(Bv,{integrationId:l,field:e,value:n,onChange:m=>r(e,m),disabled:o,onLabels:m=>c==null?void 0:c(e,m)}):a.jsx("input",{id:f,className:"form-input",type:"text",value:n,onChange:m=>r(e,m.target.value),disabled:o})});return i?a.jsxs("div",{className:"bounds-field-row",children:[a.jsx("div",{className:"bounds-field-label",children:a.jsx(Vc,{htmlFor:f,label:d,description:t.description})}),a.jsx("div",{className:"bounds-field-input",children:h})]},`${s}-${e}`):a.jsxs("div",{className:"form-group",children:[a.jsx(Vc,{htmlFor:f,label:d,description:t.description}),h]},`${s}-${e}`)}function qv(e,t){if(!t)return"no-config";const n=t.caps,r=Array.isArray(t.approvers)&&t.approvers.length>0;if(!(n&&Object.keys(n).length>0))return r?"approvers-dormant":"no-config";let o=!1;for(const[i,l]of Object.entries(n)){const c=e[i];if(c===""||c===void 0)continue;const d=Number(c);if(!isNaN(d)&&d>l){o=!0;break}}return o?r?"above-approvers":"hard-ceiling":"within-cap"}function Zv(e,t){const n=new Set;if(!t)return n;for(const[r,s]of Object.entries(t)){const o=e[r];if(o===""||o===void 0)continue;const i=Number(o);!isNaN(i)&&i>s&&n.add(r)}return n}function ey({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:s,initialContext:o,initialFrame:i,profileConfig:l,approverNames:c,adminName:d}){const f=e.boundsSchema??e.frameSchema,h=e.contextSchema,m=f?Object.entries(f.fields).filter(([R,D])=>!(R==="profile"||R==="path"||D.enforced===!1||D.enforcedBy==="gatekeeper")):[],x=f?Object.entries(f.fields).filter(([,R])=>R.enforcedBy==="gatekeeper").filter(([,R])=>R.enforced!==!1).map(([R,D])=>D.displayName??R):[],w=h&&h.keyOrder.length>0?Object.entries(h.fields):[],y=s??i??{},j=o??{},g={};for(const[R]of m)g[R]=y[R]!==void 0?String(y[R]):"";const p={};for(const[R]of w)p[R]=j[R]!==void 0?String(j[R]):"";const[v,S]=u.useState(g),[k,I]=u.useState(p),[T,P]=u.useState({}),[b,N]=u.useState(null);u.useEffect(()=>{const R=Dv(e.id);A.getIntegrationManifests().then(({manifests:D})=>{const L=D.find(U=>U.profile===R&&U.contextDiscovery&&Object.keys(U.contextDiscovery).length>0);N(L??null)}).catch(()=>N(null))},[e.id]);const O=qv(v,l),Y=Zv(v,l==null?void 0:l.caps),V=(R,D)=>{S(L=>({...L,[R]:D}))},H=(R,D)=>{I(L=>({...L,[R]:D}))},C=()=>{const R={profile:e.id};for(const[L,U]of m)U.type==="number"?R[L]=v[L]===""?0:Number(v[L]):R[L]=v[L];const D={};for(const[L,U]of w)U.type==="number"?D[L]=k[L]===""?0:Number(k[L]):D[L]=k[L];return[R,D]},J=()=>{const[R,D]=C();t(R,D,T)},ne=()=>{const R=(l==null?void 0:l.caps)??{},D={...v};for(const ee of Y)R[ee]!==void 0&&(D[ee]=String(R[ee]));S(D);const L={profile:e.id};for(const[ee,q]of m)if(q.type==="number"){const pe=D[ee]??"";L[ee]=pe===""?0:Number(pe)}else L[ee]=D[ee]??"";const U={};for(const[ee,q]of w)q.type==="number"?U[ee]=k[ee]===""?0:Number(k[ee]):U[ee]=k[ee];t(L,U,T)},$=R=>{const D=l==null?void 0:l.caps;if(!D||D[R]===void 0)return null;const L=D[R],U=Y.has(R);return O==="hard-ceiling"&&U?a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",L," — exceeds team ceiling"]}):O==="above-approvers"&&U?a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",L," — above cap"]}):a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",L," ok"]})},_=()=>{var R;if(O==="no-config")return null;if(O==="approvers-dormant"){const D=c&&c.length>0?c.join(", "):"the configured approvers";return a.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--accent)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[a.jsxs("div",{style:{fontWeight:600,color:"var(--accent)",marginBottom:"0.25rem"},children:["Profile approvers: ",D]}),a.jsxs("div",{children:["No caps are set on this profile, so ",D," won't gate any action under this authority. Your intent will still be encrypted and shared with them as an accountability record — they can read what you authorised, even though they aren't reviewing individual actions."]})]})}if(O==="within-cap")return a.jsx("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--border)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:a.jsx("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:"Within all team caps — your responsibility."})});if(O==="above-approvers"){const D=c&&c.length>0?c.join(", "):"the required approvers";return a.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--warning)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.25rem"},children:"Above team cap."}),a.jsxs("div",{children:[a.jsx("strong",{children:"Over-cap actions"})," will require approval from you and ",D,". Within-cap actions run per the mode you choose."]})]})}if(O==="hard-ceiling"){const D=Array.from(Y)[0],L=D?(R=l==null?void 0:l.caps)==null?void 0:R[D]:void 0,U=d??"the team admin";return a.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--danger)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[a.jsx("div",{style:{fontWeight:600,color:"var(--danger)",marginBottom:"0.25rem"},children:"Hard team ceiling."}),a.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Team policy caps this at ",L??"the configured limit",". Lower your bound or ask ",U," to add an approver path above the cap."]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:ne,children:"Save below cap"}),n&&a.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},W=O==="hard-ceiling";return a.jsxs("div",{children:[w.length>0&&a.jsxs("div",{className:"context-section",children:[a.jsxs("div",{className:"bounds-section-header",children:[a.jsx("span",{className:"bounds-section-icon",children:"🛡"}),a.jsxs("div",{children:[a.jsx("div",{className:"bounds-section-title",children:"Allowed scope"}),a.jsx("div",{className:"bounds-section-subtitle",children:"Encrypted on your device, never sent to the SP"})]})]}),w.map(([R,D])=>{var U;const L=!!((U=b==null?void 0:b.contextDiscovery)!=null&&U[R]);return a.jsx(Kc,{fieldKey:R,fieldDef:D,value:k[R],onChange:H,prefix:"context",readOnly:r,discoveryIntegrationId:L?b.id:void 0,onLabels:(ee,q)=>P(pe=>({...pe,[ee]:q}))},`context-${R}`)})]}),m.length>0&&a.jsxs("div",{className:"bounds-section",children:[a.jsxs("div",{className:"bounds-section-header",children:[a.jsx("span",{className:"bounds-section-icon",children:"🔒"}),a.jsxs("div",{children:[a.jsx("div",{className:"bounds-section-title",children:"Limits"}),a.jsx("div",{className:"bounds-section-subtitle",children:"Enforced by the Service Provider"})]})]}),a.jsx("div",{className:"bounds-fields-grid",children:m.map(([R,D])=>{var L;return a.jsxs("div",{style:{display:"contents"},children:[a.jsx(Kc,{fieldKey:R,fieldDef:D,value:v[R],onChange:V,prefix:"bounds",readOnly:r,twoColumn:!0}),O!=="no-config"&&((L=l==null?void 0:l.caps)==null?void 0:L[R])!==void 0&&a.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:$(R)})]},`bounds-${R}`)})}),_(),x.length>0&&a.jsxs("div",{className:"bounds-local-note",style:{marginTop:"0.75rem",fontSize:"0.78rem",color:"var(--text-muted)"},children:[x.join(", ")," ",x.length===1?"is":"are"," set on the integration, not here — reads are checked on this device, so the limit applies immediately and can be changed any time under"," ",a.jsx(Qe,{to:"/integrations",children:"Integrations"}),"."]})]}),a.jsx("button",{className:"btn btn-primary",onClick:J,disabled:W,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function ty(e){var n;const t=e.match(/```(?:markdown|md)?\s*\n([\s\S]*?)```/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function ny(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const ry="Tell me what your agent should do — I'll help shape it. Or ask me to draft a full intent and we'll iterate.";function ya({target:e,currentText:t,onApply:n,greeting:r,placeholder:s,title:o}){const[i,l]=u.useState([{role:"assistant",content:r??ry}]),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(null),w=u.useRef(null);u.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[i,f]);const y=async()=>{const g=c.trim();if(!g||f)return;const p=[...i,{role:"user",content:g}];l(p),d(""),x(null),h(!0);try{const v=await A.aiChat({target:e,currentText:t,messages:p.filter((S,k)=>!(k===0&&S.role==="assistant"))});v.success&&v.reply?l(S=>[...S,{role:"assistant",content:v.reply}]):x(v.error??"AI returned no reply")}catch(v){x(v instanceof Error?v.message:"Chat failed")}finally{h(!1)}},j=g=>{g.key==="Enter"&&!g.shiftKey&&!g.nativeEvent.isComposing&&(g.preventDefault(),y())};return a.jsxs("div",{className:"intent-chat",children:[a.jsx("h3",{className:"card-title",children:o??"AI Assistant"}),a.jsxs("div",{ref:w,className:"chat-messages",children:[i.map((g,p)=>{const v=g.role==="assistant"?ty(g.content):null,S=v?ny(g.content):g.content;return a.jsx("div",{className:`chat-msg ${g.role}`,children:a.jsxs("div",{className:"chat-msg-body",children:[S&&a.jsx("div",{className:"chat-msg-prose",children:S}),v!==null&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"chat-fenced-block",children:v}),a.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(v),children:"Apply this draft"})]})]})},p)}),f&&a.jsx("div",{className:"chat-msg assistant",children:a.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),m&&a.jsx("div",{className:"error-message",children:m}),a.jsxs("div",{className:"chat-composer",children:[a.jsxs("div",{className:"chat-composer-pill",children:[a.jsx("textarea",{className:"chat-input",value:c,onChange:g=>d(g.target.value),onKeyDown:j,placeholder:s??"Ask for help articulating the intent…",rows:1,disabled:f}),a.jsx("button",{type:"button",className:"chat-send-btn",onClick:y,disabled:f||!c.trim(),"aria-label":"Send",children:"↑"})]}),a.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Uf({open:e,onClose:t,children:n,ariaLabel:r}){const s=u.useRef(null),o=u.useRef(null);return u.useEffect(()=>{var l;if(!e)return;o.current=document.activeElement,document.body.style.overflow="hidden";const i=c=>{c.key==="Escape"&&t()};return document.addEventListener("keydown",i),(l=s.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",o.current instanceof HTMLElement&&o.current.focus()}},[e,t]),pf.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`bottom-sheet-backdrop${e?" is-open":""}`,onClick:t,"aria-hidden":"true"}),a.jsxs("aside",{ref:s,className:`bottom-sheet${e?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[a.jsx("div",{className:"bottom-sheet-handle","aria-hidden":"true"}),a.jsx("button",{type:"button",className:"bottom-sheet-close",onClick:t,"aria-label":"Close",children:"×"}),n]})]}),document.body)}function sy(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ay(e,t,n){if(t.length===0)return[{text:e,label:e,matched:null}];const r=[],s=new Set;for(const c of t)if(!(!c.scope||c.scope==="all (unscoped)"))for(const d of[c.scope,...c.scope.split(",").map(f=>f.trim())]){const f=d.toLowerCase();d&&!s.has(f)&&(s.add(f),r.push(d))}r.sort((c,d)=>d.length-c.length);const o=c=>{const d=c.toLowerCase();return t.filter(f=>{var h,m;return((h=f.scope)==null?void 0:h.toLowerCase())===d||((m=f.scope)==null?void 0:m.split(",").map(x=>x.trim().toLowerCase()).includes(d))})},i=["\\[\\d+\\]",...r.map(sy)],l=new RegExp(`(${i.join("|")})`,"gi");return e.split(l).filter(c=>c!=="").map(c=>{const d=/^\[(\d+)\]$/.exec(c);if(d){const f=t[Number(d[1])-1];if(f){const h=f.scope&&f.scope!=="all (unscoped)"?f.scope:"all recipients",m=n?`${n}: ${h}`:h;return{text:c,label:m,matched:[f]}}}else if(r.some(f=>f.toLowerCase()===c.toLowerCase())){const f=o(c);if(f.length>0)return{text:c,label:c,matched:f}}return{text:c,label:c,matched:null}})}const Gc=`Why — What's the situation? Why does this need to happen?
|
|
56
|
+
|
|
57
|
+
Goal — What should the agent try to achieve?
|
|
58
|
+
|
|
59
|
+
Watch out — What should the agent avoid or be careful about?`;function oy(e,t,n,r){return ay(e,t,r).map((s,o)=>{if(!s.matched)return a.jsx("span",{children:s.text},o);const i=s.matched;return a.jsx("button",{type:"button",onClick:()=>n(i),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--accent)",textDecoration:"underline",font:"inherit"},children:s.label},o)})}function iy(){var z;const e=qt(),[t]=Rf(),n=Number(t.get("step"))||2,[r,s]=u.useState(null),[o,i]=u.useState(null),[l,c]=u.useState(n),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,w]=u.useState({}),[y,j]=u.useState(Gc),[g,p]=u.useState(!1),[v,S]=u.useState(!0),[k,I]=u.useState(null),[T,P]=u.useState([]),[b,N]=u.useState(void 0),[O,Y]=u.useState(!1),[V,H]=u.useState(null),[C,J]=u.useState(null),[ne,$]=u.useState(null),[_,W]=u.useState([]),[R,D]=u.useState(null);u.useEffect(()=>{var ye;const E=sessionStorage.getItem("agentAuth");if(!E){e("/agent/new");return}const B=JSON.parse(E);s(B);const te=sessionStorage.getItem("agentGate");if(te){const Ee=JSON.parse(te);Ee.bounds&&f(Ee.bounds),Ee.context&&m(Ee.context),(ye=Ee.gateContent)!=null&&ye.intent&&j(Ee.gateContent.intent)}A.getProfile(B.profileId).then(Ee=>i(Ee)).catch(()=>e("/agent/new")).finally(()=>S(!1)),B.groupId&&Promise.all([A.getTeamProfileConfig(B.groupId,B.profileId).catch(()=>null),A.getGroupById(B.groupId).catch(()=>null),A.listUsers().catch(()=>[])]).then(([Ee,Q,re])=>{if(I(Ee),Ee){const me=new Map;for(const ue of re){const kt=ue.name&&ue.email?`${ue.name} (${ue.email})`:ue.name||ue.email||ue.id;me.set(ue.id,kt)}const se=(Q==null?void 0:Q.members)??[];for(const ue of se){const kt=ue.userId??ue.id;kt&&(ue.name&&ue.email?me.set(kt,`${ue.name} (${ue.email})`):ue.name&&me.set(kt,ue.name))}const ce=(Ee.approvers??[]).map(ue=>me.get(ue)??ue);P(ce);const ot=se.find(ue=>ue.role==="admin");if(ot){const ue=ot.userId??ot.id;ue&&N(me.get(ue)??ot.name)}}})},[e]);const L=d?Object.entries(d).filter(([E])=>E!=="profile"&&E!=="path").map(([E,B])=>`${E} = ${B}`).join(", "):"",U=(E,B,te)=>{f(E),m(B),te&&w(te),c(3)},ee=y.trim()!==Gc.trim()&&y.trim()!=="",q=E=>{ee&&!confirm("Replace your current intent with the AI draft?")||j(E)},pe=()=>{const E=o==null?void 0:o.ttl,B={intent:y},te=JSON.parse(sessionStorage.getItem("agentGate")??"{}");sessionStorage.setItem("agentGate",JSON.stringify({...te,bounds:d,context:h,contextLabels:x,gateContent:B,ttlConfig:E})),e("/agent/review")},ze=async()=>{if(r){Y(!0),H(null),J(null),$(null),W([]),D(null);try{const E=await A.aiIntentReview({profileId:r.profileId,newIntent:y,context:h??void 0});W(E.grants??[]),E.success?E.review?H(E.review):J(E.note??"No other authorizations on this profile to compare against."):$(E.error??"Check failed.")}catch(E){$(E instanceof Error?E.message:"Check failed.")}finally{Y(!1)}}},Oe=E=>{j(E),(V||C||ne)&&(H(null),J(null),$(null),W([]),D(null))};return v||!r||!o?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):a.jsxs(a.Fragment,{children:[a.jsx(Df,{currentStep:l,onStepClick:E=>{E>=2&&c(E)}}),a.jsx(Ov,{profileId:r.profileId,bounds:L||void 0,groupName:r.groupName,domain:r.domain}),l===2&&a.jsx("div",{className:"card",children:a.jsx(ey,{profile:o,onConfirm:U,onCancel:()=>e("/agent/new"),initialBounds:d||void 0,initialContext:h||void 0,profileConfig:k,approverNames:T,adminName:b})}),l===3&&a.jsxs("div",{className:"intent-layout",children:[a.jsx("div",{className:"card intent-pane chat tool",children:a.jsx(ya,{target:{kind:"intent",profileId:r.profileId,bounds:L||void 0},currentText:y,onApply:q})}),a.jsxs("div",{className:"card intent-pane document",children:[a.jsx("h3",{className:"card-title",children:"What should your agent know?"}),a.jsxs("div",{className:"field-editable",style:{marginBottom:0},children:[a.jsxs("div",{className:"field-label",children:[a.jsx("span",{className:"pen",children:"✎"})," Intent — your words, signed with the grant"]}),a.jsx("textarea",{className:"intent-textarea",value:y,onChange:E=>Oe(E.target.value)}),a.jsxs("div",{className:"char-counter",children:[y.length," / 2000"]})]}),a.jsxs("div",{style:{marginTop:"0.5rem"},children:[a.jsx("button",{type:"button",className:"btn btn-ghost",style:{fontSize:"0.8rem",padding:"0.4rem 0.75rem"},onClick:ze,disabled:O||!ee,children:O?"Checking…":"Check against my other grants"}),ne&&a.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem",borderLeftColor:"var(--danger)"},children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"!"}),a.jsx("div",{className:"hint-body",children:ne})]}),C&&a.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem"},children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),a.jsx("div",{className:"hint-body",children:C})]}),V&&a.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem"},children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),a.jsxs("div",{className:"hint-body",children:[a.jsx("div",{className:"hint-head",children:"Intent review (advisory)"}),a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:oy(V,_,D,$e(r.profileId))}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.4rem"},children:"Checked with your configured assistant. AI surfaces reality — you decide."})]})]})]}),a.jsxs("div",{className:"intent-footer",children:[a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(2),children:"Back"}),a.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:pe,disabled:!ee,children:"Continue to Review"})]}),(((z=k==null?void 0:k.approvers)==null?void 0:z.length)??0)>0&&a.jsxs("div",{className:"hint-box",role:"note",children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),a.jsxs("div",{className:"hint-body",children:[a.jsxs("div",{className:"hint-head",children:["Visible to ",T.length>0?T.join(", "):"the configured approvers"]}),"Your intent will be encrypted and shared with"," ",T.length>0?T.join(", "):"this profile's required approvers",". Only they can decrypt it — your Service Provider cannot. Each approver stores a copy as their accountability record."]})]})]}),a.jsx("button",{type:"button",className:"floating-help",onClick:()=>p(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),a.jsx(Uf,{open:g,onClose:()=>p(!1),ariaLabel:"Intent assistant",children:a.jsx(ya,{target:{kind:"intent",profileId:r.profileId,bounds:L||void 0},currentText:y,onApply:E=>{q(E),p(!1)}})}),R&&a.jsx("div",{className:"modal-backdrop",onClick:E=>E.target===E.currentTarget&&D(null),children:a.jsxs("div",{className:"modal",children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:R.length>1?`Existing authorizations (${R.length})`:"Existing authorization"}),a.jsx("button",{className:"modal-close",onClick:()=>D(null),children:"×"})]}),a.jsx("div",{className:"modal-body",children:R.map((E,B)=>{var te;return a.jsxs("div",{style:{marginBottom:B<R.length-1?"1rem":0,paddingBottom:B<R.length-1?"1rem":0,borderBottom:B<R.length-1?"1px solid var(--border)":"none"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Scope"}),a.jsx("div",{style:{marginBottom:"0.75rem"},children:E.scope}),a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Intent"}),a.jsx("div",{style:{whiteSpace:"pre-wrap",marginBottom:"0.75rem"},children:((te=E.intent)==null?void 0:te.trim())||"(no intent recorded)"}),Object.entries(E.bounds).filter(([ye])=>ye!=="profile"&&ye!=="path").length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Limits"}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:Object.entries(E.bounds).filter(([ye])=>ye!=="profile"&&ye!=="path").map(([ye,Ee])=>`${ye}: ${Ee}`).join(" · ")})]})]},B)})})]})})]})]})}function ly(e){return e.normalize("NFC").replace(/\r\n?/g,`
|
|
60
|
+
`).split(`
|
|
61
|
+
`).map(s=>s.replace(/[ \t]+$/,"")).join(`
|
|
62
|
+
`).replace(/\n+$/,"")}async function xi(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}async function Ks(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const s=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
|
|
63
|
+
`);return`sha256:${await xi(s)}`}async function Wf(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await xi("")}`;const r=t.contextSchema.keyOrder.map(o=>`${o}=${String(e[o])}`).join(`
|
|
64
|
+
`);return`sha256:${await xi(r)}`}async function xa(e){const t=new TextEncoder().encode(ly(e)),n=await crypto.subtle.digest("SHA-256",t);return`sha256:${Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")}`}function Hf(e,t){if(!e.authorization_id)throw new Error("Attest result lacks authorization_id — the Authority Server predates per-ceremony identity. Update the Authority Server (lockstep deploy).");return{authorizationId:e.authorization_id,boundsHash:e.bounds_hash??t.boundsHash,contextHash:t.contextHash,context:t.context,...t.contextLabels&&Object.keys(t.contextLabels).length>0?{contextLabels:t.contextLabels}:{},gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function Yc(e){return e==null?new Set:new Set(String(e).split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function cy(e,t){for(const n of e)if(t.has(n))return!0;return!1}function uy(e,t,n){for(const r of e){const s=Yc(t[r]),o=Yc(n[r]);if(!(s.size===0||o.size===0)&&!cy(s,o))return!1}return!0}function dy(e){return e.length>24?`${e.slice(0,10)}…`:e}function Vf(e,t,n){const r=n==null?void 0:n[e];return String(t).split(",").map(o=>o.trim()).filter(Boolean).map(o=>{const i=r==null?void 0:r[o];return i?`${i} (${dy(o)})`:o}).join(", ")}function fy(){var ot,ue,kt;const e=qt(),{user:t,mode:n,domain:r}=We(),[s,o]=u.useState(null),[i,l]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState("per-action"),[m,x]=u.useState(1800),[w,y]=u.useState(86400),[j,g]=u.useState(""),[p,v]=u.useState("hours"),[S,k]=u.useState(""),[I,T]=u.useState(!0),[P,b]=u.useState(!1),[N,O]=u.useState(""),[Y,V]=u.useState(null),[H,C]=u.useState([]),[J,ne]=u.useState(!1),[$,_]=u.useState([]),[W,R]=u.useState(0);u.useEffect(()=>{var de;const X=sessionStorage.getItem("agentAuth"),ge=sessionStorage.getItem("agentGate");if(!X||!ge){e("/agent/new");return}const M=JSON.parse(X),K=JSON.parse(ge),Z={bounds:K.bounds??{},context:K.context??{},contextLabels:K.contextLabels??void 0,gateContent:K.gateContent};o(M),l(Z),K.ttlConfig&&(x(K.ttlConfig.default??1800),y(K.ttlConfig.max??86400)),K.templateMode==="automatic"?h("immediate"):K.templateMode==="review"&&h("per-action");const he=((de=K.ttlConfig)==null?void 0:de.max)??86400;if(typeof K.templateTtl=="number"&&K.templateTtl>0){const le=Math.min(K.templateTtl,he);x(le),[3600,86400,604800,2592e3,31536e3].includes(le)||(le%86400===0?(g(String(le/86400)),v("days")):(g(String(Math.max(1,Math.round(le/3600)))),v("hours")))}A.getProfile(M.profileId).then(le=>{var Pe;if(d(le),!S){const Ze=le.name??((Pe=M.profileId.split("/").pop())==null?void 0:Pe.replace(/@.*$/,""))??"",et=[];if(Z.context&&le.contextSchema)for(const it of le.contextSchema.keyOrder){const oe=Z.context[it];if(oe!==void 0&&oe!==""){const Bt=String(oe).split(",").map(Fn=>Fn.trim()).filter(Boolean);et.push(Bt.join(", "))}}const Sn=et.length>0?`${Ze}: ${et.join(" · ")}`:Ze;k(Sn)}}).catch(()=>{}),M.groupId?Promise.all([A.getTeamProfileConfig(M.groupId,M.profileId).catch(()=>null),A.getGroupById(M.groupId).catch(()=>null),A.listUsers().catch(()=>[])]).then(([le,Pe,Ze])=>{if(V(le),le){const et=new Map;for(const oe of Ze){const Bt=oe.name&&oe.email?`${oe.name} (${oe.email})`:oe.name||oe.email||oe.id;et.set(oe.id,Bt)}const Sn=(Pe==null?void 0:Pe.members)??[];for(const oe of Sn){const Bt=oe.userId??oe.id;Bt&&(oe.name&&oe.email?et.set(Bt,`${oe.name} (${oe.email})`):oe.name&&et.set(Bt,oe.name))}const it=(le.approvers??[]).map(oe=>et.get(oe)??oe);C(it)}}).finally(()=>{ne(!0)}):ne(!0)},[e]),u.useEffect(()=>{if(!(s!=null&&s.profileId))return;const X=s.profileId,ge=sessionStorage.getItem("agentEditReplaces");A.getEnrichedAuthorizations().then(M=>{const K=M.filter(Z=>Z.profileId===X&&Z.authorizationId!==ge).map(Z=>({authorizationId:Z.authorizationId,bounds:Z.bounds,context:Z.context??{},intent:Z.intent}));_(K)}).catch(()=>_([]))},[s==null?void 0:s.profileId]),u.useEffect(()=>{if(!i||!c||$.length===0){R(0);return}let X=!1;return(async()=>{const ge=await Ks(i.bounds,c),M=await Promise.all($.map(K=>Ks(K.bounds,c).catch(()=>null)));X||R(M.filter(K=>K===ge).length)})().catch(()=>{X||R(0)}),()=>{X=!0}},[i,c,$]);const D=async()=>{if(!(!s||!i||!c||!t)){if(!s.groupId){O("No active group; cannot create authorization.");return}b(!0),O("");try{const X=r||s.domain||"owner",ge=await Ks(i.bounds,c),M=await Wf(i.context,c),[K,Z]=await Promise.all([xa(i.gateContent.intent),xa(JSON.stringify({profile:s.profileId,domain:X,group:s.groupId}))]);let he,de,le,Pe;if(s.isTeam){const it=await A.getApproversPubkeys(s.groupId,s.profileId);if(it.length>0){const oe=await A.encryptIntent(i.gateContent.intent,it);he=oe.intentCiphertext,de=oe.encryptedKeys,le=oe.approversFrozen,Pe=oe.intentDisclosureHash}}const Ze=`authz_${crypto.randomUUID()}`,et=sessionStorage.getItem("agentEditReplaces")||void 0,Sn=await A.attest({authorization_id:Ze,replaces:et,profile_id:s.profileId,bounds:i.bounds,bounds_hash:ge,context_hash:M,domain:X,did:t.did,gate_content_hashes:{intent:K},execution_context_hash:Z,group_id:s.groupId,ttl:m,commitment_mode:f==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:he,encrypted_keys:de,approvers_frozen:le,intent_disclosure_hash:Pe,disclose_identity:I});try{await A.pushGateContent(Hf(Sn,{boundsHash:ge,contextHash:M,context:i.context,contextLabels:i.contextLabels,gateContent:i.gateContent}))}catch(it){try{await A.revokeAttestation(Ze,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${it instanceof Error?it.message:"Unknown error"})`)}if(et)try{await A.revokeAttestation(et,`Replaced by ${Ze} (edit)`),A.resyncGates().catch(()=>{})}catch{}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),sessionStorage.removeItem("agentEditReplaces"),e(`/authorizations?highlight=${encodeURIComponent(Ze)}`)}catch(X){O(X instanceof Error?X.message:"Attestation failed")}finally{b(!1)}}};if(!s||!i)return a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const L=Object.entries(i.bounds).filter(([X])=>X!=="profile"&&X!=="path"),U=Object.entries(i.context),q=((Y==null?void 0:Y.caps)!=null?Object.keys(Y.caps):[]).length!==0,pe=H.length>0?H.join(", "):((Y==null?void 0:Y.approvers)??[]).join(", "),ze=q?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${pe}, regardless of your mode.`:"No caps set — they won't gate any action, but your intent is encrypted and shared with them as an accountability record.",Oe=q?`Over-cap actions will be reviewed by you and ${pe}. Within-cap actions run per the mode you chose above.`:`Approvers ${pe} can read your intent but won't gate any action — no caps configured on this profile.`,z=!!((ot=Y==null?void 0:Y.approvers)!=null&&ot.length),E=m>w,B={flex:1,padding:"0.75rem",border:f==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:f==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},te={flex:1,padding:"0.75rem",border:f==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:f==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},ye=((ue=c==null?void 0:c.contextSchema)==null?void 0:ue.keyOrder)??[],Ee=$.filter(X=>uy(ye,i.context,X.context)),Q=Ee.length>0,re=$e(s.profileId),me=X=>{const ge=Object.values(X).map(M=>String(M).trim()).filter(Boolean);return ge.length>0?ge.join(", "):"all (unscoped)"},se=Ee.map(X=>me(X.context)).join("; "),ce=`This grant's scope overlaps an existing grant on ${re} (scoped to: ${se}). The agent may act under either. Per-action limits take the more permissive value, and daily limits add together — two grants of 10/day allow 20/day. Approval is not weakened: if either grant requires review, review still applies. Confirm this is intended before authorizing.`;return a.jsxs(a.Fragment,{children:[a.jsx(Df,{currentStep:4,onStepClick:X=>{X<=3&&e(`/agent/gate?step=${X}`)}}),a.jsxs("div",{className:"card",children:[a.jsx("h3",{className:"card-title",style:{marginBottom:"0.25rem"},children:"Review & Commit"}),a.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1.5rem"},children:"Review your authorization details before signing."}),N&&a.jsx("div",{className:"error-message",children:N}),a.jsxs("div",{className:"field-editable",children:[a.jsxs("div",{className:"field-label",children:[a.jsx("span",{className:"pen",children:"✎"})," Title"]}),a.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${$e(s.profileId)}: daily operations`,value:S,onChange:X=>k(X.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),a.jsxs("div",{className:"field-editable",children:[a.jsxs("div",{className:"field-label",children:[a.jsx("span",{className:"pen",children:"✎"})," Commitment"]}),a.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[a.jsxs("button",{onClick:()=>h("per-action"),style:te,children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]}),a.jsxs("button",{onClick:()=>h("immediate"),style:B,children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Automatic"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Agent acts freely within your limits."})]})]})]}),a.jsxs("div",{className:"field-editable",children:[a.jsxs("div",{className:"field-label",children:[a.jsx("span",{className:"pen",children:"✎"})," Duration"]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center"},children:[[{label:"1 hour",seconds:3600},{label:"24 hours",seconds:86400},{label:"7 days",seconds:604800},{label:"30 days",seconds:2592e3},{label:"1 year",seconds:31536e3}].filter(X=>X.seconds<=w).map(X=>a.jsx("button",{onClick:()=>{x(X.seconds),g("")},style:{padding:"0.5rem 0.85rem",border:m===X.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:m===X.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:X.label},X.seconds)),a.jsxs("div",{style:{display:"flex",gap:"0.375rem",alignItems:"center"},children:[a.jsx("input",{type:"number",className:"form-input",style:{width:"5rem",padding:"0.45rem 0.6rem",fontSize:"0.85rem"},placeholder:"Custom",value:j,onChange:X=>{g(X.target.value);const ge=parseInt(X.target.value,10);if(ge>0){const M=p==="days"?ge*86400:ge*3600;x(Math.min(M,w))}}}),a.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:p,onChange:X=>{v(X.target.value);const ge=parseInt(j,10);if(ge>0){const M=X.target.value==="days"?ge*86400:ge*3600;x(Math.min(M,w))}},children:[a.jsx("option",{value:"hours",children:"hours"}),a.jsx("option",{value:"days",children:"days"})]})]}),E&&a.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",w>=86400?`${Math.floor(w/86400)} days`:`${Math.floor(w/3600)} hours`]})]})]}),a.jsx("div",{className:"field-editable",children:a.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:I,onChange:X=>T(X.target.checked),style:{marginTop:"0.15rem"}}),a.jsxs("span",{style:{fontSize:"0.8rem"},children:["Show my verified name on actions under this authority",a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.15rem"},children:'Adds "verified by Suveren" with your name to outgoing content. Takes effect only if your identity is verified; otherwise actions stay pseudonymous.'})]})]})}),a.jsx("div",{className:"info-section-label",children:"What you are signing — set in previous steps"}),a.jsxs("div",{className:"info-block",children:[a.jsxs("div",{className:"info-head",children:[a.jsx("span",{className:"info-title",children:"Intent"}),a.jsx("button",{className:"info-edit",onClick:()=>e("/agent/gate?step=3"),children:"edit in step 3"})]}),a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:i.gateContent.intent})]}),(!!L.length||!!U.length)&&a.jsxs("div",{className:"info-block",children:[a.jsxs("div",{className:"info-head",children:[a.jsx("span",{className:"info-title",children:"Scope & Limits"}),a.jsx("button",{className:"info-edit",onClick:()=>e("/agent/gate?step=2"),children:"edit in step 2"})]}),a.jsxs("dl",{className:"info-kv",children:[U.map(([X,ge])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:X}),a.jsx("dd",{children:Vf(X,ge,i.contextLabels)})]},X)),L.map(([X,ge])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:X}),a.jsx("dd",{children:String(ge)})]},X))]})]}),a.jsxs("div",{className:"info-block",children:[a.jsx("div",{className:"info-head",children:a.jsx("span",{className:"info-title",children:"Authority"})}),a.jsxs("dl",{className:"info-kv",children:[a.jsx("dt",{children:"Profile"}),a.jsxs("dd",{children:[$e(s.profileId),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:s.profileId})]}),s.groupName&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Team"}),a.jsx("dd",{children:s.groupName})]}),s.groupId&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Approvers"}),a.jsx("dd",{children:J?(((kt=Y==null?void 0:Y.approvers)==null?void 0:kt.length)??0)===0?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"None — solo authorization"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:"No approvers configured for this profile in this team. Your intent stays on your gateway."})]}):a.jsxs(a.Fragment,{children:[pe,a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:ze})]}):a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]})]})]}),W>0?a.jsxs("div",{style:{display:"flex",gap:"0.625rem",padding:"0.75rem 0.875rem",marginBottom:"1.25rem",border:"1px solid var(--warning)",borderLeft:"3px solid var(--warning)",borderRadius:"0.5rem",background:"var(--bg-elevated)",fontSize:"0.82rem",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Identical limits to an existing grant"}),a.jsxs("div",{children:[W===1?`An active grant on ${re} already has exactly these limits.`:`${W} active grants on ${re} already have exactly these limits.`," ","If you meant to give the existing grant more time, use ",a.jsx("strong",{children:"Extend"})," on the Authorizations page instead — authorizing here creates a separate, independent grant with its own intent and usage counters."]})]})]}):null,Q?a.jsxs("div",{style:{display:"flex",gap:"0.625rem",padding:"0.75rem 0.875rem",marginBottom:"1.25rem",border:"1px solid var(--warning)",borderLeft:"3px solid var(--warning)",borderRadius:"0.5rem",background:"var(--bg-elevated)",fontSize:"0.82rem",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Overlapping scope"}),a.jsx("div",{children:ce})]})]}):null,a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:()=>e("/agent/gate"),children:"Back"}),a.jsx("button",{className:"btn btn-primary btn-lg",style:{flex:1},onClick:D,disabled:P||!S.trim(),children:P?"Signing...":f==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),a.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:z?"block":"none"},children:Oe})]})]})}const py={card:"💳",mail:"✉️"};function my(e){const t=e==null?void 0:e.overrides;return!t||typeof t!="object"?!1:Object.values(t).some(n=>{var r;return typeof((r=n==null?void 0:n.read)==null?void 0:r.ageField)=="string"})}const hy=[0,7,30,90,365,3650];function wo(e){return e===null?"From your authorization":e===0?"Read nothing":e===1?"1 day back":e===365?"1 year back":e%365===0?`${e/365} years back`:`${e} days back`}function gy({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:s}){var Ee;const[o,i]=u.useState({}),[l,c]=u.useState(!1),[d,f]=u.useState(!1),[h,m]=u.useState({}),[x,w]=u.useState(!1),[y,j]=u.useState(null),[g,p]=u.useState(!1),[v,S]=u.useState(!1),[k,I]=u.useState(!1),[T,P]=u.useState(!1),[b,N]=u.useState({}),[O,Y]=u.useState(null),[V,H]=u.useState(!1),[C,J]=u.useState(null);u.useEffect(()=>{let Q=!1;return A.getCredential(e.id).then(re=>{var me;if(!(Q||!re.configured)){if(c(!0),f(!0),re.fields){const se={};for(const ce of e.credentials.fields)re.fields[ce.key]!=null&&(se[ce.key]=re.fields[ce.key]);m(se)}if(e.oauth){const se=((me=re.fieldNames)==null?void 0:me.includes(e.oauth.tokenStorage))??!1;w(se),se&&A.getOAuthHealth(e.id).then(ce=>{Q||j(ce)})}}}).catch(()=>{}),()=>{Q=!0}},[e.id,e.oauth]);const ne=my(e.toolGating),$=t?t.readAgeDays??null:void 0,_=V&&O?O.value:$,W=async Q=>{Y({value:Q}),H(!0),J(null);try{await A.setReadPolicy(e.id,Q),s(Q===null?`${e.name} read window now follows your authorization`:`${e.name} read window set to ${wo(Q).toLowerCase()}`),r()}catch(re){J(re instanceof Error?re.message:"Could not save")}finally{H(!1),Y(null)}},R=!!e.oauth||e.credentials.fields.some(Q=>!Q.optional),D=e.oauth?x:l,L=!R||D,U=n==="starting"?"starting":L?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!x?"needs-oauth":"unconfigured",ee=async()=>{if(e.credentials.fields.some(re=>{var me;return(me=o[re.key])==null?void 0:me.trim()})){p(!0);try{await A.setCredential(e.id,o),c(!0),i({}),e.oauth?s(`${e.name} credentials saved!`):(s(`${e.name} credentials saved — starting integration...`),await ze())}catch{s(`Failed to save ${e.name} credentials`)}finally{p(!1)}}},q=async()=>{if(e.credentials.fields.some(re=>{var me;return(me=o[re.key])==null?void 0:me.trim()})){p(!0);try{await A.setCredential(e.id,o),i({}),c(!0),e.oauth?s(`${e.name} credentials saved — now click Connect.`):(P(!1),s(`${e.name} credentials updated — restarting...`),await ze())}catch{s(`Failed to update ${e.name} credentials`)}finally{p(!1)}}},pe=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const Q=setInterval(async()=>{var re;try{const me=await A.getCredential(e.id);me.configured&&e.oauth&&((re=me.fieldNames)!=null&&re.includes(e.oauth.tokenStorage))&&(w(!0),P(!1),j(null),clearInterval(Q),s(`${e.name} connected — starting integration...`),A.getOAuthHealth(e.id).then(j).catch(()=>{}),await ze())}catch{}},2e3);setTimeout(()=>clearInterval(Q),12e4)},ze=async()=>{I(!0);try{const Q=await A.activateIntegration(e.id);Q.warning?s(Q.warning):s(`${e.name} integration started with ${Q.tools.length} tools`),r()}catch(Q){s(`Failed to start ${e.name}: ${Q instanceof Error?Q.message:"Unknown error"}`)}finally{I(!1)}},Oe=async()=>{try{await A.removeMcpIntegration(e.id),s(`${e.name} integration removed`),r()}catch{s(`Failed to remove ${e.name}`)}},z=py[e.icon]??"🔧",E=U==="running"?{c:"int-chip-ok",t:"Running"}:U==="starting"?{c:"int-chip-idle",t:"Starting"}:t&&!t.running&&t.error?{c:"int-chip-bad",t:"Crashed"}:{c:"int-chip-idle",t:"Stopped"},B=e.oauth&&x&&(y==null?void 0:y.status)==="failed",te=R?B?{c:"int-chip-bad",t:"Auth failed"}:D?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},ye=Q=>Q.replace(/https?:\/\/[^\s)]+\/auth\/oauth\/[a-z-]+\/callback/gi,`${window.location.origin}/auth/oauth/${e.id}/callback`);return a.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[a.jsx("span",{style:{fontSize:"1.4rem",lineHeight:1.2},children:z}),a.jsx("h3",{className:"card-title",style:{margin:0,flex:1,alignSelf:"center"},children:e.name}),a.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap",justifyContent:"flex-end"},children:[U!=="unconfigured"&&U!=="needs-oauth"&&a.jsxs("span",{className:`int-chip ${E.c}`,children:[a.jsx("span",{className:"int-dot"}),E.t]}),a.jsxs("span",{className:`int-chip ${te.c}`,children:[a.jsx("span",{className:"int-dot"}),te.t]})]})]}),e.oauth&&x&&a.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:y!=null&&y.account?a.jsxs(a.Fragment,{children:["Connected as ",a.jsx("b",{children:y.account})]}):a.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),B&&!T&&a.jsxs("div",{style:{marginTop:"0.7rem"},children:[a.jsxs("div",{className:"status-banner status-banner-error",style:{marginBottom:"0.6rem"},children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsxs("span",{className:"status-banner-text",children:["Authentication failed",y!=null&&y.error?` — ${y.error}`:"",". Reconnect to restore access."]})]}),a.jsxs("button",{className:"btn btn-primary btn-sm",onClick:pe,children:["Reconnect ",e.name]})]}),a.jsxs("details",{className:"int-details",style:{marginTop:"0.85rem",marginBottom:"1.25rem"},children:[a.jsx("summary",{children:"Details"}),a.jsxs("div",{className:"int-meta",children:[a.jsx("span",{className:"int-k",children:"What"}),a.jsx("span",{children:e.description}),e.profile&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Profile"}),a.jsx("span",{children:e.profile})]}),e.oauth&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Scopes"}),a.jsx("span",{children:((Ee=e.oauth.scopes)==null?void 0:Ee.join(", "))||"—"})]}),t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Tools"}),a.jsxs("span",{children:[t.toolCount," gated"]})]})]})]}),e.setupGuide&&e.setupGuide.length>0&&(U!=="running"||B)&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsxs("button",{onClick:()=>S(!v),style:{background:"none",border:"none",padding:0,fontSize:"0.8rem",color:"var(--accent)",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.375rem"},children:[a.jsx("span",{style:{transition:"transform 0.2s",transform:v?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),v&&a.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((Q,re)=>a.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"0.75rem"},children:[a.jsx("div",{style:{width:"1.5rem",height:"1.5rem",borderRadius:"50%",background:"var(--border)",color:"var(--text-secondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.7rem",fontWeight:700,flexShrink:0,marginTop:"0.1rem"},children:re+1}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:Q.title}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[ye(Q.description),Q.link&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("a",{href:Q.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},re))})]}),U==="starting"&&a.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[a.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),T&&a.jsxs("div",{style:{marginTop:"0.7rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"Change credentials"}),d&&a.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-muted)",marginBottom:"0.6rem"},children:["Your current values are filled in below (secret hidden — click ","“","show","”","). Edit them, then",e.oauth?" Save and Connect to re-link the account.":" Save to apply."]}),e.credentials.fields.map(Q=>a.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[a.jsx("label",{className:"form-label",children:Q.label}),Q.type==="password"?a.jsxs("div",{className:"cred-field",children:[a.jsx("input",{className:"form-input",type:b[Q.key]?"text":"password",name:`${e.id}-${Q.key}-credential`,autoComplete:"new-password",placeholder:Q.placeholder,value:o[Q.key]||"",onChange:re=>i(me=>({...me,[Q.key]:re.target.value}))}),a.jsx("button",{className:"cred-toggle",onClick:()=>N(re=>({...re,[Q.key]:!re[Q.key]})),children:b[Q.key]?"hide":"show"})]}):a.jsx("input",{className:"form-input",type:"text",name:`${e.id}-${Q.key}-credential`,autoComplete:"off",placeholder:Q.placeholder,value:o[Q.key]||"",onChange:re=>i(me=>({...me,[Q.key]:re.target.value}))})]},Q.key)),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"},children:[a.jsx("button",{className:"btn btn-primary btn-sm",onClick:q,disabled:g,children:g?"Saving…":"Save"}),e.oauth&&a.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:pe,children:["Connect ",e.name]}),a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{P(!1),i({})},children:"Cancel"})]})]}),!T&&U==="running"&&t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[a.jsx(Qe,{to:"/agent/new",className:"btn btn-primary btn-sm",style:{textDecoration:"none"},children:"Authorize agent"}),(e.credentials.fields.length>0||e.oauth)&&a.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{i({...h}),P(!0)},title:"Re-enter client ID / secret (e.g. a new OAuth client).",children:"Change credentials"}),a.jsx("span",{style:{flex:1}}),a.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:Oe,title:"Stops the subprocess and removes the integration from the registry. It will NOT auto-start on next gateway restart. Re-enable with Install.",children:"Disable"})]}),ne&&_!==void 0&&a.jsxs("div",{style:{marginTop:"0.9rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"0.5rem",marginBottom:"0.35rem"},children:[a.jsx("span",{style:{fontSize:"0.85rem",fontWeight:600},children:"Read policy"}),a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"How far back your agent may read"})]}),a.jsx("p",{style:{fontSize:"0.78rem",color:"var(--text-tertiary)",margin:"0 0 0.55rem"},children:"Applies immediately — no new authorization needed."}),a.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap"},children:[hy.map(Q=>{const re=_===Q;return a.jsx("button",{className:`btn btn-sm ${re?"btn-primary":"btn-secondary"}`,"aria-pressed":re,disabled:V,onClick:()=>W(Q),children:wo(Q)},Q)}),a.jsx("button",{className:`btn btn-sm ${_===null?"btn-primary":"btn-ghost"}`,"aria-pressed":_===null,disabled:V,onClick:()=>W(null),title:"Clear the local setting and use the read window from your signed authorization instead.",children:wo(null)})]}),a.jsx("div",{style:{fontSize:"0.78rem",marginTop:"0.5rem"},children:C?a.jsx("span",{style:{color:"var(--danger)"},children:C}):V?a.jsx("span",{style:{color:"var(--text-muted)"},children:"Saving…"}):_===null?a.jsx("span",{style:{color:"var(--text-muted)"},children:"Using the window from your authorization. If none is set there, reads are blocked."}):_===0?a.jsx("span",{style:{color:"var(--text-muted)"},children:"Your agent cannot read any mail."}):a.jsxs("span",{style:{color:"var(--text-muted)"},children:["Anything older than ",_," days is blocked, whoever it is from."]})})]}),a.jsx("div",{style:{display:"none"},children:a.jsx(Qe,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),U==="unconfigured"&&(()=>{const Q=e.credentials.fields.every(se=>se.optional),re=e.credentials.fields.some(se=>!se.optional),me=e.credentials.fields.some(se=>{var ce;return(ce=o[se.key])==null?void 0:ce.trim()});return a.jsxs(a.Fragment,{children:[d&&a.jsxs("div",{className:"alert",style:{fontSize:"0.8rem",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.5rem 0.75rem",marginBottom:"0.75rem",color:"var(--text-secondary)"},children:[a.jsx("strong",{style:{color:"var(--text-primary)"},children:"Credentials on file."})," ","Existing values are encrypted in the vault and not shown. Enter new values below to replace them, or"," ",a.jsx("button",{onClick:()=>{c(!0),e.oauth&&w(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!d&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"Step 1 of 2 — enter credentials, then connect your account."}),e.setupHint&&!d&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(se=>a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:se.label}),se.type==="password"?a.jsxs("div",{className:"cred-field",children:[a.jsx("input",{className:"form-input",type:b[se.key]?"text":"password",name:`${e.id}-${se.key}-credential`,autoComplete:"new-password",placeholder:se.placeholder,value:o[se.key]||"",onChange:ce=>i(ot=>({...ot,[se.key]:ce.target.value}))}),a.jsx("button",{className:"cred-toggle",onClick:()=>N(ce=>({...ce,[se.key]:!ce[se.key]})),children:b[se.key]?"hide":"show"})]}):a.jsx("input",{className:"form-input",type:"text",name:`${e.id}-${se.key}-credential`,autoComplete:"off",placeholder:se.placeholder,value:o[se.key]||"",onChange:ce=>i(ot=>({...ot,[se.key]:ce.target.value}))})]},se.key)),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[me&&a.jsx("button",{className:"btn btn-primary",onClick:ee,disabled:g||re&&!e.credentials.fields.filter(se=>!se.optional).every(se=>{var ce;return(ce=o[se.key])==null?void 0:ce.trim()}),children:g?"Saving...":"Save & Encrypt"}),Q&&!me&&a.jsx("button",{className:"btn btn-primary",onClick:ze,disabled:k,children:k?"Starting...":`Activate ${e.name}`})]})]})})(),U==="needs-oauth"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[a.jsxs("button",{className:"btn btn-primary",onClick:pe,children:["Connect ",e.name," Account"]}),a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),U==="ready"&&!t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[a.jsx("button",{className:"btn btn-primary",onClick:ze,disabled:k,children:k?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Update Credentials"}),e.oauth&&a.jsx("button",{className:"btn btn-ghost",onClick:()=>{c(!1),w(!1)},children:"Change Credentials"})]})]}),U==="ready"&&t&&!t.running&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[a.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:ze,disabled:k,children:k?"Starting...":"Start"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:Oe,children:"Disable"})]})]})]})}function vy(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:s}=Cl(),[o,i]=u.useState(""),l=u.useCallback(c=>{i(c),setTimeout(()=>i(""),5e3)},[]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Integrations"}),a.jsx("p",{className:"page-subtitle",children:"Connect external services and manage MCP integrations."})]}),o&&a.jsx("div",{className:"alert alert-success",children:o}),e?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading integrations..."}):t===!1?a.jsxs("div",{className:"status-banner status-banner-error",children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsx("span",{className:"status-banner-text",children:"MCP server is not reachable. Make sure it is running."})]}):a.jsxs(a.Fragment,{children:[r.map(c=>a.jsx(gy,{manifest:c.manifest,integration:c.integration,state:c.state,onStatusChange:s,onSuccess:l},c.id)),r.length===0&&(n?a.jsxs("div",{className:"status-banner status-banner-error",children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsxs("span",{className:"status-banner-text",children:["Couldn't load integrations — the gateway can't reach its MCP server (or you're signed out). Check the control-plane's"," ",a.jsx("code",{children:"SUVEREN_MCP_INTERNAL_URL"})," (dev MCP is :3431), then refresh."]})]}):a.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integrations available yet."}))]})]})}function yy(){var O,Y,V;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=We(),[s,o]=u.useState(null),[i,l]=u.useState(!1),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(!1),[w,y]=u.useState(""),[j,g]=u.useState("");u.useEffect(()=>{fetch("/health").then(H=>H.json()).then(H=>{typeof H.spUrl=="string"&&g(H.spUrl)}).catch(()=>{})},[]),u.useEffect(()=>{if(!e){o(null);return}A.getGroupById(e.id).then(H=>{const C=H.group??H,J=H.members??[],ne=H.isAdmin??!1,$=J.map(_=>{const W=_.userId||_.id||"",R=_.role||(ne&&W===C.createdBy?"admin":"member");return{id:W,name:_.name||W.slice(0,8)||"Member",email:_.email||"",domains:_.domains||[],role:R,isAdmin:R==="admin"||ne&&W===C.createdBy}});o({id:C.id,name:C.name,members:$})}).catch(()=>o(null))},[e==null?void 0:e.id]);const p=(s==null?void 0:s.members.filter(H=>H.isAdmin))??[],v=(e==null?void 0:e.isAdmin)===!0&&p.length<=1&&p.some(H=>H.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",k=w.trim()===S&&!i,I=()=>{y(""),x(!0)},T=()=>{x(!1),y("")},P=async()=>{if(!(!e||!k)){l(!0),d("");try{await A.leaveTeam(e.id),await n(),h("You have left the team."),o(null),T()}catch(H){d(H instanceof Error?H.message:"Failed to leave team")}finally{l(!1)}}},b=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,N=j?`${j}/dashboard/groups`:void 0;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"page-header",children:a.jsxs("div",{children:[a.jsx("h1",{className:"page-title",children:"Team"}),a.jsx("p",{className:"page-subtitle",children:"Your current team context. Team management lives in your Service Provider dashboard."})]})}),c&&a.jsx("div",{className:"error-message",children:c}),f&&a.jsx("div",{className:"alert alert-success",children:f}),e?a.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[a.jsxs("div",{className:"card-header",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"card-title",children:e.name}),a.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:[((O=s==null?void 0:s.members)==null?void 0:O.length)??0," ",(((Y=s==null?void 0:s.members)==null?void 0:Y.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),a.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(V=s==null?void 0:s.members)==null?void 0:V.map(H=>a.jsxs("div",{className:"member-row",children:[a.jsx("div",{className:"member-avatar",children:H.name.split(" ").map(C=>C[0]).join("").slice(0,2).toUpperCase()}),a.jsxs("div",{className:"member-info",children:[a.jsx("div",{className:"member-name",children:H.name}),a.jsx("div",{className:"member-email",children:H.email})]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:H.role})]},H.id)),a.jsxs("div",{style:{marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[b&&a.jsx("a",{className:"btn btn-secondary btn-sm",href:b,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),a.jsx("span",{title:v?"You are the only admin. Transfer admin to another member in your Service Provider dashboard before leaving.":void 0,style:{marginLeft:"auto"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:I,disabled:i||v,children:"Leave team"})})]})]}):a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem 1.5rem"},children:[a.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem"},children:"You are working solo."}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",maxWidth:480,marginLeft:"auto",marginRight:"auto"},children:"Every authorization you create here is in your personal context. You can join an existing team or create a new one in your Service Provider dashboard."}),N&&a.jsx("a",{className:"btn btn-primary btn-sm",href:N,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),m&&e&&a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"leave-team-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},onClick:T,children:a.jsxs("div",{className:"card",onClick:H=>H.stopPropagation(),style:{maxWidth:480,width:"100%",margin:0},children:[a.jsxs("h3",{id:"leave-team-title",className:"card-title",style:{marginBottom:"0.5rem"},children:["Leave ",S,"?"]}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:"Leaving will:"}),a.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[a.jsx("li",{children:"Revoke all authorizations you created in this team's context"}),a.jsx("li",{children:"Reject any pending action proposals you authored"}),a.jsx("li",{children:"Disable your membership — rejoining requires admin reactivation"})]}),a.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:["Your ",a.jsx("strong",{children:"personal"})," authorizations are not affected."]}),a.jsxs("div",{className:"form-group",children:[a.jsxs("label",{htmlFor:"leave-confirm-input",style:{fontSize:"0.825rem",display:"block",marginBottom:"0.375rem"},children:["Type ",a.jsx("code",{children:S})," to confirm:"]}),a.jsx("input",{id:"leave-confirm-input",className:"form-input",type:"text",value:w,onChange:H=>y(H.target.value),placeholder:S,disabled:i,autoFocus:!0})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end",marginTop:"1rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:T,disabled:i,children:"Cancel"}),a.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:P,disabled:!k,children:i?"Leaving...":"Leave team"})]})]})})]})}function xy({onDismiss:e}){const t=qt(),{group:n,groupId:r,domain:s}=We(),[o,i]=u.useState([]),[l,c]=u.useState([]),[d,f]=u.useState([]),[h,m]=u.useState(!0),[x,w]=u.useState({}),[y,j]=u.useState(null);u.useEffect(()=>{Promise.all([A.listProfiles().catch(()=>[]),A.getIntegrationManifests().then(b=>b.manifests??[]).catch(()=>[]),A.getMcpHealth().then(b=>b.integrations??[]).catch(()=>[])]).then(async([b,N,O])=>{if(i(b),c(N),f(O),r){const Y=await Promise.all(b.map(H=>A.getTeamProfileConfig(r,H.id).catch(()=>null))),V={};b.forEach((H,C)=>{const J=Y[C];J&&(V[H.id]=J)}),w(V)}}).finally(()=>m(!1))},[r]);const g=new Map;for(const b of l)b.profile&&g.set(b.profile,b);const p=b=>b.replace(/@.*$/,"").split("/").pop()??b,v=b=>b.split("@")[1]??"",S=new Map;for(const b of o){const N=p(b.id);if(!g.has(N))continue;const O=S.get(N);(!O||v(b.id).localeCompare(v(O.id),void 0,{numeric:!0})>0)&&S.set(N,b)}const k=l.map(b=>{const N=b.profile?S.get(b.profile):void 0;return N?{manifest:b,profile:N,integration:d.find(O=>O.id===b.id)}:null}).filter(b=>b!==null),I=b=>b in x,T=(b,N)=>{if(!r){console.error("No active group when creating authorization");return}const O=I(b);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:b,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:s,isTeam:O})),N?sessionStorage.setItem("agentGate",JSON.stringify({bounds:N.bounds,context:N.context,gateContent:{intent:N.intent},ttlConfig:{max:N.ttl},templateMode:N.mode,templateTtl:N.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},P=(b,N)=>{r&&(N!=null&&N.templates&&N.templates.length>0?j({profileId:b,manifest:N}):T(b))};if(y){const b=y.manifest.templates??[];return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginBottom:"1rem"},onClick:()=>j(null),children:"← Back to profiles"}),a.jsxs("h3",{style:{margin:"0 0 0.25rem 0",fontSize:"1rem"},children:["Set up ",y.manifest.name," authorization"]}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.5rem",marginBottom:"0.75rem",fontWeight:600},children:"Quick start"}),a.jsx("div",{style:{display:"grid",gap:"0.75rem",gridTemplateColumns:`repeat(${Math.min(b.length,3)}, 1fr)`},children:b.map(N=>a.jsxs("button",{className:"template-card",onClick:()=>T(y.profileId,N),children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[a.jsx("span",{className:`template-mode template-mode-${N.mode==="automatic"?"auto":"review"}`,children:N.mode==="automatic"?"Auto":"Review"}),a.jsx("span",{className:"template-risk","data-risk":N.risk,children:N.risk})]}),a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:N.name}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:N.description}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:N.tags.map(O=>a.jsx("span",{className:"template-tag",children:O},O))})]},N.name))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",margin:"1.5rem 0"},children:[a.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}}),a.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"or"}),a.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),a.jsx("button",{className:"btn btn-primary",style:{width:"100%",textAlign:"center",padding:"0.75rem"},onClick:()=>T(y.profileId),children:"Custom — define your own limits and scope"})]})}return a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
65
|
+
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: stretch; }
|
|
66
|
+
.profile-grid .card { display: flex; flex-direction: column; height: 100%; margin-top: 0 !important; }
|
|
67
|
+
@media (max-width: 900px) { .profile-grid { grid-template-columns: repeat(2, 1fr); } }
|
|
68
|
+
@media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }
|
|
69
|
+
`}),h?a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):k.length===0?a.jsxs("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:[a.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.9rem",marginBottom:"1rem"},children:"No integrations set up yet. Connect a service first."}),a.jsx(Qe,{to:"/integrations",className:"btn btn-primary btn-sm",onClick:()=>e==null?void 0:e(),children:"Go to Integrations"})]}):a.jsx("div",{className:"profile-grid",children:k.map(({manifest:b,profile:N,integration:O})=>{const Y=I(N.id),V=(O==null?void 0:O.running)===!0;return a.jsxs("div",{className:"card",style:V?void 0:{opacity:.7},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.125rem"},children:[a.jsx("h3",{className:"card-title",style:{margin:0},children:b.name}),Y?a.jsx("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.35rem",borderRadius:"0.2rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Team"}):a.jsx("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.35rem",borderRadius:"0.2rem",background:"var(--bg-main)",color:"var(--text-tertiary)",fontWeight:600,border:"1px solid var(--border)"},children:"Personal"})]}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"1rem",flex:1},children:b.description||N.description}),V?a.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>P(N.id,b),children:"Authorize"}):a.jsxs(Qe,{to:`/integrations?setup=${(b==null?void 0:b.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(b==null?void 0:b.name)??"integration"]})]},b.id)})})]})}const wy={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function Sy({status:e,label:t}){return a.jsx("span",{className:`status-badge status-${e}`,children:t||wy[e]})}function jy({domain:e,attested:t}){const n=t===!0?"domain-attested":t===!1?"domain-missing":"";return a.jsx("span",{className:`domain-badge ${n}`,style:{fontSize:"0.75rem"},children:e})}const bn=86400,Ir=3600,Ps=60,ky=30*bn;function by(e){if(e<=0)return"Expired";if(e>90*bn){const t=Math.floor(e/ky);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*bn){const t=Math.floor(e/bn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*bn){const t=Math.floor(e/bn),n=Math.floor(e%bn/Ir);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*Ir){const t=Math.floor(e/Ir),n=Math.floor(e%Ir/Ps);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=Ps){const t=Math.floor(e/Ps),n=Math.floor(e%Ps);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function Cy({expiresAt:e}){const[t,n]=u.useState(()=>e-Date.now()/1e3),r=t<2*Ir;u.useEffect(()=>{const o=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(o)},[e,r]);const s=t<300;return a.jsx("span",{className:`ttl-badge ${s?"ttl-warn":"ttl-ok"}`,children:by(t)})}function Kf({icon:e,title:t,text:n,children:r}){return a.jsxs("div",{className:"empty-state",children:[e&&a.jsx("div",{className:"empty-state-icon",children:e}),a.jsx("div",{className:"empty-state-title",children:t}),n&&a.jsx("div",{className:"empty-state-text",children:n}),r]})}function Ny(e){const t=Math.floor(e/86400);if(t>=1)return`${t} day${t===1?"":"s"}`;const n=Math.floor(e/3600);if(n>=1)return`${n} hour${n===1?"":"s"}`;const r=Math.ceil(e/60);return`${r} minute${r===1?"":"s"}`}const Ey=[{label:"30m",seconds:1800},{label:"1h",seconds:3600},{label:"2h",seconds:7200},{label:"4h",seconds:14400},{label:"8h",seconds:28800},{label:"24h",seconds:86400},{label:"7d",seconds:604800},{label:"30d",seconds:2592e3},{label:"1y",seconds:31536e3}];function Ty({item:e,onClose:t,onSuccess:n}){var g;const{user:r,activeDomain:s,groupId:o}=We(),i=e.remaining_seconds??0,l=Ey.filter(p=>p.seconds>i),c=((g=l[0])==null?void 0:g.seconds)??2592e3,[d,f]=u.useState(c),[h,m]=u.useState(!1),[x,w]=u.useState(""),y=Object.entries(e.frame).filter(([p])=>p!=="profile"&&p!=="path"),j=async()=>{var p;if(r){m(!0),w("");try{const v=e.authorization_id,S=await A.getGateContent(v);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const k=await A.getProfile(e.profile_id),I=e.frame,T=S.context??{},P=e.attested_domains[0]||s||"owner",b=await Ks(I,k),N=await Wf(T,k),[O,Y]=await Promise.all([xa(S.gateContent.intent),xa(JSON.stringify({profile:e.profile_id,path:e.path,domain:P}))]);if(!o)throw new Error("No active group; cannot extend authorization.");const V=(((p=e.deferred_commitment_domains)==null?void 0:p.length)??0)>0?"review":"automatic",H=await A.attest({authorization_id:e.authorization_id,renew:!0,profile_id:e.profile_id,bounds:I,bounds_hash:b,context_hash:N,domain:P,did:r.did,gate_content_hashes:{intent:O},execution_context_hash:Y,group_id:o,commitment_mode:V,ttl:d});await A.pushGateContent(Hf(H,{boundsHash:b,contextHash:N,context:T,path:e.path,gateContent:S.gateContent})),n()}catch(v){w(v instanceof Error?v.message:"Extension failed")}finally{m(!1)}}};return a.jsx("div",{className:"modal-backdrop",onClick:p=>p.target===p.currentTarget&&t(),children:a.jsxs("div",{className:"modal",children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:"Extend Authorization"}),a.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsxs("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[$e(e.profile_id)," / ",e.path]}),y.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:y.map(([p,v])=>`${p}=${v}`).join(" · ")})]}),a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"New duration"}),i>0&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["Currently valid for ",Ny(i),". Only longer durations are shown."]}),a.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:l.length===0?a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"This authorization is already on the longest available duration. Nothing to extend."}):l.map(p=>a.jsx("button",{className:`btn ${d===p.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>f(p.seconds),style:{minWidth:"3.5rem"},children:p.label},p.seconds))})]}),a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"Same bounds, context, and gate content will be re-attested with a new TTL (measured from now)."}),x&&a.jsx("div",{className:"error-message",children:x})]}),a.jsxs("div",{className:"modal-footer",children:[a.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:h,children:"Cancel"}),a.jsx("button",{className:"btn btn-primary",onClick:j,disabled:h,children:h?"Extending...":"Extend"})]})]})})}function zy(e,t,n){return[...e].sort((r,s)=>{if(n){if(r.authorization_id===n&&s.authorization_id!==n)return-1;if(s.authorization_id===n&&r.authorization_id!==n)return 1}const o=At(r,{revokedSet:t}),i=At(s,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[o]!==l[i]?l[o]-l[i]:new Date(s.created_at).getTime()-new Date(r.created_at).getTime()})}function Iy({item:e,newerProfile:t,revokedSet:n,expandedHash:r,gateCache:s,gateLoading:o,copiedHash:i,revokingHash:l,copyingHash:c,profileConfigCache:d,mode:f,ownerLabel:h,isAdmin:m,onExpand:x,onCopyHash:w,onCopy:y,onRevoke:j,onExtend:g,highlightHash:p}){var D;const v=At(e,{revokedSet:n}),S=r===e.authorization_id,k=s[e.authorization_id],I=v==="active"||v==="pending"||v==="expired",T=Object.entries(e.frame).filter(([L])=>L!=="profile"&&L!=="path"),P=d.get(e.profile_id)??null,b=(((D=P==null?void 0:P.approvers)==null?void 0:D.length)??0)>0,N=new Map;if(P!=null&&P.caps&&f==="team")for(const[L,U]of T){const ee=P.caps[L];ee!==void 0&&Number(U)>ee&&N.set(L,{authorized:Number(U),cap:ee})}const O=N.size>0,Y=e.approvers_frozen??[],V=(P==null?void 0:P.approvers)??[],H=f==="team"&&Y.length>0&&V.length>0&&(Y.length!==V.length||Y.some(L=>!V.includes(L))||V.some(L=>!Y.includes(L))),C=Array.from(N.entries()).map(([L,U])=>`${L}: ${U.authorized} (cap ${U.cap})`).join(", "),J=Array.from(N.entries()).map(([L,U])=>`${L}: ${U.authorized} → ${U.cap}`).join(", "),ne=O?b?N.size===1?`Above team cap: ${C} — actions require approval`:`Above team cap (${N.size}): ${C} — actions require approval`:N.size===1?`Reduced by hard cap: ${J}`:`Reduced by hard cap (${N.size}): ${J}`:"",$=O?b?"Above-cap actions under this authority require per-action approval from the profile's approvers. Bounds remain authorized at their original values.":"No approvers are configured for this profile, so the team cap is a hard ceiling. Bounds above the cap are effectively reduced to the cap. Ask the admin to raise the cap or add approvers, or copy this authorization to reissue within the cap.":void 0,_=$e(e.profile_id),W=t?a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem",padding:"0.4rem 0.6rem",border:"1px solid var(--border)",borderRadius:6},children:[a.jsxs("strong",{style:{color:"var(--text-secondary)"},children:[_,"@",t.version," available"]}),t.whatsNew?a.jsxs(a.Fragment,{children:[" — ",t.whatsNew]}):null,a.jsx("br",{}),a.jsxs("span",{children:["This authority stays on ",e.profile_id.split("@")[1]??"its pinned version","; authorize again to move it."]})]}):null,R=p!=null&&e.authorization_id===p;return a.jsxs("div",{className:`card${R?" card-highlight":""}`,style:{marginBottom:0},children:[W,h&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner: ",a.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:h})]}),a.jsxs("div",{className:"auth-card-header",children:[a.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:_}),e.title&&a.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),a.jsx(Sy,{status:v}),v==="active"&&e.earliest_expiry&&a.jsx(Cy,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),v==="expired"&&a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem",alignItems:"center"},children:[e.required_domains.map(L=>a.jsx(jy,{domain:L,attested:e.attested_domains.includes(L)},L)),e.deferred_commitment_domains.length>0&&a.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Review Mode"}),O&&a.jsx("span",{title:$,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:b?"var(--accent-subtle)":"var(--danger-subtle)",color:b?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:ne}),H&&a.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.65rem",padding:"0.15rem 0.5rem",borderRadius:"0.25rem",background:"var(--warning-subtle, rgba(234,179,8,0.12))",color:"var(--warning, #ca8a04)",fontWeight:600,border:"1px solid var(--warning-border, rgba(234,179,8,0.3))",cursor:"pointer",lineHeight:1.4},onClick:()=>y(e),disabled:c===e.authorization_id,title:"The approver list for this profile has changed since this authority was created. Copy to reissue with the current approvers.",children:c===e.authorization_id?"Copying...":"Approver list updated · Copy with new approvers"})]}),T.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:T.map(([L,U],ee)=>{const q=N.get(L);return a.jsxs("span",{children:[ee>0&&" · ",q?b?a.jsxs("span",{title:`Team cap on ${L} is ${q.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${q.authorized}.`,children:[a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[L,"=",String(U)]}),a.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",q.cap]})]}):a.jsxs("span",{title:`Team cap on ${L} is ${q.cap} with no approvers configured (hard cap). Authorized for ${q.authorized}; effective ${q.cap}.`,children:[a.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[L,"=",String(U)]}),a.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",q.cap]})]}):a.jsxs("span",{children:[L,"=",String(U)]})]},L)})}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>x(e),children:S?"▲ Hide Details":"▼ Details"})}),S&&a.jsxs("div",{style:{borderTop:"1px solid var(--border)",marginTop:"0.75rem",paddingTop:"0.75rem"},children:[T.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Bounds"}),a.jsx("dl",{className:"review-grid",children:T.map(([L,U])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:L}),a.jsx("dd",{children:String(U)})]},L))})]}),(k==null?void 0:k.context)&&Object.keys(k.context).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),a.jsx("dl",{className:"review-grid",children:Object.entries(k.context).map(([L,U])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:L}),a.jsx("dd",{title:String(U),children:Vf(L,U,k.contextLabels)})]},L))})]}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Intent"}),o===e.authorization_id?a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Loading gate content..."}):k?a.jsx("div",{className:"gate-content-block",children:a.jsx("div",{className:"gate-content-item",children:a.jsx("div",{className:"gate-content-text",children:k.gateContent.intent})})}):a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Gate content not available."}),a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"1rem"},children:["Created: ",new Date(e.created_at).toLocaleString(),e.earliest_expiry&&` · Expires: ${new Date(e.earliest_expiry).toLocaleString()}`]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginTop:"0.25rem"},children:[a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all"},children:e.authorization_id}),a.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>w(e.authorization_id),children:i===e.authorization_id?"copied":"copy"})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!h&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>y(e),disabled:c===e.authorization_id,title:"Start a new authorization pre-filled with these bounds, context, and intent",children:c===e.authorization_id?"Copying…":"⧉ Copy"}),!h&&(v==="active"||v==="pending")&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>y(e,{asEdit:!0}),disabled:c===e.authorization_id,title:"Adjust intent, bounds, or scope: opens the ceremony pre-filled; signing the new authorization revokes this one",children:"✎ Edit"}),!h&&I&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>g(e),children:"↻ Extend"}),h&&m&&v!=="revoked"?a.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>j(e.authorization_id,h,_),disabled:l===e.authorization_id,children:l===e.authorization_id?"Revoking…":"Revoke"}):!h&&(v==="active"||v==="pending")?a.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>j(e.authorization_id),disabled:l===e.authorization_id,children:l===e.authorization_id?"Revoking…":"Revoke"}):null]})]})]},e.authorization_id)}function Py(){const[e,t]=u.useState([]),[n,r]=u.useState(!0),[s,o]=u.useState([]),[i,l]=u.useState(!1),[c,d]=u.useState(new Map),[f,h]=u.useState("mine"),[m,x]=u.useState("active"),[w,y]=u.useState(null),[j,g]=u.useState(null),[p,v]=Rf(),[S,k]=u.useState(()=>p.get("new")==="1"),[I,T]=u.useState(()=>p.get("highlight")),[P,b]=u.useState(null),[N,O]=u.useState({}),[Y,V]=u.useState(null),[H,C]=u.useState(null),[J,ne]=u.useState(null),[$,_]=u.useState(new Set),[W,R]=u.useState(null),[D,L]=u.useState(null),U=qt(),{group:ee,groupId:q,domain:pe,mode:ze,activeTeam:Oe}=We(),z=(Oe==null?void 0:Oe.isAdmin)===!0,[E,B]=u.useState(()=>new Map),te=u.useCallback(()=>{r(!0),A.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),ye=u.useCallback(()=>{q&&(l(!0),A.listTeamAuthorizations(q).then(o).catch(()=>{}).finally(()=>l(!1)))},[q]);ke("attestation-changed",()=>{te(),z&&q&&ye()}),u.useEffect(()=>{if(!I)return;p.get("highlight")&&(p.delete("highlight"),v(p,{replace:!0}));const M=window.setTimeout(()=>T(null),3e3);return()=>window.clearTimeout(M)},[]),Lt(te,3e5),u.useEffect(()=>{f==="team"&&z&&q&&s.length===0&&!i&&ye()},[f,z,q,s.length,i,ye]),u.useEffect(()=>{let M=!1;return A.listProfiles().then(K=>{if(M)return;const Z=le=>le.replace(/@.*$/,"").split("/").pop()??le,he=le=>le.split("@")[1]??"",de=new Map;for(const le of K){const Pe=Z(le.id),Ze=de.get(Pe);(!Ze||he(le.id).localeCompare(he(Ze.id),void 0,{numeric:!0})>0)&&de.set(Pe,le)}d(de)}).catch(()=>{}),()=>{M=!0}},[]);const Ee=u.useCallback(M=>{const K=Pe=>Pe.replace(/@.*$/,"").split("/").pop()??Pe,Z=Pe=>Pe.split("@")[1]??"",he=c.get(K(M));if(!he)return;const de=Z(M),le=Z(he.id);if(!(!de||!le))return le.localeCompare(de,void 0,{numeric:!0})>0?he:void 0},[c]);u.useEffect(()=>{if(ze!=="team"||!q)return;const M=f==="mine"?e:s;if(M.length===0)return;const K=[...new Set(M.map(Z=>Z.profile_id))].filter(Z=>!E.has(Z));if(K.length!==0){B(Z=>{const he=new Map(Z);for(const de of K)he.set(de,null);return he});for(const Z of K)A.getTeamProfileConfig(q,Z).then(he=>{B(de=>new Map(de).set(Z,he))}).catch(()=>{})}},[e,s,f,q,ze,E]);const Q=async M=>{if(P===M.authorization_id){b(null);return}b(M.authorization_id);const K=M.authorization_id;if(!(K in N)){V(M.authorization_id);try{const Z=await A.getGateContent(K);O(he=>({...he,[K]:Z}))}catch{O(Z=>({...Z,[K]:null}))}finally{V(null)}}},re=M=>{navigator.clipboard.writeText(M).then(()=>{ne(M),setTimeout(()=>ne(null),2e3)})},me=async(M,K)=>{var Z;if(!q){alert("No active group; cannot copy authorization.");return}L(M.authorization_id);try{const he=M.authorization_id;let de=N[he]??null;he in N||(de=await A.getGateContent(he),O(Fn=>({...Fn,[he]:de})));const le=Object.fromEntries(Object.entries(M.frame).filter(([Fn])=>Fn!=="profile"&&Fn!=="path")),Pe=(de==null?void 0:de.context)??{},Ze=((Z=de==null?void 0:de.gateContent)==null?void 0:Z.intent)??"",et=M.deferred_commitment_domains.length>0?"review":"automatic",Sn=M.attested_domains[0]||pe||"owner",it=Date.parse(M.created_at),oe=M.earliest_expiry?Date.parse(M.earliest_expiry):NaN,Bt=Number.isFinite(it)&&Number.isFinite(oe)&&oe>it?Math.round((oe-it)/1e3):void 0;sessionStorage.setItem("agentAuth",JSON.stringify({profileId:M.profile_id,groupId:q,groupName:(ee==null?void 0:ee.name)??null,domain:Sn})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:le,context:Pe,gateContent:{intent:Ze},templateMode:et,templateTtl:Bt})),K!=null&&K.asEdit?sessionStorage.setItem("agentEditReplaces",M.authorization_id):sessionStorage.removeItem("agentEditReplaces"),U("/agent/gate")}catch(he){alert(he instanceof Error?he.message:"Failed to copy authorization")}finally{L(null)}},se=async(M,K,Z)=>{const he=K&&Z?`Revoke ${K}'s ${Z} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(he)){R(M);try{await A.revokeAttestation(M),_(de=>new Set(de).add(M)),A.resyncGates().catch(()=>{}),K&&q&&ye()}catch(de){alert(de instanceof Error?de.message:"Failed to revoke authorization")}finally{R(null)}}},ce=f==="mine"?e:s,ot=f==="mine"?n:i,ue={active:ce.filter(M=>At(M,{revokedSet:$})==="active").length,pending:ce.filter(M=>At(M,{revokedSet:$})==="pending").length,expired:ce.filter(M=>At(M,{revokedSet:$})==="expired").length,revoked:ce.filter(M=>At(M,{revokedSet:$})==="revoked").length},kt=(()=>{const M=new Map;for(const K of ce){if(At(K,{revokedSet:$})!==m)continue;const Z=M.get(K.profile_id)??{count:0,review:!1};Z.count+=1,K.deferred_commitment_domains.length>0&&(Z.review=!0),M.set(K.profile_id,Z)}return Array.from(M.entries()).map(([K,Z])=>({profileId:K,...Z})).sort((K,Z)=>$e(K.profileId).localeCompare($e(Z.profileId)))})(),X=zy(ce.filter(M=>{if(At(M,{revokedSet:$})!==m||w!==null&&M.profile_id!==w)return!1;if(j!==null){const K=M.deferred_commitment_domains.length>0;if(j==="review"&&!K||j==="auto"&&K)return!1}return!0}),$,I),ge={revokedSet:$,expandedHash:P,gateCache:N,gateLoading:Y,copiedHash:J,revokingHash:W,copyingHash:D,profileConfigCache:E,mode:ze,activeDomain:pe,group:ee,groupId:q,onExpand:Q,onCopyHash:re,onCopy:me,onRevoke:se,onExtend:C,highlightHash:I};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",flexWrap:"wrap"},children:[a.jsxs("div",{children:[a.jsx("h1",{className:"page-title",children:"Authorizations"}),a.jsx("p",{className:"page-subtitle",children:"Active, pending, and expired agent authorizations."})]}),a.jsx("button",{className:"btn btn-primary",onClick:()=>k(!0),children:"+ New authorization"})]}),S&&a.jsx("div",{className:"modal-backdrop",onClick:()=>{k(!1),p.get("new")&&(p.delete("new"),v(p,{replace:!0}))},children:a.jsxs("div",{className:"modal",onClick:M=>M.stopPropagation(),style:{maxWidth:"960px",width:"90vw"},children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h2",{className:"modal-title",children:"New authorization"}),a.jsx("button",{className:"modal-close",onClick:()=>{k(!1),p.get("new")&&(p.delete("new"),v(p,{replace:!0}))},children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem",marginTop:0,marginBottom:"1rem"},children:"What should your agent be able to do? Pick a profile, set limits, then authorize."}),a.jsx(xy,{onDismiss:()=>k(!1)})]})]})}),z&&a.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[a.jsx("button",{className:`nav-tab${f==="mine"?" active":""}`,onClick:()=>{h("mine"),x("active"),y(null),g(null),b(null)},children:"Mine"}),a.jsx("button",{className:`nav-tab${f==="team"?" active":""}`,onClick:()=>{h("team"),x("active"),y(null),g(null),b(null)},children:"Team"})]}),a.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(M=>a.jsxs("button",{className:`nav-tab${m===M?" active":""}`,onClick:()=>{x(M),y(null),g(null)},children:[M.charAt(0).toUpperCase()+M.slice(1)," (",ue[M],")"]},M))}),kt.length>0&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[kt.map(M=>{const K=w===M.profileId;return a.jsx("button",{className:`btn btn-sm ${K?"btn-primary":"btn-secondary"}`,onClick:()=>y(K?null:M.profileId),children:$e(M.profileId)},M.profileId)}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(M=>{const K=j===M;return a.jsx("button",{className:`btn btn-sm ${K?"btn-primary":"btn-secondary"}`,onClick:()=>g(K?null:M),children:M==="auto"?"Auto":"Review"},M)})]}),ot&&ce.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):X.length===0?a.jsx(Kf,{icon:"☰",title:"No authorizations",text:`No ${m} authorizations found.`}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:X.map(M=>{const K=f==="team"?M:null,Z=K!=null&&K.owner?K.owner.name??K.owner.email??K.owner.userId:void 0;return a.jsx(Iy,{item:M,newerProfile:Ee(M.profile_id),ownerLabel:Z,isAdmin:z,...ge},M.authorization_id)})}),H&&a.jsx(Ty,{item:H,onClose:()=>C(null),onSuccess:()=>{C(null),te()}})]})}function Ry(e){const t=e.indexOf("__");return t<0?{integrationId:"",toolName:e}:{integrationId:e.slice(0,t),toolName:e.slice(t+2)}}function _y(e,t){var c,d,f;const{integrationId:n,toolName:r}=Ry(e.action),s=t.find(h=>h.id===n),o=(d=(c=s==null?void 0:s.toolGating)==null?void 0:c.overrides)==null?void 0:d[r];if(o!=null&&o.actionLabel)return o.actionLabel;const i=$e(e.profileId),l=(f=e.executionContext)==null?void 0:f.action_type;return typeof l=="string"&&l?`${i} · ${l}`:`${i} · ${r}`}function Qc(e){const t=[];for(const[n,r]of Object.entries(e.executionContext??{})){if(!n.startsWith("allowed_"))continue;const s=String(r??"").trim();s&&t.push(s.split(",").map(o=>o.trim()).filter(Boolean).join(", "))}return t.join(" · ")}function Ay(e){return typeof e.proposalId=="string"&&e.proposalId.length>0}function $y(e){const t=$e(e),n=e.split("@")[1];return n?`${t}@${n}`:t}function Ly(e){return new Date(e*1e3).toLocaleString()}function My(e,t){if(t==="all")return!0;const n=t==="1d"?1:t==="7d"?7:30,r=Math.floor(Date.now()/1e3)-n*86400;return e.timestamp>=r}function Fy(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||$e(e.profileId).toLowerCase().includes(n)||e.path.toLowerCase().includes(n)||e.action.toLowerCase().includes(n)||e.attestationHash.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)||JSON.stringify(e.executionContext).toLowerCase().includes(n)}function Jc(e,t){const n=new Map(e.map(r=>[r.id,r]));for(const r of t)n.set(r.id,r);return[...n.values()].sort((r,s)=>s.timestamp-r.timestamp)}function Oy(){const{activeTeam:e,groupId:t}=We(),n=(e==null?void 0:e.isAdmin)===!0,[r,s]=u.useState("mine"),[o,i]=u.useState([]),[l,c]=u.useState([]),[d,f]=u.useState(""),[h,m]=u.useState(!0),[x,w]=u.useState({}),[y,j]=u.useState(new Set),[g,p]=u.useState(""),[v,S]=u.useState(new Set),[k,I]=u.useState(new Set),[T,P]=u.useState("all"),[b,N]=u.useState(!1),[O,Y]=u.useState(null),[V,H]=u.useState(!1),[C,J]=u.useState(!1),ne=u.useRef(""),$=u.useCallback(z=>r==="team"&&n&&t?A.listTeamReceiptsPage(t,{before:z,limit:200}):A.getMyReceiptsPage({before:z,limit:200}),[r,n,t]),_=u.useCallback(()=>{const z=r==="team"?`team:${t}`:"mine",E=ne.current!==z;ne.current=z,m(!0),J(!1),$().then(B=>{i(te=>E?B.receipts:Jc(te,B.receipts)),Y(te=>E?B.nextBefore:te??B.nextBefore)}).catch(()=>{E&&i([]),J(!0)}).finally(()=>m(!1))},[$,r,t]),W=u.useCallback(()=>{!O||V||(H(!0),J(!1),$(O).then(z=>{i(E=>Jc(E,z.receipts)),Y(z.nextBefore)}).catch(()=>J(!0)).finally(()=>H(!1)))},[O,V,$]);Lt(_,12e4),u.useEffect(()=>{A.getIntegrationManifests().then(({manifests:z})=>c(z)).catch(()=>{}),fetch("/health").then(z=>z.json()).then(z=>{typeof z.spUrl=="string"&&f(z.spUrl.replace(/\/$/,""))}).catch(()=>{})},[]),u.useEffect(()=>{r!=="team"||Object.keys(x).length>0||A.listUsers().then(z=>{const E={};for(const B of z)E[B.id]={name:B.name,email:B.email};w(E)}).catch(()=>{})},[r,x]);const R=u.useMemo(()=>{const z=new Set;for(const E of o)z.add($e(E.profileId));return[...z].sort()},[o]),D=u.useMemo(()=>{const z=new Set;for(const E of o)z.add(E.action);return[...z].sort()},[o]),L=u.useMemo(()=>{if(r!=="team")return[];const z=new Set;for(const E of o)E.userId&&z.add(E.userId);return[...z].map(E=>{var B;return{id:E,label:(B=x[E])!=null&&B.name?`${x[E].name} (${x[E].email})`:E}}).sort((E,B)=>E.label.localeCompare(B.label))},[r,o,x]),U=u.useMemo(()=>o.filter(z=>!(!Fy(z,g)||v.size>0&&!v.has($e(z.profileId))||k.size>0&&!k.has(z.action)||y.size>0&&z.userId&&!y.has(z.userId)||!My(z,T))),[o,g,v,k,y,T]),ee=v.size>0||k.size>0||y.size>0||T!=="all";function q(z){S(E=>{const B=new Set(E);return B.has(z)?B.delete(z):B.add(z),B})}function pe(z){I(E=>{const B=new Set(E);return B.has(z)?B.delete(z):B.add(z),B})}function ze(z){j(E=>{const B=new Set(E);return B.has(z)?B.delete(z):B.add(z),B})}function Oe(){S(new Set),I(new Set),j(new Set),P("all"),p("")}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Receipts"}),a.jsx("p",{className:"page-subtitle",children:"Execution history for agent actions."})]}),n&&a.jsx("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",borderBottom:"1px solid var(--border)"},children:["mine","team"].map(z=>a.jsx("button",{onClick:()=>s(z),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===z?"2px solid var(--accent)":"2px solid transparent",color:r===z?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===z?600:500},children:z==="mine"?"Mine":"Team"},z))}),a.jsxs("div",{className:"search-filter-bar",children:[a.jsxs("div",{className:"search-input-wrap",children:[a.jsx("span",{className:"search-icon",children:"⌕"}),a.jsx("input",{type:"text",className:"form-input search-input",placeholder:"Search by profile, action, path, or hash\\u2026",value:g,onChange:z=>p(z.target.value)}),g&&a.jsx("button",{className:"search-clear",onClick:()=>p(""),children:"×"})]}),a.jsxs("button",{className:`btn btn-sm btn-secondary${b?" active":""}`,onClick:()=>N(!b),children:["Filters",ee?` (${v.size+k.size+(T!=="all"?1:0)})`:""]})]}),b&&a.jsxs("div",{className:"filter-panel",children:[R.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Profile"}),a.jsx("div",{className:"filter-chips",children:R.map(z=>a.jsx("button",{className:`filter-chip${v.has(z)?" selected":""}`,onClick:()=>q(z),children:z},z))})]}),D.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Action"}),a.jsx("div",{className:"filter-chips",children:D.map(z=>a.jsx("button",{className:`filter-chip${k.has(z)?" selected":""}`,onClick:()=>pe(z),children:z},z))})]}),r==="team"&&L.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Owner"}),a.jsx("div",{className:"filter-chips",children:L.map(z=>a.jsx("button",{className:`filter-chip${y.has(z.id)?" selected":""}`,onClick:()=>ze(z.id),children:z.label},z.id))})]}),a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Time range"}),a.jsx("div",{className:"filter-chips",children:[["1d","Today"],["7d","7 days"],["30d","30 days"],["all","All time"]].map(([z,E])=>a.jsx("button",{className:`filter-chip${T===z?" selected":""}`,onClick:()=>P(z),children:E},z))})]})]}),ee&&a.jsxs("div",{className:"active-filters",children:[[...v].map(z=>a.jsxs("span",{className:"active-chip",onClick:()=>q(z),children:[z," ",a.jsx("span",{className:"chip-remove",children:"×"})]},z)),[...k].map(z=>a.jsxs("span",{className:"active-chip",onClick:()=>pe(z),children:[z," ",a.jsx("span",{className:"chip-remove",children:"×"})]},z)),[...y].map(z=>{const E=x[z],B=E?E.name:z;return a.jsxs("span",{className:"active-chip",onClick:()=>ze(z),children:[B," ",a.jsx("span",{className:"chip-remove",children:"×"})]},z)}),T!=="all"&&a.jsxs("span",{className:"active-chip",onClick:()=>P("all"),children:[T==="1d"?"Today":T==="7d"?"7 days":"30 days"," ",a.jsx("span",{className:"chip-remove",children:"×"})]}),a.jsx("button",{className:"clear-filters",onClick:Oe,children:"Clear all"})]}),C&&a.jsx("div",{className:"card",style:{borderColor:"var(--danger, #c0392b)",marginBottom:"0.75rem"},children:a.jsx("span",{style:{color:"var(--danger, #c0392b)",fontSize:"0.85rem"},children:"Couldn’t load receipts — your session may have expired. Try signing out and back in."})}),h&&o.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):U.length===0?a.jsx(Kf,{icon:"⌕",title:o.length===0?"No receipts in the last 30 days":"No matching receipts",text:o.length===0?"Execution receipts appear here after an agent uses an authorized tool. Older receipts can be loaded below.":"Try adjusting your search or filters."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:U.length===o.length?`${o.length} receipt${o.length!==1?"s":""}`:`${U.length} of ${o.length} receipts`}),a.jsx("div",{className:"timeline",children:U.map(z=>{var E,B;return a.jsx("div",{className:"timeline-event",children:a.jsxs("div",{className:"card",style:{marginBottom:0},children:[a.jsxs("div",{className:"receipt-head",children:[a.jsx("span",{className:"receipt-what",children:_y(z,l)}),a.jsx("span",{className:"receipt-tag",children:Ay(z)?"review":"automatic"}),z.contentHash&&a.jsx("span",{className:"receipt-tag receipt-tag-bound",title:(E=z.contentBinding)!=null&&E.fields?`The receipt binds: ${z.contentBinding.fields.join(", ")}`:"This exact content was authorized",children:"content bound"}),a.jsx("span",{className:"auth-card-time",children:Ly(z.timestamp)})]}),Qc(z)&&a.jsx("div",{className:"receipt-scope",children:Qc(z)}),r==="team"&&z.userId&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner:"," ",a.jsx("span",{style:{color:"var(--text-secondary)"},children:(B=x[z.userId])!=null&&B.name?`${x[z.userId].name} (${x[z.userId].email})`:z.userId})]}),a.jsxs("div",{className:"receipt-foot",children:[d&&a.jsx("a",{className:"receipt-link",href:`${d}/r/${z.id}`,target:"_blank",rel:"noreferrer",children:"View receipt ↗"}),a.jsx("span",{className:"receipt-id",children:z.id.slice(0,8)}),a.jsx("span",{className:"receipt-tag",children:$y(z.profileId)})]}),a.jsxs("details",{className:"receipt-more",children:[a.jsx("summary",{children:"Technical"}),a.jsxs("div",{className:"receipt-kv",children:[a.jsxs("div",{children:["action · ",z.action]}),a.jsxs("div",{children:["profile · ",z.profileId]}),Object.keys(z.executionContext).length>0&&a.jsxs("div",{children:["context ·"," ",Object.entries(z.executionContext).map(([te,ye])=>`${te}=${ye}`).join(" · ")]}),a.jsxs("div",{children:["usage · daily ",z.cumulativeState.daily.count," calls, $",z.cumulativeState.daily.amount," · monthly"," ",z.cumulativeState.monthly.count," calls, $",z.cumulativeState.monthly.amount]}),z.contentHash&&a.jsxs("div",{children:["content · ",z.contentHash]}),a.jsxs("div",{children:["authorization · ",z.attestationHash]})]})]})]})},z.id)})})]}),O&&a.jsx("div",{style:{textAlign:"center",marginTop:"1rem"},children:a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:W,disabled:V,children:V?"Loading…":"Load older"})})]})}const By={darwin:"a macOS login item",win32:"a Windows scheduled task",linux:"a systemd user service"};function Dy(){const[e,t]=u.useState(null),[n,r]=u.useState(!1),[s,o]=u.useState(null),i=u.useCallback(async()=>{try{t(await A.getAutostart())}catch(d){o(d instanceof Error?d.message:"Could not read autostart state")}},[]);u.useEffect(()=>{i()},[i]);const l=u.useCallback(async()=>{if(!(!(e!=null&&e.supported)||n)){r(!0),o(null);try{await A.setAutostart(!e.installed)}catch(d){o(d instanceof Error?d.message:"Failed")}finally{try{t(await A.getAutostart()),o(null)}catch(d){o(d instanceof Error?d.message:"Could not re-read state")}r(!1)}}},[e,n,i]);if(!e)return a.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[a.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,margin:0},children:"Keep Suveren running"}),a.jsx("p",{role:s?"alert":void 0,style:{margin:"0.5rem 0 0",fontSize:"0.9rem",color:"var(--text-secondary)"},children:s?`Could not read autostart state: ${s}`:"Checking…"})]});const c=By[e.platform]??"a login service";return a.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem"},children:[a.jsxs("div",{children:[a.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,margin:0},children:"Keep Suveren running"}),a.jsx("p",{style:{color:"var(--text-secondary)",margin:"0.5rem 0 0",fontSize:"0.9rem"},children:e.supported?a.jsxs(a.Fragment,{children:["Starts automatically when you log in, and restarts if it crashes. Uses ",c," — no admin rights needed."]}):e.reason})]}),e.supported&&a.jsx("button",{type:"button",onClick:()=>void l(),disabled:n,"aria-pressed":e.installed,className:e.installed?"btn btn-secondary":"btn btn-primary",style:{whiteSpace:"nowrap"},children:n?"Working…":e.installed?"Turn off":"Turn on"})]}),e.supported&&a.jsxs("p",{style:{margin:"1rem 0 0",fontSize:"0.85rem",color:"var(--text-tertiary)"},children:["Status: ",a.jsx("strong",{children:e.installed?"On — starts from your next login":"Off"})]}),e.supported&&a.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:"0.85rem",color:"var(--text-tertiary)"},children:["Turning this on doesn't interrupt the gateway you're using — it takes effect at your next login. After any restart Suveren comes back ",a.jsx("strong",{children:"locked"}),": you enter your API key once to unlock it, because nothing stored on this machine can unlock it for you."]}),s&&a.jsx("p",{role:"alert",style:{margin:"0.75rem 0 0",fontSize:"0.85rem",color:"var(--danger, #c00)"},children:s})]})}const Uy={npm:"Checking npm for new releases",docker:"Checking the container registry for new images",dev:"Git checkout — comparing against origin/main, not npm releases"};function Wy(){const{version:e,latestVersion:t,updateAvailable:n,installMethod:r}=kl();return e?a.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[a.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,margin:0},children:"Version"}),a.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:"0.9rem",color:"var(--text-secondary)"},children:["Running ",a.jsx("strong",{children:e}),n&&t?a.jsxs(a.Fragment,{children:[" — ",a.jsx("strong",{children:t})," is available"]}):null]}),a.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:"0.85rem",color:"var(--text-tertiary)"},children:[Uy[r]??"Update checking is unavailable",r==="dev"&&a.jsx(a.Fragment,{children:" — a development checkout is not told about published releases."})]})]}):null}const Hy={ollama:{provider:"ollama",endpoint:"http://localhost:11434",models:["gemma4:e4b","gemma4:e2b","gemma4:26b","gemma4:31b","llama3.2","llama3.1","mistral","qwen2.5"]},openrouter:{provider:"openai-compatible",endpoint:"https://openrouter.ai/api/v1",models:["google/gemma-4-31b-it","qwen/qwen3.6-plus:free","stepfun/step-3.5-flash:free","google/gemini-2.5-flash","openai/gpt-4o-mini","anthropic/claude-haiku-4"]},openai:{provider:"openai-compatible",endpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","o3-mini"]},groq:{provider:"openai-compatible",endpoint:"https://api.groq.com/openai/v1",models:["llama-3.1-8b-instant","llama-3.3-70b-versatile","gemma2-9b-it"]},together:{provider:"openai-compatible",endpoint:"https://api.together.xyz/v1",models:["meta-llama/Llama-3-8b-chat-hf","meta-llama/Llama-3-70b-chat-hf"]}};function Vy(){const[e,t]=u.useState(""),[n,r]=u.useState("openrouter"),[s,o]=u.useState("openai-compatible"),[i,l]=u.useState("https://openrouter.ai/api/v1"),[c,d]=u.useState("google/gemma-4-31b-it"),[f,h]=u.useState(""),[m,x]=u.useState(!1),[w,y]=u.useState(!1),[j,g]=u.useState(!1),[p,v]=u.useState(null),[S,k]=u.useState([]),[I,T]=u.useState(!1),[P,b]=u.useState(null),[N,O]=u.useState(""),Y=u.useCallback(_=>{t(_),setTimeout(()=>t(""),3e3)},[]),V=u.useCallback(async(_,W,R)=>{T(!0),b(null);try{const D=await A.aiModels({provider:_,endpoint:W,...R?{apiKey:R}:{}});D.ok&&D.models.length>0?(k(D.models),b(`${D.models.length} models available`)):(k([]),b(D.message||"No models returned — using defaults"))}catch(D){k([]),b(D instanceof Error?D.message:"Failed to load models")}finally{T(!1)}},[]),H=u.useCallback(async()=>{try{const _=await A.getCredential("ai-config");if(x(_.configured),_.configured&&_.fields){const W=_.fields.provider||"openai-compatible",R=_.fields.endpoint||"";_.fields.provider&&o(W),_.fields.endpoint&&l(R),_.fields.model&&d(_.fields.model),R.includes("openai.com")?r("openai"):R.includes("groq.com")?r("groq"):R.includes("together.xyz")?r("together"):R.includes("openrouter.ai")?r("openrouter"):r("ollama"),R&&V(W,R)}}catch{}},[V]);u.useEffect(()=>{H()},[H]);const C=_=>{r(_),k([]),b(null),O("");const W=Hy[_];W&&(o(W.provider),l(W.endpoint),d(""),V(W.provider,W.endpoint,f||void 0))},J=()=>V(s,i,f||void 0),ne=async()=>{y(!0);try{await A.setCredential("ai-config",{provider:s,endpoint:i,model:c,...f?{apiKey:f}:{}}),x(!0),Y("AI configuration saved!")}catch{Y("Failed to save AI config")}finally{y(!1)}},$=async()=>{g(!0),v(null);try{const _=await A.aiTest({provider:s,endpoint:i,model:c,...f?{apiKey:f}:{}});v(_.ok?`OK: ${_.message}`:`Failed: ${_.message}`)}catch(_){v(`Error: ${_ instanceof Error?_.message:"Unknown"}`)}finally{g(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"AI Assistant"}),a.jsx("p",{className:"page-subtitle",children:"Advisory AI to help you think through intent when authorizing agents."})]}),e&&a.jsx("div",{className:"alert alert-success",children:e}),a.jsxs("div",{className:"card",children:[a.jsx("h3",{className:"card-title",children:"Configuration"}),a.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Connect a trusted AI model that has access to your intent — problem, objective, and tradeoffs — to help you think through authorizations. Keys are encrypted in your vault."}),m&&a.jsxs("div",{className:"status-banner status-banner-success",style:{marginBottom:"1rem",fontSize:"0.8rem"},children:[a.jsx("span",{className:"status-banner-icon",children:"✓"}),a.jsx("span",{className:"status-banner-text",children:"AI configured"})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:"Provider Preset"}),a.jsxs("select",{className:"form-input",value:n,onChange:_=>C(_.target.value),children:[a.jsx("option",{value:"openrouter",children:"OpenRouter (recommended)"}),a.jsx("option",{value:"ollama",children:"Ollama (local)"}),a.jsx("option",{value:"openai",children:"OpenAI"}),a.jsx("option",{value:"groq",children:"Groq"}),a.jsx("option",{value:"together",children:"Together"})]})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsxs("label",{className:"form-label",children:["API Key ",s==="ollama"?"(not needed for Ollama)":"(required to load models)"]}),a.jsx("input",{className:"form-input",type:"password",name:"ai-provider-api-key-credential-top",autoComplete:"new-password",value:f,onChange:_=>h(_.target.value),onBlur:()=>{f.trim()&&V(s,i,f.trim())},placeholder:m?"••••••••••••••••":"sk-... (not needed for Ollama)"}),a.jsx("p",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",margin:"0.375rem 0 0"},children:"Each provider uses its own key — paste it and the model list loads automatically."})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsx("label",{className:"form-label",children:"Model"}),a.jsx("button",{type:"button",className:"btn btn-ghost",style:{fontSize:"0.75rem",padding:"0.125rem 0.5rem"},onClick:J,disabled:I,title:"Re-fetch the model list from the provider",children:I?"Loading…":"↻ Refresh"})]}),S.length===0?a.jsx("div",{className:"form-input",style:{display:"flex",alignItems:"center",minHeight:"2.5rem",color:"var(--text-secondary)",fontSize:"0.85rem"},children:I?"Loading models…":s==="ollama"?"Start Ollama locally, then ↻ Refresh to load models.":"Enter a valid API key above to load available models."}):(()=>{const _=S,W=_.includes(c),R=_.length>12,D=N.trim().toLowerCase();let L=D?_.filter(U=>U.toLowerCase().includes(D)):_;return W&&!L.includes(c)&&(L=[c,...L]),a.jsxs(a.Fragment,{children:[R&&a.jsx("input",{className:"form-input",value:N,onChange:U=>O(U.target.value),placeholder:"Filter models… (e.g. kimi)",style:{marginBottom:"0.375rem"}}),a.jsxs("select",{className:"form-input",value:W?c:"__unset__",onChange:U=>d(U.target.value==="__unset__"?"":U.target.value),children:[a.jsx("option",{value:"__unset__",disabled:!0,children:"Select a model…"}),L.map(U=>a.jsx("option",{value:U,children:U},U)),D&&L.length===0&&a.jsxs("option",{value:"__unset__",disabled:!0,children:["No models match “",N,"”"]})]})]})})(),P&&a.jsx("p",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",margin:"0.375rem 0 0"},children:P})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.jsx("button",{className:"btn btn-primary",onClick:ne,disabled:w||!c.trim(),title:c.trim()?void 0:"Select a model first",children:w?"Saving...":"Save & Encrypt"}),m&&a.jsx("button",{className:"btn btn-ghost",onClick:$,disabled:j,children:j?"Testing...":"Test Connection"})]}),p&&a.jsx("div",{className:`alert ${p.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:p})]}),a.jsx(Ky,{}),a.jsx(Dy,{}),a.jsx(Wy,{}),a.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[a.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,marginBottom:"1rem"},children:"Security"}),a.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.7},children:[a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"What the gateway protects"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[a.jsx("li",{children:"Every tool call verified against your authorization bounds"}),a.jsx("li",{children:"Credentials never exposed to agents through MCP"}),a.jsx("li",{children:"Every action produces a signed receipt"})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"Your responsibility"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[a.jsx("li",{children:"If your AI agent has full access to your computer, it could bypass the gateway"}),a.jsx("li",{children:"For best security, run agents in sandboxed environments"}),a.jsx("li",{children:"The gateway secures what agents do through tools — not what they do on your machine"})]})]})]})]})]})}function Ky(){const[e,t]=u.useState(null),[n,r]=u.useState({intent:"",context:""}),[s,o]=u.useState(null),[i,l]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(!1),m=u.useCallback(async()=>{if(!f)try{const y=await A.getAIPrompts();t(y),r({intent:y.intent.current,context:y.context.current}),h(!0)}catch(y){l(y instanceof Error?y.message:"Failed to load prompts")}},[f]),x=async y=>{if(e){o(y),l(null);try{const j=n[y],g=j.trim()===e[y].default.trim()?"":j;await A.setAIPrompt(y,g);const p=await A.getAIPrompts();t(p),r({intent:p.intent.current,context:p.context.current}),d(y),setTimeout(()=>d(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{o(null)}}},w=async y=>{if(confirm(`Revert ${y} prompt to the built-in default?`)){o(y),l(null);try{await A.setAIPrompt(y,"");const j=await A.getAIPrompts();t(j),r({intent:j.intent.current,context:j.context.current})}catch(j){l(j instanceof Error?j.message:"Revert failed")}finally{o(null)}}};return a.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:y=>{y.currentTarget.open&&m()},children:[a.jsx("summary",{style:{fontSize:"1rem",fontWeight:700,cursor:"pointer",listStyle:"revert",userSelect:"none"},children:"Advanced — AI assistant prompts"}),a.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",margin:"0.75rem 0 1rem 0",lineHeight:1.55},children:"These are the system prompts the AI assistant sees when helping you write Intent (per-authorization) or Context (your standing-orders brief). Edit with care — changes apply on the next chat turn."}),i&&a.jsx("div",{className:"alert alert-error",style:{marginBottom:"0.75rem"},children:i}),!f&&!i&&a.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&a.jsxs(a.Fragment,{children:[a.jsx(Xc,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:y=>r(j=>({...j,intent:y})),onSave:()=>x("intent"),onRevert:()=>w("intent"),saving:s==="intent",justSaved:c==="intent"}),a.jsx(Xc,{kind:"context",label:"Context — standing-orders brief",description:"Used on the Brief page when refining your context.md.",state:e.context,draft:n.context,onChange:y=>r(j=>({...j,context:y})),onSave:()=>x("context"),onRevert:()=>w("context"),saving:s==="context",justSaved:c==="context"})]})]})}function Xc({kind:e,label:t,description:n,state:r,draft:s,onChange:o,onSave:i,onRevert:l,saving:c,justSaved:d}){const f=s!==r.current;return a.jsxs("section",{style:{marginBottom:"1.5rem"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"0.25rem",gap:"1rem",flexWrap:"wrap"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem"},children:t}),a.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-secondary)"},children:n})]}),r.overridden&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom"})]}),a.jsx("textarea",{className:"form-textarea",value:s,onChange:h=>o(h.target.value),rows:12,spellCheck:!1,style:{width:"100%",fontFamily:"'SF Mono', Monaco, 'Cascadia Code', monospace",fontSize:"0.82rem",lineHeight:1.55,resize:"vertical",minHeight:"14rem",marginTop:"0.5rem"},"aria-label":`${t} system prompt`}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",marginTop:"0.5rem",flexWrap:"wrap"},children:[a.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:i,disabled:c||!f,children:c?"Saving…":"Save"}),r.overridden&&a.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:l,disabled:c,title:"Discard the override and use the built-in default",children:"Revert to default"}),d&&a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),f&&!c&&!d&&a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"Unsaved changes"})]}),a.jsxs("details",{style:{marginTop:"0.5rem"},children:[a.jsx("summary",{style:{fontSize:"0.78rem",color:"var(--text-muted)",cursor:"pointer"},children:"Show built-in default"}),a.jsx("pre",{style:{marginTop:"0.5rem",padding:"0.75rem 1rem",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.5rem",fontSize:"0.78rem",lineHeight:1.55,whiteSpace:"pre-wrap",maxHeight:"20rem",overflowY:"auto"},children:r.default})]}),a.jsx("span",{style:{display:"none"},children:e})]})}function Gy(e){return e.proposalId?"review":"automatic"}function qc(e,t,n={}){const r=n.status??"pending",s=n.includeAutonomous??!1,o=[];for(const i of e)r==="pending"&&i.status!=="pending"||n.profile&&i.profileId!==n.profile||o.push({kind:"proposal",id:i.id,sortTimestamp:i.createdAt,commitmentMode:"review",profileId:i.profileId,proposal:i});if(r==="all")for(const i of t){const l=Gy(i);!s&&l==="automatic"||n.profile&&i.profileId!==n.profile||o.push({kind:"receipt",id:i.id,sortTimestamp:i.timestamp,commitmentMode:l,profileId:i.profileId,receipt:i})}return o.sort((i,l)=>l.sortTimestamp-i.sortTimestamp),typeof n.limit=="number"&&n.limit>0?o.slice(0,n.limit):o}const Yy=["https://","http://"];function Gf(e,t){return e!=null&&e.length?e.flatMap(n=>{const r=n.template.replace(/\{(\w+)\}/g,(s,o)=>{const i=t[o];return typeof i=="string"||typeof i=="number"?String(i):"\0"});return r.includes("\0")||/\{|\}/.test(r)?[]:Yy.some(s=>r.toLowerCase().startsWith(s))?[{label:n.label,href:r,description:n.description}]:[]}):[]}function Qy({profileId:e}){return a.jsx("span",{className:"profile-badge",children:$e(e)})}function Yf(e,t){const n=e-Math.floor(t/1e3);if(n<=0)return{label:"expired",urgent:!1,expired:!0};const r=Math.floor(n/86400),s=Math.floor(n%86400/3600),o=Math.floor(n%3600/60);let i;return r>0?i=`expires in ${r}d ${s}h`:s>0?i=`expires in ${s}h ${o}m`:i=`expires in ${Math.max(1,o)}m`,{label:i,urgent:n<2*3600,expired:!1}}const Jy={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},Xy={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function qy(e){const t=Date.now()-e*1e3,n=t/36e5;return n<48?n<1?`${Math.max(1,Math.round(t/6e4))}m ago`:`${Math.round(n)}h ago`:new Date(e*1e3).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Zy(e){return e.split("__").pop()??e}function ex(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const tx=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),nx=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function rx(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:nx.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function wi(e){if(e==null)return"—";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>wi(t)).join(", ");try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Zc({item:e,onApprove:t,onReject:n,resolving:r,proposalLinks:s}){const o=e.kind==="proposal",i=o?e.proposal.status:"executed",l=o?e.proposal.tool:e.receipt.action,c=Zy(l),d=ex(l),f=o?e.proposal.toolArgs:null,h=o?e.proposal.executionContext:e.receipt.executionContext,m=o?null:e.receipt.cumulativeState,x=o?Gf(s,e.proposal.toolArgs):[],w=f?Object.entries(f).filter(([j])=>!tx.has(j)):[],y=Object.entries(h??{});return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.75rem",flexWrap:"wrap"},children:[a.jsx(Qy,{profileId:e.profileId}),a.jsx("code",{style:{fontSize:"0.85rem"},children:c}),e.commitmentMode==="automatic"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"autonomous"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[o&&i==="pending"&&(()=>{const j=Yf(e.proposal.expiresAt,Date.now());return a.jsx("span",{style:{fontSize:"0.72rem",color:j.urgent?"var(--warning)":"var(--text-tertiary)",fontWeight:j.urgent?600:400,whiteSpace:"nowrap"},children:j.label})})(),a.jsx("span",{className:`status-badge ${Xy[i]}`,children:Jy[i]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:qy(e.sortTimestamp)})]})]}),d&&a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.8rem",color:"var(--warning)",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.4rem 0.6rem",marginBottom:"0.75rem"},children:[a.jsx("span",{children:"⚠"}),a.jsx("span",{children:"Irreversible action"})]}),o&&typeof(f==null?void 0:f._imagePreview)=="string"&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Preview"}),a.jsx("img",{src:f._imagePreview,alt:typeof(f==null?void 0:f.altText)=="string"?f.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),x.length>0&&a.jsx("div",{style:{marginBottom:"0.75rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:x.map(j=>a.jsxs("a",{href:j.href,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm",style:{textDecoration:"none"},title:j.description??j.href,children:[j.label," ↗"]},j.label))}),o&&w.length>0&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Arguments"}),a.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:w.map(([j,g])=>a.jsxs(u.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:j}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:rx(j,g)?a.jsx("img",{src:g,alt:typeof(f==null?void 0:f.altText)=="string"?f.altText:j,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:p=>{const v=p.currentTarget,S=v.parentElement;if(!S)return;v.style.display="none";const k=document.createElement("span");k.textContent=g,k.style.color="var(--text-tertiary)",S.appendChild(k)}}):wi(g)})]},j))})]}),y.length>0&&a.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:y.map(([j,g])=>`${j}=${wi(g)}`).join(" · ")}),m&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["After this action · today: ",m.daily.count," action",m.daily.count===1?"":"s",m.daily.amount>0?`, ${m.daily.amount}`:""," · ","this month: ",m.monthly.count,m.monthly.amount>0?`, ${m.monthly.amount}`:""]}),o&&i==="pending"&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),a.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[o?"Proposal":"Receipt",": ",e.id]})]})}const sx=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function Si(e){if(e==null)return"—";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>Si(t)).join(", ");try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ax(e){const t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<60)return`${Math.max(1,n)}m ago`;const r=Math.floor(t/36e5);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function ox({proposal:e,currentUserId:t,onAction:n,onMessage:r,proposalLinks:s}){const[o,i]=u.useState(!1),[l,c]=u.useState(!1),[d,f]=u.useState(null),[h,m]=u.useState(!1),[x,w]=u.useState(null),[y,j]=u.useState(!1),g=e.tool.split("__").pop()??e.tool,p=Object.entries(e.toolArgs).filter(([C])=>!sx.has(C)),v=Object.entries(e.executionContext),S=Gf(s,e.toolArgs),k=e.pendingApprovers??[],I=e.approvedBy??{},T=Object.keys(I).length,P=k.filter(C=>!(C in I)).length,b=t in I,N=async()=>{if(d===null){m(!0),w(null);try{const C=await A.getAttestationIntent(e.authorizationId);if(!C){w("Intent not available or you are not an authorized approver.");return}const J=await A.decryptIntent({intentCiphertext:C.intentCiphertext,encryptedKey:C.encryptedKey,approverId:t});f(J)}catch(C){w(C instanceof Error?C.message:"Failed to decrypt intent")}finally{m(!1)}}},O=async()=>{y?j(!1):(j(!0),await N())},Y=async()=>{i(!0),r("");try{await A.approveProposal(e.id);try{if(d===null){const C=await A.getAttestationIntent(e.authorizationId);if(C){const J=await A.decryptIntent({intentCiphertext:C.intentCiphertext,encryptedKey:C.encryptedKey,approverId:t});f(J),await A.storeApprovedIntent(e.authorizationId,J)}}else await A.storeApprovedIntent(e.authorizationId,d)}catch{}r(`Approved. ${P-1>0?`${P-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(C){r(C instanceof Error?C.message:"Approval failed")}finally{i(!1)}},V=async()=>{const C=prompt("Rejection reason (optional):");if(C!==null){c(!0),r("");try{await A.rejectProposal(e.id,C||void 0),r("Action rejected."),n()}catch(J){r(J instanceof Error?J.message:"Rejection failed")}finally{c(!1)}}},H=o||l;return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:$e(e.profileId)}),a.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Above cap"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[(()=>{const C=Yf(e.expiresAt,Date.now());return a.jsx("span",{style:{fontSize:"0.72rem",color:C.urgent?"var(--warning)":"var(--text-tertiary)",fontWeight:C.urgent?600:400,whiteSpace:"nowrap"},children:C.label})})(),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:ax(e.createdAt)})]})]}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[T," of ",k.length," approver",k.length===1?"":"s"," signed off",k.map(C=>{const J=C in I;return a.jsxs("span",{style:{marginLeft:"0.5rem",color:J?"var(--success, green)":"var(--text-tertiary)"},children:[J?"✓":"○"," ",C===t?"You":C]},C)})]}),a.jsxs("div",{style:{marginBottom:"0.5rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Proposed action"}),a.jsx("code",{style:{fontSize:"0.85rem"},children:g})]}),S.length>0&&a.jsx("div",{style:{marginBottom:"0.75rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:S.map(C=>a.jsxs("a",{href:C.href,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm",style:{textDecoration:"none"},title:C.description??C.href,children:[C.label," ↗"]},C.label))}),p.length>0&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),a.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:p.map(([C,J])=>a.jsxs(u.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:C}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:Si(J)})]},C))})]}),v.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:v.map(([C,J])=>`${C}=${Si(J)}`).join(" · ")}),a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsxs("button",{className:"btn btn-ghost btn-sm",style:{padding:"0.2rem 0",fontSize:"0.75rem"},onClick:O,disabled:h,children:[y?"▲ Hide intent":"▼ Show intent",h&&" (decrypting...)"]}),y&&a.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:x?a.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:x}):d!==null?a.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:d}):a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.8rem",margin:0},children:"No intent available for this authority."})})]}),!b&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.25rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:Y,disabled:H,children:o?"Approving...":"Approve"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:V,disabled:H,children:l?"Rejecting...":"Reject"})]}),b&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"You approved this action. Waiting on other approvers."}),a.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["Proposal: ",e.id]})]})}function ix(){const{domain:e,user:t}=We(),n=(t==null?void 0:t.id)??"",[r,s]=u.useState("awaiting-me"),[o,i]=u.useState([]),[l,c]=u.useState([]),[d,f]=u.useState(!0),[h,m]=u.useState(""),x=u.useCallback(async()=>{try{const E=await A.getProposalsForApprover();i(E)}catch{}finally{f(!1)}},[]);ke("proposal-added",x),ke("proposal-approved",x),ke("proposal-rejected",x),ke("proposal-resolved",x),Lt(x,3e4);const[w,y]=u.useState([]),j=u.useCallback(async()=>{try{const E=await A.getProposals(e||"owner");y(E)}catch{}},[e]);ke("proposal-added",j),ke("proposal-approved",j),ke("proposal-rejected",j),ke("proposal-resolved",j),Lt(j,3e4,e);const g=u.useMemo(()=>w.filter(E=>{var B;return E.status==="pending"&&(((B=E.pendingApprovers)==null?void 0:B.length)??0)===0}),[w]),p=u.useMemo(()=>qc(g,[],{status:"pending"}),[g]),[v,S]=u.useState([]),k=u.useCallback(async()=>{if(n)try{const B=(await A.getProposals(e||"owner")).filter(te=>te.status==="pending"&&te.pendingApprovers&&te.pendingApprovers.includes(n)&&te.approvedBy&&n in te.approvedBy);S(B)}catch{}},[n,e]);ke("proposal-approved",k),ke("proposal-rejected",k),Lt(k,3e4,`${n}:${e}`),u.useEffect(()=>{A.getIntegrationManifests().then(E=>c(E.manifests??[])).catch(()=>{})},[]);const I=E=>{var B;return(B=l.find(te=>te.id===E.split("__")[0]))==null?void 0:B.proposalLinks};u.useEffect(()=>{x(),j(),k()},[]);const[T,P]=u.useState([]),[b,N]=u.useState([]),[O,Y]=u.useState(!0),[V,H]=u.useState(null),[C,J]=u.useState(""),[ne,$]=u.useState("pending"),[_,W]=u.useState(null),[R,D]=u.useState(!1),L=u.useCallback(async()=>{try{const{proposals:E,receipts:B}=await A.getThread({domain:e,status:ne,sinceDays:7});P(E),N(B)}catch{}finally{Y(!1)}},[e,ne]);Lt(L,3e4,`${e}:${ne}`);const U=async(E,B)=>{H(E),J("");try{const te=e||"owner",ye=await A.resolveProposal(E,B,te);J(B==="commit"?`Action approved. Status: ${ye.status}`:"Action rejected."),await Promise.all([L(),j()])}catch(te){J(te instanceof Error?te.message:"Failed")}finally{H(null)}},ee=u.useMemo(()=>{const E=new Set;for(const B of T)E.add(B.profileId);for(const B of b)E.add(B.profileId);return Array.from(E).sort()},[T,b]),q=u.useMemo(()=>qc(T,b,{status:ne,profile:_??void 0,includeAutonomous:R}),[T,b,ne,_,R]),pe=u.useCallback(()=>{x(),k()},[x,k]),ze=u.useMemo(()=>{const E=new Set,B=[];for(const te of v)E.has(te.id)||(E.add(te.id),B.push(te));return B.sort((te,ye)=>ye.createdAt-te.createdAt)},[v]),Oe=o.length+p.length,z=ze.length;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Pending Approvals"}),a.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),a.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[a.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>s("awaiting-me"),children:["Awaiting me ",Oe>0&&a.jsx("span",{style:{marginLeft:"0.4rem",background:"var(--warning)",color:"var(--bg-elevated)",borderRadius:"0.625rem",padding:"0 0.375rem",fontSize:"0.7rem",fontWeight:600},children:Oe})]}),a.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>s("awaiting-others"),children:["Awaiting others ",z>0&&a.jsx("span",{style:{marginLeft:"0.4rem",background:"var(--border)",color:"var(--text-secondary)",borderRadius:"0.625rem",padding:"0 0.375rem",fontSize:"0.7rem",fontWeight:600},children:z})]}),a.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{s("all"),L()},children:"All"})]}),r==="awaiting-me"&&a.jsx(a.Fragment,{children:d&&Oe===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):Oe===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions awaiting your approval."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Review-mode actions and above-cap actions you must approve will appear here."})]}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(h||C)&&a.jsx("div",{className:"alert alert-success",children:h||C}),p.map(E=>a.jsx(Zc,{proposalLinks:E.kind==="proposal"?I(E.proposal.tool):void 0,item:E,onApprove:B=>U(B,"commit"),onReject:B=>U(B,"reject"),resolving:V===E.id},E.id)),o.map(E=>a.jsx(ox,{proposal:E,currentUserId:n,onAction:pe,onMessage:m,proposalLinks:I(E.tool)},E.id))]})}),r==="awaiting-others"&&a.jsx(a.Fragment,{children:ze.length===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:ze.map(E=>a.jsx(cx,{proposal:E,currentUserId:n,onCancel:async()=>{try{await A.rejectProposal(E.id,"cancelled by creator"),k(),j()}catch(B){alert(B instanceof Error?B.message:"Cancel failed")}}},E.id))})}),r==="all"&&a.jsxs(a.Fragment,{children:[C&&a.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:C}),a.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[a.jsx("button",{className:`filter-chip ${ne==="pending"?"selected":""}`,onClick:()=>$("pending"),children:"Pending"}),a.jsx("button",{className:`filter-chip ${ne==="all"?"selected":""}`,onClick:()=>$("all"),children:"All"}),ee.length>0&&a.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),ee.map(E=>a.jsx("button",{className:`filter-chip ${_===E?"selected":""}`,onClick:()=>W(_===E?null:E),children:$e(E)},E)),ne==="all"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),a.jsxs("button",{className:`filter-chip ${R?"selected":""}`,onClick:()=>D(!R),title:"Include actions executed without human review (automatic commitment mode)",children:[R?"✓ ":"","Autonomous actions"]})]})]}),O&&q.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):q.length===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:ne==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:ne==="pending"?"Your agents are operating within their authorizations. Switch to All to see recent activity.":"When an agent calls a gated tool, activity will appear here."})]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:q.map(E=>a.jsx(Zc,{proposalLinks:E.kind==="proposal"?I(E.proposal.tool):void 0,item:E,onApprove:B=>U(B,"commit"),onReject:B=>U(B,"reject"),resolving:V===E.id},E.id))})]})]})}function lx(e){const t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<60)return`${Math.max(1,n)}m ago`;const r=Math.floor(t/36e5);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function cx({proposal:e,currentUserId:t,onCancel:n}){var d;const[r,s]=u.useState(!1),o=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(f=>!(f in(e.approvedBy??{}))),l=(((d=e.pendingApprovers)==null?void 0:d.length)??0)>0,c=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){s(!0);try{await n()}finally{s(!1)}}};return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:$e(e.profileId)}),l&&a.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Above cap"}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:lx(e.createdAt)})]}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:a.jsx("code",{children:e.tool.split("__").pop()??e.tool})}),l&&a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[o.map(f=>a.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:f===t?"You approved":`${f} approved`},f)),i.map(f=>a.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",f===t?"you":f]},f))]}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--danger)"},onClick:c,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const ux=`# Agent Brief
|
|
70
|
+
|
|
71
|
+
You act on my behalf through Suveren — the gateway that gates every
|
|
72
|
+
privileged tool call you make. Suveren implements the bounded-authority
|
|
73
|
+
model from the open Human Agency Protocol (HAP): each authorization
|
|
74
|
+
describes an area of authority, a set of numeric limits, and a scope.
|
|
75
|
+
Operate inside those bounds or the Gatekeeper will reject your action.
|
|
76
|
+
|
|
77
|
+
## Before you act in a domain
|
|
78
|
+
|
|
79
|
+
1. Call \`list-authorizations(domain: "<domain>")\` to load the full
|
|
80
|
+
intent, scope, and usage for that area. The session brief shows only
|
|
81
|
+
a one-line summary per authority — the Intent paragraph lives behind
|
|
82
|
+
that call, and often contains soft rules you MUST honor (e.g. "never
|
|
83
|
+
publish on weekends", "only reply in English").
|
|
84
|
+
2. If the action would exceed a bound or fall outside the scope, stop
|
|
85
|
+
and explain what would be blocked instead of trying.
|
|
86
|
+
3. If you're not sure whether an action is covered, ask me first.
|
|
87
|
+
|
|
88
|
+
## How to handle reviews
|
|
89
|
+
|
|
90
|
+
Authorizations in review mode require my approval before the action
|
|
91
|
+
executes. When you propose an action:
|
|
92
|
+
- Include everything I need to judge it (title, recipients, amounts,
|
|
93
|
+
dates, attendees) in the tool arguments.
|
|
94
|
+
- Don't batch unrelated proposals — one proposal per decision.
|
|
95
|
+
|
|
96
|
+
## Standing orders
|
|
97
|
+
|
|
98
|
+
(Add your own here. Examples:)
|
|
99
|
+
|
|
100
|
+
- Every morning, summarize today's calendar and flag conflicts.
|
|
101
|
+
- On Fridays, give me a weekly review: what's done, what slipped, what's
|
|
102
|
+
next.
|
|
103
|
+
- Never email anyone outside the company without asking first.
|
|
104
|
+
- When drafting posts, prefer plain language over marketing copy.
|
|
105
|
+
`;function dx(){const[e,t]=u.useState(""),[n,r]=u.useState(""),[s,o]=u.useState(!0),[i,l]=u.useState(!1),[c,d]=u.useState(null),[f,h]=u.useState(!1),m=e!==n,x=new Blob([e]).size,w=16*1024;u.useEffect(()=>{if(!m)return;const p=S=>{S.preventDefault(),S.returnValue=""},v=S=>{var T,P;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const k=(P=(T=S.target)==null?void 0:T.closest)==null?void 0:P.call(T,"a");if(!k||!k.href)return;let I;try{I=new URL(k.href)}catch{return}I.origin===window.location.origin&&I.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",p),document.addEventListener("click",v,!0),()=>{window.removeEventListener("beforeunload",p),document.removeEventListener("click",v,!0)}},[m]),u.useEffect(()=>{let p=!1;return A.getAgentContext().then(v=>{p||(t(v),r(v))}).catch(v=>{p||d({kind:"error",text:v instanceof Error?v.message:"Failed to load context"})}).finally(()=>{p||o(!1)}),()=>{p=!0}},[]);const y=async()=>{l(!0),d(null);try{await A.saveAgentContext(e),r(e),d({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(p){d({kind:"error",text:p instanceof Error?p.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),d(null)},g=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(ux)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Agent Brief"}),a.jsx("p",{className:"page-subtitle",children:"Standing orders for agents that connect via MCP. This text prepends every new session — keep it tight."}),!e.trim()&&!s&&a.jsx("button",{className:"btn btn-primary btn-sm",onClick:g,disabled:i,title:"Insert a starter brief covering Suveren basics and example standing orders",style:{marginTop:"0.5rem"},children:"Insert starter template"})]}),c&&a.jsx("div",{className:c.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:c.text}),a.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[a.jsx("div",{className:"card intent-pane chat",children:a.jsx(ya,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||t(p)},greeting:"Tell me what your agent should know — I'll help shape your standing orders. Or ask me to draft a full brief and we'll iterate.",placeholder:"Ask for help with your brief…"})}),a.jsxs("div",{className:"card intent-pane document",children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:[a.jsx("h3",{className:"card-title",style:{marginBottom:0},children:"context.md"}),a.jsxs("span",{style:{fontSize:"0.75rem",color:x>w?"var(--danger)":"var(--text-muted)"},children:[x.toLocaleString()," / ",w.toLocaleString()," bytes"]})]}),a.jsx("textarea",{className:"form-textarea",value:e,onChange:p=>t(p.target.value),placeholder:s?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:s,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),a.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!m,children:"Revert"}),a.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:y,disabled:i||!m||x>w||s,children:i?"Saving…":"Save"})]})]}),a.jsx("button",{type:"button",className:"floating-help",onClick:()=>h(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),a.jsx(Uf,{open:f,onClose:()=>h(!1),ariaLabel:"Brief assistant",children:a.jsx(ya,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(p),h(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function fx({children:e}){const{user:t,mode:n,domain:r}=We();return t?n==="team"&&!r?a.jsx(nn,{to:"/onboarding",replace:!0}):a.jsx(a.Fragment,{children:e}):a.jsx(nn,{to:"/login",replace:!0})}function px(){const{user:e}=We();return a.jsxs(Sg,{children:[a.jsx(Le,{path:"/login",element:e?a.jsx(nn,{to:"/",replace:!0}):a.jsx(kv,{})}),a.jsx(Le,{path:"/onboarding",element:e?a.jsx(bv,{}):a.jsx(nn,{to:"/login",replace:!0})}),a.jsxs(Le,{element:a.jsx(fx,{children:a.jsx(jv,{})}),children:[a.jsx(Le,{path:"/",element:a.jsx(Lv,{})}),a.jsx(Le,{path:"/agent/new",element:a.jsx(nn,{to:"/authorizations?new=1",replace:!0})}),a.jsx(Le,{path:"/agent/gate",element:a.jsx(iy,{})}),a.jsx(Le,{path:"/agent/review",element:a.jsx(fy,{})}),a.jsx(Le,{path:"/integrations",element:a.jsx(vy,{})}),a.jsx(Le,{path:"/groups",element:a.jsx(yy,{})}),a.jsx(Le,{path:"/authorizations",element:a.jsx(Py,{})}),a.jsx(Le,{path:"/audit",element:a.jsx(Oy,{})}),a.jsx(Le,{path:"/proposals",element:a.jsx(ix,{})}),a.jsx(Le,{path:"/agent-brief",element:a.jsx(dx,{})}),a.jsx(Le,{path:"/settings",element:a.jsx(Vy,{})}),a.jsx(Le,{path:"/settings/services",element:a.jsx(nn,{to:"/settings",replace:!0})}),a.jsx(Le,{path:"/deploy",element:a.jsx(nn,{to:"/integrations",replace:!0})})]}),a.jsx(Le,{path:"*",element:a.jsx(nn,{to:"/",replace:!0})})]})}function mx(){return a.jsx(Kg,{children:a.jsx(nv,{children:a.jsx(rv,{children:a.jsx(px,{})})})})}mf(document.getElementById("root")).render(a.jsx(u.StrictMode,{children:a.jsx(mx,{})}));
|