@abstractframework/continuum 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -4
- package/dist/assets/{abnfDiagram-VRR7QNED-CptTkH57.js → abnfDiagram-VRR7QNED-DUoj6rgR.js} +2 -2
- package/dist/assets/{arc-oQ5R3mHX.js → arc-I6yCEc-n.js} +2 -2
- package/dist/assets/{architectureDiagram-ZJ3FMSHR-Bn00f0nM.js → architectureDiagram-ZJ3FMSHR-DJYsy6Ke.js} +2 -2
- package/dist/assets/{blockDiagram-677ZJIJ3-BgQg2xzI.js → blockDiagram-677ZJIJ3-BjB9Abvu.js} +2 -2
- package/dist/assets/{c4Diagram-LMCZKHZV-DSrFKkwF.js → c4Diagram-LMCZKHZV-DiukFpvk.js} +2 -2
- package/dist/assets/channel-CsGWNVeB.js +2 -0
- package/dist/assets/{chunk-2Q5K7J3B-D8JcDR0u.js → chunk-2Q5K7J3B-Bzj3nCUE.js} +2 -2
- package/dist/assets/{chunk-32BRIVSS-Di3jxbyw.js → chunk-32BRIVSS-P-cd15lV.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-xA0TZltq.js → chunk-5VM5RSS4-C926qres.js} +2 -2
- package/dist/assets/{chunk-EX3LRPZG-BkNMQroi.js → chunk-EX3LRPZG-D-8MH237.js} +2 -2
- package/dist/assets/{chunk-JWPE2WC7-DaTATpXD.js → chunk-JWPE2WC7-xesmSJf_.js} +2 -2
- package/dist/assets/{chunk-MOJQB5TN-CzzOSJWb.js → chunk-MOJQB5TN-Cur1aPrT.js} +2 -2
- package/dist/assets/{chunk-RYQCIY6F-DAhqq1xl.js → chunk-RYQCIY6F-BVTILQCf.js} +2 -2
- package/dist/assets/{chunk-V7JOEXUC-D88CIHey.js → chunk-V7JOEXUC-DH8DqqLP.js} +2 -2
- package/dist/assets/{chunk-VR4S4FIN-CV5xjwAx.js → chunk-VR4S4FIN-DONA5ZQE.js} +2 -2
- package/dist/assets/{chunk-XXDRQBXY-CHnfAGOy.js → chunk-XXDRQBXY-Cj5h3H9W.js} +2 -2
- package/dist/assets/classDiagram-OUVF2IWQ-BRgLg1Zt.js +2 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-BRgLg1Zt.js +2 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-BgTNPlnQ.js → cose-bilkent-JH36ORCC-DPp5nz7X.js} +2 -2
- package/dist/assets/{cynefin-VYW2F7L2-DFRQoaMD.js → cynefin-VYW2F7L2-Cb1VDqjx.js} +2 -2
- package/dist/assets/{cynefinDiagram-TSTJHNR4-DA2MOQXI.js → cynefinDiagram-TSTJHNR4-BkVCVAKN.js} +2 -2
- package/dist/assets/{dagre-VKFMJZFB-BUIShmyq.js → dagre-VKFMJZFB-C69yqHLO.js} +2 -2
- package/dist/assets/{diagram-FQU43EPY-DVjgItuu.js → diagram-FQU43EPY-Cu2AB9_p.js} +2 -2
- package/dist/assets/{diagram-G47NLZAW-eJSMzGjb.js → diagram-G47NLZAW-CxoS06le.js} +2 -2
- package/dist/assets/{diagram-NH7WQ7WH-uJNNsz13.js → diagram-NH7WQ7WH-BfWvQlGK.js} +2 -2
- package/dist/assets/{diagram-OA4YK3LP-xmJewu37.js → diagram-OA4YK3LP-BT4lqaBM.js} +2 -2
- package/dist/assets/{diagram-WEI45ONY-CaXYx2ei.js → diagram-WEI45ONY-DzN57p-J.js} +2 -2
- package/dist/assets/{ebnfDiagram-CCIWWBDH-BrgvjnU5.js → ebnfDiagram-CCIWWBDH-DENI1vQm.js} +2 -2
- package/dist/assets/{erDiagram-Q63AITRT-CFF8G5wJ.js → erDiagram-Q63AITRT-D0Xg--j1.js} +2 -2
- package/dist/assets/{flowDiagram-23GEKE2U-W02vEFp0.js → flowDiagram-23GEKE2U-V_z3dBhe.js} +2 -2
- package/dist/assets/{ganttDiagram-NO4QXBWP-CRV1W7ht.js → ganttDiagram-NO4QXBWP-9QKS4cRZ.js} +2 -2
- package/dist/assets/{gitGraphDiagram-IHSO6WYX-CAe9Kkrb.js → gitGraphDiagram-IHSO6WYX-DfBBOfgk.js} +2 -2
- package/dist/assets/index-C_TjOHlB.css +1 -0
- package/dist/assets/index-SU9S3HCp.js +122 -0
- package/dist/assets/{infoDiagram-FWYZ7A6U-DzPZb8XV.js → infoDiagram-FWYZ7A6U-2PxB9AEr.js} +2 -2
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-CUSZtsJ2.js → ishikawaDiagram-FXEZZL3T-BPs88htZ.js} +2 -2
- package/dist/assets/{journeyDiagram-5HDEW3XC-Ce4DZjHq.js → journeyDiagram-5HDEW3XC-D59tgM9D.js} +2 -2
- package/dist/assets/{kanban-definition-HUTT4EX6-B2aNvJXN.js → kanban-definition-HUTT4EX6-MfmvVLTi.js} +2 -2
- package/dist/assets/{linear-Cy9Vf-l3.js → linear-DUi9ti0c.js} +2 -2
- package/dist/assets/{mermaid.core-rvwxvqSK.js → mermaid.core-i20J3FaS.js} +5 -5
- package/dist/assets/{mindmap-definition-LN4V7U3C-LIaA-8NC.js → mindmap-definition-LN4V7U3C-D2Q7oe5w.js} +2 -2
- package/dist/assets/{pegDiagram-2B236MQR-D3veo_Oo.js → pegDiagram-2B236MQR-CNmY3KTl.js} +2 -2
- package/dist/assets/{pieDiagram-ENE6RG2P-DryYCAYE.js → pieDiagram-ENE6RG2P-Ch2esIfg.js} +2 -2
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-CQY6rt5A.js → quadrantDiagram-ABIIQ3AL-CJHDjhnh.js} +2 -2
- package/dist/assets/{railroadDiagram-RFXS5EU6-0QiEYfyx.js → railroadDiagram-RFXS5EU6-C_mgIhjT.js} +2 -2
- package/dist/assets/{requirementDiagram-TGXJPOKE-CHk5lpA2.js → requirementDiagram-TGXJPOKE-C-tQSD22.js} +2 -2
- package/dist/assets/{sankeyDiagram-HTMAVEWB-CYPx25gJ.js → sankeyDiagram-HTMAVEWB-D2zvcJ4r.js} +2 -2
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-BSUr-JBi.js → sequenceDiagram-DBY2YBRQ-CI0liPpW.js} +2 -2
- package/dist/assets/{sizeCapture-X5ZJPWSS-B6ZebkVB.js → sizeCapture-X5ZJPWSS-8-Z0Kdmg.js} +2 -2
- package/dist/assets/{stateDiagram-2N3HPSRC-Dmqo36MA.js → stateDiagram-2N3HPSRC-D335WS9r.js} +2 -2
- package/dist/assets/stateDiagram-v2-6OUMAXLB-DnoX14wc.js +2 -0
- package/dist/assets/{swimlanes-5IMT3BWC-CuvrNUfQ.js → swimlanes-5IMT3BWC-BO-KsJgL.js} +3 -3
- package/dist/assets/swimlanesDiagram-G3AALYLV-DIwiFP1r.js +9 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-DSmOxhA8.js → timeline-definition-FHXFAJF6-BuN-EhNZ.js} +2 -2
- package/dist/assets/{vennDiagram-L72KCM5P-DKkd_lMz.js → vennDiagram-L72KCM5P-CeZevnKl.js} +2 -2
- package/dist/assets/{wardleyDiagram-EHGQE667-DYYxdBBD.js → wardleyDiagram-EHGQE667-D7kBjKl4.js} +2 -2
- package/dist/assets/{xychartDiagram-FW5EYKEG-Qsc3YQdG.js → xychartDiagram-FW5EYKEG-D7uR7Ic7.js} +2 -2
- package/dist/index.html +4 -3
- package/package.json +3 -1
- package/dist/assets/channel-BBUeEZaL.js +0 -2
- package/dist/assets/classDiagram-OUVF2IWQ-GIwsZVZi.js +0 -2
- package/dist/assets/classDiagram-v2-EOCWNBFH-GIwsZVZi.js +0 -2
- package/dist/assets/index-Cn7OlSFa.js +0 -121
- package/dist/assets/index-D1NTcviR.css +0 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-CwN_yVcy.js +0 -2
- package/dist/assets/swimlanesDiagram-G3AALYLV-BFp8yG0X.js +0 -9
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var Sp=Object.defineProperty;var Np=(a,s,r)=>s in a?Sp(a,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[s]=r;var Nr=(a,s,r)=>Np(a,typeof s!="symbol"?s+"":s,r);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&l(m)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function Cp(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var _u={exports:{}},yl={},gu={exports:{}},ut={};/**
|
|
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 Hm;function $p(){if(Hm)return ut;Hm=1;var a=Symbol.for("react.element"),s=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),x=Symbol.iterator;function N(w){return w===null||typeof w!="object"?null:(w=x&&w[x]||w["@@iterator"],typeof w=="function"?w:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},I=Object.assign,C={};function z(w,A,ee){this.props=w,this.context=A,this.refs=C,this.updater=ee||L}z.prototype.isReactComponent={},z.prototype.setState=function(w,A){if(typeof w!="object"&&typeof w!="function"&&w!=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,w,A,"setState")},z.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function B(){}B.prototype=z.prototype;function F(w,A,ee){this.props=w,this.context=A,this.refs=C,this.updater=ee||L}var q=F.prototype=new B;q.constructor=F,I(q,z.prototype),q.isPureReactComponent=!0;var Q=Array.isArray,E=Object.prototype.hasOwnProperty,Z={current:null},oe={key:!0,ref:!0,__self:!0,__source:!0};function le(w,A,ee){var ge,he={},O=null,je=null;if(A!=null)for(ge in A.ref!==void 0&&(je=A.ref),A.key!==void 0&&(O=""+A.key),A)E.call(A,ge)&&!oe.hasOwnProperty(ge)&&(he[ge]=A[ge]);var te=arguments.length-2;if(te===1)he.children=ee;else if(1<te){for(var Ce=Array(te),Ae=0;Ae<te;Ae++)Ce[Ae]=arguments[Ae+2];he.children=Ce}if(w&&w.defaultProps)for(ge in te=w.defaultProps,te)he[ge]===void 0&&(he[ge]=te[ge]);return{$$typeof:a,type:w,key:O,ref:je,props:he,_owner:Z.current}}function pe(w,A){return{$$typeof:a,type:w.type,key:A,ref:w.ref,props:w.props,_owner:w._owner}}function Te(w){return typeof w=="object"&&w!==null&&w.$$typeof===a}function Me(w){var A={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(ee){return A[ee]})}var ve=/\/+/g;function ce(w,A){return typeof w=="object"&&w!==null&&w.key!=null?Me(""+w.key):A.toString(36)}function D(w,A,ee,ge,he){var O=typeof w;(O==="undefined"||O==="boolean")&&(w=null);var je=!1;if(w===null)je=!0;else switch(O){case"string":case"number":je=!0;break;case"object":switch(w.$$typeof){case a:case s:je=!0}}if(je)return je=w,he=he(je),w=ge===""?"."+ce(je,0):ge,Q(he)?(ee="",w!=null&&(ee=w.replace(ve,"$&/")+"/"),D(he,A,ee,"",function(Ae){return Ae})):he!=null&&(Te(he)&&(he=pe(he,ee+(!he.key||je&&je.key===he.key?"":(""+he.key).replace(ve,"$&/")+"/")+w)),A.push(he)),1;if(je=0,ge=ge===""?".":ge+":",Q(w))for(var te=0;te<w.length;te++){O=w[te];var Ce=ge+ce(O,te);je+=D(O,A,ee,Ce,he)}else if(Ce=N(w),typeof Ce=="function")for(w=Ce.call(w),te=0;!(O=w.next()).done;)O=O.value,Ce=ge+ce(O,te++),je+=D(O,A,ee,Ce,he);else if(O==="object")throw A=String(w),Error("Objects are not valid as a React child (found: "+(A==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":A)+"). If you meant to render a collection of children, use an array instead.");return je}function R(w,A,ee){if(w==null)return w;var ge=[],he=0;return D(w,ge,"","",function(O){return A.call(ee,O,he++)}),ge}function U(w){if(w._status===-1){var A=w._result;A=A(),A.then(function(ee){(w._status===0||w._status===-1)&&(w._status=1,w._result=ee)},function(ee){(w._status===0||w._status===-1)&&(w._status=2,w._result=ee)}),w._status===-1&&(w._status=0,w._result=A)}if(w._status===1)return w._result.default;throw w._result}var X={current:null},M={transition:null},ue={ReactCurrentDispatcher:X,ReactCurrentBatchConfig:M,ReactCurrentOwner:Z};function V(){throw Error("act(...) is not supported in production builds of React.")}return ut.Children={map:R,forEach:function(w,A,ee){R(w,function(){A.apply(this,arguments)},ee)},count:function(w){var A=0;return R(w,function(){A++}),A},toArray:function(w){return R(w,function(A){return A})||[]},only:function(w){if(!Te(w))throw Error("React.Children.only expected to receive a single React element child.");return w}},ut.Component=z,ut.Fragment=r,ut.Profiler=c,ut.PureComponent=F,ut.StrictMode=l,ut.Suspense=_,ut.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ue,ut.act=V,ut.cloneElement=function(w,A,ee){if(w==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+w+".");var ge=I({},w.props),he=w.key,O=w.ref,je=w._owner;if(A!=null){if(A.ref!==void 0&&(O=A.ref,je=Z.current),A.key!==void 0&&(he=""+A.key),w.type&&w.type.defaultProps)var te=w.type.defaultProps;for(Ce in A)E.call(A,Ce)&&!oe.hasOwnProperty(Ce)&&(ge[Ce]=A[Ce]===void 0&&te!==void 0?te[Ce]:A[Ce])}var Ce=arguments.length-2;if(Ce===1)ge.children=ee;else if(1<Ce){te=Array(Ce);for(var Ae=0;Ae<Ce;Ae++)te[Ae]=arguments[Ae+2];ge.children=te}return{$$typeof:a,type:w.type,key:he,ref:O,props:ge,_owner:je}},ut.createContext=function(w){return w={$$typeof:m,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},w.Provider={$$typeof:d,_context:w},w.Consumer=w},ut.createElement=le,ut.createFactory=function(w){var A=le.bind(null,w);return A.type=w,A},ut.createRef=function(){return{current:null}},ut.forwardRef=function(w){return{$$typeof:p,render:w}},ut.isValidElement=Te,ut.lazy=function(w){return{$$typeof:b,_payload:{_status:-1,_result:w},_init:U}},ut.memo=function(w,A){return{$$typeof:y,type:w,compare:A===void 0?null:A}},ut.startTransition=function(w){var A=M.transition;M.transition={};try{w()}finally{M.transition=A}},ut.unstable_act=V,ut.useCallback=function(w,A){return X.current.useCallback(w,A)},ut.useContext=function(w){return X.current.useContext(w)},ut.useDebugValue=function(){},ut.useDeferredValue=function(w){return X.current.useDeferredValue(w)},ut.useEffect=function(w,A){return X.current.useEffect(w,A)},ut.useId=function(){return X.current.useId()},ut.useImperativeHandle=function(w,A,ee){return X.current.useImperativeHandle(w,A,ee)},ut.useInsertionEffect=function(w,A){return X.current.useInsertionEffect(w,A)},ut.useLayoutEffect=function(w,A){return X.current.useLayoutEffect(w,A)},ut.useMemo=function(w,A){return X.current.useMemo(w,A)},ut.useReducer=function(w,A,ee){return X.current.useReducer(w,A,ee)},ut.useRef=function(w){return X.current.useRef(w)},ut.useState=function(w){return X.current.useState(w)},ut.useSyncExternalStore=function(w,A,ee){return X.current.useSyncExternalStore(w,A,ee)},ut.useTransition=function(){return X.current.useTransition()},ut.version="18.3.1",ut}var Vm;function rd(){return Vm||(Vm=1,gu.exports=$p()),gu.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 Gm;function Ep(){if(Gm)return yl;Gm=1;var a=rd(),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,c=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function m(p,_,y){var b,x={},N=null,L=null;y!==void 0&&(N=""+y),_.key!==void 0&&(N=""+_.key),_.ref!==void 0&&(L=_.ref);for(b in _)l.call(_,b)&&!d.hasOwnProperty(b)&&(x[b]=_[b]);if(p&&p.defaultProps)for(b in _=p.defaultProps,_)x[b]===void 0&&(x[b]=_[b]);return{$$typeof:s,type:p,key:N,ref:L,props:x,_owner:c.current}}return yl.Fragment=r,yl.jsx=m,yl.jsxs=m,yl}var Km;function Tp(){return Km||(Km=1,_u.exports=Ep()),_u.exports}var e=Tp(),h=rd();const Kt=Cp(h);var Oo={},vu={exports:{}},Pn={},yu={exports:{}},xu={};/**
|
|
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
|
-
*/var Qm;function Ap(){return Qm||(Qm=1,(function(a){function s(M,ue){var V=M.length;M.push(ue);e:for(;0<V;){var w=V-1>>>1,A=M[w];if(0<c(A,ue))M[w]=ue,M[V]=A,V=w;else break e}}function r(M){return M.length===0?null:M[0]}function l(M){if(M.length===0)return null;var ue=M[0],V=M.pop();if(V!==ue){M[0]=V;e:for(var w=0,A=M.length,ee=A>>>1;w<ee;){var ge=2*(w+1)-1,he=M[ge],O=ge+1,je=M[O];if(0>c(he,V))O<A&&0>c(je,he)?(M[w]=je,M[O]=V,w=O):(M[w]=he,M[ge]=V,w=ge);else if(O<A&&0>c(je,V))M[w]=je,M[O]=V,w=O;else break e}}return ue}function c(M,ue){var V=M.sortIndex-ue.sortIndex;return V!==0?V:M.id-ue.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var m=Date,p=m.now();a.unstable_now=function(){return m.now()-p}}var _=[],y=[],b=1,x=null,N=3,L=!1,I=!1,C=!1,z=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function q(M){for(var ue=r(y);ue!==null;){if(ue.callback===null)l(y);else if(ue.startTime<=M)l(y),ue.sortIndex=ue.expirationTime,s(_,ue);else break;ue=r(y)}}function Q(M){if(C=!1,q(M),!I)if(r(_)!==null)I=!0,U(E);else{var ue=r(y);ue!==null&&X(Q,ue.startTime-M)}}function E(M,ue){I=!1,C&&(C=!1,B(le),le=-1),L=!0;var V=N;try{for(q(ue),x=r(_);x!==null&&(!(x.expirationTime>ue)||M&&!Me());){var w=x.callback;if(typeof w=="function"){x.callback=null,N=x.priorityLevel;var A=w(x.expirationTime<=ue);ue=a.unstable_now(),typeof A=="function"?x.callback=A:x===r(_)&&l(_),q(ue)}else l(_);x=r(_)}if(x!==null)var ee=!0;else{var ge=r(y);ge!==null&&X(Q,ge.startTime-ue),ee=!1}return ee}finally{x=null,N=V,L=!1}}var Z=!1,oe=null,le=-1,pe=5,Te=-1;function Me(){return!(a.unstable_now()-Te<pe)}function ve(){if(oe!==null){var M=a.unstable_now();Te=M;var ue=!0;try{ue=oe(!0,M)}finally{ue?ce():(Z=!1,oe=null)}}else Z=!1}var ce;if(typeof F=="function")ce=function(){F(ve)};else if(typeof MessageChannel<"u"){var D=new MessageChannel,R=D.port2;D.port1.onmessage=ve,ce=function(){R.postMessage(null)}}else ce=function(){z(ve,0)};function U(M){oe=M,Z||(Z=!0,ce())}function X(M,ue){le=z(function(){M(a.unstable_now())},ue)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(M){M.callback=null},a.unstable_continueExecution=function(){I||L||(I=!0,U(E))},a.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):pe=0<M?Math.floor(1e3/M):5},a.unstable_getCurrentPriorityLevel=function(){return N},a.unstable_getFirstCallbackNode=function(){return r(_)},a.unstable_next=function(M){switch(N){case 1:case 2:case 3:var ue=3;break;default:ue=N}var V=N;N=ue;try{return M()}finally{N=V}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(M,ue){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var V=N;N=M;try{return ue()}finally{N=V}},a.unstable_scheduleCallback=function(M,ue,V){var w=a.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?w+V:w):V=w,M){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=V+A,M={id:b++,callback:ue,priorityLevel:M,startTime:V,expirationTime:A,sortIndex:-1},V>w?(M.sortIndex=V,s(y,M),r(_)===null&&M===r(y)&&(C?(B(le),le=-1):C=!0,X(Q,V-w))):(M.sortIndex=A,s(_,M),I||L||(I=!0,U(E))),M},a.unstable_shouldYield=Me,a.unstable_wrapCallback=function(M){var ue=N;return function(){var V=N;N=ue;try{return M.apply(this,arguments)}finally{N=V}}}})(xu)),xu}var Jm;function Rp(){return Jm||(Jm=1,yu.exports=Ap()),yu.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 Ym;function Lp(){if(Ym)return Pn;Ym=1;var a=rd(),s=Rp();function r(t){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=1;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,c={};function d(t,n){m(t,n),m(t+"Capture",n)}function m(t,n){for(c[t]=n,t=0;t<n.length;t++)l.add(n[t])}var p=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_=Object.prototype.hasOwnProperty,y=/^[: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]*$/,b={},x={};function N(t){return _.call(x,t)?!0:_.call(b,t)?!1:y.test(t)?x[t]=!0:(b[t]=!0,!1)}function L(t,n,i,o){if(i!==null&&i.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return o?!1:i!==null?!i.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function I(t,n,i,o){if(n===null||typeof n>"u"||L(t,n,i,o))return!0;if(o)return!1;if(i!==null)switch(i.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(t,n,i,o,f,g,j){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=o,this.attributeNamespace=f,this.mustUseProperty=i,this.propertyName=t,this.type=n,this.sanitizeURL=g,this.removeEmptyString=j}var z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){z[t]=new C(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var n=t[0];z[n]=new C(n,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){z[t]=new C(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){z[t]=new C(t,2,!1,t,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(t){z[t]=new C(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){z[t]=new C(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){z[t]=new C(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){z[t]=new C(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){z[t]=new C(t,5,!1,t.toLowerCase(),null,!1,!1)});var B=/[\-:]([a-z])/g;function F(t){return t[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(t){var n=t.replace(B,F);z[n]=new C(n,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var n=t.replace(B,F);z[n]=new C(n,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var n=t.replace(B,F);z[n]=new C(n,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){z[t]=new C(t,1,!1,t.toLowerCase(),null,!1,!1)}),z.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){z[t]=new C(t,1,!1,t.toLowerCase(),null,!0,!0)});function q(t,n,i,o){var f=z.hasOwnProperty(n)?z[n]:null;(f!==null?f.type!==0:o||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(I(n,i,f,o)&&(i=null),o||f===null?N(n)&&(i===null?t.removeAttribute(n):t.setAttribute(n,""+i)):f.mustUseProperty?t[f.propertyName]=i===null?f.type===3?!1:"":i:(n=f.attributeName,o=f.attributeNamespace,i===null?t.removeAttribute(n):(f=f.type,i=f===3||f===4&&i===!0?"":""+i,o?t.setAttributeNS(o,n,i):t.setAttribute(n,i))))}var Q=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),Z=Symbol.for("react.portal"),oe=Symbol.for("react.fragment"),le=Symbol.for("react.strict_mode"),pe=Symbol.for("react.profiler"),Te=Symbol.for("react.provider"),Me=Symbol.for("react.context"),ve=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),M=Symbol.iterator;function ue(t){return t===null||typeof t!="object"?null:(t=M&&t[M]||t["@@iterator"],typeof t=="function"?t:null)}var V=Object.assign,w;function A(t){if(w===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);w=n&&n[1]||""}return`
|
|
34
|
-
`+w+t}var ee=!1;function ge(t,n){if(!t||ee)return"";ee=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(de){var o=de}Reflect.construct(t,[],n)}else{try{n.call()}catch(de){o=de}t.call(n.prototype)}else{try{throw Error()}catch(de){o=de}t()}}catch(de){if(de&&o&&typeof de.stack=="string"){for(var f=de.stack.split(`
|
|
35
|
-
`),g=o.stack.split(`
|
|
36
|
-
`),j=f.length-1,P=g.length-1;1<=j&&0<=P&&f[j]!==g[P];)P--;for(;1<=j&&0<=P;j--,P--)if(f[j]!==g[P]){if(j!==1||P!==1)do if(j--,P--,0>P||f[j]!==g[P]){var H=`
|
|
37
|
-
`+f[j].replace(" at new "," at ");return t.displayName&&H.includes("<anonymous>")&&(H=H.replace("<anonymous>",t.displayName)),H}while(1<=j&&0<=P);break}}}finally{ee=!1,Error.prepareStackTrace=i}return(t=t?t.displayName||t.name:"")?A(t):""}function he(t){switch(t.tag){case 5:return A(t.type);case 16:return A("Lazy");case 13:return A("Suspense");case 19:return A("SuspenseList");case 0:case 2:case 15:return t=ge(t.type,!1),t;case 11:return t=ge(t.type.render,!1),t;case 1:return t=ge(t.type,!0),t;default:return""}}function O(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oe:return"Fragment";case Z:return"Portal";case pe:return"Profiler";case le:return"StrictMode";case ce:return"Suspense";case D:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Me:return(t.displayName||"Context")+".Consumer";case Te:return(t._context.displayName||"Context")+".Provider";case ve:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case R:return n=t.displayName||null,n!==null?n:O(t.type)||"Memo";case U:n=t._payload,t=t._init;try{return O(t(n))}catch{}}return null}function je(t){var n=t.type;switch(t.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=n.render,t=t.displayName||t.name||"",n.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return O(n);case 8:return n===le?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function te(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ce(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ae(t){var n=Ce(t)?"checked":"value",i=Object.getOwnPropertyDescriptor(t.constructor.prototype,n),o=""+t[n];if(!t.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var f=i.get,g=i.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return f.call(this)},set:function(j){o=""+j,g.call(this,j)}}),Object.defineProperty(t,n,{enumerable:i.enumerable}),{getValue:function(){return o},setValue:function(j){o=""+j},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Ge(t){t._valueTracker||(t._valueTracker=Ae(t))}function fe(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var i=n.getValue(),o="";return t&&(o=Ce(t)?t.checked?"true":"false":t.value),t=o,t!==i?(n.setValue(t),!0):!1}function Re(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ie(t,n){var i=n.checked;return V({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??t._wrapperState.initialChecked})}function se(t,n){var i=n.defaultValue==null?"":n.defaultValue,o=n.checked!=null?n.checked:n.defaultChecked;i=te(n.value!=null?n.value:i),t._wrapperState={initialChecked:o,initialValue:i,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function ye(t,n){n=n.checked,n!=null&&q(t,"checked",n,!1)}function _e(t,n){ye(t,n);var i=te(n.value),o=n.type;if(i!=null)o==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+i):t.value!==""+i&&(t.value=""+i);else if(o==="submit"||o==="reset"){t.removeAttribute("value");return}n.hasOwnProperty("value")?Ye(t,n.type,i):n.hasOwnProperty("defaultValue")&&Ye(t,n.type,te(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(t.defaultChecked=!!n.defaultChecked)}function qe(t,n,i){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var o=n.type;if(!(o!=="submit"&&o!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+t._wrapperState.initialValue,i||n===t.value||(t.value=n),t.defaultValue=n}i=t.name,i!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,i!==""&&(t.name=i)}function Ye(t,n,i){(n!=="number"||Re(t.ownerDocument)!==t)&&(i==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+i&&(t.defaultValue=""+i))}var ie=Array.isArray;function me(t,n,i,o){if(t=t.options,n){n={};for(var f=0;f<i.length;f++)n["$"+i[f]]=!0;for(i=0;i<t.length;i++)f=n.hasOwnProperty("$"+t[i].value),t[i].selected!==f&&(t[i].selected=f),f&&o&&(t[i].defaultSelected=!0)}else{for(i=""+te(i),n=null,f=0;f<t.length;f++){if(t[f].value===i){t[f].selected=!0,o&&(t[f].defaultSelected=!0);return}n!==null||t[f].disabled||(n=t[f])}n!==null&&(n.selected=!0)}}function be(t,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return V({},n,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function G(t,n){var i=n.value;if(i==null){if(i=n.children,n=n.defaultValue,i!=null){if(n!=null)throw Error(r(92));if(ie(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),i=n}t._wrapperState={initialValue:te(i)}}function ke(t,n){var i=te(n.value),o=te(n.defaultValue);i!=null&&(i=""+i,i!==t.value&&(t.value=i),n.defaultValue==null&&t.defaultValue!==i&&(t.defaultValue=i)),o!=null&&(t.defaultValue=""+o)}function Xe(t){var n=t.textContent;n===t._wrapperState.initialValue&&n!==""&&n!==null&&(t.value=n)}function J(t){switch(t){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 T(t,n){return t==null||t==="http://www.w3.org/1999/xhtml"?J(n):t==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Y,Se=(function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,i,o,f){MSApp.execUnsafeLocalFunction(function(){return t(n,i,o,f)})}:t})(function(t,n){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=n;else{for(Y=Y||document.createElement("div"),Y.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=Y.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;n.firstChild;)t.appendChild(n.firstChild)}});function ze(t,n){if(n){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=n;return}}t.textContent=n}var Ke={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},nt=["Webkit","ms","Moz","O"];Object.keys(Ke).forEach(function(t){nt.forEach(function(n){n=n+t.charAt(0).toUpperCase()+t.substring(1),Ke[n]=Ke[t]})});function dt(t,n,i){return n==null||typeof n=="boolean"||n===""?"":i||typeof n!="number"||n===0||Ke.hasOwnProperty(t)&&Ke[t]?(""+n).trim():n+"px"}function yt(t,n){t=t.style;for(var i in n)if(n.hasOwnProperty(i)){var o=i.indexOf("--")===0,f=dt(i,n[i],o);i==="float"&&(i="cssFloat"),o?t.setProperty(i,f):t[i]=f}}var ht=V({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 Et(t,n){if(n){if(ht[t]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,t));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Ut(t,n){if(t.indexOf("-")===-1)return typeof n.is=="string";switch(t){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 De=null;function it(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var tt=null,jt=null,ft=null;function Zt(t){if(t=$a(t)){if(typeof tt!="function")throw Error(r(280));var n=t.stateNode;n&&(n=ai(n),tt(t.stateNode,t.type,n))}}function we(t){jt?ft?ft.push(t):ft=[t]:jt=t}function $e(){if(jt){var t=jt,n=ft;if(ft=jt=null,Zt(t),n)for(t=0;t<n.length;t++)Zt(n[t])}}function Oe(t,n){return t(n)}function mt(){}var pt=!1;function _t(t,n,i){if(pt)return t(n,i);pt=!0;try{return Oe(t,n,i)}finally{pt=!1,(jt!==null||ft!==null)&&(mt(),$e())}}function nn(t,n){var i=t.stateNode;if(i===null)return null;var o=ai(i);if(o===null)return null;i=o[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(t=t.type,o=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!o;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var fn=!1;if(p)try{var Wt={};Object.defineProperty(Wt,"passive",{get:function(){fn=!0}}),window.addEventListener("test",Wt,Wt),window.removeEventListener("test",Wt,Wt)}catch{fn=!1}function Wa(t,n,i,o,f,g,j,P,H){var de=Array.prototype.slice.call(arguments,3);try{n.apply(i,de)}catch(Ee){this.onError(Ee)}}var Qn=!1,Fn=null,ma=!1,Rr=null,ki={onError:function(t){Qn=!0,Fn=t}};function ot(t,n,i,o,f,g,j,P,H){Qn=!1,Fn=null,Wa.apply(ki,arguments)}function Qt(t,n,i,o,f,g,j,P,H){if(ot.apply(this,arguments),Qn){if(Qn){var de=Fn;Qn=!1,Fn=null}else throw Error(r(198));ma||(ma=!0,Rr=de)}}function Jn(t){var n=t,i=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(i=n.return),t=n.return;while(t)}return n.tag===3?i:null}function Mt(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function Ha(t){if(Jn(t)!==t)throw Error(r(188))}function Pl(t){var n=t.alternate;if(!n){if(n=Jn(t),n===null)throw Error(r(188));return n!==t?null:t}for(var i=t,o=n;;){var f=i.return;if(f===null)break;var g=f.alternate;if(g===null){if(o=f.return,o!==null){i=o;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===i)return Ha(f),t;if(g===o)return Ha(f),n;g=g.sibling}throw Error(r(188))}if(i.return!==o.return)i=f,o=g;else{for(var j=!1,P=f.child;P;){if(P===i){j=!0,i=f,o=g;break}if(P===o){j=!0,o=f,i=g;break}P=P.sibling}if(!j){for(P=g.child;P;){if(P===i){j=!0,i=g,o=f;break}if(P===o){j=!0,o=g,i=f;break}P=P.sibling}if(!j)throw Error(r(189))}}if(i.alternate!==o)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?t:n}function Si(t){return t=Pl(t),t!==null?Lr(t):null}function Lr(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var n=Lr(t);if(n!==null)return n;t=t.sibling}return null}var Ni=s.unstable_scheduleCallback,Va=s.unstable_cancelCallback,Il=s.unstable_shouldYield,Mr=s.unstable_requestPaint,zt=s.unstable_now,Ol=s.unstable_getCurrentPriorityLevel,Ga=s.unstable_ImmediatePriority,Ds=s.unstable_UserBlockingPriority,ms=s.unstable_NormalPriority,zr=s.unstable_LowPriority,fa=s.unstable_IdlePriority,Ka=null,hn=null;function Dl(t){if(hn&&typeof hn.onCommitFiberRoot=="function")try{hn.onCommitFiberRoot(Ka,t,void 0,(t.current.flags&128)===128)}catch{}}var kn=Math.clz32?Math.clz32:qn,Xo=Math.log,Zo=Math.LN2;function qn(t){return t>>>=0,t===0?32:31-(Xo(t)/Zo|0)|0}var Yn=64,Fs=4194304;function Xn(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ft(t,n){var i=t.pendingLanes;if(i===0)return 0;var o=0,f=t.suspendedLanes,g=t.pingedLanes,j=i&268435455;if(j!==0){var P=j&~f;P!==0?o=Xn(P):(g&=j,g!==0&&(o=Xn(g)))}else j=i&~f,j!==0?o=Xn(j):g!==0&&(o=Xn(g));if(o===0)return 0;if(n!==0&&n!==o&&(n&f)===0&&(f=o&-o,g=n&-n,f>=g||f===16&&(g&4194240)!==0))return n;if((o&4)!==0&&(o|=i&16),n=t.entangledLanes,n!==0)for(t=t.entanglements,n&=o;0<n;)i=31-kn(n),f=1<<i,o|=t[i],n&=~f;return o}function on(t,n){switch(t){case 1:case 2:case 4:return n+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 n+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 Pr(t,n){for(var i=t.suspendedLanes,o=t.pingedLanes,f=t.expirationTimes,g=t.pendingLanes;0<g;){var j=31-kn(g),P=1<<j,H=f[j];H===-1?((P&i)===0||(P&o)!==0)&&(f[j]=on(P,n)):H<=n&&(t.expiredLanes|=P),g&=~P}}function Ss(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function qs(){var t=Yn;return Yn<<=1,(Yn&4194240)===0&&(Yn=64),t}function Ir(t){for(var n=[],i=0;31>i;i++)n.push(t);return n}function Ot(t,n,i){t.pendingLanes|=n,n!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,n=31-kn(n),t[n]=i}function Ns(t,n){var i=t.pendingLanes&~n;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=n,t.mutableReadLanes&=n,t.entangledLanes&=n,n=t.entanglements;var o=t.eventTimes;for(t=t.expirationTimes;0<i;){var f=31-kn(i),g=1<<f;n[f]=0,o[f]=-1,t[f]=-1,i&=~g}}function Or(t,n){var i=t.entangledLanes|=n;for(t=t.entanglements;i;){var o=31-kn(i),f=1<<o;f&n|t[o]&n&&(t[o]|=n),i&=~f}}var ct=0;function Dr(t){return t&=-t,1<t?4<t?(t&268435455)!==0?16:536870912:4:1}var Ci,Qa,$i,Ei,Ja,Cs=!1,Bs=[],Jt=null,pn=null,$s=null,fs=new Map,kt=new Map,sn=[],Bn="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 Fr(t,n){switch(t){case"focusin":case"focusout":Jt=null;break;case"dragenter":case"dragleave":pn=null;break;case"mouseover":case"mouseout":$s=null;break;case"pointerover":case"pointerout":fs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":kt.delete(n.pointerId)}}function Us(t,n,i,o,f,g){return t===null||t.nativeEvent!==g?(t={blockedOn:n,domEventName:i,eventSystemFlags:o,nativeEvent:g,targetContainers:[f]},n!==null&&(n=$a(n),n!==null&&Qa(n)),t):(t.eventSystemFlags|=o,n=t.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),t)}function Fl(t,n,i,o,f){switch(n){case"focusin":return Jt=Us(Jt,t,n,i,o,f),!0;case"dragenter":return pn=Us(pn,t,n,i,o,f),!0;case"mouseover":return $s=Us($s,t,n,i,o,f),!0;case"pointerover":var g=f.pointerId;return fs.set(g,Us(fs.get(g)||null,t,n,i,o,f)),!0;case"gotpointercapture":return g=f.pointerId,kt.set(g,Us(kt.get(g)||null,t,n,i,o,f)),!0}return!1}function Un(t){var n=na(t.target);if(n!==null){var i=Jn(n);if(i!==null){if(n=i.tag,n===13){if(n=Mt(i),n!==null){t.blockedOn=n,Ja(t.priority,function(){$i(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ya(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var i=ha(t.domEventName,t.eventSystemFlags,n[0],t.nativeEvent);if(i===null){i=t.nativeEvent;var o=new i.constructor(i.type,i);De=o,i.target.dispatchEvent(o),De=null}else return n=$a(i),n!==null&&Qa(n),t.blockedOn=i,!1;n.shift()}return!0}function Xa(t,n,i){Ya(t)&&i.delete(n)}function ql(){Cs=!1,Jt!==null&&Ya(Jt)&&(Jt=null),pn!==null&&Ya(pn)&&(pn=null),$s!==null&&Ya($s)&&($s=null),fs.forEach(Xa),kt.forEach(Xa)}function Ws(t,n){t.blockedOn===n&&(t.blockedOn=null,Cs||(Cs=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,ql)))}function hs(t){function n(f){return Ws(f,t)}if(0<Bs.length){Ws(Bs[0],t);for(var i=1;i<Bs.length;i++){var o=Bs[i];o.blockedOn===t&&(o.blockedOn=null)}}for(Jt!==null&&Ws(Jt,t),pn!==null&&Ws(pn,t),$s!==null&&Ws($s,t),fs.forEach(n),kt.forEach(n),i=0;i<sn.length;i++)o=sn[i],o.blockedOn===t&&(o.blockedOn=null);for(;0<sn.length&&(i=sn[0],i.blockedOn===null);)Un(i),i.blockedOn===null&&sn.shift()}var Hs=Q.ReactCurrentBatchConfig,Za=!0;function Ti(t,n,i,o){var f=ct,g=Hs.transition;Hs.transition=null;try{ct=1,Vs(t,n,i,o)}finally{ct=f,Hs.transition=g}}function Bl(t,n,i,o){var f=ct,g=Hs.transition;Hs.transition=null;try{ct=4,Vs(t,n,i,o)}finally{ct=f,Hs.transition=g}}function Vs(t,n,i,o){if(Za){var f=ha(t,n,i,o);if(f===null)Xr(t,n,o,Zn,i),Fr(t,o);else if(Fl(f,t,n,i,o))o.stopPropagation();else if(Fr(t,o),n&4&&-1<Bn.indexOf(t)){for(;f!==null;){var g=$a(f);if(g!==null&&Ci(g),g=ha(t,n,i,o),g===null&&Xr(t,n,o,Zn,i),g===f)break;f=g}f!==null&&o.stopPropagation()}else Xr(t,n,o,null,i)}}var Zn=null;function ha(t,n,i,o){if(Zn=null,t=it(o),t=na(t),t!==null)if(n=Jn(t),n===null)t=null;else if(i=n.tag,i===13){if(t=Mt(n),t!==null)return t;t=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null);return Zn=t,null}function qr(t){switch(t){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(Ol()){case Ga:return 1;case Ds:return 4;case ms:case zr:return 16;case fa:return 536870912;default:return 16}default:return 16}}var es=null,er=null,ps=null;function pa(){if(ps)return ps;var t,n=er,i=n.length,o,f="value"in es?es.value:es.textContent,g=f.length;for(t=0;t<i&&n[t]===f[t];t++);var j=i-t;for(o=1;o<=j&&n[i-o]===f[g-o];o++);return ps=f.slice(t,1<o?1-o:void 0)}function Br(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Ht(){return!0}function tr(){return!1}function _n(t){function n(i,o,f,g,j){this._reactName=i,this._targetInst=f,this.type=o,this.nativeEvent=g,this.target=j,this.currentTarget=null;for(var P in t)t.hasOwnProperty(P)&&(i=t[P],this[P]=i?i(g):g[P]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Ht:tr,this.isPropagationStopped=tr,this}return V(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Ht)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Ht)},persist:function(){},isPersistent:Ht}),n}var Gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nr=_n(Gs),Ks=V({},Gs,{view:0,detail:0}),Ai=_n(Ks),Ur,sr,_a,ar=V({},Ks,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qs,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==_a&&(_a&&t.type==="mousemove"?(Ur=t.screenX-_a.screenX,sr=t.screenY-_a.screenY):sr=Ur=0,_a=t),Ur)},movementY:function(t){return"movementY"in t?t.movementY:sr}}),Ri=_n(ar),Ul=V({},ar,{dataTransfer:0}),Li=_n(Ul),Wl=V({},Ks,{relatedTarget:0}),rr=_n(Wl),Mi=V({},Gs,{animationName:0,elapsedTime:0,pseudoElement:0}),Hl=_n(Mi),Tn=V({},Gs,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Es=_n(Tn),Ts=V({},Gs,{data:0}),Wr=_n(Ts),zi={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pi={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"},ec={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ga(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=ec[t])?!!n[t]:!1}function Qs(){return ga}var _s=V({},Ks,{key:function(t){if(t.key){var n=zi[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=Br(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Pi[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qs,charCode:function(t){return t.type==="keypress"?Br(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Br(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Js=_n(_s),Vl=V({},ar,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ii=_n(Vl),Gl=V({},Ks,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qs}),tc=_n(Gl),nc=V({},Gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Oi=_n(nc),va=V({},ar,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Di=_n(va),Kl=[9,13,27,32],ir=p&&"CompositionEvent"in window,ya=null;p&&"documentMode"in document&&(ya=document.documentMode);var xa=p&&"TextEvent"in window&&!ya,Hr=p&&(!ir||ya&&8<ya&&11>=ya),Ql=" ",ba=!1;function Vr(t,n){switch(t){case"keyup":return Kl.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fi(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ys=!1;function Jl(t,n){switch(t){case"compositionend":return Fi(n);case"keypress":return n.which!==32?null:(ba=!0,Ql);case"textInput":return t=n.data,t===Ql&&ba?null:t;default:return null}}function sc(t,n){if(Ys)return t==="compositionend"||!ir&&Vr(t,n)?(t=pa(),ps=er=es=null,Ys=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Hr&&n.locale!=="ko"?null:n.data;default:return null}}var Xs={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 wa(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!Xs[t.type]:n==="textarea"}function Yl(t,n,i,o){we(o),n=Zr(n,"onChange"),0<n.length&&(i=new nr("onChange","change",null,i,o),t.push({event:i,listeners:n}))}var As=null,Zs=null;function ac(t){Zi(t,0)}function ea(t){var n=sa(t);if(fe(n))return t}function Gr(t,n){if(t==="change")return n}var Xl=!1;if(p){var qi;if(p){var Bi="oninput"in document;if(!Bi){var Ui=document.createElement("div");Ui.setAttribute("oninput","return;"),Bi=typeof Ui.oninput=="function"}qi=Bi}else qi=!1;Xl=qi&&(!document.documentMode||9<document.documentMode)}function Zl(){As&&(As.detachEvent("onpropertychange",Wi),Zs=As=null)}function Wi(t){if(t.propertyName==="value"&&ea(Zs)){var n=[];Yl(n,Zs,t,it(t)),_t(ac,n)}}function rc(t,n,i){t==="focusin"?(Zl(),As=n,Zs=i,As.attachEvent("onpropertychange",Wi)):t==="focusout"&&Zl()}function ic(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ea(Zs)}function Hi(t,n){if(t==="click")return ea(n)}function lc(t,n){if(t==="input"||t==="change")return ea(n)}function eo(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var An=typeof Object.is=="function"?Object.is:eo;function lr(t,n){if(An(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var i=Object.keys(t),o=Object.keys(n);if(i.length!==o.length)return!1;for(o=0;o<i.length;o++){var f=i[o];if(!_.call(n,f)||!An(t[f],n[f]))return!1}return!0}function Vi(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function or(t,n){var i=Vi(t);t=0;for(var o;i;){if(i.nodeType===3){if(o=t+i.textContent.length,t<=n&&o>=n)return{node:i,offset:n-t};t=o}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Vi(i)}}function Gi(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?Gi(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function cr(){for(var t=window,n=Re();n instanceof t.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)t=n.contentWindow;else break;n=Re(t.document)}return n}function Kr(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}function oc(t){var n=cr(),i=t.focusedElem,o=t.selectionRange;if(n!==i&&i&&i.ownerDocument&&Gi(i.ownerDocument.documentElement,i)){if(o!==null&&Kr(i)){if(n=o.start,t=o.end,t===void 0&&(t=n),"selectionStart"in i)i.selectionStart=n,i.selectionEnd=Math.min(t,i.value.length);else if(t=(n=i.ownerDocument||document)&&n.defaultView||window,t.getSelection){t=t.getSelection();var f=i.textContent.length,g=Math.min(o.start,f);o=o.end===void 0?g:Math.min(o.end,f),!t.extend&&g>o&&(f=o,o=g,g=f),f=or(i,g);var j=or(i,o);f&&j&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==j.node||t.focusOffset!==j.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),t.removeAllRanges(),g>o?(t.addRange(n),t.extend(j.node,j.offset)):(n.setEnd(j.node,j.offset),t.addRange(n)))}}for(n=[],t=i;t=t.parentNode;)t.nodeType===1&&n.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<n.length;i++)t=n[i],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var cc=p&&"documentMode"in document&&11>=document.documentMode,ta=null,Ki=null,ja=null,Qi=!1;function Ji(t,n,i){var o=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Qi||ta==null||ta!==Re(o)||(o=ta,"selectionStart"in o&&Kr(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),ja&&lr(ja,o)||(ja=o,o=Zr(Ki,"onSelect"),0<o.length&&(n=new nr("onSelect","select",null,n,i),t.push({event:n,listeners:o}),n.target=ta)))}function ur(t,n){var i={};return i[t.toLowerCase()]=n.toLowerCase(),i["Webkit"+t]="webkit"+n,i["Moz"+t]="moz"+n,i}var ka={animationend:ur("Animation","AnimationEnd"),animationiteration:ur("Animation","AnimationIteration"),animationstart:ur("Animation","AnimationStart"),transitionend:ur("Transition","TransitionEnd")},Yi={},Xi={};p&&(Xi=document.createElement("div").style,"AnimationEvent"in window||(delete ka.animationend.animation,delete ka.animationiteration.animation,delete ka.animationstart.animation),"TransitionEvent"in window||delete ka.transitionend.transition);function dr(t){if(Yi[t])return Yi[t];if(!ka[t])return t;var n=ka[t],i;for(i in n)if(n.hasOwnProperty(i)&&i in Xi)return Yi[t]=n[i];return t}var to=dr("animationend"),Sn=dr("animationiteration"),St=dr("animationstart"),en=dr("transitionend"),Qr=new Map,no="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 gn(t,n){Qr.set(t,n),d(n,[t])}for(var ts=0;ts<no.length;ts++){var Wn=no[ts],Sa=Wn.toLowerCase(),mr=Wn[0].toUpperCase()+Wn.slice(1);gn(Sa,"on"+mr)}gn(to,"onAnimationEnd"),gn(Sn,"onAnimationIteration"),gn(St,"onAnimationStart"),gn("dblclick","onDoubleClick"),gn("focusin","onFocus"),gn("focusout","onBlur"),gn(en,"onTransitionEnd"),m("onMouseEnter",["mouseout","mouseover"]),m("onMouseLeave",["mouseout","mouseover"]),m("onPointerEnter",["pointerout","pointerover"]),m("onPointerLeave",["pointerout","pointerover"]),d("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),d("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),d("onBeforeInput",["compositionend","keypress","textInput","paste"]),d("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),d("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),d("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gs="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(" "),fr=new Set("cancel close invalid load scroll toggle".split(" ").concat(gs));function Jr(t,n,i){var o=t.type||"unknown-event";t.currentTarget=i,Qt(o,n,void 0,t),t.currentTarget=null}function Zi(t,n){n=(n&4)!==0;for(var i=0;i<t.length;i++){var o=t[i],f=o.event;o=o.listeners;e:{var g=void 0;if(n)for(var j=o.length-1;0<=j;j--){var P=o[j],H=P.instance,de=P.currentTarget;if(P=P.listener,H!==g&&f.isPropagationStopped())break e;Jr(f,P,de),g=H}else for(j=0;j<o.length;j++){if(P=o[j],H=P.instance,de=P.currentTarget,P=P.listener,H!==g&&f.isPropagationStopped())break e;Jr(f,P,de),g=H}}}if(ma)throw t=Rr,ma=!1,Rr=null,t}function Ct(t,n){var i=n[al];i===void 0&&(i=n[al]=new Set);var o=t+"__bubble";i.has(o)||(el(n,t,2,!1),i.add(o))}function hr(t,n,i){var o=0;n&&(o|=4),el(i,t,o,n)}var Yr="_reactListening"+Math.random().toString(36).slice(2);function pr(t){if(!t[Yr]){t[Yr]=!0,l.forEach(function(i){i!=="selectionchange"&&(fr.has(i)||hr(i,!1,t),hr(i,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[Yr]||(n[Yr]=!0,hr("selectionchange",!1,n))}}function el(t,n,i,o){switch(qr(n)){case 1:var f=Ti;break;case 4:f=Bl;break;default:f=Vs}i=f.bind(null,n,i,t),f=void 0,!fn||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),o?f!==void 0?t.addEventListener(n,i,{capture:!0,passive:f}):t.addEventListener(n,i,!0):f!==void 0?t.addEventListener(n,i,{passive:f}):t.addEventListener(n,i,!1)}function Xr(t,n,i,o,f){var g=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var j=o.tag;if(j===3||j===4){var P=o.stateNode.containerInfo;if(P===f||P.nodeType===8&&P.parentNode===f)break;if(j===4)for(j=o.return;j!==null;){var H=j.tag;if((H===3||H===4)&&(H=j.stateNode.containerInfo,H===f||H.nodeType===8&&H.parentNode===f))return;j=j.return}for(;P!==null;){if(j=na(P),j===null)return;if(H=j.tag,H===5||H===6){o=g=j;continue e}P=P.parentNode}}o=o.return}_t(function(){var de=g,Ee=it(i),Le=[];e:{var Ne=Qr.get(t);if(Ne!==void 0){var We=nr,Qe=t;switch(t){case"keypress":if(Br(i)===0)break e;case"keydown":case"keyup":We=Js;break;case"focusin":Qe="focus",We=rr;break;case"focusout":Qe="blur",We=rr;break;case"beforeblur":case"afterblur":We=rr;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":We=Ri;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":We=Li;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":We=tc;break;case to:case Sn:case St:We=Hl;break;case en:We=Oi;break;case"scroll":We=Ai;break;case"wheel":We=Di;break;case"copy":case"cut":case"paste":We=Es;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":We=Ii}var Je=(n&4)!==0,Xt=!Je&&t==="scroll",ae=Je?Ne!==null?Ne+"Capture":null:Ne;Je=[];for(var K=de,re;K!==null;){re=K;var Fe=re.stateNode;if(re.tag===5&&Fe!==null&&(re=Fe,ae!==null&&(Fe=nn(K,ae),Fe!=null&&Je.push(ns(K,Fe,re)))),Xt)break;K=K.return}0<Je.length&&(Ne=new We(Ne,Qe,null,i,Ee),Le.push({event:Ne,listeners:Je}))}}if((n&7)===0){e:{if(Ne=t==="mouseover"||t==="pointerover",We=t==="mouseout"||t==="pointerout",Ne&&i!==De&&(Qe=i.relatedTarget||i.fromElement)&&(na(Qe)||Qe[Hn]))break e;if((We||Ne)&&(Ne=Ee.window===Ee?Ee:(Ne=Ee.ownerDocument)?Ne.defaultView||Ne.parentWindow:window,We?(Qe=i.relatedTarget||i.toElement,We=de,Qe=Qe?na(Qe):null,Qe!==null&&(Xt=Jn(Qe),Qe!==Xt||Qe.tag!==5&&Qe.tag!==6)&&(Qe=null)):(We=null,Qe=de),We!==Qe)){if(Je=Ri,Fe="onMouseLeave",ae="onMouseEnter",K="mouse",(t==="pointerout"||t==="pointerover")&&(Je=Ii,Fe="onPointerLeave",ae="onPointerEnter",K="pointer"),Xt=We==null?Ne:sa(We),re=Qe==null?Ne:sa(Qe),Ne=new Je(Fe,K+"leave",We,i,Ee),Ne.target=Xt,Ne.relatedTarget=re,Fe=null,na(Ee)===de&&(Je=new Je(ae,K+"enter",Qe,i,Ee),Je.target=re,Je.relatedTarget=Xt,Fe=Je),Xt=Fe,We&&Qe)t:{for(Je=We,ae=Qe,K=0,re=Je;re;re=an(re))K++;for(re=0,Fe=ae;Fe;Fe=an(Fe))re++;for(;0<K-re;)Je=an(Je),K--;for(;0<re-K;)ae=an(ae),re--;for(;K--;){if(Je===ae||ae!==null&&Je===ae.alternate)break t;Je=an(Je),ae=an(ae)}Je=null}else Je=null;We!==null&&ei(Le,Ne,We,Je,!1),Qe!==null&&Xt!==null&&ei(Le,Xt,Qe,Je,!0)}}e:{if(Ne=de?sa(de):window,We=Ne.nodeName&&Ne.nodeName.toLowerCase(),We==="select"||We==="input"&&Ne.type==="file")var Ze=Gr;else if(wa(Ne))if(Xl)Ze=lc;else{Ze=ic;var st=rc}else(We=Ne.nodeName)&&We.toLowerCase()==="input"&&(Ne.type==="checkbox"||Ne.type==="radio")&&(Ze=Hi);if(Ze&&(Ze=Ze(t,de))){Yl(Le,Ze,i,Ee);break e}st&&st(t,Ne,de),t==="focusout"&&(st=Ne._wrapperState)&&st.controlled&&Ne.type==="number"&&Ye(Ne,"number",Ne.value)}switch(st=de?sa(de):window,t){case"focusin":(wa(st)||st.contentEditable==="true")&&(ta=st,Ki=de,ja=null);break;case"focusout":ja=Ki=ta=null;break;case"mousedown":Qi=!0;break;case"contextmenu":case"mouseup":case"dragend":Qi=!1,Ji(Le,i,Ee);break;case"selectionchange":if(cc)break;case"keydown":case"keyup":Ji(Le,i,Ee)}var at;if(ir)e:{switch(t){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else Ys?Vr(t,i)&&(lt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(lt="onCompositionStart");lt&&(Hr&&i.locale!=="ko"&&(Ys||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&Ys&&(at=pa()):(es=Ee,er="value"in es?es.value:es.textContent,Ys=!0)),st=Zr(de,lt),0<st.length&&(lt=new Wr(lt,t,null,i,Ee),Le.push({event:lt,listeners:st}),at?lt.data=at:(at=Fi(i),at!==null&&(lt.data=at)))),(at=xa?Jl(t,i):sc(t,i))&&(de=Zr(de,"onBeforeInput"),0<de.length&&(Ee=new Wr("onBeforeInput","beforeinput",null,i,Ee),Le.push({event:Ee,listeners:de}),Ee.data=at))}Zi(Le,n)})}function ns(t,n,i){return{instance:t,listener:n,currentTarget:i}}function Zr(t,n){for(var i=n+"Capture",o=[];t!==null;){var f=t,g=f.stateNode;f.tag===5&&g!==null&&(f=g,g=nn(t,i),g!=null&&o.unshift(ns(t,g,f)),g=nn(t,n),g!=null&&o.push(ns(t,g,f))),t=t.return}return o}function an(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function ei(t,n,i,o,f){for(var g=n._reactName,j=[];i!==null&&i!==o;){var P=i,H=P.alternate,de=P.stateNode;if(H!==null&&H===o)break;P.tag===5&&de!==null&&(P=de,f?(H=nn(i,g),H!=null&&j.unshift(ns(i,H,P))):f||(H=nn(i,g),H!=null&&j.push(ns(i,H,P)))),i=i.return}j.length!==0&&t.push({event:n,listeners:j})}var ss=/\r\n?/g,ti=/\u0000|\uFFFD/g;function ni(t){return(typeof t=="string"?t:""+t).replace(ss,`
|
|
38
|
-
`).replace(ti,"")}function Rn(t,n,i){if(n=ni(n),ni(t)!==n&&i)throw Error(r(425))}function Nn(){}var Na=null,tl=null;function _r(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var nl=typeof setTimeout=="function"?setTimeout:void 0,uc=typeof clearTimeout=="function"?clearTimeout:void 0,sl=typeof Promise=="function"?Promise:void 0,dc=typeof queueMicrotask=="function"?queueMicrotask:typeof sl<"u"?function(t){return sl.resolve(null).then(t).catch(mc)}:nl;function mc(t){setTimeout(function(){throw t})}function si(t,n){var i=n,o=0;do{var f=i.nextSibling;if(t.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"){if(o===0){t.removeChild(f),hs(n);return}o--}else i!=="$"&&i!=="$?"&&i!=="$!"||o++;i=f}while(i);hs(n)}function Rs(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return t}function so(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"){if(n===0)return t;n--}else i==="/$"&&n++}t=t.previousSibling}return null}var Ca=Math.random().toString(36).slice(2),as="__reactFiber$"+Ca,gr="__reactProps$"+Ca,Hn="__reactContainer$"+Ca,al="__reactEvents$"+Ca,fc="__reactListeners$"+Ca,hc="__reactHandles$"+Ca;function na(t){var n=t[as];if(n)return n;for(var i=t.parentNode;i;){if(n=i[Hn]||i[as]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(t=so(t);t!==null;){if(i=t[as])return i;t=so(t)}return n}t=i,i=t.parentNode}return null}function $a(t){return t=t[as]||t[Hn],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function sa(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(r(33))}function ai(t){return t[gr]||null}var ri=[],aa=-1;function vs(t){return{current:t}}function $t(t){0>aa||(t.current=ri[aa],ri[aa]=null,aa--)}function Nt(t,n){aa++,ri[aa]=t.current,t.current=n}var ys={},u=vs(ys),v=vs(!1),S=ys;function k(t,n){var i=t.type.contextTypes;if(!i)return ys;var o=t.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===n)return o.__reactInternalMemoizedMaskedChildContext;var f={},g;for(g in i)f[g]=n[g];return o&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=n,t.__reactInternalMemoizedMaskedChildContext=f),f}function $(t){return t=t.childContextTypes,t!=null}function ne(){$t(v),$t(u)}function W(t,n,i){if(u.current!==ys)throw Error(r(168));Nt(u,n),Nt(v,i)}function xe(t,n,i){var o=t.stateNode;if(n=n.childContextTypes,typeof o.getChildContext!="function")return i;o=o.getChildContext();for(var f in o)if(!(f in n))throw Error(r(108,je(t)||"Unknown",f));return V({},i,o)}function Pe(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||ys,S=u.current,Nt(u,t),Nt(v,v.current),!0}function Ue(t,n,i){var o=t.stateNode;if(!o)throw Error(r(169));i?(t=xe(t,n,S),o.__reactInternalMemoizedMergedChildContext=t,$t(v),$t(u),Nt(u,t)):$t(v),Nt(v,i)}var Be=null,Tt=!1,Vt=!1;function rs(t){Be===null?Be=[t]:Be.push(t)}function bt(t){Tt=!0,rs(t)}function et(){if(!Vt&&Be!==null){Vt=!0;var t=0,n=ct;try{var i=Be;for(ct=1;t<i.length;t++){var o=i[t];do o=o(!0);while(o!==null)}Be=null,Tt=!1}catch(f){throw Be!==null&&(Be=Be.slice(t+1)),Ni(Ga,et),f}finally{ct=n,Vt=!1}}return null}var Yt=[],wt=0,He=null,At=0,Pt=[],Rt=0,It=null,gt=1,Lt="";function is(t,n){Yt[wt++]=At,Yt[wt++]=He,He=t,At=n}function gd(t,n,i){Pt[Rt++]=gt,Pt[Rt++]=Lt,Pt[Rt++]=It,It=t;var o=gt;t=Lt;var f=32-kn(o)-1;o&=~(1<<f),i+=1;var g=32-kn(n)+f;if(30<g){var j=f-f%5;g=(o&(1<<j)-1).toString(32),o>>=j,f-=j,gt=1<<32-kn(n)+f|i<<f|o,Lt=g+t}else gt=1<<g|i<<f|o,Lt=t}function pc(t){t.return!==null&&(is(t,1),gd(t,1,0))}function _c(t){for(;t===He;)He=Yt[--wt],Yt[wt]=null,At=Yt[--wt],Yt[wt]=null;for(;t===It;)It=Pt[--Rt],Pt[Rt]=null,Lt=Pt[--Rt],Pt[Rt]=null,gt=Pt[--Rt],Pt[Rt]=null}var Vn=null,Gn=null,Dt=!1,xs=null;function vd(t,n){var i=us(5,null,null,0);i.elementType="DELETED",i.stateNode=n,i.return=t,n=t.deletions,n===null?(t.deletions=[i],t.flags|=16):n.push(i)}function yd(t,n){switch(t.tag){case 5:var i=t.type;return n=n.nodeType!==1||i.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(t.stateNode=n,Vn=t,Gn=Rs(n.firstChild),!0):!1;case 6:return n=t.pendingProps===""||n.nodeType!==3?null:n,n!==null?(t.stateNode=n,Vn=t,Gn=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(i=It!==null?{id:gt,overflow:Lt}:null,t.memoizedState={dehydrated:n,treeContext:i,retryLane:1073741824},i=us(18,null,null,0),i.stateNode=n,i.return=t,t.child=i,Vn=t,Gn=null,!0):!1;default:return!1}}function gc(t){return(t.mode&1)!==0&&(t.flags&128)===0}function vc(t){if(Dt){var n=Gn;if(n){var i=n;if(!yd(t,n)){if(gc(t))throw Error(r(418));n=Rs(i.nextSibling);var o=Vn;n&&yd(t,n)?vd(o,i):(t.flags=t.flags&-4097|2,Dt=!1,Vn=t)}}else{if(gc(t))throw Error(r(418));t.flags=t.flags&-4097|2,Dt=!1,Vn=t}}}function xd(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Vn=t}function ao(t){if(t!==Vn)return!1;if(!Dt)return xd(t),Dt=!0,!1;var n;if((n=t.tag!==3)&&!(n=t.tag!==5)&&(n=t.type,n=n!=="head"&&n!=="body"&&!_r(t.type,t.memoizedProps)),n&&(n=Gn)){if(gc(t))throw bd(),Error(r(418));for(;n;)vd(t,n),n=Rs(n.nextSibling)}if(xd(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,n=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"){if(n===0){Gn=Rs(t.nextSibling);break e}n--}else i!=="$"&&i!=="$!"&&i!=="$?"||n++}t=t.nextSibling}Gn=null}}else Gn=Vn?Rs(t.stateNode.nextSibling):null;return!0}function bd(){for(var t=Gn;t;)t=Rs(t.nextSibling)}function ii(){Gn=Vn=null,Dt=!1}function yc(t){xs===null?xs=[t]:xs.push(t)}var Hh=Q.ReactCurrentBatchConfig;function rl(t,n,i){if(t=i.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var o=i.stateNode}if(!o)throw Error(r(147,t));var f=o,g=""+t;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===g?n.ref:(n=function(j){var P=f.refs;j===null?delete P[g]:P[g]=j},n._stringRef=g,n)}if(typeof t!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,t))}return t}function ro(t,n){throw t=Object.prototype.toString.call(n),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t))}function wd(t){var n=t._init;return n(t._payload)}function jd(t){function n(ae,K){if(t){var re=ae.deletions;re===null?(ae.deletions=[K],ae.flags|=16):re.push(K)}}function i(ae,K){if(!t)return null;for(;K!==null;)n(ae,K),K=K.sibling;return null}function o(ae,K){for(ae=new Map;K!==null;)K.key!==null?ae.set(K.key,K):ae.set(K.index,K),K=K.sibling;return ae}function f(ae,K){return ae=Pa(ae,K),ae.index=0,ae.sibling=null,ae}function g(ae,K,re){return ae.index=re,t?(re=ae.alternate,re!==null?(re=re.index,re<K?(ae.flags|=2,K):re):(ae.flags|=2,K)):(ae.flags|=1048576,K)}function j(ae){return t&&ae.alternate===null&&(ae.flags|=2),ae}function P(ae,K,re,Fe){return K===null||K.tag!==6?(K=uu(re,ae.mode,Fe),K.return=ae,K):(K=f(K,re),K.return=ae,K)}function H(ae,K,re,Fe){var Ze=re.type;return Ze===oe?Ee(ae,K,re.props.children,Fe,re.key):K!==null&&(K.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===U&&wd(Ze)===K.type)?(Fe=f(K,re.props),Fe.ref=rl(ae,K,re),Fe.return=ae,Fe):(Fe=To(re.type,re.key,re.props,null,ae.mode,Fe),Fe.ref=rl(ae,K,re),Fe.return=ae,Fe)}function de(ae,K,re,Fe){return K===null||K.tag!==4||K.stateNode.containerInfo!==re.containerInfo||K.stateNode.implementation!==re.implementation?(K=du(re,ae.mode,Fe),K.return=ae,K):(K=f(K,re.children||[]),K.return=ae,K)}function Ee(ae,K,re,Fe,Ze){return K===null||K.tag!==7?(K=Sr(re,ae.mode,Fe,Ze),K.return=ae,K):(K=f(K,re),K.return=ae,K)}function Le(ae,K,re){if(typeof K=="string"&&K!==""||typeof K=="number")return K=uu(""+K,ae.mode,re),K.return=ae,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case E:return re=To(K.type,K.key,K.props,null,ae.mode,re),re.ref=rl(ae,null,K),re.return=ae,re;case Z:return K=du(K,ae.mode,re),K.return=ae,K;case U:var Fe=K._init;return Le(ae,Fe(K._payload),re)}if(ie(K)||ue(K))return K=Sr(K,ae.mode,re,null),K.return=ae,K;ro(ae,K)}return null}function Ne(ae,K,re,Fe){var Ze=K!==null?K.key:null;if(typeof re=="string"&&re!==""||typeof re=="number")return Ze!==null?null:P(ae,K,""+re,Fe);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case E:return re.key===Ze?H(ae,K,re,Fe):null;case Z:return re.key===Ze?de(ae,K,re,Fe):null;case U:return Ze=re._init,Ne(ae,K,Ze(re._payload),Fe)}if(ie(re)||ue(re))return Ze!==null?null:Ee(ae,K,re,Fe,null);ro(ae,re)}return null}function We(ae,K,re,Fe,Ze){if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number")return ae=ae.get(re)||null,P(K,ae,""+Fe,Ze);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case E:return ae=ae.get(Fe.key===null?re:Fe.key)||null,H(K,ae,Fe,Ze);case Z:return ae=ae.get(Fe.key===null?re:Fe.key)||null,de(K,ae,Fe,Ze);case U:var st=Fe._init;return We(ae,K,re,st(Fe._payload),Ze)}if(ie(Fe)||ue(Fe))return ae=ae.get(re)||null,Ee(K,ae,Fe,Ze,null);ro(K,Fe)}return null}function Qe(ae,K,re,Fe){for(var Ze=null,st=null,at=K,lt=K=0,dn=null;at!==null&<<re.length;lt++){at.index>lt?(dn=at,at=null):dn=at.sibling;var xt=Ne(ae,at,re[lt],Fe);if(xt===null){at===null&&(at=dn);break}t&&at&&xt.alternate===null&&n(ae,at),K=g(xt,K,lt),st===null?Ze=xt:st.sibling=xt,st=xt,at=dn}if(lt===re.length)return i(ae,at),Dt&&is(ae,lt),Ze;if(at===null){for(;lt<re.length;lt++)at=Le(ae,re[lt],Fe),at!==null&&(K=g(at,K,lt),st===null?Ze=at:st.sibling=at,st=at);return Dt&&is(ae,lt),Ze}for(at=o(ae,at);lt<re.length;lt++)dn=We(at,ae,lt,re[lt],Fe),dn!==null&&(t&&dn.alternate!==null&&at.delete(dn.key===null?lt:dn.key),K=g(dn,K,lt),st===null?Ze=dn:st.sibling=dn,st=dn);return t&&at.forEach(function(Ia){return n(ae,Ia)}),Dt&&is(ae,lt),Ze}function Je(ae,K,re,Fe){var Ze=ue(re);if(typeof Ze!="function")throw Error(r(150));if(re=Ze.call(re),re==null)throw Error(r(151));for(var st=Ze=null,at=K,lt=K=0,dn=null,xt=re.next();at!==null&&!xt.done;lt++,xt=re.next()){at.index>lt?(dn=at,at=null):dn=at.sibling;var Ia=Ne(ae,at,xt.value,Fe);if(Ia===null){at===null&&(at=dn);break}t&&at&&Ia.alternate===null&&n(ae,at),K=g(Ia,K,lt),st===null?Ze=Ia:st.sibling=Ia,st=Ia,at=dn}if(xt.done)return i(ae,at),Dt&&is(ae,lt),Ze;if(at===null){for(;!xt.done;lt++,xt=re.next())xt=Le(ae,xt.value,Fe),xt!==null&&(K=g(xt,K,lt),st===null?Ze=xt:st.sibling=xt,st=xt);return Dt&&is(ae,lt),Ze}for(at=o(ae,at);!xt.done;lt++,xt=re.next())xt=We(at,ae,lt,xt.value,Fe),xt!==null&&(t&&xt.alternate!==null&&at.delete(xt.key===null?lt:xt.key),K=g(xt,K,lt),st===null?Ze=xt:st.sibling=xt,st=xt);return t&&at.forEach(function(kp){return n(ae,kp)}),Dt&&is(ae,lt),Ze}function Xt(ae,K,re,Fe){if(typeof re=="object"&&re!==null&&re.type===oe&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case E:e:{for(var Ze=re.key,st=K;st!==null;){if(st.key===Ze){if(Ze=re.type,Ze===oe){if(st.tag===7){i(ae,st.sibling),K=f(st,re.props.children),K.return=ae,ae=K;break e}}else if(st.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===U&&wd(Ze)===st.type){i(ae,st.sibling),K=f(st,re.props),K.ref=rl(ae,st,re),K.return=ae,ae=K;break e}i(ae,st);break}else n(ae,st);st=st.sibling}re.type===oe?(K=Sr(re.props.children,ae.mode,Fe,re.key),K.return=ae,ae=K):(Fe=To(re.type,re.key,re.props,null,ae.mode,Fe),Fe.ref=rl(ae,K,re),Fe.return=ae,ae=Fe)}return j(ae);case Z:e:{for(st=re.key;K!==null;){if(K.key===st)if(K.tag===4&&K.stateNode.containerInfo===re.containerInfo&&K.stateNode.implementation===re.implementation){i(ae,K.sibling),K=f(K,re.children||[]),K.return=ae,ae=K;break e}else{i(ae,K);break}else n(ae,K);K=K.sibling}K=du(re,ae.mode,Fe),K.return=ae,ae=K}return j(ae);case U:return st=re._init,Xt(ae,K,st(re._payload),Fe)}if(ie(re))return Qe(ae,K,re,Fe);if(ue(re))return Je(ae,K,re,Fe);ro(ae,re)}return typeof re=="string"&&re!==""||typeof re=="number"?(re=""+re,K!==null&&K.tag===6?(i(ae,K.sibling),K=f(K,re),K.return=ae,ae=K):(i(ae,K),K=uu(re,ae.mode,Fe),K.return=ae,ae=K),j(ae)):i(ae,K)}return Xt}var li=jd(!0),kd=jd(!1),io=vs(null),lo=null,oi=null,xc=null;function bc(){xc=oi=lo=null}function wc(t){var n=io.current;$t(io),t._currentValue=n}function jc(t,n,i){for(;t!==null;){var o=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),t===i)break;t=t.return}}function ci(t,n){lo=t,xc=oi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&n)!==0&&(Ln=!0),t.firstContext=null)}function ls(t){var n=t._currentValue;if(xc!==t)if(t={context:t,memoizedValue:n,next:null},oi===null){if(lo===null)throw Error(r(308));oi=t,lo.dependencies={lanes:0,firstContext:t}}else oi=oi.next=t;return n}var vr=null;function kc(t){vr===null?vr=[t]:vr.push(t)}function Sd(t,n,i,o){var f=n.interleaved;return f===null?(i.next=i,kc(n)):(i.next=f.next,f.next=i),n.interleaved=i,ra(t,o)}function ra(t,n){t.lanes|=n;var i=t.alternate;for(i!==null&&(i.lanes|=n),i=t,t=t.return;t!==null;)t.childLanes|=n,i=t.alternate,i!==null&&(i.childLanes|=n),i=t,t=t.return;return i.tag===3?i.stateNode:null}var Ea=!1;function Sc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Nd(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ia(t,n){return{eventTime:t,lane:n,tag:0,payload:null,callback:null,next:null}}function Ta(t,n,i){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(vt&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,ra(t,i)}return f=o.interleaved,f===null?(n.next=n,kc(o)):(n.next=f.next,f.next=n),o.interleaved=n,ra(t,i)}function oo(t,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var o=n.lanes;o&=t.pendingLanes,i|=o,n.lanes=i,Or(t,i)}}function Cd(t,n){var i=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var f=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var j={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};g===null?f=g=j:g=g.next=j,i=i.next}while(i!==null);g===null?f=g=n:g=g.next=n}else f=g=n;i={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:o.shared,effects:o.effects},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=n:t.next=n,i.lastBaseUpdate=n}function co(t,n,i,o){var f=t.updateQueue;Ea=!1;var g=f.firstBaseUpdate,j=f.lastBaseUpdate,P=f.shared.pending;if(P!==null){f.shared.pending=null;var H=P,de=H.next;H.next=null,j===null?g=de:j.next=de,j=H;var Ee=t.alternate;Ee!==null&&(Ee=Ee.updateQueue,P=Ee.lastBaseUpdate,P!==j&&(P===null?Ee.firstBaseUpdate=de:P.next=de,Ee.lastBaseUpdate=H))}if(g!==null){var Le=f.baseState;j=0,Ee=de=H=null,P=g;do{var Ne=P.lane,We=P.eventTime;if((o&Ne)===Ne){Ee!==null&&(Ee=Ee.next={eventTime:We,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var Qe=t,Je=P;switch(Ne=n,We=i,Je.tag){case 1:if(Qe=Je.payload,typeof Qe=="function"){Le=Qe.call(We,Le,Ne);break e}Le=Qe;break e;case 3:Qe.flags=Qe.flags&-65537|128;case 0:if(Qe=Je.payload,Ne=typeof Qe=="function"?Qe.call(We,Le,Ne):Qe,Ne==null)break e;Le=V({},Le,Ne);break e;case 2:Ea=!0}}P.callback!==null&&P.lane!==0&&(t.flags|=64,Ne=f.effects,Ne===null?f.effects=[P]:Ne.push(P))}else We={eventTime:We,lane:Ne,tag:P.tag,payload:P.payload,callback:P.callback,next:null},Ee===null?(de=Ee=We,H=Le):Ee=Ee.next=We,j|=Ne;if(P=P.next,P===null){if(P=f.shared.pending,P===null)break;Ne=P,P=Ne.next,Ne.next=null,f.lastBaseUpdate=Ne,f.shared.pending=null}}while(!0);if(Ee===null&&(H=Le),f.baseState=H,f.firstBaseUpdate=de,f.lastBaseUpdate=Ee,n=f.shared.interleaved,n!==null){f=n;do j|=f.lane,f=f.next;while(f!==n)}else g===null&&(f.shared.lanes=0);br|=j,t.lanes=j,t.memoizedState=Le}}function $d(t,n,i){if(t=n.effects,n.effects=null,t!==null)for(n=0;n<t.length;n++){var o=t[n],f=o.callback;if(f!==null){if(o.callback=null,o=i,typeof f!="function")throw Error(r(191,f));f.call(o)}}}var il={},Ls=vs(il),ll=vs(il),ol=vs(il);function yr(t){if(t===il)throw Error(r(174));return t}function Nc(t,n){switch(Nt(ol,n),Nt(ll,t),Nt(Ls,il),t=n.nodeType,t){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:T(null,"");break;default:t=t===8?n.parentNode:n,n=t.namespaceURI||null,t=t.tagName,n=T(n,t)}$t(Ls),Nt(Ls,n)}function ui(){$t(Ls),$t(ll),$t(ol)}function Ed(t){yr(ol.current);var n=yr(Ls.current),i=T(n,t.type);n!==i&&(Nt(ll,t),Nt(Ls,i))}function Cc(t){ll.current===t&&($t(Ls),$t(ll))}var qt=vs(0);function uo(t){for(var n=t;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(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 null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var $c=[];function Ec(){for(var t=0;t<$c.length;t++)$c[t]._workInProgressVersionPrimary=null;$c.length=0}var mo=Q.ReactCurrentDispatcher,Tc=Q.ReactCurrentBatchConfig,xr=0,Bt=null,rn=null,cn=null,fo=!1,cl=!1,ul=0,Vh=0;function bn(){throw Error(r(321))}function Ac(t,n){if(n===null)return!1;for(var i=0;i<n.length&&i<t.length;i++)if(!An(t[i],n[i]))return!1;return!0}function Rc(t,n,i,o,f,g){if(xr=g,Bt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,mo.current=t===null||t.memoizedState===null?Jh:Yh,t=i(o,f),cl){g=0;do{if(cl=!1,ul=0,25<=g)throw Error(r(301));g+=1,cn=rn=null,n.updateQueue=null,mo.current=Xh,t=i(o,f)}while(cl)}if(mo.current=_o,n=rn!==null&&rn.next!==null,xr=0,cn=rn=Bt=null,fo=!1,n)throw Error(r(300));return t}function Lc(){var t=ul!==0;return ul=0,t}function Ms(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Bt.memoizedState=cn=t:cn=cn.next=t,cn}function os(){if(rn===null){var t=Bt.alternate;t=t!==null?t.memoizedState:null}else t=rn.next;var n=cn===null?Bt.memoizedState:cn.next;if(n!==null)cn=n,rn=t;else{if(t===null)throw Error(r(310));rn=t,t={memoizedState:rn.memoizedState,baseState:rn.baseState,baseQueue:rn.baseQueue,queue:rn.queue,next:null},cn===null?Bt.memoizedState=cn=t:cn=cn.next=t}return cn}function dl(t,n){return typeof n=="function"?n(t):n}function Mc(t){var n=os(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var o=rn,f=o.baseQueue,g=i.pending;if(g!==null){if(f!==null){var j=f.next;f.next=g.next,g.next=j}o.baseQueue=f=g,i.pending=null}if(f!==null){g=f.next,o=o.baseState;var P=j=null,H=null,de=g;do{var Ee=de.lane;if((xr&Ee)===Ee)H!==null&&(H=H.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),o=de.hasEagerState?de.eagerState:t(o,de.action);else{var Le={lane:Ee,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};H===null?(P=H=Le,j=o):H=H.next=Le,Bt.lanes|=Ee,br|=Ee}de=de.next}while(de!==null&&de!==g);H===null?j=o:H.next=P,An(o,n.memoizedState)||(Ln=!0),n.memoizedState=o,n.baseState=j,n.baseQueue=H,i.lastRenderedState=o}if(t=i.interleaved,t!==null){f=t;do g=f.lane,Bt.lanes|=g,br|=g,f=f.next;while(f!==t)}else f===null&&(i.lanes=0);return[n.memoizedState,i.dispatch]}function zc(t){var n=os(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=t;var o=i.dispatch,f=i.pending,g=n.memoizedState;if(f!==null){i.pending=null;var j=f=f.next;do g=t(g,j.action),j=j.next;while(j!==f);An(g,n.memoizedState)||(Ln=!0),n.memoizedState=g,n.baseQueue===null&&(n.baseState=g),i.lastRenderedState=g}return[g,o]}function Td(){}function Ad(t,n){var i=Bt,o=os(),f=n(),g=!An(o.memoizedState,f);if(g&&(o.memoizedState=f,Ln=!0),o=o.queue,Pc(Md.bind(null,i,o,t),[t]),o.getSnapshot!==n||g||cn!==null&&cn.memoizedState.tag&1){if(i.flags|=2048,ml(9,Ld.bind(null,i,o,f,n),void 0,null),un===null)throw Error(r(349));(xr&30)!==0||Rd(i,n,f)}return f}function Rd(t,n,i){t.flags|=16384,t={getSnapshot:n,value:i},n=Bt.updateQueue,n===null?(n={lastEffect:null,stores:null},Bt.updateQueue=n,n.stores=[t]):(i=n.stores,i===null?n.stores=[t]:i.push(t))}function Ld(t,n,i,o){n.value=i,n.getSnapshot=o,zd(n)&&Pd(t)}function Md(t,n,i){return i(function(){zd(n)&&Pd(t)})}function zd(t){var n=t.getSnapshot;t=t.value;try{var i=n();return!An(t,i)}catch{return!0}}function Pd(t){var n=ra(t,1);n!==null&&ks(n,t,1,-1)}function Id(t){var n=Ms();return typeof t=="function"&&(t=t()),n.memoizedState=n.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:dl,lastRenderedState:t},n.queue=t,t=t.dispatch=Qh.bind(null,Bt,t),[n.memoizedState,t]}function ml(t,n,i,o){return t={tag:t,create:n,destroy:i,deps:o,next:null},n=Bt.updateQueue,n===null?(n={lastEffect:null,stores:null},Bt.updateQueue=n,n.lastEffect=t.next=t):(i=n.lastEffect,i===null?n.lastEffect=t.next=t:(o=i.next,i.next=t,t.next=o,n.lastEffect=t)),t}function Od(){return os().memoizedState}function ho(t,n,i,o){var f=Ms();Bt.flags|=t,f.memoizedState=ml(1|n,i,void 0,o===void 0?null:o)}function po(t,n,i,o){var f=os();o=o===void 0?null:o;var g=void 0;if(rn!==null){var j=rn.memoizedState;if(g=j.destroy,o!==null&&Ac(o,j.deps)){f.memoizedState=ml(n,i,g,o);return}}Bt.flags|=t,f.memoizedState=ml(1|n,i,g,o)}function Dd(t,n){return ho(8390656,8,t,n)}function Pc(t,n){return po(2048,8,t,n)}function Fd(t,n){return po(4,2,t,n)}function qd(t,n){return po(4,4,t,n)}function Bd(t,n){if(typeof n=="function")return t=t(),n(t),function(){n(null)};if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Ud(t,n,i){return i=i!=null?i.concat([t]):null,po(4,4,Bd.bind(null,n,t),i)}function Ic(){}function Wd(t,n){var i=os();n=n===void 0?null:n;var o=i.memoizedState;return o!==null&&n!==null&&Ac(n,o[1])?o[0]:(i.memoizedState=[t,n],t)}function Hd(t,n){var i=os();n=n===void 0?null:n;var o=i.memoizedState;return o!==null&&n!==null&&Ac(n,o[1])?o[0]:(t=t(),i.memoizedState=[t,n],t)}function Vd(t,n,i){return(xr&21)===0?(t.baseState&&(t.baseState=!1,Ln=!0),t.memoizedState=i):(An(i,n)||(i=qs(),Bt.lanes|=i,br|=i,t.baseState=!0),n)}function Gh(t,n){var i=ct;ct=i!==0&&4>i?i:4,t(!0);var o=Tc.transition;Tc.transition={};try{t(!1),n()}finally{ct=i,Tc.transition=o}}function Gd(){return os().memoizedState}function Kh(t,n,i){var o=Ma(t);if(i={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null},Kd(t))Qd(n,i);else if(i=Sd(t,n,i,o),i!==null){var f=$n();ks(i,t,o,f),Jd(i,n,o)}}function Qh(t,n,i){var o=Ma(t),f={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null};if(Kd(t))Qd(n,f);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var j=n.lastRenderedState,P=g(j,i);if(f.hasEagerState=!0,f.eagerState=P,An(P,j)){var H=n.interleaved;H===null?(f.next=f,kc(n)):(f.next=H.next,H.next=f),n.interleaved=f;return}}catch{}finally{}i=Sd(t,n,f,o),i!==null&&(f=$n(),ks(i,t,o,f),Jd(i,n,o))}}function Kd(t){var n=t.alternate;return t===Bt||n!==null&&n===Bt}function Qd(t,n){cl=fo=!0;var i=t.pending;i===null?n.next=n:(n.next=i.next,i.next=n),t.pending=n}function Jd(t,n,i){if((i&4194240)!==0){var o=n.lanes;o&=t.pendingLanes,i|=o,n.lanes=i,Or(t,i)}}var _o={readContext:ls,useCallback:bn,useContext:bn,useEffect:bn,useImperativeHandle:bn,useInsertionEffect:bn,useLayoutEffect:bn,useMemo:bn,useReducer:bn,useRef:bn,useState:bn,useDebugValue:bn,useDeferredValue:bn,useTransition:bn,useMutableSource:bn,useSyncExternalStore:bn,useId:bn,unstable_isNewReconciler:!1},Jh={readContext:ls,useCallback:function(t,n){return Ms().memoizedState=[t,n===void 0?null:n],t},useContext:ls,useEffect:Dd,useImperativeHandle:function(t,n,i){return i=i!=null?i.concat([t]):null,ho(4194308,4,Bd.bind(null,n,t),i)},useLayoutEffect:function(t,n){return ho(4194308,4,t,n)},useInsertionEffect:function(t,n){return ho(4,2,t,n)},useMemo:function(t,n){var i=Ms();return n=n===void 0?null:n,t=t(),i.memoizedState=[t,n],t},useReducer:function(t,n,i){var o=Ms();return n=i!==void 0?i(n):n,o.memoizedState=o.baseState=n,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},o.queue=t,t=t.dispatch=Kh.bind(null,Bt,t),[o.memoizedState,t]},useRef:function(t){var n=Ms();return t={current:t},n.memoizedState=t},useState:Id,useDebugValue:Ic,useDeferredValue:function(t){return Ms().memoizedState=t},useTransition:function(){var t=Id(!1),n=t[0];return t=Gh.bind(null,t[1]),Ms().memoizedState=t,[n,t]},useMutableSource:function(){},useSyncExternalStore:function(t,n,i){var o=Bt,f=Ms();if(Dt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),un===null)throw Error(r(349));(xr&30)!==0||Rd(o,n,i)}f.memoizedState=i;var g={value:i,getSnapshot:n};return f.queue=g,Dd(Md.bind(null,o,g,t),[t]),o.flags|=2048,ml(9,Ld.bind(null,o,g,i,n),void 0,null),i},useId:function(){var t=Ms(),n=un.identifierPrefix;if(Dt){var i=Lt,o=gt;i=(o&~(1<<32-kn(o)-1)).toString(32)+i,n=":"+n+"R"+i,i=ul++,0<i&&(n+="H"+i.toString(32)),n+=":"}else i=Vh++,n=":"+n+"r"+i.toString(32)+":";return t.memoizedState=n},unstable_isNewReconciler:!1},Yh={readContext:ls,useCallback:Wd,useContext:ls,useEffect:Pc,useImperativeHandle:Ud,useInsertionEffect:Fd,useLayoutEffect:qd,useMemo:Hd,useReducer:Mc,useRef:Od,useState:function(){return Mc(dl)},useDebugValue:Ic,useDeferredValue:function(t){var n=os();return Vd(n,rn.memoizedState,t)},useTransition:function(){var t=Mc(dl)[0],n=os().memoizedState;return[t,n]},useMutableSource:Td,useSyncExternalStore:Ad,useId:Gd,unstable_isNewReconciler:!1},Xh={readContext:ls,useCallback:Wd,useContext:ls,useEffect:Pc,useImperativeHandle:Ud,useInsertionEffect:Fd,useLayoutEffect:qd,useMemo:Hd,useReducer:zc,useRef:Od,useState:function(){return zc(dl)},useDebugValue:Ic,useDeferredValue:function(t){var n=os();return rn===null?n.memoizedState=t:Vd(n,rn.memoizedState,t)},useTransition:function(){var t=zc(dl)[0],n=os().memoizedState;return[t,n]},useMutableSource:Td,useSyncExternalStore:Ad,useId:Gd,unstable_isNewReconciler:!1};function bs(t,n){if(t&&t.defaultProps){n=V({},n),t=t.defaultProps;for(var i in t)n[i]===void 0&&(n[i]=t[i]);return n}return n}function Oc(t,n,i,o){n=t.memoizedState,i=i(o,n),i=i==null?n:V({},n,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var go={isMounted:function(t){return(t=t._reactInternals)?Jn(t)===t:!1},enqueueSetState:function(t,n,i){t=t._reactInternals;var o=$n(),f=Ma(t),g=ia(o,f);g.payload=n,i!=null&&(g.callback=i),n=Ta(t,g,f),n!==null&&(ks(n,t,f,o),oo(n,t,f))},enqueueReplaceState:function(t,n,i){t=t._reactInternals;var o=$n(),f=Ma(t),g=ia(o,f);g.tag=1,g.payload=n,i!=null&&(g.callback=i),n=Ta(t,g,f),n!==null&&(ks(n,t,f,o),oo(n,t,f))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var i=$n(),o=Ma(t),f=ia(i,o);f.tag=2,n!=null&&(f.callback=n),n=Ta(t,f,o),n!==null&&(ks(n,t,o,i),oo(n,t,o))}};function Yd(t,n,i,o,f,g,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(o,g,j):n.prototype&&n.prototype.isPureReactComponent?!lr(i,o)||!lr(f,g):!0}function Xd(t,n,i){var o=!1,f=ys,g=n.contextType;return typeof g=="object"&&g!==null?g=ls(g):(f=$(n)?S:u.current,o=n.contextTypes,g=(o=o!=null)?k(t,f):ys),n=new n(i,g),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=go,t.stateNode=n,n._reactInternals=t,o&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=f,t.__reactInternalMemoizedMaskedChildContext=g),n}function Zd(t,n,i,o){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,o),n.state!==t&&go.enqueueReplaceState(n,n.state,null)}function Dc(t,n,i,o){var f=t.stateNode;f.props=i,f.state=t.memoizedState,f.refs={},Sc(t);var g=n.contextType;typeof g=="object"&&g!==null?f.context=ls(g):(g=$(n)?S:u.current,f.context=k(t,g)),f.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(Oc(t,n,g,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(n=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),n!==f.state&&go.enqueueReplaceState(f,f.state,null),co(t,i,f,o),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308)}function di(t,n){try{var i="",o=n;do i+=he(o),o=o.return;while(o);var f=i}catch(g){f=`
|
|
39
|
-
Error generating stack: `+g.message+`
|
|
40
|
-
`+g.stack}return{value:t,source:n,stack:f,digest:null}}function Fc(t,n,i){return{value:t,source:null,stack:i??null,digest:n??null}}function qc(t,n){try{console.error(n.value)}catch(i){setTimeout(function(){throw i})}}var Zh=typeof WeakMap=="function"?WeakMap:Map;function em(t,n,i){i=ia(-1,i),i.tag=3,i.payload={element:null};var o=n.value;return i.callback=function(){ko||(ko=!0,nu=o),qc(t,n)},i}function tm(t,n,i){i=ia(-1,i),i.tag=3;var o=t.type.getDerivedStateFromError;if(typeof o=="function"){var f=n.value;i.payload=function(){return o(f)},i.callback=function(){qc(t,n)}}var g=t.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){qc(t,n),typeof o!="function"&&(Ra===null?Ra=new Set([this]):Ra.add(this));var j=n.stack;this.componentDidCatch(n.value,{componentStack:j!==null?j:""})}),i}function nm(t,n,i){var o=t.pingCache;if(o===null){o=t.pingCache=new Zh;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(i)||(f.add(i),t=fp.bind(null,t,n,i),n.then(t,t))}function sm(t){do{var n;if((n=t.tag===13)&&(n=t.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return t;t=t.return}while(t!==null);return null}function am(t,n,i,o,f){return(t.mode&1)===0?(t===n?t.flags|=65536:(t.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(n=ia(-1,1),n.tag=2,Ta(i,n,1))),i.lanes|=1),t):(t.flags|=65536,t.lanes=f,t)}var ep=Q.ReactCurrentOwner,Ln=!1;function Cn(t,n,i,o){n.child=t===null?kd(n,null,i,o):li(n,t.child,i,o)}function rm(t,n,i,o,f){i=i.render;var g=n.ref;return ci(n,f),o=Rc(t,n,i,o,g,f),i=Lc(),t!==null&&!Ln?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~f,la(t,n,f)):(Dt&&i&&pc(n),n.flags|=1,Cn(t,n,o,f),n.child)}function im(t,n,i,o,f){if(t===null){var g=i.type;return typeof g=="function"&&!cu(g)&&g.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(n.tag=15,n.type=g,lm(t,n,g,o,f)):(t=To(i.type,null,o,n,n.mode,f),t.ref=n.ref,t.return=n,n.child=t)}if(g=t.child,(t.lanes&f)===0){var j=g.memoizedProps;if(i=i.compare,i=i!==null?i:lr,i(j,o)&&t.ref===n.ref)return la(t,n,f)}return n.flags|=1,t=Pa(g,o),t.ref=n.ref,t.return=n,n.child=t}function lm(t,n,i,o,f){if(t!==null){var g=t.memoizedProps;if(lr(g,o)&&t.ref===n.ref)if(Ln=!1,n.pendingProps=o=g,(t.lanes&f)!==0)(t.flags&131072)!==0&&(Ln=!0);else return n.lanes=t.lanes,la(t,n,f)}return Bc(t,n,i,o,f)}function om(t,n,i){var o=n.pendingProps,f=o.children,g=t!==null?t.memoizedState:null;if(o.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Nt(fi,Kn),Kn|=i;else{if((i&1073741824)===0)return t=g!==null?g.baseLanes|i:i,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:t,cachePool:null,transitions:null},n.updateQueue=null,Nt(fi,Kn),Kn|=t,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},o=g!==null?g.baseLanes:i,Nt(fi,Kn),Kn|=o}else g!==null?(o=g.baseLanes|i,n.memoizedState=null):o=i,Nt(fi,Kn),Kn|=o;return Cn(t,n,f,i),n.child}function cm(t,n){var i=n.ref;(t===null&&i!==null||t!==null&&t.ref!==i)&&(n.flags|=512,n.flags|=2097152)}function Bc(t,n,i,o,f){var g=$(i)?S:u.current;return g=k(n,g),ci(n,f),i=Rc(t,n,i,o,g,f),o=Lc(),t!==null&&!Ln?(n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~f,la(t,n,f)):(Dt&&o&&pc(n),n.flags|=1,Cn(t,n,i,f),n.child)}function um(t,n,i,o,f){if($(i)){var g=!0;Pe(n)}else g=!1;if(ci(n,f),n.stateNode===null)yo(t,n),Xd(n,i,o),Dc(n,i,o,f),o=!0;else if(t===null){var j=n.stateNode,P=n.memoizedProps;j.props=P;var H=j.context,de=i.contextType;typeof de=="object"&&de!==null?de=ls(de):(de=$(i)?S:u.current,de=k(n,de));var Ee=i.getDerivedStateFromProps,Le=typeof Ee=="function"||typeof j.getSnapshotBeforeUpdate=="function";Le||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(P!==o||H!==de)&&Zd(n,j,o,de),Ea=!1;var Ne=n.memoizedState;j.state=Ne,co(n,o,j,f),H=n.memoizedState,P!==o||Ne!==H||v.current||Ea?(typeof Ee=="function"&&(Oc(n,i,Ee,o),H=n.memoizedState),(P=Ea||Yd(n,i,P,o,Ne,H,de))?(Le||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(n.flags|=4194308)):(typeof j.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=H),j.props=o,j.state=H,j.context=de,o=P):(typeof j.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{j=n.stateNode,Nd(t,n),P=n.memoizedProps,de=n.type===n.elementType?P:bs(n.type,P),j.props=de,Le=n.pendingProps,Ne=j.context,H=i.contextType,typeof H=="object"&&H!==null?H=ls(H):(H=$(i)?S:u.current,H=k(n,H));var We=i.getDerivedStateFromProps;(Ee=typeof We=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(P!==Le||Ne!==H)&&Zd(n,j,o,H),Ea=!1,Ne=n.memoizedState,j.state=Ne,co(n,o,j,f);var Qe=n.memoizedState;P!==Le||Ne!==Qe||v.current||Ea?(typeof We=="function"&&(Oc(n,i,We,o),Qe=n.memoizedState),(de=Ea||Yd(n,i,de,o,Ne,Qe,H)||!1)?(Ee||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(o,Qe,H),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(o,Qe,H)),typeof j.componentDidUpdate=="function"&&(n.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof j.componentDidUpdate!="function"||P===t.memoizedProps&&Ne===t.memoizedState||(n.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||P===t.memoizedProps&&Ne===t.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=Qe),j.props=o,j.state=Qe,j.context=H,o=de):(typeof j.componentDidUpdate!="function"||P===t.memoizedProps&&Ne===t.memoizedState||(n.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||P===t.memoizedProps&&Ne===t.memoizedState||(n.flags|=1024),o=!1)}return Uc(t,n,i,o,g,f)}function Uc(t,n,i,o,f,g){cm(t,n);var j=(n.flags&128)!==0;if(!o&&!j)return f&&Ue(n,i,!1),la(t,n,g);o=n.stateNode,ep.current=n;var P=j&&typeof i.getDerivedStateFromError!="function"?null:o.render();return n.flags|=1,t!==null&&j?(n.child=li(n,t.child,null,g),n.child=li(n,null,P,g)):Cn(t,n,P,g),n.memoizedState=o.state,f&&Ue(n,i,!0),n.child}function dm(t){var n=t.stateNode;n.pendingContext?W(t,n.pendingContext,n.pendingContext!==n.context):n.context&&W(t,n.context,!1),Nc(t,n.containerInfo)}function mm(t,n,i,o,f){return ii(),yc(f),n.flags|=256,Cn(t,n,i,o),n.child}var Wc={dehydrated:null,treeContext:null,retryLane:0};function Hc(t){return{baseLanes:t,cachePool:null,transitions:null}}function fm(t,n,i){var o=n.pendingProps,f=qt.current,g=!1,j=(n.flags&128)!==0,P;if((P=j)||(P=t!==null&&t.memoizedState===null?!1:(f&2)!==0),P?(g=!0,n.flags&=-129):(t===null||t.memoizedState!==null)&&(f|=1),Nt(qt,f&1),t===null)return vc(n),t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?((n.mode&1)===0?n.lanes=1:t.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(j=o.children,t=o.fallback,g?(o=n.mode,g=n.child,j={mode:"hidden",children:j},(o&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=j):g=Ao(j,o,0,null),t=Sr(t,o,i,null),g.return=n,t.return=n,g.sibling=t,n.child=g,n.child.memoizedState=Hc(i),n.memoizedState=Wc,t):Vc(n,j));if(f=t.memoizedState,f!==null&&(P=f.dehydrated,P!==null))return tp(t,n,j,o,P,f,i);if(g){g=o.fallback,j=n.mode,f=t.child,P=f.sibling;var H={mode:"hidden",children:o.children};return(j&1)===0&&n.child!==f?(o=n.child,o.childLanes=0,o.pendingProps=H,n.deletions=null):(o=Pa(f,H),o.subtreeFlags=f.subtreeFlags&14680064),P!==null?g=Pa(P,g):(g=Sr(g,j,i,null),g.flags|=2),g.return=n,o.return=n,o.sibling=g,n.child=o,o=g,g=n.child,j=t.child.memoizedState,j=j===null?Hc(i):{baseLanes:j.baseLanes|i,cachePool:null,transitions:j.transitions},g.memoizedState=j,g.childLanes=t.childLanes&~i,n.memoizedState=Wc,o}return g=t.child,t=g.sibling,o=Pa(g,{mode:"visible",children:o.children}),(n.mode&1)===0&&(o.lanes=i),o.return=n,o.sibling=null,t!==null&&(i=n.deletions,i===null?(n.deletions=[t],n.flags|=16):i.push(t)),n.child=o,n.memoizedState=null,o}function Vc(t,n){return n=Ao({mode:"visible",children:n},t.mode,0,null),n.return=t,t.child=n}function vo(t,n,i,o){return o!==null&&yc(o),li(n,t.child,null,i),t=Vc(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function tp(t,n,i,o,f,g,j){if(i)return n.flags&256?(n.flags&=-257,o=Fc(Error(r(422))),vo(t,n,j,o)):n.memoizedState!==null?(n.child=t.child,n.flags|=128,null):(g=o.fallback,f=n.mode,o=Ao({mode:"visible",children:o.children},f,0,null),g=Sr(g,f,j,null),g.flags|=2,o.return=n,g.return=n,o.sibling=g,n.child=o,(n.mode&1)!==0&&li(n,t.child,null,j),n.child.memoizedState=Hc(j),n.memoizedState=Wc,g);if((n.mode&1)===0)return vo(t,n,j,null);if(f.data==="$!"){if(o=f.nextSibling&&f.nextSibling.dataset,o)var P=o.dgst;return o=P,g=Error(r(419)),o=Fc(g,o,void 0),vo(t,n,j,o)}if(P=(j&t.childLanes)!==0,Ln||P){if(o=un,o!==null){switch(j&-j){case 4:f=2;break;case 16:f=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:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(o.suspendedLanes|j))!==0?0:f,f!==0&&f!==g.retryLane&&(g.retryLane=f,ra(t,f),ks(o,t,f,-1))}return ou(),o=Fc(Error(r(421))),vo(t,n,j,o)}return f.data==="$?"?(n.flags|=128,n.child=t.child,n=hp.bind(null,t),f._reactRetry=n,null):(t=g.treeContext,Gn=Rs(f.nextSibling),Vn=n,Dt=!0,xs=null,t!==null&&(Pt[Rt++]=gt,Pt[Rt++]=Lt,Pt[Rt++]=It,gt=t.id,Lt=t.overflow,It=n),n=Vc(n,o.children),n.flags|=4096,n)}function hm(t,n,i){t.lanes|=n;var o=t.alternate;o!==null&&(o.lanes|=n),jc(t.return,n,i)}function Gc(t,n,i,o,f){var g=t.memoizedState;g===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:i,tailMode:f}:(g.isBackwards=n,g.rendering=null,g.renderingStartTime=0,g.last=o,g.tail=i,g.tailMode=f)}function pm(t,n,i){var o=n.pendingProps,f=o.revealOrder,g=o.tail;if(Cn(t,n,o.children,i),o=qt.current,(o&2)!==0)o=o&1|2,n.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&hm(t,i,n);else if(t.tag===19)hm(t,i,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}o&=1}if(Nt(qt,o),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(i=n.child,f=null;i!==null;)t=i.alternate,t!==null&&uo(t)===null&&(f=i),i=i.sibling;i=f,i===null?(f=n.child,n.child=null):(f=i.sibling,i.sibling=null),Gc(n,!1,f,i,g);break;case"backwards":for(i=null,f=n.child,n.child=null;f!==null;){if(t=f.alternate,t!==null&&uo(t)===null){n.child=f;break}t=f.sibling,f.sibling=i,i=f,f=t}Gc(n,!0,i,null,g);break;case"together":Gc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function yo(t,n){(n.mode&1)===0&&t!==null&&(t.alternate=null,n.alternate=null,n.flags|=2)}function la(t,n,i){if(t!==null&&(n.dependencies=t.dependencies),br|=n.lanes,(i&n.childLanes)===0)return null;if(t!==null&&n.child!==t.child)throw Error(r(153));if(n.child!==null){for(t=n.child,i=Pa(t,t.pendingProps),n.child=i,i.return=n;t.sibling!==null;)t=t.sibling,i=i.sibling=Pa(t,t.pendingProps),i.return=n;i.sibling=null}return n.child}function np(t,n,i){switch(n.tag){case 3:dm(n),ii();break;case 5:Ed(n);break;case 1:$(n.type)&&Pe(n);break;case 4:Nc(n,n.stateNode.containerInfo);break;case 10:var o=n.type._context,f=n.memoizedProps.value;Nt(io,o._currentValue),o._currentValue=f;break;case 13:if(o=n.memoizedState,o!==null)return o.dehydrated!==null?(Nt(qt,qt.current&1),n.flags|=128,null):(i&n.child.childLanes)!==0?fm(t,n,i):(Nt(qt,qt.current&1),t=la(t,n,i),t!==null?t.sibling:null);Nt(qt,qt.current&1);break;case 19:if(o=(i&n.childLanes)!==0,(t.flags&128)!==0){if(o)return pm(t,n,i);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Nt(qt,qt.current),o)break;return null;case 22:case 23:return n.lanes=0,om(t,n,i)}return la(t,n,i)}var _m,Kc,gm,vm;_m=function(t,n){for(var i=n.child;i!==null;){if(i.tag===5||i.tag===6)t.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Kc=function(){},gm=function(t,n,i,o){var f=t.memoizedProps;if(f!==o){t=n.stateNode,yr(Ls.current);var g=null;switch(i){case"input":f=Ie(t,f),o=Ie(t,o),g=[];break;case"select":f=V({},f,{value:void 0}),o=V({},o,{value:void 0}),g=[];break;case"textarea":f=be(t,f),o=be(t,o),g=[];break;default:typeof f.onClick!="function"&&typeof o.onClick=="function"&&(t.onclick=Nn)}Et(i,o);var j;i=null;for(de in f)if(!o.hasOwnProperty(de)&&f.hasOwnProperty(de)&&f[de]!=null)if(de==="style"){var P=f[de];for(j in P)P.hasOwnProperty(j)&&(i||(i={}),i[j]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(c.hasOwnProperty(de)?g||(g=[]):(g=g||[]).push(de,null));for(de in o){var H=o[de];if(P=f!=null?f[de]:void 0,o.hasOwnProperty(de)&&H!==P&&(H!=null||P!=null))if(de==="style")if(P){for(j in P)!P.hasOwnProperty(j)||H&&H.hasOwnProperty(j)||(i||(i={}),i[j]="");for(j in H)H.hasOwnProperty(j)&&P[j]!==H[j]&&(i||(i={}),i[j]=H[j])}else i||(g||(g=[]),g.push(de,i)),i=H;else de==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,P=P?P.__html:void 0,H!=null&&P!==H&&(g=g||[]).push(de,H)):de==="children"?typeof H!="string"&&typeof H!="number"||(g=g||[]).push(de,""+H):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(c.hasOwnProperty(de)?(H!=null&&de==="onScroll"&&Ct("scroll",t),g||P===H||(g=[])):(g=g||[]).push(de,H))}i&&(g=g||[]).push("style",i);var de=g;(n.updateQueue=de)&&(n.flags|=4)}},vm=function(t,n,i,o){i!==o&&(n.flags|=4)};function fl(t,n){if(!Dt)switch(t.tailMode){case"hidden":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var o=null;i!==null;)i.alternate!==null&&(o=i),i=i.sibling;o===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:o.sibling=null}}function wn(t){var n=t.alternate!==null&&t.alternate.child===t.child,i=0,o=0;if(n)for(var f=t.child;f!==null;)i|=f.lanes|f.childLanes,o|=f.subtreeFlags&14680064,o|=f.flags&14680064,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)i|=f.lanes|f.childLanes,o|=f.subtreeFlags,o|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=o,t.childLanes=i,n}function sp(t,n,i){var o=n.pendingProps;switch(_c(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wn(n),null;case 1:return $(n.type)&&ne(),wn(n),null;case 3:return o=n.stateNode,ui(),$t(v),$t(u),Ec(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(ao(n)?n.flags|=4:t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,xs!==null&&(ru(xs),xs=null))),Kc(t,n),wn(n),null;case 5:Cc(n);var f=yr(ol.current);if(i=n.type,t!==null&&n.stateNode!=null)gm(t,n,i,o,f),t.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!o){if(n.stateNode===null)throw Error(r(166));return wn(n),null}if(t=yr(Ls.current),ao(n)){o=n.stateNode,i=n.type;var g=n.memoizedProps;switch(o[as]=n,o[gr]=g,t=(n.mode&1)!==0,i){case"dialog":Ct("cancel",o),Ct("close",o);break;case"iframe":case"object":case"embed":Ct("load",o);break;case"video":case"audio":for(f=0;f<gs.length;f++)Ct(gs[f],o);break;case"source":Ct("error",o);break;case"img":case"image":case"link":Ct("error",o),Ct("load",o);break;case"details":Ct("toggle",o);break;case"input":se(o,g),Ct("invalid",o);break;case"select":o._wrapperState={wasMultiple:!!g.multiple},Ct("invalid",o);break;case"textarea":G(o,g),Ct("invalid",o)}Et(i,g),f=null;for(var j in g)if(g.hasOwnProperty(j)){var P=g[j];j==="children"?typeof P=="string"?o.textContent!==P&&(g.suppressHydrationWarning!==!0&&Rn(o.textContent,P,t),f=["children",P]):typeof P=="number"&&o.textContent!==""+P&&(g.suppressHydrationWarning!==!0&&Rn(o.textContent,P,t),f=["children",""+P]):c.hasOwnProperty(j)&&P!=null&&j==="onScroll"&&Ct("scroll",o)}switch(i){case"input":Ge(o),qe(o,g,!0);break;case"textarea":Ge(o),Xe(o);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(o.onclick=Nn)}o=f,n.updateQueue=o,o!==null&&(n.flags|=4)}else{j=f.nodeType===9?f:f.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=J(i)),t==="http://www.w3.org/1999/xhtml"?i==="script"?(t=j.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof o.is=="string"?t=j.createElement(i,{is:o.is}):(t=j.createElement(i),i==="select"&&(j=t,o.multiple?j.multiple=!0:o.size&&(j.size=o.size))):t=j.createElementNS(t,i),t[as]=n,t[gr]=o,_m(t,n,!1,!1),n.stateNode=t;e:{switch(j=Ut(i,o),i){case"dialog":Ct("cancel",t),Ct("close",t),f=o;break;case"iframe":case"object":case"embed":Ct("load",t),f=o;break;case"video":case"audio":for(f=0;f<gs.length;f++)Ct(gs[f],t);f=o;break;case"source":Ct("error",t),f=o;break;case"img":case"image":case"link":Ct("error",t),Ct("load",t),f=o;break;case"details":Ct("toggle",t),f=o;break;case"input":se(t,o),f=Ie(t,o),Ct("invalid",t);break;case"option":f=o;break;case"select":t._wrapperState={wasMultiple:!!o.multiple},f=V({},o,{value:void 0}),Ct("invalid",t);break;case"textarea":G(t,o),f=be(t,o),Ct("invalid",t);break;default:f=o}Et(i,f),P=f;for(g in P)if(P.hasOwnProperty(g)){var H=P[g];g==="style"?yt(t,H):g==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,H!=null&&Se(t,H)):g==="children"?typeof H=="string"?(i!=="textarea"||H!=="")&&ze(t,H):typeof H=="number"&&ze(t,""+H):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(c.hasOwnProperty(g)?H!=null&&g==="onScroll"&&Ct("scroll",t):H!=null&&q(t,g,H,j))}switch(i){case"input":Ge(t),qe(t,o,!1);break;case"textarea":Ge(t),Xe(t);break;case"option":o.value!=null&&t.setAttribute("value",""+te(o.value));break;case"select":t.multiple=!!o.multiple,g=o.value,g!=null?me(t,!!o.multiple,g,!1):o.defaultValue!=null&&me(t,!!o.multiple,o.defaultValue,!0);break;default:typeof f.onClick=="function"&&(t.onclick=Nn)}switch(i){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}}o&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return wn(n),null;case 6:if(t&&n.stateNode!=null)vm(t,n,t.memoizedProps,o);else{if(typeof o!="string"&&n.stateNode===null)throw Error(r(166));if(i=yr(ol.current),yr(Ls.current),ao(n)){if(o=n.stateNode,i=n.memoizedProps,o[as]=n,(g=o.nodeValue!==i)&&(t=Vn,t!==null))switch(t.tag){case 3:Rn(o.nodeValue,i,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Rn(o.nodeValue,i,(t.mode&1)!==0)}g&&(n.flags|=4)}else o=(i.nodeType===9?i:i.ownerDocument).createTextNode(o),o[as]=n,n.stateNode=o}return wn(n),null;case 13:if($t(qt),o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Dt&&Gn!==null&&(n.mode&1)!==0&&(n.flags&128)===0)bd(),ii(),n.flags|=98560,g=!1;else if(g=ao(n),o!==null&&o.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=n.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[as]=n}else ii(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;wn(n),g=!1}else xs!==null&&(ru(xs),xs=null),g=!0;if(!g)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=i,n):(o=o!==null,o!==(t!==null&&t.memoizedState!==null)&&o&&(n.child.flags|=8192,(n.mode&1)!==0&&(t===null||(qt.current&1)!==0?ln===0&&(ln=3):ou())),n.updateQueue!==null&&(n.flags|=4),wn(n),null);case 4:return ui(),Kc(t,n),t===null&&pr(n.stateNode.containerInfo),wn(n),null;case 10:return wc(n.type._context),wn(n),null;case 17:return $(n.type)&&ne(),wn(n),null;case 19:if($t(qt),g=n.memoizedState,g===null)return wn(n),null;if(o=(n.flags&128)!==0,j=g.rendering,j===null)if(o)fl(g,!1);else{if(ln!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(j=uo(t),j!==null){for(n.flags|=128,fl(g,!1),o=j.updateQueue,o!==null&&(n.updateQueue=o,n.flags|=4),n.subtreeFlags=0,o=i,i=n.child;i!==null;)g=i,t=o,g.flags&=14680066,j=g.alternate,j===null?(g.childLanes=0,g.lanes=t,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=j.childLanes,g.lanes=j.lanes,g.child=j.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=j.memoizedProps,g.memoizedState=j.memoizedState,g.updateQueue=j.updateQueue,g.type=j.type,t=j.dependencies,g.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),i=i.sibling;return Nt(qt,qt.current&1|2),n.child}t=t.sibling}g.tail!==null&&zt()>hi&&(n.flags|=128,o=!0,fl(g,!1),n.lanes=4194304)}else{if(!o)if(t=uo(j),t!==null){if(n.flags|=128,o=!0,i=t.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),fl(g,!0),g.tail===null&&g.tailMode==="hidden"&&!j.alternate&&!Dt)return wn(n),null}else 2*zt()-g.renderingStartTime>hi&&i!==1073741824&&(n.flags|=128,o=!0,fl(g,!1),n.lanes=4194304);g.isBackwards?(j.sibling=n.child,n.child=j):(i=g.last,i!==null?i.sibling=j:n.child=j,g.last=j)}return g.tail!==null?(n=g.tail,g.rendering=n,g.tail=n.sibling,g.renderingStartTime=zt(),n.sibling=null,i=qt.current,Nt(qt,o?i&1|2:i&1),n):(wn(n),null);case 22:case 23:return lu(),o=n.memoizedState!==null,t!==null&&t.memoizedState!==null!==o&&(n.flags|=8192),o&&(n.mode&1)!==0?(Kn&1073741824)!==0&&(wn(n),n.subtreeFlags&6&&(n.flags|=8192)):wn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function ap(t,n){switch(_c(n),n.tag){case 1:return $(n.type)&&ne(),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return ui(),$t(v),$t(u),Ec(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 5:return Cc(n),null;case 13:if($t(qt),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ii()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return $t(qt),null;case 4:return ui(),null;case 10:return wc(n.type._context),null;case 22:case 23:return lu(),null;case 24:return null;default:return null}}var xo=!1,jn=!1,rp=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function mi(t,n){var i=t.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(o){Gt(t,n,o)}else i.current=null}function Qc(t,n,i){try{i()}catch(o){Gt(t,n,o)}}var ym=!1;function ip(t,n){if(Na=Za,t=cr(),Kr(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var f=o.anchorOffset,g=o.focusNode;o=o.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var j=0,P=-1,H=-1,de=0,Ee=0,Le=t,Ne=null;t:for(;;){for(var We;Le!==i||f!==0&&Le.nodeType!==3||(P=j+f),Le!==g||o!==0&&Le.nodeType!==3||(H=j+o),Le.nodeType===3&&(j+=Le.nodeValue.length),(We=Le.firstChild)!==null;)Ne=Le,Le=We;for(;;){if(Le===t)break t;if(Ne===i&&++de===f&&(P=j),Ne===g&&++Ee===o&&(H=j),(We=Le.nextSibling)!==null)break;Le=Ne,Ne=Le.parentNode}Le=We}i=P===-1||H===-1?null:{start:P,end:H}}else i=null}i=i||{start:0,end:0}}else i=null;for(tl={focusedElem:t,selectionRange:i},Za=!1,Ve=n;Ve!==null;)if(n=Ve,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Ve=t;else for(;Ve!==null;){n=Ve;try{var Qe=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Qe!==null){var Je=Qe.memoizedProps,Xt=Qe.memoizedState,ae=n.stateNode,K=ae.getSnapshotBeforeUpdate(n.elementType===n.type?Je:bs(n.type,Je),Xt);ae.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var re=n.stateNode.containerInfo;re.nodeType===1?re.textContent="":re.nodeType===9&&re.documentElement&&re.removeChild(re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Fe){Gt(n,n.return,Fe)}if(t=n.sibling,t!==null){t.return=n.return,Ve=t;break}Ve=n.return}return Qe=ym,ym=!1,Qe}function hl(t,n,i){var o=n.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var f=o=o.next;do{if((f.tag&t)===t){var g=f.destroy;f.destroy=void 0,g!==void 0&&Qc(n,i,g)}f=f.next}while(f!==o)}}function bo(t,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.create;i.destroy=o()}i=i.next}while(i!==n)}}function Jc(t){var n=t.ref;if(n!==null){var i=t.stateNode;switch(t.tag){case 5:t=i;break;default:t=i}typeof n=="function"?n(t):n.current=t}}function xm(t){var n=t.alternate;n!==null&&(t.alternate=null,xm(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&(delete n[as],delete n[gr],delete n[al],delete n[fc],delete n[hc])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function bm(t){return t.tag===5||t.tag===3||t.tag===4}function wm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||bm(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yc(t,n,i){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(t,n):i.insertBefore(t,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(t,i)):(n=i,n.appendChild(t)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Nn));else if(o!==4&&(t=t.child,t!==null))for(Yc(t,n,i),t=t.sibling;t!==null;)Yc(t,n,i),t=t.sibling}function Xc(t,n,i){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?i.insertBefore(t,n):i.appendChild(t);else if(o!==4&&(t=t.child,t!==null))for(Xc(t,n,i),t=t.sibling;t!==null;)Xc(t,n,i),t=t.sibling}var vn=null,ws=!1;function Aa(t,n,i){for(i=i.child;i!==null;)jm(t,n,i),i=i.sibling}function jm(t,n,i){if(hn&&typeof hn.onCommitFiberUnmount=="function")try{hn.onCommitFiberUnmount(Ka,i)}catch{}switch(i.tag){case 5:jn||mi(i,n);case 6:var o=vn,f=ws;vn=null,Aa(t,n,i),vn=o,ws=f,vn!==null&&(ws?(t=vn,i=i.stateNode,t.nodeType===8?t.parentNode.removeChild(i):t.removeChild(i)):vn.removeChild(i.stateNode));break;case 18:vn!==null&&(ws?(t=vn,i=i.stateNode,t.nodeType===8?si(t.parentNode,i):t.nodeType===1&&si(t,i),hs(t)):si(vn,i.stateNode));break;case 4:o=vn,f=ws,vn=i.stateNode.containerInfo,ws=!0,Aa(t,n,i),vn=o,ws=f;break;case 0:case 11:case 14:case 15:if(!jn&&(o=i.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){f=o=o.next;do{var g=f,j=g.destroy;g=g.tag,j!==void 0&&((g&2)!==0||(g&4)!==0)&&Qc(i,n,j),f=f.next}while(f!==o)}Aa(t,n,i);break;case 1:if(!jn&&(mi(i,n),o=i.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=i.memoizedProps,o.state=i.memoizedState,o.componentWillUnmount()}catch(P){Gt(i,n,P)}Aa(t,n,i);break;case 21:Aa(t,n,i);break;case 22:i.mode&1?(jn=(o=jn)||i.memoizedState!==null,Aa(t,n,i),jn=o):Aa(t,n,i);break;default:Aa(t,n,i)}}function km(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var i=t.stateNode;i===null&&(i=t.stateNode=new rp),n.forEach(function(o){var f=pp.bind(null,t,o);i.has(o)||(i.add(o),o.then(f,f))})}}function js(t,n){var i=n.deletions;if(i!==null)for(var o=0;o<i.length;o++){var f=i[o];try{var g=t,j=n,P=j;e:for(;P!==null;){switch(P.tag){case 5:vn=P.stateNode,ws=!1;break e;case 3:vn=P.stateNode.containerInfo,ws=!0;break e;case 4:vn=P.stateNode.containerInfo,ws=!0;break e}P=P.return}if(vn===null)throw Error(r(160));jm(g,j,f),vn=null,ws=!1;var H=f.alternate;H!==null&&(H.return=null),f.return=null}catch(de){Gt(f,n,de)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)Sm(n,t),n=n.sibling}function Sm(t,n){var i=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(js(n,t),zs(t),o&4){try{hl(3,t,t.return),bo(3,t)}catch(Je){Gt(t,t.return,Je)}try{hl(5,t,t.return)}catch(Je){Gt(t,t.return,Je)}}break;case 1:js(n,t),zs(t),o&512&&i!==null&&mi(i,i.return);break;case 5:if(js(n,t),zs(t),o&512&&i!==null&&mi(i,i.return),t.flags&32){var f=t.stateNode;try{ze(f,"")}catch(Je){Gt(t,t.return,Je)}}if(o&4&&(f=t.stateNode,f!=null)){var g=t.memoizedProps,j=i!==null?i.memoizedProps:g,P=t.type,H=t.updateQueue;if(t.updateQueue=null,H!==null)try{P==="input"&&g.type==="radio"&&g.name!=null&&ye(f,g),Ut(P,j);var de=Ut(P,g);for(j=0;j<H.length;j+=2){var Ee=H[j],Le=H[j+1];Ee==="style"?yt(f,Le):Ee==="dangerouslySetInnerHTML"?Se(f,Le):Ee==="children"?ze(f,Le):q(f,Ee,Le,de)}switch(P){case"input":_e(f,g);break;case"textarea":ke(f,g);break;case"select":var Ne=f._wrapperState.wasMultiple;f._wrapperState.wasMultiple=!!g.multiple;var We=g.value;We!=null?me(f,!!g.multiple,We,!1):Ne!==!!g.multiple&&(g.defaultValue!=null?me(f,!!g.multiple,g.defaultValue,!0):me(f,!!g.multiple,g.multiple?[]:"",!1))}f[gr]=g}catch(Je){Gt(t,t.return,Je)}}break;case 6:if(js(n,t),zs(t),o&4){if(t.stateNode===null)throw Error(r(162));f=t.stateNode,g=t.memoizedProps;try{f.nodeValue=g}catch(Je){Gt(t,t.return,Je)}}break;case 3:if(js(n,t),zs(t),o&4&&i!==null&&i.memoizedState.isDehydrated)try{hs(n.containerInfo)}catch(Je){Gt(t,t.return,Je)}break;case 4:js(n,t),zs(t);break;case 13:js(n,t),zs(t),f=t.child,f.flags&8192&&(g=f.memoizedState!==null,f.stateNode.isHidden=g,!g||f.alternate!==null&&f.alternate.memoizedState!==null||(tu=zt())),o&4&&km(t);break;case 22:if(Ee=i!==null&&i.memoizedState!==null,t.mode&1?(jn=(de=jn)||Ee,js(n,t),jn=de):js(n,t),zs(t),o&8192){if(de=t.memoizedState!==null,(t.stateNode.isHidden=de)&&!Ee&&(t.mode&1)!==0)for(Ve=t,Ee=t.child;Ee!==null;){for(Le=Ve=Ee;Ve!==null;){switch(Ne=Ve,We=Ne.child,Ne.tag){case 0:case 11:case 14:case 15:hl(4,Ne,Ne.return);break;case 1:mi(Ne,Ne.return);var Qe=Ne.stateNode;if(typeof Qe.componentWillUnmount=="function"){o=Ne,i=Ne.return;try{n=o,Qe.props=n.memoizedProps,Qe.state=n.memoizedState,Qe.componentWillUnmount()}catch(Je){Gt(o,i,Je)}}break;case 5:mi(Ne,Ne.return);break;case 22:if(Ne.memoizedState!==null){$m(Le);continue}}We!==null?(We.return=Ne,Ve=We):$m(Le)}Ee=Ee.sibling}e:for(Ee=null,Le=t;;){if(Le.tag===5){if(Ee===null){Ee=Le;try{f=Le.stateNode,de?(g=f.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(P=Le.stateNode,H=Le.memoizedProps.style,j=H!=null&&H.hasOwnProperty("display")?H.display:null,P.style.display=dt("display",j))}catch(Je){Gt(t,t.return,Je)}}}else if(Le.tag===6){if(Ee===null)try{Le.stateNode.nodeValue=de?"":Le.memoizedProps}catch(Je){Gt(t,t.return,Je)}}else if((Le.tag!==22&&Le.tag!==23||Le.memoizedState===null||Le===t)&&Le.child!==null){Le.child.return=Le,Le=Le.child;continue}if(Le===t)break e;for(;Le.sibling===null;){if(Le.return===null||Le.return===t)break e;Ee===Le&&(Ee=null),Le=Le.return}Ee===Le&&(Ee=null),Le.sibling.return=Le.return,Le=Le.sibling}}break;case 19:js(n,t),zs(t),o&4&&km(t);break;case 21:break;default:js(n,t),zs(t)}}function zs(t){var n=t.flags;if(n&2){try{e:{for(var i=t.return;i!==null;){if(bm(i)){var o=i;break e}i=i.return}throw Error(r(160))}switch(o.tag){case 5:var f=o.stateNode;o.flags&32&&(ze(f,""),o.flags&=-33);var g=wm(t);Xc(t,g,f);break;case 3:case 4:var j=o.stateNode.containerInfo,P=wm(t);Yc(t,P,j);break;default:throw Error(r(161))}}catch(H){Gt(t,t.return,H)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function lp(t,n,i){Ve=t,Nm(t)}function Nm(t,n,i){for(var o=(t.mode&1)!==0;Ve!==null;){var f=Ve,g=f.child;if(f.tag===22&&o){var j=f.memoizedState!==null||xo;if(!j){var P=f.alternate,H=P!==null&&P.memoizedState!==null||jn;P=xo;var de=jn;if(xo=j,(jn=H)&&!de)for(Ve=f;Ve!==null;)j=Ve,H=j.child,j.tag===22&&j.memoizedState!==null?Em(f):H!==null?(H.return=j,Ve=H):Em(f);for(;g!==null;)Ve=g,Nm(g),g=g.sibling;Ve=f,xo=P,jn=de}Cm(t)}else(f.subtreeFlags&8772)!==0&&g!==null?(g.return=f,Ve=g):Cm(t)}}function Cm(t){for(;Ve!==null;){var n=Ve;if((n.flags&8772)!==0){var i=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:jn||bo(5,n);break;case 1:var o=n.stateNode;if(n.flags&4&&!jn)if(i===null)o.componentDidMount();else{var f=n.elementType===n.type?i.memoizedProps:bs(n.type,i.memoizedProps);o.componentDidUpdate(f,i.memoizedState,o.__reactInternalSnapshotBeforeUpdate)}var g=n.updateQueue;g!==null&&$d(n,g,o);break;case 3:var j=n.updateQueue;if(j!==null){if(i=null,n.child!==null)switch(n.child.tag){case 5:i=n.child.stateNode;break;case 1:i=n.child.stateNode}$d(n,j,i)}break;case 5:var P=n.stateNode;if(i===null&&n.flags&4){i=P;var H=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":H.autoFocus&&i.focus();break;case"img":H.src&&(i.src=H.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var de=n.alternate;if(de!==null){var Ee=de.memoizedState;if(Ee!==null){var Le=Ee.dehydrated;Le!==null&&hs(Le)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}jn||n.flags&512&&Jc(n)}catch(Ne){Gt(n,n.return,Ne)}}if(n===t){Ve=null;break}if(i=n.sibling,i!==null){i.return=n.return,Ve=i;break}Ve=n.return}}function $m(t){for(;Ve!==null;){var n=Ve;if(n===t){Ve=null;break}var i=n.sibling;if(i!==null){i.return=n.return,Ve=i;break}Ve=n.return}}function Em(t){for(;Ve!==null;){var n=Ve;try{switch(n.tag){case 0:case 11:case 15:var i=n.return;try{bo(4,n)}catch(H){Gt(n,i,H)}break;case 1:var o=n.stateNode;if(typeof o.componentDidMount=="function"){var f=n.return;try{o.componentDidMount()}catch(H){Gt(n,f,H)}}var g=n.return;try{Jc(n)}catch(H){Gt(n,g,H)}break;case 5:var j=n.return;try{Jc(n)}catch(H){Gt(n,j,H)}}}catch(H){Gt(n,n.return,H)}if(n===t){Ve=null;break}var P=n.sibling;if(P!==null){P.return=n.return,Ve=P;break}Ve=n.return}}var op=Math.ceil,wo=Q.ReactCurrentDispatcher,Zc=Q.ReactCurrentOwner,cs=Q.ReactCurrentBatchConfig,vt=0,un=null,tn=null,yn=0,Kn=0,fi=vs(0),ln=0,pl=null,br=0,jo=0,eu=0,_l=null,Mn=null,tu=0,hi=1/0,oa=null,ko=!1,nu=null,Ra=null,So=!1,La=null,No=0,gl=0,su=null,Co=-1,$o=0;function $n(){return(vt&6)!==0?zt():Co!==-1?Co:Co=zt()}function Ma(t){return(t.mode&1)===0?1:(vt&2)!==0&&yn!==0?yn&-yn:Hh.transition!==null?($o===0&&($o=qs()),$o):(t=ct,t!==0||(t=window.event,t=t===void 0?16:qr(t.type)),t)}function ks(t,n,i,o){if(50<gl)throw gl=0,su=null,Error(r(185));Ot(t,i,o),((vt&2)===0||t!==un)&&(t===un&&((vt&2)===0&&(jo|=i),ln===4&&za(t,yn)),zn(t,o),i===1&&vt===0&&(n.mode&1)===0&&(hi=zt()+500,Tt&&et()))}function zn(t,n){var i=t.callbackNode;Pr(t,n);var o=Ft(t,t===un?yn:0);if(o===0)i!==null&&Va(i),t.callbackNode=null,t.callbackPriority=0;else if(n=o&-o,t.callbackPriority!==n){if(i!=null&&Va(i),n===1)t.tag===0?bt(Am.bind(null,t)):rs(Am.bind(null,t)),dc(function(){(vt&6)===0&&et()}),i=null;else{switch(Dr(o)){case 1:i=Ga;break;case 4:i=Ds;break;case 16:i=ms;break;case 536870912:i=fa;break;default:i=ms}i=Dm(i,Tm.bind(null,t))}t.callbackPriority=n,t.callbackNode=i}}function Tm(t,n){if(Co=-1,$o=0,(vt&6)!==0)throw Error(r(327));var i=t.callbackNode;if(pi()&&t.callbackNode!==i)return null;var o=Ft(t,t===un?yn:0);if(o===0)return null;if((o&30)!==0||(o&t.expiredLanes)!==0||n)n=Eo(t,o);else{n=o;var f=vt;vt|=2;var g=Lm();(un!==t||yn!==n)&&(oa=null,hi=zt()+500,jr(t,n));do try{dp();break}catch(P){Rm(t,P)}while(!0);bc(),wo.current=g,vt=f,tn!==null?n=0:(un=null,yn=0,n=ln)}if(n!==0){if(n===2&&(f=Ss(t),f!==0&&(o=f,n=au(t,f))),n===1)throw i=pl,jr(t,0),za(t,o),zn(t,zt()),i;if(n===6)za(t,o);else{if(f=t.current.alternate,(o&30)===0&&!cp(f)&&(n=Eo(t,o),n===2&&(g=Ss(t),g!==0&&(o=g,n=au(t,g))),n===1))throw i=pl,jr(t,0),za(t,o),zn(t,zt()),i;switch(t.finishedWork=f,t.finishedLanes=o,n){case 0:case 1:throw Error(r(345));case 2:kr(t,Mn,oa);break;case 3:if(za(t,o),(o&130023424)===o&&(n=tu+500-zt(),10<n)){if(Ft(t,0)!==0)break;if(f=t.suspendedLanes,(f&o)!==o){$n(),t.pingedLanes|=t.suspendedLanes&f;break}t.timeoutHandle=nl(kr.bind(null,t,Mn,oa),n);break}kr(t,Mn,oa);break;case 4:if(za(t,o),(o&4194240)===o)break;for(n=t.eventTimes,f=-1;0<o;){var j=31-kn(o);g=1<<j,j=n[j],j>f&&(f=j),o&=~g}if(o=f,o=zt()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*op(o/1960))-o,10<o){t.timeoutHandle=nl(kr.bind(null,t,Mn,oa),o);break}kr(t,Mn,oa);break;case 5:kr(t,Mn,oa);break;default:throw Error(r(329))}}}return zn(t,zt()),t.callbackNode===i?Tm.bind(null,t):null}function au(t,n){var i=_l;return t.current.memoizedState.isDehydrated&&(jr(t,n).flags|=256),t=Eo(t,n),t!==2&&(n=Mn,Mn=i,n!==null&&ru(n)),t}function ru(t){Mn===null?Mn=t:Mn.push.apply(Mn,t)}function cp(t){for(var n=t;;){if(n.flags&16384){var i=n.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var o=0;o<i.length;o++){var f=i[o],g=f.getSnapshot;f=f.value;try{if(!An(g(),f))return!1}catch{return!1}}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function za(t,n){for(n&=~eu,n&=~jo,t.suspendedLanes|=n,t.pingedLanes&=~n,t=t.expirationTimes;0<n;){var i=31-kn(n),o=1<<i;t[i]=-1,n&=~o}}function Am(t){if((vt&6)!==0)throw Error(r(327));pi();var n=Ft(t,0);if((n&1)===0)return zn(t,zt()),null;var i=Eo(t,n);if(t.tag!==0&&i===2){var o=Ss(t);o!==0&&(n=o,i=au(t,o))}if(i===1)throw i=pl,jr(t,0),za(t,n),zn(t,zt()),i;if(i===6)throw Error(r(345));return t.finishedWork=t.current.alternate,t.finishedLanes=n,kr(t,Mn,oa),zn(t,zt()),null}function iu(t,n){var i=vt;vt|=1;try{return t(n)}finally{vt=i,vt===0&&(hi=zt()+500,Tt&&et())}}function wr(t){La!==null&&La.tag===0&&(vt&6)===0&&pi();var n=vt;vt|=1;var i=cs.transition,o=ct;try{if(cs.transition=null,ct=1,t)return t()}finally{ct=o,cs.transition=i,vt=n,(vt&6)===0&&et()}}function lu(){Kn=fi.current,$t(fi)}function jr(t,n){t.finishedWork=null,t.finishedLanes=0;var i=t.timeoutHandle;if(i!==-1&&(t.timeoutHandle=-1,uc(i)),tn!==null)for(i=tn.return;i!==null;){var o=i;switch(_c(o),o.tag){case 1:o=o.type.childContextTypes,o!=null&&ne();break;case 3:ui(),$t(v),$t(u),Ec();break;case 5:Cc(o);break;case 4:ui();break;case 13:$t(qt);break;case 19:$t(qt);break;case 10:wc(o.type._context);break;case 22:case 23:lu()}i=i.return}if(un=t,tn=t=Pa(t.current,null),yn=Kn=n,ln=0,pl=null,eu=jo=br=0,Mn=_l=null,vr!==null){for(n=0;n<vr.length;n++)if(i=vr[n],o=i.interleaved,o!==null){i.interleaved=null;var f=o.next,g=i.pending;if(g!==null){var j=g.next;g.next=f,o.next=j}i.pending=o}vr=null}return t}function Rm(t,n){do{var i=tn;try{if(bc(),mo.current=_o,fo){for(var o=Bt.memoizedState;o!==null;){var f=o.queue;f!==null&&(f.pending=null),o=o.next}fo=!1}if(xr=0,cn=rn=Bt=null,cl=!1,ul=0,Zc.current=null,i===null||i.return===null){ln=1,pl=n,tn=null;break}e:{var g=t,j=i.return,P=i,H=n;if(n=yn,P.flags|=32768,H!==null&&typeof H=="object"&&typeof H.then=="function"){var de=H,Ee=P,Le=Ee.tag;if((Ee.mode&1)===0&&(Le===0||Le===11||Le===15)){var Ne=Ee.alternate;Ne?(Ee.updateQueue=Ne.updateQueue,Ee.memoizedState=Ne.memoizedState,Ee.lanes=Ne.lanes):(Ee.updateQueue=null,Ee.memoizedState=null)}var We=sm(j);if(We!==null){We.flags&=-257,am(We,j,P,g,n),We.mode&1&&nm(g,de,n),n=We,H=de;var Qe=n.updateQueue;if(Qe===null){var Je=new Set;Je.add(H),n.updateQueue=Je}else Qe.add(H);break e}else{if((n&1)===0){nm(g,de,n),ou();break e}H=Error(r(426))}}else if(Dt&&P.mode&1){var Xt=sm(j);if(Xt!==null){(Xt.flags&65536)===0&&(Xt.flags|=256),am(Xt,j,P,g,n),yc(di(H,P));break e}}g=H=di(H,P),ln!==4&&(ln=2),_l===null?_l=[g]:_l.push(g),g=j;do{switch(g.tag){case 3:g.flags|=65536,n&=-n,g.lanes|=n;var ae=em(g,H,n);Cd(g,ae);break e;case 1:P=H;var K=g.type,re=g.stateNode;if((g.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||re!==null&&typeof re.componentDidCatch=="function"&&(Ra===null||!Ra.has(re)))){g.flags|=65536,n&=-n,g.lanes|=n;var Fe=tm(g,P,n);Cd(g,Fe);break e}}g=g.return}while(g!==null)}zm(i)}catch(Ze){n=Ze,tn===i&&i!==null&&(tn=i=i.return);continue}break}while(!0)}function Lm(){var t=wo.current;return wo.current=_o,t===null?_o:t}function ou(){(ln===0||ln===3||ln===2)&&(ln=4),un===null||(br&268435455)===0&&(jo&268435455)===0||za(un,yn)}function Eo(t,n){var i=vt;vt|=2;var o=Lm();(un!==t||yn!==n)&&(oa=null,jr(t,n));do try{up();break}catch(f){Rm(t,f)}while(!0);if(bc(),vt=i,wo.current=o,tn!==null)throw Error(r(261));return un=null,yn=0,ln}function up(){for(;tn!==null;)Mm(tn)}function dp(){for(;tn!==null&&!Il();)Mm(tn)}function Mm(t){var n=Om(t.alternate,t,Kn);t.memoizedProps=t.pendingProps,n===null?zm(t):tn=n,Zc.current=null}function zm(t){var n=t;do{var i=n.alternate;if(t=n.return,(n.flags&32768)===0){if(i=sp(i,n,Kn),i!==null){tn=i;return}}else{if(i=ap(i,n),i!==null){i.flags&=32767,tn=i;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{ln=6,tn=null;return}}if(n=n.sibling,n!==null){tn=n;return}tn=n=t}while(n!==null);ln===0&&(ln=5)}function kr(t,n,i){var o=ct,f=cs.transition;try{cs.transition=null,ct=1,mp(t,n,i,o)}finally{cs.transition=f,ct=o}return null}function mp(t,n,i,o){do pi();while(La!==null);if((vt&6)!==0)throw Error(r(327));i=t.finishedWork;var f=t.finishedLanes;if(i===null)return null;if(t.finishedWork=null,t.finishedLanes=0,i===t.current)throw Error(r(177));t.callbackNode=null,t.callbackPriority=0;var g=i.lanes|i.childLanes;if(Ns(t,g),t===un&&(tn=un=null,yn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||So||(So=!0,Dm(ms,function(){return pi(),null})),g=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||g){g=cs.transition,cs.transition=null;var j=ct;ct=1;var P=vt;vt|=4,Zc.current=null,ip(t,i),Sm(i,t),oc(tl),Za=!!Na,tl=Na=null,t.current=i,lp(i),Mr(),vt=P,ct=j,cs.transition=g}else t.current=i;if(So&&(So=!1,La=t,No=f),g=t.pendingLanes,g===0&&(Ra=null),Dl(i.stateNode),zn(t,zt()),n!==null)for(o=t.onRecoverableError,i=0;i<n.length;i++)f=n[i],o(f.value,{componentStack:f.stack,digest:f.digest});if(ko)throw ko=!1,t=nu,nu=null,t;return(No&1)!==0&&t.tag!==0&&pi(),g=t.pendingLanes,(g&1)!==0?t===su?gl++:(gl=0,su=t):gl=0,et(),null}function pi(){if(La!==null){var t=Dr(No),n=cs.transition,i=ct;try{if(cs.transition=null,ct=16>t?16:t,La===null)var o=!1;else{if(t=La,La=null,No=0,(vt&6)!==0)throw Error(r(331));var f=vt;for(vt|=4,Ve=t.current;Ve!==null;){var g=Ve,j=g.child;if((Ve.flags&16)!==0){var P=g.deletions;if(P!==null){for(var H=0;H<P.length;H++){var de=P[H];for(Ve=de;Ve!==null;){var Ee=Ve;switch(Ee.tag){case 0:case 11:case 15:hl(8,Ee,g)}var Le=Ee.child;if(Le!==null)Le.return=Ee,Ve=Le;else for(;Ve!==null;){Ee=Ve;var Ne=Ee.sibling,We=Ee.return;if(xm(Ee),Ee===de){Ve=null;break}if(Ne!==null){Ne.return=We,Ve=Ne;break}Ve=We}}}var Qe=g.alternate;if(Qe!==null){var Je=Qe.child;if(Je!==null){Qe.child=null;do{var Xt=Je.sibling;Je.sibling=null,Je=Xt}while(Je!==null)}}Ve=g}}if((g.subtreeFlags&2064)!==0&&j!==null)j.return=g,Ve=j;else e:for(;Ve!==null;){if(g=Ve,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:hl(9,g,g.return)}var ae=g.sibling;if(ae!==null){ae.return=g.return,Ve=ae;break e}Ve=g.return}}var K=t.current;for(Ve=K;Ve!==null;){j=Ve;var re=j.child;if((j.subtreeFlags&2064)!==0&&re!==null)re.return=j,Ve=re;else e:for(j=K;Ve!==null;){if(P=Ve,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:bo(9,P)}}catch(Ze){Gt(P,P.return,Ze)}if(P===j){Ve=null;break e}var Fe=P.sibling;if(Fe!==null){Fe.return=P.return,Ve=Fe;break e}Ve=P.return}}if(vt=f,et(),hn&&typeof hn.onPostCommitFiberRoot=="function")try{hn.onPostCommitFiberRoot(Ka,t)}catch{}o=!0}return o}finally{ct=i,cs.transition=n}}return!1}function Pm(t,n,i){n=di(i,n),n=em(t,n,1),t=Ta(t,n,1),n=$n(),t!==null&&(Ot(t,1,n),zn(t,n))}function Gt(t,n,i){if(t.tag===3)Pm(t,t,i);else for(;n!==null;){if(n.tag===3){Pm(n,t,i);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(Ra===null||!Ra.has(o))){t=di(i,t),t=tm(n,t,1),n=Ta(n,t,1),t=$n(),n!==null&&(Ot(n,1,t),zn(n,t));break}}n=n.return}}function fp(t,n,i){var o=t.pingCache;o!==null&&o.delete(n),n=$n(),t.pingedLanes|=t.suspendedLanes&i,un===t&&(yn&i)===i&&(ln===4||ln===3&&(yn&130023424)===yn&&500>zt()-tu?jr(t,0):eu|=i),zn(t,n)}function Im(t,n){n===0&&((t.mode&1)===0?n=1:(n=Fs,Fs<<=1,(Fs&130023424)===0&&(Fs=4194304)));var i=$n();t=ra(t,n),t!==null&&(Ot(t,n,i),zn(t,i))}function hp(t){var n=t.memoizedState,i=0;n!==null&&(i=n.retryLane),Im(t,i)}function pp(t,n){var i=0;switch(t.tag){case 13:var o=t.stateNode,f=t.memoizedState;f!==null&&(i=f.retryLane);break;case 19:o=t.stateNode;break;default:throw Error(r(314))}o!==null&&o.delete(n),Im(t,i)}var Om;Om=function(t,n,i){if(t!==null)if(t.memoizedProps!==n.pendingProps||v.current)Ln=!0;else{if((t.lanes&i)===0&&(n.flags&128)===0)return Ln=!1,np(t,n,i);Ln=(t.flags&131072)!==0}else Ln=!1,Dt&&(n.flags&1048576)!==0&&gd(n,At,n.index);switch(n.lanes=0,n.tag){case 2:var o=n.type;yo(t,n),t=n.pendingProps;var f=k(n,u.current);ci(n,i),f=Rc(null,n,o,t,f,i);var g=Lc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,$(o)?(g=!0,Pe(n)):g=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Sc(n),f.updater=go,n.stateNode=f,f._reactInternals=n,Dc(n,o,t,i),n=Uc(null,n,o,!0,g,i)):(n.tag=0,Dt&&g&&pc(n),Cn(null,n,f,i),n=n.child),n;case 16:o=n.elementType;e:{switch(yo(t,n),t=n.pendingProps,f=o._init,o=f(o._payload),n.type=o,f=n.tag=gp(o),t=bs(o,t),f){case 0:n=Bc(null,n,o,t,i);break e;case 1:n=um(null,n,o,t,i);break e;case 11:n=rm(null,n,o,t,i);break e;case 14:n=im(null,n,o,bs(o.type,t),i);break e}throw Error(r(306,o,""))}return n;case 0:return o=n.type,f=n.pendingProps,f=n.elementType===o?f:bs(o,f),Bc(t,n,o,f,i);case 1:return o=n.type,f=n.pendingProps,f=n.elementType===o?f:bs(o,f),um(t,n,o,f,i);case 3:e:{if(dm(n),t===null)throw Error(r(387));o=n.pendingProps,g=n.memoizedState,f=g.element,Nd(t,n),co(n,o,null,i);var j=n.memoizedState;if(o=j.element,g.isDehydrated)if(g={element:o,isDehydrated:!1,cache:j.cache,pendingSuspenseBoundaries:j.pendingSuspenseBoundaries,transitions:j.transitions},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){f=di(Error(r(423)),n),n=mm(t,n,o,i,f);break e}else if(o!==f){f=di(Error(r(424)),n),n=mm(t,n,o,i,f);break e}else for(Gn=Rs(n.stateNode.containerInfo.firstChild),Vn=n,Dt=!0,xs=null,i=kd(n,null,o,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ii(),o===f){n=la(t,n,i);break e}Cn(t,n,o,i)}n=n.child}return n;case 5:return Ed(n),t===null&&vc(n),o=n.type,f=n.pendingProps,g=t!==null?t.memoizedProps:null,j=f.children,_r(o,f)?j=null:g!==null&&_r(o,g)&&(n.flags|=32),cm(t,n),Cn(t,n,j,i),n.child;case 6:return t===null&&vc(n),null;case 13:return fm(t,n,i);case 4:return Nc(n,n.stateNode.containerInfo),o=n.pendingProps,t===null?n.child=li(n,null,o,i):Cn(t,n,o,i),n.child;case 11:return o=n.type,f=n.pendingProps,f=n.elementType===o?f:bs(o,f),rm(t,n,o,f,i);case 7:return Cn(t,n,n.pendingProps,i),n.child;case 8:return Cn(t,n,n.pendingProps.children,i),n.child;case 12:return Cn(t,n,n.pendingProps.children,i),n.child;case 10:e:{if(o=n.type._context,f=n.pendingProps,g=n.memoizedProps,j=f.value,Nt(io,o._currentValue),o._currentValue=j,g!==null)if(An(g.value,j)){if(g.children===f.children&&!v.current){n=la(t,n,i);break e}}else for(g=n.child,g!==null&&(g.return=n);g!==null;){var P=g.dependencies;if(P!==null){j=g.child;for(var H=P.firstContext;H!==null;){if(H.context===o){if(g.tag===1){H=ia(-1,i&-i),H.tag=2;var de=g.updateQueue;if(de!==null){de=de.shared;var Ee=de.pending;Ee===null?H.next=H:(H.next=Ee.next,Ee.next=H),de.pending=H}}g.lanes|=i,H=g.alternate,H!==null&&(H.lanes|=i),jc(g.return,i,n),P.lanes|=i;break}H=H.next}}else if(g.tag===10)j=g.type===n.type?null:g.child;else if(g.tag===18){if(j=g.return,j===null)throw Error(r(341));j.lanes|=i,P=j.alternate,P!==null&&(P.lanes|=i),jc(j,i,n),j=g.sibling}else j=g.child;if(j!==null)j.return=g;else for(j=g;j!==null;){if(j===n){j=null;break}if(g=j.sibling,g!==null){g.return=j.return,j=g;break}j=j.return}g=j}Cn(t,n,f.children,i),n=n.child}return n;case 9:return f=n.type,o=n.pendingProps.children,ci(n,i),f=ls(f),o=o(f),n.flags|=1,Cn(t,n,o,i),n.child;case 14:return o=n.type,f=bs(o,n.pendingProps),f=bs(o.type,f),im(t,n,o,f,i);case 15:return lm(t,n,n.type,n.pendingProps,i);case 17:return o=n.type,f=n.pendingProps,f=n.elementType===o?f:bs(o,f),yo(t,n),n.tag=1,$(o)?(t=!0,Pe(n)):t=!1,ci(n,i),Xd(n,o,f),Dc(n,o,f,i),Uc(null,n,o,!0,t,i);case 19:return pm(t,n,i);case 22:return om(t,n,i)}throw Error(r(156,n.tag))};function Dm(t,n){return Ni(t,n)}function _p(t,n,i,o){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function us(t,n,i,o){return new _p(t,n,i,o)}function cu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function gp(t){if(typeof t=="function")return cu(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ve)return 11;if(t===R)return 14}return 2}function Pa(t,n){var i=t.alternate;return i===null?(i=us(t.tag,n,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=n,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&14680064,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,n=t.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i}function To(t,n,i,o,f,g){var j=2;if(o=t,typeof t=="function")cu(t)&&(j=1);else if(typeof t=="string")j=5;else e:switch(t){case oe:return Sr(i.children,f,g,n);case le:j=8,f|=8;break;case pe:return t=us(12,i,n,f|2),t.elementType=pe,t.lanes=g,t;case ce:return t=us(13,i,n,f),t.elementType=ce,t.lanes=g,t;case D:return t=us(19,i,n,f),t.elementType=D,t.lanes=g,t;case X:return Ao(i,f,g,n);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Te:j=10;break e;case Me:j=9;break e;case ve:j=11;break e;case R:j=14;break e;case U:j=16,o=null;break e}throw Error(r(130,t==null?t:typeof t,""))}return n=us(j,i,n,f),n.elementType=t,n.type=o,n.lanes=g,n}function Sr(t,n,i,o){return t=us(7,t,o,n),t.lanes=i,t}function Ao(t,n,i,o){return t=us(22,t,o,n),t.elementType=X,t.lanes=i,t.stateNode={isHidden:!1},t}function uu(t,n,i){return t=us(6,t,null,n),t.lanes=i,t}function du(t,n,i){return n=us(4,t.children!==null?t.children:[],t.key,n),n.lanes=i,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}function vp(t,n,i,o,f){this.tag=n,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ir(0),this.expirationTimes=Ir(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ir(0),this.identifierPrefix=o,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function mu(t,n,i,o,f,g,j,P,H){return t=new vp(t,n,i,P,H),n===1?(n=1,g===!0&&(n|=8)):n=0,g=us(3,null,null,n),t.current=g,g.stateNode=t,g.memoizedState={element:o,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sc(g),t}function yp(t,n,i){var o=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Z,key:o==null?null:""+o,children:t,containerInfo:n,implementation:i}}function Fm(t){if(!t)return ys;t=t._reactInternals;e:{if(Jn(t)!==t||t.tag!==1)throw Error(r(170));var n=t;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if($(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(t.tag===1){var i=t.type;if($(i))return xe(t,i,n)}return n}function qm(t,n,i,o,f,g,j,P,H){return t=mu(i,o,!0,t,f,g,j,P,H),t.context=Fm(null),i=t.current,o=$n(),f=Ma(i),g=ia(o,f),g.callback=n??null,Ta(i,g,f),t.current.lanes=f,Ot(t,f,o),zn(t,o),t}function Ro(t,n,i,o){var f=n.current,g=$n(),j=Ma(f);return i=Fm(i),n.context===null?n.context=i:n.pendingContext=i,n=ia(g,j),n.payload={element:t},o=o===void 0?null:o,o!==null&&(n.callback=o),t=Ta(f,n,j),t!==null&&(ks(t,f,j,g),oo(t,f,j)),j}function Lo(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function Bm(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<n?i:n}}function fu(t,n){Bm(t,n),(t=t.alternate)&&Bm(t,n)}function xp(){return null}var Um=typeof reportError=="function"?reportError:function(t){console.error(t)};function hu(t){this._internalRoot=t}Mo.prototype.render=hu.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(r(409));Ro(t,n,null,null)},Mo.prototype.unmount=hu.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;wr(function(){Ro(null,t,null,null)}),n[Hn]=null}};function Mo(t){this._internalRoot=t}Mo.prototype.unstable_scheduleHydration=function(t){if(t){var n=Ei();t={blockedOn:null,target:t,priority:n};for(var i=0;i<sn.length&&n!==0&&n<sn[i].priority;i++);sn.splice(i,0,t),i===0&&Un(t)}};function pu(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function zo(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Wm(){}function bp(t,n,i,o,f){if(f){if(typeof o=="function"){var g=o;o=function(){var de=Lo(j);g.call(de)}}var j=qm(n,o,t,0,null,!1,!1,"",Wm);return t._reactRootContainer=j,t[Hn]=j.current,pr(t.nodeType===8?t.parentNode:t),wr(),j}for(;f=t.lastChild;)t.removeChild(f);if(typeof o=="function"){var P=o;o=function(){var de=Lo(H);P.call(de)}}var H=mu(t,0,!1,null,null,!1,!1,"",Wm);return t._reactRootContainer=H,t[Hn]=H.current,pr(t.nodeType===8?t.parentNode:t),wr(function(){Ro(n,H,i,o)}),H}function Po(t,n,i,o,f){var g=i._reactRootContainer;if(g){var j=g;if(typeof f=="function"){var P=f;f=function(){var H=Lo(j);P.call(H)}}Ro(n,j,t,f)}else j=bp(i,n,t,f,o);return Lo(j)}Ci=function(t){switch(t.tag){case 3:var n=t.stateNode;if(n.current.memoizedState.isDehydrated){var i=Xn(n.pendingLanes);i!==0&&(Or(n,i|1),zn(n,zt()),(vt&6)===0&&(hi=zt()+500,et()))}break;case 13:wr(function(){var o=ra(t,1);if(o!==null){var f=$n();ks(o,t,1,f)}}),fu(t,1)}},Qa=function(t){if(t.tag===13){var n=ra(t,134217728);if(n!==null){var i=$n();ks(n,t,134217728,i)}fu(t,134217728)}},$i=function(t){if(t.tag===13){var n=Ma(t),i=ra(t,n);if(i!==null){var o=$n();ks(i,t,n,o)}fu(t,n)}},Ei=function(){return ct},Ja=function(t,n){var i=ct;try{return ct=t,n()}finally{ct=i}},tt=function(t,n,i){switch(n){case"input":if(_e(t,i),n=i.name,i.type==="radio"&&n!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<i.length;n++){var o=i[n];if(o!==t&&o.form===t.form){var f=ai(o);if(!f)throw Error(r(90));fe(o),_e(o,f)}}}break;case"textarea":ke(t,i);break;case"select":n=i.value,n!=null&&me(t,!!i.multiple,n,!1)}},Oe=iu,mt=wr;var wp={usingClientEntryPoint:!1,Events:[$a,sa,ai,we,$e,iu]},vl={findFiberByHostInstance:na,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jp={bundleType:vl.bundleType,version:vl.version,rendererPackageName:vl.rendererPackageName,rendererConfig:vl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Q.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Si(t),t===null?null:t.stateNode},findFiberByHostInstance:vl.findFiberByHostInstance||xp,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 Io=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Io.isDisabled&&Io.supportsFiber)try{Ka=Io.inject(jp),hn=Io}catch{}}return Pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wp,Pn.createPortal=function(t,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pu(n))throw Error(r(200));return yp(t,n,null,i)},Pn.createRoot=function(t,n){if(!pu(t))throw Error(r(299));var i=!1,o="",f=Um;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),n=mu(t,1,!1,null,null,i,!1,o,f),t[Hn]=n.current,pr(t.nodeType===8?t.parentNode:t),new hu(n)},Pn.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=Si(n),t=t===null?null:t.stateNode,t},Pn.flushSync=function(t){return wr(t)},Pn.hydrate=function(t,n,i){if(!zo(n))throw Error(r(200));return Po(null,t,n,!0,i)},Pn.hydrateRoot=function(t,n,i){if(!pu(t))throw Error(r(405));var o=i!=null&&i.hydratedSources||null,f=!1,g="",j=Um;if(i!=null&&(i.unstable_strictMode===!0&&(f=!0),i.identifierPrefix!==void 0&&(g=i.identifierPrefix),i.onRecoverableError!==void 0&&(j=i.onRecoverableError)),n=qm(n,null,t,1,i??null,f,!1,g,j),t[Hn]=n.current,pr(t),o)for(t=0;t<o.length;t++)i=o[t],f=i._getVersion,f=f(i._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[i,f]:n.mutableSourceEagerHydrationData.push(i,f);return new Mo(n)},Pn.render=function(t,n,i){if(!zo(n))throw Error(r(200));return Po(null,t,n,!1,i)},Pn.unmountComponentAtNode=function(t){if(!zo(t))throw Error(r(40));return t._reactRootContainer?(wr(function(){Po(null,null,t,!1,function(){t._reactRootContainer=null,t[Hn]=null})}),!0):!1},Pn.unstable_batchedUpdates=iu,Pn.unstable_renderSubtreeIntoContainer=function(t,n,i,o){if(!zo(i))throw Error(r(200));if(t==null||t._reactInternals===void 0)throw Error(r(38));return Po(t,n,i,!1,o)},Pn.version="18.3.1-next-f1338f8080-20240426",Pn}var Xm;function Xf(){if(Xm)return vu.exports;Xm=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),vu.exports=Lp(),vu.exports}var Zm;function Mp(){if(Zm)return Oo;Zm=1;var a=Xf();return Oo.createRoot=a.createRoot,Oo.hydrateRoot=a.hydrateRoot,Oo}var zp=Mp();const Zf=[{id:"dark",label:"Dark (Abstract)",group:"dark",swatches:["#1a1a2e","#16213e","#0f3460","#e94560","#60a5fa","#27ae60"]},{id:"observer-night",label:"Observer Night",group:"dark",swatches:["#0b0f14","#10161e","#161e28","#e8a54a","#6ea8d8","#7bc98c"]},{id:"catppuccin-mocha",label:"Catppuccin Mocha",group:"dark",swatches:["#1e1e2e","#181825","#313244","#cba6f7","#89b4fa","#a6e3a1"]},{id:"catppuccin-macchiato",label:"Catppuccin Macchiato",group:"dark",swatches:["#24273a","#1e2030","#363a4f","#c6a0f6","#8aadf4","#a6da95"]},{id:"catppuccin-frappe",label:"Catppuccin Frappe",group:"dark",swatches:["#303446","#292c3c","#414559","#ca9ee6","#8caaee","#a6d189"]},{id:"rose-pine",label:"Rose Pine",group:"dark",swatches:["#191724","#1f1d2e","#26233a","#c4a7e7","#31748f","#9ccfd8"]},{id:"rose-pine-moon",label:"Rose Pine Moon",group:"dark",swatches:["#232136","#2a273f","#393552","#c4a7e7","#3e8fb0","#9ccfd8"]},{id:"tokyo-night",label:"Tokyo Night",group:"dark",swatches:["#1a1b26","#24283b","#414868","#7aa2f7","#2ac3de","#9ece6a"]},{id:"nord",label:"Nord",group:"dark",swatches:["#2e3440","#3b4252","#434c5e","#88c0d0","#5e81ac","#a3be8c"]},{id:"one-dark",label:"One Dark",group:"dark",swatches:["#282c34","#21252b","#3a3f4b","#61afef","#c678dd","#98c379"]},{id:"dracula",label:"Dracula",group:"dark",swatches:["#282a36","#343746","#44475a","#ff79c6","#8be9fd","#50fa7b"]},{id:"monokai",label:"Monokai",group:"dark",swatches:["#272822","#2d2e27","#3e3d32","#66d9ef","#a1efe4","#a6e22e"]},{id:"gruvbox",label:"Gruvbox",group:"dark",swatches:["#282828","#3c3836","#504945","#fe8019","#83a598","#b8bb26"]},{id:"solarized-dark",label:"Solarized Dark",group:"dark",swatches:["#002b36","#073642","#0b4b5a","#268bd2","#2aa198","#859900"]},{id:"everforest-dark",label:"Everforest Dark",group:"dark",swatches:["#2b3339","#323c41","#3a464c","#a7c080","#7fbbb3","#a7c080"]},{id:"catppuccin-latte",label:"Catppuccin Latte",group:"light",swatches:["#eff1f5","#e6e9ef","#ccd0da","#8839ef","#1e66f5","#40a02b"]},{id:"rose-pine-dawn",label:"Rose Pine Dawn",group:"light",swatches:["#faf4ed","#fffaf3","#f2e9e1","#907aa9","#56949f","#286983"]},{id:"one-light",label:"One Light",group:"light",swatches:["#fafafa","#ffffff","#e5e5e6","#4078f2","#a626a4","#50a14f"]},{id:"everforest-light",label:"Everforest Light",group:"light",swatches:["#fdf6e3","#fffbef","#e8e0cc","#4f8f5a","#3a94c5","#4f8f5a"]},{id:"solarized-light",label:"Solarized Light",group:"light",swatches:["#fdf6e3","#eee8d5","#e3ddc9","#268bd2","#2aa198","#859900"]},{id:"light",label:"Light",group:"light",swatches:["#f7f7fb","#ffffff","#e6e8f0","#e94560","#2563eb","#16a34a"]}];Zf.map(a=>({id:a.id,label:a.label}));function Pp(a){return`theme-${String(a||"").trim()||"dark"}`}function ef(a){try{const s=document.documentElement,r=Array.from(s.classList).filter(l=>l.startsWith("theme-"));for(const l of r)s.classList.remove(l);s.classList.add(Pp(a))}catch{}}const Bu=[{id:"sm",label:"Small",scale:.9},{id:"md",label:"Medium",scale:1},{id:"lg",label:"Large",scale:1.1},{id:"xl",label:"Extra Large",scale:1.2}],Uu=[{id:"compact",label:"Compact",density:.85},{id:"standard",label:"Standard",density:1},{id:"spacious",label:"Spacious",density:1.2}];function Ip(a){const s=String(a).trim();return Bu.find(r=>r.id===s)||Bu[1]}function Op(a){const s=String(a).trim();return Uu.find(r=>r.id===s)||Uu[1]}function tf(a){try{const s=document.documentElement,r=Ip(a.font_scale||"md"),l=Op(a.header_density||"standard");s.style.setProperty("--font-scale",String(r.scale)),s.style.setProperty("--header-density",String(l.density))}catch{}}var eh=Xf();function _i(...a){return a.filter(Boolean).join(" ")}function Ar({value:a,options:s,placeholder:r="Select…",disabled:l=!1,loading:c=!1,searchable:d=!0,searchPlaceholder:m="Search…",allowCustom:p=!1,clearable:_=!1,minPopoverWidth:y=240,variant:b="panel",className:x,triggerClassName:N,ariaLabel:L,id:I,includeValueOption:C=!1,onOpen:z,customOptionLabel:B,validateCustomValue:F,onChange:q,renderOption:Q,renderValue:E}){const Z=h.useRef(null),oe=h.useRef(null),le=h.useRef(null),pe=h.useRef(z),Te=h.useId(),Me=I||`af-select-${Te.replace(/[^a-zA-Z0-9_-]/g,"")}`,ve=`${Me}-listbox`,[ce,D]=h.useState(!1),[R,U]=h.useState(""),[X,M]=h.useState(0),[ue,V]=h.useState("bottom"),[w,A]=h.useState({left:0,top:0,width:0});h.useEffect(()=>{pe.current=z},[z]);const ee=h.useMemo(()=>{if(!C)return s;const ie=String(a??"").trim();return!ie||s.some(me=>me.value===ie)?s:[...s,{value:ie,label:ie}]},[C,s,a]),ge=h.useMemo(()=>{const ie=String(a??"");return ee.find(me=>me.value===ie)||null},[ee,a]),he=h.useMemo(()=>(ge==null?void 0:ge.label)||String(a||"").trim()||"",[ge,a]),O=h.useMemo(()=>{const ie=R.trim().toLowerCase();return ie?ee.filter(me=>me.label.toLowerCase().includes(ie)||me.value.toLowerCase().includes(ie)):ee},[ee,R]),je=h.useMemo(()=>{if(!p)return null;const ie=R.trim();if(!ie||ee.some(G=>G.value===ie))return null;const be=(F==null?void 0:F(ie,{options:ee}))||"";return{value:ie,label:B?B(ie):`Use "${ie}"`,disabled:!!be,reason:be}},[p,B,ee,R,F]),te=h.useMemo(()=>{const ie=je?[je,...O]:O;if(ie.length>0)return ie;const me=String(a??"").trim();return c&&me?[{value:me,label:he||me}]:ie},[je,O,c,he,a]),Ce=h.useCallback(()=>{const ie=Z.current;if(!ie)return;const me=ie.getBoundingClientRect(),be=Math.max(me.width,y),G=Math.max(8,Math.min(me.left,window.innerWidth-be-8)),ke=window.innerHeight-me.bottom,Xe=me.top,J=ke>=220||ke>=Xe?"bottom":"top";V(J);const T=J==="bottom"?me.bottom+6:me.top-6;A({left:G,top:T,width:be})},[y]),Ae=h.useCallback(()=>{D(!1),U("")},[]);h.useEffect(()=>{var ie;ce&&((ie=pe.current)==null||ie.call(pe))},[ce]),h.useEffect(()=>{if(!ce)return;Ce();const ie=()=>Ce();return window.addEventListener("resize",ie),window.addEventListener("scroll",ie,!0),()=>{window.removeEventListener("resize",ie),window.removeEventListener("scroll",ie,!0)}},[ce,Ce]),h.useEffect(()=>{if(!ce)return;const ie=me=>{var G,ke;const be=me.target;be&&((G=Z.current)!=null&&G.contains(be)||(ke=oe.current)!=null&&ke.contains(be)||Ae())};return document.addEventListener("mousedown",ie,!0),()=>document.removeEventListener("mousedown",ie,!0)},[ce,Ae]),h.useEffect(()=>{if(!ce)return;const ie=Math.max(0,te.findIndex(me=>me.value===a));M(ie===-1?0:ie),d&&setTimeout(()=>{var me;return(me=le.current)==null?void 0:me.focus()},0)},[ce,d,a,te]);const Ge=ie=>{var be;const me=te.find(G=>G.value===ie);me!=null&&me.disabled||(q(ie),Ae(),(be=Z.current)==null||be.focus())},fe=ie=>{var me,be;if(ie.key==="Escape")return ie.preventDefault(),Ae(),(me=Z.current)==null||me.focus(),!0;if(ie.key==="Tab")return Ae(),(be=Z.current)==null||be.focus(),!1;if(ie.key==="ArrowDown")return ie.preventDefault(),M(G=>Math.min(G+1,Math.max(0,te.length-1))),!0;if(ie.key==="ArrowUp")return ie.preventDefault(),M(G=>Math.max(G-1,0)),!0;if(ie.key==="Home")return ie.preventDefault(),M(0),!0;if(ie.key==="End")return ie.preventDefault(),M(Math.max(0,te.length-1)),!0;if(ie.key==="Enter"){ie.preventDefault();const G=te[X];return G&&Ge(G.value),!0}return!1},Re=ie=>{if(!l){if(ce){if(fe(ie))return;if(ie.key===" "&&!d){ie.preventDefault();const me=te[X];me&&Ge(me.value)}return}(ie.key==="Enter"||ie.key===" "||ie.key==="ArrowDown"||ie.key==="ArrowUp")&&(ie.preventDefault(),D(!0))}},Ie=!!String(a||"").trim(),se=Ie?he:r,ye=je!=null&&je.disabled?je.reason||"Unavailable":"",_e=ce&&te.length>0?`${Me}-opt-${X}`:void 0,qe=e.jsx("span",{className:_i("af-select-value",!Ie&&"af-select-value--placeholder"),children:c&&!Ie?"Loading…":se}),Ye=E?E(ge,String(a||"")):qe;return e.jsxs("span",{className:_i("af-select",b==="pin"?"af-select--pin":"af-select--panel",x),children:[e.jsxs("button",{ref:Z,id:Me,type:"button",className:_i("af-select-trigger",_&&Ie&&"af-select-trigger--clearable",N),disabled:l,onMouseDown:ie=>ie.stopPropagation(),onClick:ie=>{ie.stopPropagation(),!l&&D(me=>!me)},onKeyDown:Re,role:d?void 0:"combobox","aria-haspopup":"listbox","aria-expanded":ce,"aria-controls":ce?ve:void 0,"aria-activedescendant":d?void 0:_e,"aria-label":L,children:[Ye,e.jsx("span",{className:_i("af-select-caret",ce&&"af-select-caret--open"),children:"▾"})]}),_&&Ie?e.jsx("button",{type:"button",className:"af-select-clear-btn","aria-label":"Clear selection",disabled:l,onMouseDown:ie=>{ie.preventDefault(),ie.stopPropagation()},onClick:ie=>{var me;ie.preventDefault(),ie.stopPropagation(),q(""),Ae(),(me=Z.current)==null||me.focus()},title:"Clear",children:"×"}):null,ce?eh.createPortal(e.jsxs("div",{ref:oe,className:_i("af-select-popover",ue==="top"&&"af-select-popover--top"),style:{position:"fixed",left:`${w.left}px`,top:`${w.top}px`,width:`${w.width}px`},onMouseDown:ie=>ie.stopPropagation(),onClick:ie=>ie.stopPropagation(),onWheel:ie=>ie.stopPropagation(),onKeyDown:fe,tabIndex:-1,children:[d?e.jsxs("div",{className:"af-select-search",children:[e.jsx("input",{ref:le,className:"af-select-search-input",value:R,onChange:ie=>U(ie.target.value),placeholder:m,onKeyDown:fe,role:"combobox","aria-expanded":!0,"aria-controls":ve,"aria-activedescendant":_e,"aria-invalid":!!ye,"aria-describedby":ye?`${Me}-custom-error`:void 0}),ye?e.jsx("div",{id:`${Me}-custom-error`,className:"af-select-custom-error",role:"alert",children:ye}):null]}):null,e.jsx("div",{className:"af-select-options",role:"listbox",id:ve,"aria-label":L,children:c&&te.length===0?e.jsx("div",{className:"af-select-empty",children:"Loading…"}):te.length===0?e.jsx("div",{className:"af-select-empty",children:"No results"}):te.map((ie,me)=>{var T;const be=ie.value===a,G=me===X,ke=String(ie.group||"").trim(),Xe=me>0?String(((T=te[me-1])==null?void 0:T.group)||"").trim():"",J=!!ke&&ke!==Xe;return e.jsxs(Kt.Fragment,{children:[J?e.jsx("div",{className:"af-select-group",role:"presentation",children:ke}):null,e.jsx("div",{id:`${Me}-opt-${me}`,role:"option","aria-selected":be,className:_i("af-select-option",be&&"af-select-option--selected",G&&"af-select-option--highlighted",ie.disabled&&"af-select-option--disabled"),title:ie.disabled?ie.reason||"Unavailable":void 0,onMouseEnter:()=>M(me),onMouseDown:Y=>{Y.preventDefault(),Y.stopPropagation()},onClick:()=>Ge(ie.value),"aria-disabled":ie.disabled?!0:void 0,children:Q?Q(ie,{selected:be,highlighted:G}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"af-select-option-label",children:[e.jsx("span",{children:ie.label}),ie.reason?e.jsx("small",{className:"af-select-option-reason",children:ie.reason}):null]}),be?e.jsx("span",{className:"af-select-check",children:"✓"}):null]})})]},ie.value)})})]}),document.body):null]})}function Dp(a){const s=new Set,r=[];for(const l of a||[]){if(!l||typeof l!="object")continue;const c=String(l.name||"").trim();!c||s.has(c)||(s.add(c),r.push({name:c,display_name:typeof l.display_name=="string"?l.display_name:void 0}))}return r.sort((l,c)=>l.name.localeCompare(c.name)),r}function Fp(a){const s=new Set,r=[];for(const l of a||[]){const c=String(l||"").trim();!c||s.has(c)||(s.add(c),r.push(c))}return r.sort(),r}function qp(a){const s=a.disabled===!0,r=a.layout||"stack",l=a.allowGatewayDefault!==!1,c=String(a.gatewayDefaultLabel||"(gateway default)"),d=String(a.providerLabel||"Provider"),m=String(a.modelLabel||"Model"),p=String(a.providerPlaceholder||"(select)"),_=String(a.modelPlaceholder||"(select)"),y=String(a.provider||"").trim(),b=String(a.model||"").trim(),x=Dp(a.providers),N=Fp(a.models),L=s||!!a.loadingProviders,I=s||!!a.loadingModels,C=[...l?[{value:"",label:c}]:[],...x.map(B=>({value:B.name,label:B.display_name?`${B.display_name} (${B.name})`:B.name}))],z=[...l?[{value:"",label:c}]:[],...N.map(B=>({value:B,label:B}))];return e.jsxs("div",{className:a.className,style:r==="row"?{display:"flex",gap:"10px",flexWrap:"wrap",alignItems:"flex-start"}:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsxs("div",{style:r==="row"?{flex:"1 1 260px",minWidth:240}:void 0,children:[e.jsx("label",{children:d}),e.jsx(Ar,{value:y,options:C,placeholder:l?c:p,disabled:L,loading:!!a.loadingProviders,searchable:!0,allowCustom:a.allowCustomProvider===!0,clearable:l,variant:"panel",triggerClassName:a.selectClassName,ariaLabel:d,onChange:B=>a.onChange({provider:String(B||"").trim(),model:""})}),a.loadingProviders?e.jsx("div",{className:"mono muted",style:{fontSize:"12px",marginTop:"6px"},children:"Loading providers…"}):null,a.providerError?e.jsx("div",{className:"mono",style:{color:"var(--error)",fontSize:"12px",marginTop:"6px"},children:a.providerError}):null]}),e.jsxs("div",{style:r==="row"?{flex:"1 1 260px",minWidth:240}:void 0,children:[e.jsx("label",{children:m}),e.jsx(Ar,{value:b,options:z,placeholder:l?c:_,disabled:I,loading:!!a.loadingModels,searchable:!0,allowCustom:a.allowCustomModel===!0,clearable:l,variant:"panel",triggerClassName:a.selectClassName,ariaLabel:m,onChange:B=>a.onChange({provider:y,model:String(B||"").trim()})}),a.loadingModels?e.jsx("div",{className:"mono muted",style:{fontSize:"12px",marginTop:"6px"},children:"Loading models…"}):null,a.modelError?e.jsx("div",{className:"mono",style:{color:"var(--error)",fontSize:"12px",marginTop:"6px"},children:a.modelError}):null]})]})}function Bp(a){if(a===!1||a&&typeof a=="object"&&a.mode==="off")return!1;if(!a||typeof a!="object")return;const s=a;if(!(s.mode!=="native_mtp"||!Number.isInteger(s.num_draft_tokens)||Number(s.num_draft_tokens)<1))return{mode:"native_mtp",num_draft_tokens:Number(s.num_draft_tokens),require_acceleration:!0}}function Up(a){var r;const s=(r=a==null?void 0:a.execution)==null?void 0:r.speculation;return!s||typeof s.supported!="boolean"?null:{supported:s.supported,ready:typeof s.ready=="boolean"?s.ready:null,reason:typeof s.reason=="string"?s.reason:null,supported_depths:s.supported&&Array.isArray(s.supported_depths)?[...new Set(s.supported_depths.filter(l=>typeof l=="number"&&Number.isInteger(l)&&l>0))]:[],default:Object.prototype.hasOwnProperty.call(s,"effective_default")?s.effective_default:s.default,requires_reload:typeof s.requires_reload=="boolean"?s.requires_reload:null}}function nf(a){const s=Bp(a);return s===!1?"off":s?String(s.num_draft_tokens):""}function Wp(a){if(a==="off")return!1;if(!(!/^\d+$/.test(a)||Number(a)<1))return{mode:"native_mtp",num_draft_tokens:Number(a),require_acceleration:!0}}function Hp(a){const s=Up(a.capabilities),r=nf(a.value),l=(s==null?void 0:s.supported_depths.map(String))||[],c=nf(s==null?void 0:s.default),d=a.inheritLabel||"Workflow / Gateway default",m=c?`${d} (${c==="off"?"Off":`depth ${c}`})`:d,p=a.error||(a.loading?"Checking MTP capability…":s?s.reason||(s.requires_reload?"Model reload required before MTP can run.":s.ready===!1?"MTP is supported but not ready on this instance.":s.ready===null&&s.supported?"MTP support verified; loaded-instance readiness is unknown.":s.supported?"":"MTP is not supported on this model/backend."):"MTP capability unknown; no depth is assumed.");return e.jsxs("div",{className:"af-pmp__speculation",children:[e.jsx("label",{children:"MTP depth"}),e.jsx(Ar,{ariaLabel:"MTP depth",value:r,placeholder:m,disabled:a.disabled||a.loading,options:[{value:"",label:m},{value:"off",label:"Off"},...l.map(_=>({value:_,label:`Depth ${_}`})),...r&&r!=="off"&&!l.includes(r)?[{value:r,label:`Depth ${r} (saved; not available)`}]:[]],onChange:_=>a.onChange(Wp(_))}),p?e.jsx("div",{role:"status",className:"af-pmp__hint",children:p}):null]})}function Vp(a){var M,ue;const s=a.disabled===!0,r=a.value||{provider:"",model:""},l=!String(r.provider||"").trim()&&!String(r.model||"").trim(),[c,d]=h.useState(!l),m=l&&!c,p=h.useRef(l);h.useEffect(()=>{l&&!p.current&&d(!1),p.current=l},[l]);const[_,y]=h.useState([]),[b,x]=h.useState(!1),[N,L]=h.useState(""),[I,C]=h.useState([]),[z,B]=h.useState(!1),[F,q]=h.useState(""),Q=h.useRef(a);Q.current=a,h.useEffect(()=>{if(m||s)return;let V=!0;return x(!0),(async()=>{try{const w=await Q.current.fetchProviders();if(!V)return;y(Array.isArray(w)?w:[]),L("")}catch(w){if(!V)return;y([]),L(`#FALLBACK provider discovery failed: ${String((w==null?void 0:w.message)||w)}`)}finally{V&&x(!1)}})(),()=>{V=!1}},[m,s]);const E=String(r.provider||"").trim();h.useEffect(()=>{if(!E||s){C([]),q(""),B(!1);return}let V=!0;return C([]),B(!0),q(""),(async()=>{try{const w=await Q.current.fetchModels(E);if(!V)return;C(Array.isArray(w)?w:[])}catch(w){if(!V)return;C([]),q(`#FALLBACK model discovery failed: ${String((w==null?void 0:w.message)||w)}`)}finally{V&&B(!1)}})(),()=>{V=!1}},[E,s]);const Z=h.useMemo(()=>{const V=[..._];return E&&!V.some(w=>w.name===E)&&V.unshift({name:E}),V},[_,E]),oe=String(r.model||"").trim(),le=h.useMemo(()=>{const V=[...I];return oe&&!V.includes(oe)&&V.unshift(oe),V},[I,oe]),pe=a.defaultModeLabel||"Gateway default",Te=a.customModeLabel||"Custom",Me=E||((M=a.effectiveDefault)==null?void 0:M.provider)||"",ve=oe||(E?"":(ue=a.effectiveDefault)==null?void 0:ue.model)||"",[ce,D]=h.useState({levels:[],error:"",loading:!1}),R=!!a.fetchModelCapabilities,[U,X]=h.useState();return h.useEffect(()=>{let V=!0;if(X(void 0),D({levels:[],error:"",loading:R&&!!ve}),!(!R||!ve||s))return Q.current.fetchModelCapabilities(ve,Me).then(w=>{var he;if(!V)return;if(w!=null&&w.error)throw new Error(String(w.error));X(w);const A=(w==null?void 0:w.capabilities)||w||{},ee=A.reasoning_levels||A.thinking_levels,ge=Array.isArray(ee)?[...new Set(ee.filter(O=>typeof O=="string"&&!!O.trim()))]:[];!ge.length&&A.thinking_support===!0&&((he=A.thinking_control)!=null&&he.prompt_disable_token)&&ge.push("off","auto"),D({levels:ge,error:"",loading:!1})}).catch(w=>{V&&D({levels:[],error:`Reasoning options unavailable: ${String((w==null?void 0:w.message)||w)}`,loading:!1})}),()=>{V=!1}},[Me,ve,R,s]),e.jsxs("div",{className:`af-pmp${a.className?` ${a.className}`:""}`,children:[e.jsxs("div",{className:"af-pmp__seg",role:"tablist","aria-label":"Provider mode",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":m,className:`af-pmp__seg-btn${m?" is-active":""}`,onClick:()=>{d(!1),a.onChange({...r,provider:"",model:"",...R?{reasoning:""}:{}})},disabled:s,children:pe}),e.jsx("button",{type:"button",role:"tab","aria-selected":!m,className:`af-pmp__seg-btn${m?"":" is-active"}`,onClick:()=>{d(!0)},disabled:s,children:Te})]}),m?e.jsx("div",{className:"af-pmp__hint",children:a.defaultHint||"The gateway picks its configured default provider and model for this task."}):e.jsx(qp,{provider:E,model:oe,providers:Z,models:le,disabled:s,loadingProviders:b,loadingModels:z,providerError:N||void 0,modelError:F||void 0,providerLabel:a.providerLabel,modelLabel:a.modelLabel,allowGatewayDefault:!1,allowCustomProvider:a.allowCustom!==!1,allowCustomModel:a.allowCustom!==!1,onChange:V=>a.onChange({...r,provider:V.provider,model:V.model,...R?{reasoning:""}:{}})}),R&&(ce.levels.length>0||r.reasoning)?e.jsxs("div",{className:"af-pmp__reasoning",children:[e.jsx("label",{children:a.reasoningLabel||"Reasoning effort"}),e.jsx(Ar,{ariaLabel:a.reasoningLabel||"Reasoning effort",placeholder:"Workflow / Gateway default",value:r.reasoning||"",options:[{value:"",label:"Workflow / Gateway default"},...ce.levels.map(V=>({value:V,label:V})),...r.reasoning&&!ce.levels.includes(r.reasoning)?[{value:r.reasoning,label:`${r.reasoning} (saved; not advertised)`}]:[]],disabled:s||ce.loading,onChange:V=>a.onChange({...r,reasoning:V})})]}):null,ce.error?e.jsx("div",{role:"status",className:"af-pmp__hint",children:ce.error}):null,a.enableSpeculation?e.jsx(Hp,{value:r.speculation,onChange:V=>a.onChange({...r,speculation:V}),capabilities:U,disabled:s,loading:ce.loading,error:ce.error?ce.error.replace("Reasoning options","MTP options"):void 0}):null]})}function sf(...a){return a.filter(Boolean).join(" ")}function Gp({kicker:a="AbstractGateway connection",title:s="Connect to AbstractGateway",description:r="Sign in with the Gateway user token assigned by the Gateway admin.",statusLabel:l="Gateway token missing",statusTone:c="warn",tokenSourceLabel:d="token: missing",showGatewayUrl:m=!1,gatewayUrl:p="",gatewayUrlPlaceholder:_="http://127.0.0.1:8080",onGatewayUrlChange:y,userId:b,userPlaceholder:x="admin",onUserIdChange:N,token:L,tokenPlaceholder:I="Paste Gateway user token",showToken:C=!1,onTokenChange:z,onShowTokenChange:B,remember:F=!1,rememberLabel:q="Remember this browser",onRememberChange:Q,loading:E=!1,submitting:Z=!1,submitDisabled:oe=!1,submitLabel:le="Sign in",submittingLabel:pe="Signing in...",closeLabel:Te="Close",signOutLabel:Me="Sign out",showClose:ve=!1,showSignOut:ce=!1,error:D,message:R,className:U,onSubmit:X,onClose:M,onSignOut:ue}){const V=E||Z,w=V||oe||!String(b||"").trim()||!String(L||"").trim(),A=ee=>{ee.preventDefault(),!w&&X()};return e.jsxs("form",{className:sf("af-gateway-signin",U),onSubmit:A,children:[e.jsxs("div",{className:"af-gateway-signin__hero",children:[e.jsxs("div",{children:[e.jsx("div",{className:"af-gateway-signin__kicker",children:a}),e.jsx("h2",{children:s}),r?e.jsx("p",{children:r}):null]}),e.jsx("div",{className:"af-gateway-signin__mark","aria-hidden":"true",children:"↔"})]}),e.jsxs("div",{className:"af-gateway-signin__status-row",children:[e.jsx("span",{className:sf("af-gateway-signin__status",`af-gateway-signin__status--${c}`),children:l}),d?e.jsx("span",{className:"af-gateway-signin__source",children:d}):null]}),e.jsxs("div",{className:"af-gateway-signin__form",children:[m?e.jsxs(e.Fragment,{children:[e.jsx("label",{className:"af-gateway-signin__label",htmlFor:"gateway-session-url",children:"Gateway URL"}),e.jsx("input",{id:"gateway-session-url",value:p,onChange:ee=>y==null?void 0:y(ee.target.value),placeholder:_,autoComplete:"url",disabled:V})]}):null,e.jsx("label",{className:"af-gateway-signin__label",htmlFor:"gateway-session-user",children:"Gateway user"}),e.jsx("input",{id:"gateway-session-user",value:b,onChange:ee=>N(ee.target.value),placeholder:x,autoComplete:"username",disabled:V}),e.jsx("label",{className:"af-gateway-signin__label",htmlFor:"gateway-session-token",children:"Gateway token"}),e.jsxs("div",{className:"af-gateway-signin__token-input",children:[e.jsx("input",{id:"gateway-session-token",type:C?"text":"password",value:L,onChange:ee=>z(ee.target.value),placeholder:I,autoComplete:"current-password",disabled:V}),e.jsx("button",{className:"af-gateway-signin__secondary",type:"button",onClick:()=>B==null?void 0:B(!C),disabled:V,children:C?"Hide":"Show"})]}),e.jsx("label",{className:"af-gateway-signin__label",children:"Browser session"}),e.jsxs("label",{className:"af-gateway-signin__checkbox",children:[e.jsx("input",{type:"checkbox",checked:!!F,onChange:ee=>Q==null?void 0:Q(ee.target.checked),disabled:V}),q]})]}),D?e.jsx("div",{className:"af-gateway-signin__message af-gateway-signin__message--error",children:D}):null,!D&&R?e.jsx("div",{className:"af-gateway-signin__message af-gateway-signin__message--ok",children:R}):null,e.jsxs("div",{className:"af-gateway-signin__actions",children:[ve?e.jsx("button",{className:"af-gateway-signin__secondary",type:"button",onClick:M,disabled:V,children:Te}):null,ce?e.jsx("button",{className:"af-gateway-signin__secondary",type:"button",onClick:()=>void(ue==null?void 0:ue()),disabled:V,children:Me}):null,e.jsx("button",{className:"af-gateway-signin__primary",type:"submit",disabled:w,children:Z?pe:le})]})]})}function Kp(a){return a==="light"?"Light":"Dark"}function Qp(a){const s=a.themes&&a.themes.length?a.themes:Zf,r=a.showSwatches!==!1,l=a.variant||"panel",c=h.useMemo(()=>{const m={};for(const p of s)m[p.id]=p;return m},[s]),d=h.useMemo(()=>s.map(m=>({value:m.id,label:m.label,group:Kp(m.group)})),[s]);return e.jsx(Ar,{value:a.value,options:d,placeholder:a.placeholder||"Select theme…",disabled:a.disabled===!0,searchable:!0,allowCustom:!1,clearable:!1,variant:l,className:a.className,triggerClassName:a.triggerClassName,onChange:m=>a.onChange(String(m||"").trim()),renderValue:(m,p)=>{const _=String(p||"").trim(),y=c[_],b=(y==null?void 0:y.label)||_||a.placeholder||"Select theme…",x=(y==null?void 0:y.swatches)||null,N=!_;return e.jsxs("span",{className:"af-theme-value",children:[e.jsx("span",{className:`af-theme-label ${N?"af-theme-label--placeholder":""}`.trim(),children:b}),r&&x?e.jsx("span",{className:"af-theme-swatches","aria-hidden":"true",children:x.map((L,I)=>e.jsx("span",{className:"af-theme-swatch",style:{background:L}},`${_}:${I}`))}):null]})},renderOption:(m,p)=>{const _=String(m.value||"").trim(),y=c[_],b=(y==null?void 0:y.swatches)||null;return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"af-theme-option-label",children:m.label}),e.jsxs("span",{className:"af-theme-option-right",children:[r&&b?e.jsx("span",{className:"af-theme-swatches","aria-hidden":"true",children:b.map((x,N)=>e.jsx("span",{className:"af-theme-swatch",style:{background:x}},`${_}:${N}`))}):null,p.selected?e.jsx("span",{className:"af-select-check",children:"✓"}):null]})]})}})}function Jp(a){const s=a.scales&&a.scales.length?a.scales:Bu,r=a.variant||"panel",l=h.useMemo(()=>s.map(c=>({value:c.id,label:c.label})),[s]);return e.jsx(Ar,{value:a.value,options:l,placeholder:a.placeholder||"Font size…",disabled:a.disabled===!0,searchable:!1,allowCustom:!1,clearable:!1,variant:r,className:a.className,triggerClassName:a.triggerClassName,onChange:c=>a.onChange(String(c||"").trim())})}function Yp(a){const s=a.densities&&a.densities.length?a.densities:Uu,r=a.variant||"panel",l=h.useMemo(()=>s.map(c=>({value:c.id,label:c.label})),[s]);return e.jsx(Ar,{value:a.value,options:l,placeholder:a.placeholder||"Header size…",disabled:a.disabled===!0,searchable:!1,allowCustom:!1,clearable:!1,variant:r,className:a.className,triggerClassName:a.triggerClassName,onChange:c=>a.onChange(String(c||"").trim())})}const Xp=new Set(["board","inbox","server","agent","playCircle","list","gear"]);function Zp(a){switch(a){case"chat":return e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"});case"plus":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 5v14"}),e.jsx("path",{d:"M5 12h14"})]});case"history":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7v5l3 3"})]});case"refresh":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M21 12a9 9 0 0 0-15.5-6.4L3 8"}),e.jsx("path",{d:"M3 3v5h5"}),e.jsx("path",{d:"M3 12a9 9 0 0 0 15.5 6.4L21 16"}),e.jsx("path",{d:"M21 21v-5h-5"})]});case"settings":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M4 6h16"}),e.jsx("circle",{cx:"8",cy:"6",r:"2"}),e.jsx("path",{d:"M4 12h16"}),e.jsx("circle",{cx:"16",cy:"12",r:"2"}),e.jsx("path",{d:"M4 18h16"}),e.jsx("circle",{cx:"10",cy:"18",r:"2"})]});case"user":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"8",r:"4"}),e.jsx("path",{d:"M4 21a8 8 0 0 1 16 0"})]});case"bot":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 2v3"}),e.jsx("rect",{x:"5",y:"6",width:"14",height:"14",rx:"3"}),e.jsx("circle",{cx:"9",cy:"13",r:"1",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"15",cy:"13",r:"1",fill:"currentColor",stroke:"none"}),e.jsx("path",{d:"M9 17h6"})]});case"paperclip":return e.jsx("path",{d:"M21.44 11.05l-9.19 9.19a5.5 5.5 0 0 1-7.78-7.78l9.19-9.19a3.5 3.5 0 0 1 4.95 4.95l-9.2 9.19a1.5 1.5 0 0 1-2.12-2.12l8.49-8.48"});case"mic":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 14a3 3 0 0 0 3-3V5a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3z"}),e.jsx("path",{d:"M19 11a7 7 0 0 1-14 0"}),e.jsx("path",{d:"M12 18v4"}),e.jsx("path",{d:"M8 22h8"})]});case"speaker":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),e.jsx("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),e.jsx("path",{d:"M18 6a9 9 0 0 1 0 12"})]});case"pause":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",fill:"currentColor",stroke:"none"}),e.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",fill:"currentColor",stroke:"none"})]});case"terminal":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 9l3 3-3 3"}),e.jsx("path",{d:"M12 15h5"})]});case"edit":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]});case"download":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("path",{d:"M7 10l5 5 5-5"}),e.jsx("path",{d:"M12 15V3"})]});case"loader":return e.jsx("path",{d:"M21 12a9 9 0 1 1-3.3-6.9"});case"info":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("circle",{cx:"12",cy:"8",r:"0.75",fill:"currentColor",stroke:"none"})]});case"warning":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 3l10 18H2L12 3z"}),e.jsx("path",{d:"M12 9v4"}),e.jsx("circle",{cx:"12",cy:"17",r:"0.75",fill:"currentColor",stroke:"none"})]});case"error":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M15 9l-6 6"}),e.jsx("path",{d:"M9 9l6 6"})]});case"copy":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),e.jsx("path",{d:"M5 15V5a2 2 0 0 1 2-2h10"})]});case"check":return e.jsx("path",{d:"M20 6L9 17l-5-5"});case"x":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M18 6L6 18"}),e.jsx("path",{d:"M6 6l12 12"})]});case"chevronDown":return e.jsx("path",{d:"M6 9l6 6 6-6"});case"chevronRight":return e.jsx("path",{d:"M9 18l6-6-6-6"});case"trash":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),e.jsx("path",{d:"M6 6l1 16h10l1-16"}),e.jsx("path",{d:"M10 11v6"}),e.jsx("path",{d:"M14 11v6"})]});case"send":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M22 2L11 13"}),e.jsx("path",{d:"M22 2L15 22l-4-9-9-4 20-7z"})]});case"thumbsUp":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M7 10v11"}),e.jsx("path",{d:"M7 10l4.5-8a2 2 0 0 1 3.6 1.5L14 8h5.2a2 2 0 0 1 2 2.4l-1.6 8a2 2 0 0 1-2 1.6H7"})]});case"thumbsDown":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M17 14V3"}),e.jsx("path",{d:"M17 14l-4.5 8a2 2 0 0 1-3.6-1.5L10 16H4.8a2 2 0 0 1-2-2.4l1.6-8a2 2 0 0 1 2-1.6H17"})]});case"thumbsUpFilled":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M7 10v11"}),e.jsx("path",{d:"M7 10l4.5-8a2 2 0 0 1 3.6 1.5L14 8h5.2a2 2 0 0 1 2 2.4l-1.6 8a2 2 0 0 1-2 1.6H7z",fill:"currentColor",stroke:"none"})]});case"thumbsDownFilled":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M17 14V3"}),e.jsx("path",{d:"M17 14l-4.5 8a2 2 0 0 1-3.6-1.5L10 16H4.8a2 2 0 0 1-2-2.4l1.6-8a2 2 0 0 1 2-1.6H17z",fill:"currentColor",stroke:"none"})]});case"board":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"1.5",y:"2",width:"3.6",height:"12",rx:"1"}),e.jsx("rect",{x:"6.2",y:"2",width:"3.6",height:"8.5",rx:"1"}),e.jsx("rect",{x:"10.9",y:"2",width:"3.6",height:"5.5",rx:"1"})]});case"inbox":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M2 9.5 L4 3.5 h8 l2 6"}),e.jsx("path",{d:"M2 9.5 v3 h12 v-3"}),e.jsx("path",{d:"M2 9.5 h3.4 l1 1.6 h3.2 l1-1.6 H14"})]});case"server":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"2",y:"2.5",width:"12",height:"4.6",rx:"1.2"}),e.jsx("rect",{x:"2",y:"8.9",width:"12",height:"4.6",rx:"1.2"}),e.jsx("circle",{cx:"4.6",cy:"4.8",r:"0.8",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"4.6",cy:"11.2",r:"0.8",fill:"currentColor",stroke:"none"})]});case"agent":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"4.5",width:"10",height:"8",rx:"2"}),e.jsx("path",{d:"M8 4.5V2.2"}),e.jsx("circle",{cx:"8",cy:"1.8",r:"0.9",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"5.8",cy:"8.4",r:"0.9",fill:"currentColor",stroke:"none"}),e.jsx("circle",{cx:"10.2",cy:"8.4",r:"0.9",fill:"currentColor",stroke:"none"})]});case"playCircle":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"8",cy:"8",r:"6.2"}),e.jsx("path",{d:"M6.5 5.6 L11 8 L6.5 10.4 Z",fill:"currentColor",stroke:"none"})]});case"list":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M2.5 4h11"}),e.jsx("path",{d:"M2.5 8h11"}),e.jsx("path",{d:"M2.5 12h7"})]});case"gear":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"8",cy:"8",r:"2.2"}),e.jsx("path",{d:"M8 1.6v2"}),e.jsx("path",{d:"M8 12.4v2"}),e.jsx("path",{d:"M1.6 8h2"}),e.jsx("path",{d:"M12.4 8h2"}),e.jsx("path",{d:"M3.5 3.5l1.4 1.4"}),e.jsx("path",{d:"M11.1 11.1l1.4 1.4"}),e.jsx("path",{d:"M12.5 3.5l-1.4 1.4"}),e.jsx("path",{d:"M4.9 11.1l-1.4 1.4"})]});case"sparkle":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z"}),e.jsx("path",{d:"M18.5 15.5l.8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2-2.2-.8 2.2-.8z"})]});case"contrast":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]});case"logout":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("path",{d:"M16 17l5-5-5-5"}),e.jsx("path",{d:"M21 12H9"})]});case"play":return e.jsx("path",{d:"M7 4.5v15a1 1 0 0 0 1.5.86l12-7.5a1 1 0 0 0 0-1.72l-12-7.5A1 1 0 0 0 7 4.5z",fill:"currentColor",stroke:"none"});case"stop":return e.jsx("rect",{x:"5",y:"5",width:"14",height:"14",rx:"2",fill:"currentColor",stroke:"none"});case"folder":return e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"});case"file":return e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 2v6h6"})]});case"archive":return e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"5",rx:"1"}),e.jsx("path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}),e.jsx("path",{d:"M10 12h4"})]});case"clock":return e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 6v6h4"})]});default:return null}}function rt({name:a,size:s=16,className:r,title:l,...c}){const d=l?void 0:!0,m=Xp.has(a);return e.jsxs("svg",{width:s,height:s,viewBox:m?"0 0 16 16":"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:m?1.4:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,"aria-hidden":d,role:l?"img":"presentation",...c,children:[l?e.jsx("title",{children:l}):null,Zp(a)]})}const ji="api/connection/gateway";function af(a,s){const r=String(s||"");if(r.startsWith("/"))throw new Error(`joinBaseUrl takes a relative path, got ${JSON.stringify(r)}.`);let l=String(a??"");for(;l.endsWith("/");)l=l.slice(0,-1);return l?`${l}/${r}`:r}const bu=1;function Fa(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}const e_=["granted","denied","structurally_unavailable","trust_gated"],t_=["attachable","requires_review","blocked"],n_=["default","operator","structural"],s_=["grant","deny","clear"],a_=new Set(["__proto__","constructor","prototype"]);function r_(a,s){if(!Fa(a))return{ok:!1,reason:`${s}: cell is not an object`};const r=String(a.availability||"");if(!e_.includes(r))return{ok:!1,reason:`${s}: unknown availability "${r}"`};const l=String(a.provenance||"");if(!n_.includes(l))return{ok:!1,reason:`${s}: unknown provenance "${l}"`};let c;if(r==="trust_gated"){const d=String(a.trust_state||"");if(!t_.includes(d))return{ok:!1,reason:`${s}: trust_gated cell without a valid trust_state ("${d}")`};c=d}for(const d of["assigned","resolved_value","executable"]){const m=a[d];if(m!==void 0&&typeof m!="boolean")return{ok:!1,reason:`${s}: "${d}" is present but not a boolean`}}return{ok:!0,cell:{assigned:a.assigned===!0,resolved_value:a.resolved_value===!0,provenance:l,availability:r,executable:a.executable!==!1,reason:typeof a.reason=="string"?a.reason:void 0,trust_state:c}}}function th(a){if(!Fa(a))return{ok:!1,reason:"payload is not an object"};const s=a.schema_version;if(typeof s!="number"||!Number.isFinite(s))return{ok:!1,reason:"payload has no numeric schema_version"};if(Math.floor(s)!==bu)return{ok:!1,reason:`unsupported schema_version ${s} (this build understands ${bu}); refusing to render grant state from an unknown schema`};if(!Array.isArray(a.phases)||a.phases.length===0)return{ok:!1,reason:"payload has no phases"};if(!Array.isArray(a.sections))return{ok:!1,reason:"payload has no sections"};const r=[],l=new Set;for(const m of a.phases){if(!Fa(m)||typeof m.id!="string"||!m.id.trim())return{ok:!1,reason:"phase without a string id"};const p=m.id.trim();if(a_.has(p))return{ok:!1,reason:`reserved phase id "${p}"`};if(l.has(p))return{ok:!1,reason:`duplicate phase id "${p}"`};l.add(p),r.push({id:p,label:typeof m.label=="string"?m.label:void 0,hint:typeof m.hint=="string"?m.hint:void 0})}const c=[],d=new Set;for(const m of a.sections){if(!Fa(m)||typeof m.id!="string"||!m.id.trim())return{ok:!1,reason:"section without a string id"};const p=m.id.trim();if(d.has(p))return{ok:!1,reason:`duplicate section id "${p}"`};if(d.add(p),!Array.isArray(m.items))return{ok:!1,reason:`section "${p}" has no items array`};const _=[],y=new Set;for(const b of m.items){if(!Fa(b)||typeof b.id!="string"||!b.id.trim())return{ok:!1,reason:`section "${p}": item without a string id`};const x=b.id.trim();if(y.has(x))return{ok:!1,reason:`section "${p}": duplicate item id "${x}"`};if(y.add(x),b.cells!==void 0&&!Fa(b.cells))return{ok:!1,reason:`section "${p}" item "${x}": cells is not an object`};const N=Object.create(null),L=Fa(b.cells)?b.cells:{};for(const[I,C]of Object.entries(L)){if(!l.has(I))return{ok:!1,reason:`section "${p}" item "${x}": cell for undeclared phase "${I}"`};const z=r_(C,`section "${p}" item "${x}" phase "${I}"`);if(!z.ok)return z;N[I]=z.cell}_.push({id:x,label:typeof b.label=="string"?b.label:void 0,description:typeof b.description=="string"?b.description:void 0,cells:N})}c.push({id:p,label:typeof m.label=="string"?m.label:void 0,items:_})}return{ok:!0,payload:{schema_version:bu,phases:r,sections:c}}}function i_(a,s,r,l){for(const c of a)if(c.section===s&&c.item===r&&c.phase===l)return c.op;return null}function id(a,s,r,l,c){const d=a.sections.find(I=>I.id===r),m=d==null?void 0:d.items.find(I=>I.id===l),p=m&&m.cells[c]||null,_=i_(s,r,l,c);if(!p)return{cell:null,pending:null,effective_value:!1,interactive:!1,approval_required:!1,standing_config:!1,reason:"not declared by the server for this phase",control:{kind:"absent"}};const y=p.availability==="structurally_unavailable"||p.availability==="trust_gated"&&p.trust_state==="blocked";let b=p.resolved_value;_==="grant"?b=!0:_==="deny"?b=!1:_==="clear"&&(b=p.provenance==="operator"?null:p.resolved_value);const x=p.availability==="trust_gated"&&p.trust_state==="requires_review",N=y?!1:b;let L;return y?L={kind:"blocked",blocked_kind:p.availability==="trust_gated"?"trust":"structural"}:x&&N!==!0?L={kind:"approval"}:L={kind:"tristate",options:["grant","clear","deny"],active_op:_!==null?_:p.assigned?p.resolved_value?"grant":"deny":"clear"},{cell:p,pending:_,effective_value:N,interactive:!y,approval_required:x,standing_config:!y&&p.executable===!1,reason:p.reason||(y?p.availability:null),control:L}}function l_(a,s,r){const l=id(a,s,r.section,r.item,r.phase);if(!l.cell||!l.interactive)return s;const c=s.filter(p=>!(p.section===r.section&&p.item===r.item&&p.phase===r.phase)),d=l.cell;return r.op==="clear"?d.assigned?[...c,r]:c:d.assigned&&d.provenance==="operator"&&d.resolved_value===(r.op==="grant")?c:[...c,r]}function o_(a,s){const r=new Set,l=[];for(const c of s){if(!Fa(c)||!s_.includes(c.op))continue;const d=`${c.section}\0${c.item}\0${c.phase}`;if(r.has(d))continue;r.add(d);const m=id(a,[],c.section,c.item,c.phase);!m.cell||!m.interactive||l.push(c)}return l}function c_(a){return a==="grant"?"Grant":a==="deny"?"Deny":"Default"}function u_(a){const{view:s,disabled:r}=a,l=s.control;if(l.kind==="absent")return e.jsx("div",{className:"af-matrix__cell is-absent",title:s.reason||void 0,children:e.jsx("span",{className:"af-matrix__cell-mark",children:"—"})});if(l.kind==="blocked")return e.jsxs("div",{className:`af-matrix__cell is-unavailable is-${l.blocked_kind}`,children:[e.jsx("span",{className:"af-matrix__cell-mark",children:"✕"}),e.jsx("span",{className:"af-matrix__cell-note",children:l.blocked_kind==="trust"?"blocked":"structural"}),s.reason?e.jsx("span",{className:"af-matrix__cell-reason",children:s.reason}):null]});if(l.kind==="approval")return e.jsxs("div",{className:"af-matrix__cell is-review",children:[e.jsx("span",{className:"af-matrix__cell-note",children:"needs review"}),e.jsx("button",{type:"button",className:"af-matrix__approve-btn",disabled:r,onClick:()=>a.onAct("grant"),"aria-label":`Approve and enable: ${a.cellLabel}`,children:"Approve & enable"}),s.reason?e.jsx("span",{className:"af-matrix__cell-reason",children:s.reason}):null]});const c=s.cell,d=s.effective_value===null?"server default (unknown until saved)":s.effective_value?"on":"off";return e.jsxs("div",{className:`af-matrix__cell ${s.effective_value===null?"is-indeterminate":s.effective_value?"is-on":"is-off"} ${s.pending?"is-pending":""}`.trim(),title:s.reason||void 0,children:[e.jsx("div",{className:"af-matrix__tristate",role:"group","aria-label":a.cellLabel,children:l.options.map(m=>e.jsx("button",{type:"button","aria-pressed":l.active_op===m,className:`af-matrix__tri-btn is-${m} ${l.active_op===m?"is-active":""}`.trim(),disabled:r,onClick:()=>a.onAct(m),children:c_(m)},m))}),e.jsxs("div",{className:"af-matrix__cell-meta",children:[e.jsx("span",{className:`af-matrix__prov is-${c.provenance}`,children:s.pending?"pending":c.provenance}),e.jsx("span",{className:"af-matrix__value-mark",children:d}),s.standing_config?e.jsx("span",{className:"af-matrix__standing",title:s.reason||"grant is stored; no executor consumes it yet",children:"standing config"}):null]})]})}function d_(a){const s=a.disabled===!0,r=h.useMemo(()=>th(a.payload),[a.payload]),l=h.useMemo(()=>r.ok?o_(r.payload,a.patches):a.patches,[r,a.patches]);if(!r.ok)return e.jsxs("div",{className:`af-matrix af-matrix--refused ${a.className||""}`.trim(),children:[e.jsx("div",{className:"af-matrix__title",children:a.title||"Phase capabilities"}),e.jsxs("div",{className:"af-matrix__refusal",children:["Cannot render capability state: ",r.reason]})]});const c=r.payload,d=(m,p,_,y)=>{if(s)return;const b=l_(c,l,{section:m,item:p,phase:_,op:y});a.onPatchesChange(b)};return e.jsxs("div",{className:`af-matrix ${a.className||""}`.trim(),children:[e.jsxs("div",{className:"af-matrix__header",children:[e.jsx("div",{className:"af-matrix__title",children:a.title||"Phase capabilities"}),a.subtitle?e.jsx("div",{className:"af-matrix__subtitle",children:a.subtitle}):null,l.length>0?e.jsxs("div",{className:"af-matrix__pending-note",children:[l.length," unsaved change",l.length===1?"":"s"," (cell-scoped; untouched cells are never written)"]}):null]}),e.jsx("div",{className:"af-matrix__scroll",children:e.jsxs("table",{className:"af-matrix__table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"af-matrix__corner"}),c.phases.map(m=>e.jsxs("th",{className:"af-matrix__phase",title:m.hint||void 0,children:[e.jsx("span",{className:"af-matrix__phase-label",children:m.label||m.id}),m.hint?e.jsx("span",{className:"af-matrix__phase-hint",children:m.hint}):null]},m.id))]})}),c.sections.map(m=>e.jsxs("tbody",{className:"af-matrix__section",children:[e.jsx("tr",{className:"af-matrix__section-row",children:e.jsx("th",{className:"af-matrix__section-label",colSpan:c.phases.length+1,children:m.label||m.id})}),m.items.map(p=>e.jsxs("tr",{className:"af-matrix__item-row",children:[e.jsx("th",{className:"af-matrix__item",title:p.description||void 0,children:e.jsx("span",{className:"af-matrix__item-name",children:p.label||p.id})}),c.phases.map(_=>{const y=id(c,l,m.id,p.id,_.id);return e.jsx("td",{className:"af-matrix__cell-td",children:e.jsx(u_,{view:y,cellLabel:`${p.label||p.id} — ${_.label||_.id}`,disabled:s,onAct:b=>d(m.id,p.id,_.id,b)})},_.id)})]},p.id)),m.items.length===0?e.jsx("tr",{children:e.jsx("td",{className:"af-matrix__empty",colSpan:c.phases.length+1,children:"No entries in this section."})}):null]},m.id))]})})]})}async function Wu(a=ji){const s=await fetch(a),r=await s.json().catch(()=>null);if(!s.ok){const l=r&&typeof r=="object"&&r.detail?String(r.detail):`HTTP ${s.status}`;throw new Error(l)}return r}async function m_(a,s=ji){const r=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),l=await r.json().catch(()=>null);if(!r.ok){const c=l&&typeof l=="object"&&l.detail?String(l.detail):`HTTP ${r.status}`;throw new Error(c)}return l}async function nh(a=ji){const s=await fetch(a,{method:"DELETE"});if(!s.ok){const r=await s.json().catch(()=>({})),l=r&&typeof r=="object"&&r.detail?String(r.detail):`HTTP ${s.status}`;throw new Error(l)}}function wu(a){let s=String(a||"").trim();for(let r=0;r<2&&s;r+=1){try{const d=JSON.parse(s);if(typeof d=="string"&&d!==s){s=d.trim();continue}}catch{}const l=s[0],c=s[s.length-1];if(l==='"'&&c==='"'||l==="'"&&c==="'"){s=s.slice(1,-1).trim();continue}break}return s.replace(/\/+$/,"")}function f_(a){var d,m;if(!a)return{label:"Signed out",tone:"warn"};if(!a.has_session)return{label:"Signed out",tone:"warn"};const s=a.gateway||{},r=(d=s.principal)==null?void 0:d.user_id,l=(m=s.principal)==null?void 0:m.runtime_id;if(s.ok&&r)return{label:`Signed in as ${r}${l?` · runtime ${l}`:""}`,tone:"ok"};if(s.ok)return{label:"Signed in",tone:"ok"};const c=s.error||s.detail;return typeof c=="string"&&c.trim()?{label:"Session rejected — sign in again",tone:"err"}:{label:"Sign in required",tone:"err"}}function h_(a){const s=a.connectionPath||ji,[r,l]=h.useState(!1),[c,d]=h.useState(!1),[m,p]=h.useState(null),[_,y]=h.useState(!1);h.useEffect(()=>{a.isOpen||y(!1)},[a.isOpen]);const[b,x]=h.useState(a.defaultGatewayUrl||"http://127.0.0.1:8080"),[N,L]=h.useState("admin"),[I,C]=h.useState(""),[z,B]=h.useState(!1),[F,q]=h.useState(!0),[Q,E]=h.useState(""),[Z,oe]=h.useState(""),le=h.useMemo(()=>f_(m),[m]),pe=ce=>{var D;p(ce),(D=a.onStatusChange)==null||D.call(a,ce)},Te=h.useRef(!1);if(h.useEffect(()=>{var D;if(!a.isOpen)return;const ce=!Te.current;if(Te.current=!0,ce&&a.initialStatus!==void 0&&a.initialStatus!==null){const R=a.initialStatus;pe(R),typeof R.gateway_url=="string"&&R.gateway_url.trim()&&x(wu(R.gateway_url));const U=(D=R.gateway)==null?void 0:D.principal;U!=null&&U.user_id&&L(U.user_id);return}l(!0),E(""),Wu(s).then(R=>{var X;pe(R),typeof R.gateway_url=="string"&&R.gateway_url.trim()&&x(wu(R.gateway_url));const U=(X=R.gateway)==null?void 0:X.principal;U!=null&&U.user_id&&L(U.user_id)}).catch(R=>E(`Failed to load connection status: ${String((R==null?void 0:R.message)||R)}`)).finally(()=>l(!1))},[a.isOpen]),h.useEffect(()=>{if(!a.isOpen)return;const ce=D=>{D.key==="Escape"&&!D.defaultPrevented&&!a.blocking&&(D.preventDefault(),a.onClose())};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[a.isOpen,a.blocking,a.onClose]),!a.isOpen||_)return null;const Me=async()=>{d(!0),E(""),oe("");try{const ce=wu(b);x(ce);const D=await m_({gateway_url:ce,gateway_user_id:N,gateway_token:I,persist:F},s);pe(D),C(""),y(!0),a.onClose()}catch(ce){E(String((ce==null?void 0:ce.message)||ce))}finally{d(!1)}},ve=async()=>{d(!0),E(""),oe("");try{await nh(s),C("");const ce=await Wu(s).catch(()=>null);pe(ce),oe("Signed out. This browser no longer holds a gateway session.")}catch(ce){E(String((ce==null?void 0:ce.message)||ce))}finally{d(!1)}};return e.jsx("div",{className:"af-connect-overlay",role:"presentation",onMouseDown:ce=>{!a.blocking&&ce.target===ce.currentTarget&&a.onClose()},children:e.jsx("div",{className:"af-connect-modal",role:"dialog","aria-modal":"true","aria-label":"Gateway connection",children:e.jsx(Gp,{kicker:`${a.appName||"AbstractFramework"} connection`,title:"Connect this browser to AbstractGateway",description:"Sign in with a Gateway user token. The app exchanges it for an HTTP-only browser session and never stores the raw token.",statusLabel:le.label,statusTone:le.tone,tokenSourceLabel:m!=null&&m.has_session?"token: browser session":"token: missing",showGatewayUrl:!0,gatewayUrl:b,onGatewayUrlChange:ce=>x(ce),userId:N,onUserIdChange:L,token:I,tokenPlaceholder:m!=null&&m.has_session?"(browser session already signed in)":"Paste Gateway user token",showToken:z,onTokenChange:C,onShowTokenChange:B,remember:F,rememberLabel:"Keep this browser signed in",onRememberChange:q,loading:r,submitting:c,submittingLabel:"Signing in...",showClose:!a.blocking,onClose:a.onClose,showSignOut:!a.blocking&&!!(m!=null&&m.has_session),onSignOut:ve,error:Q,message:Z,onSubmit:Me})})})}function p_(a){return!!(a&&a.ok===!0&&a.has_session===!0)}function __(a){const s=a||{},r=s.connectionPath||ji,l=s.variant||"dismissable",c=h.useRef(s.onStatusChange);c.current=s.onStatusChange;const d=h.useRef(l);d.current=l;const m=h.useRef(!!s.autoOpenMidSession);m.current=!!s.autoOpenMidSession;const[p,_]=h.useState(null),[y,b]=h.useState("loading"),[x,N]=h.useState(!1),L=h.useRef(!1),I=h.useRef(!1),C=h.useRef("loading"),z=h.useRef("none"),B=h.useRef(!1),F=h.useRef(0),q=h.useCallback(D=>{var U;F.current+=1,_(D),(U=c.current)==null||U.call(c,D);const R=p_(D);if(R)b("connected"),C.current="connected",L.current=!1,z.current="none",I.current||N(!1);else if(D!==null){const X=C.current;b("disconnected"),C.current="disconnected",X!=="disconnected"&&(z.current=B.current?"signout":X==="connected"?"mid":"boot");const M=d.current==="blocking"||z.current!=="mid"||m.current;!L.current&&M&&N(!0)}D!==null&&(I.current=R)},[]),Q=h.useCallback(async()=>{const D=F.current;try{const R=await Wu(r);if(F.current!==D)return;q(R)}catch{if(F.current!==D)return;q(null)}},[r,q]),[E,Z]=h.useState(!1),[oe,le]=h.useState(null),pe=h.useCallback(async()=>{Z(!0),le(null),F.current+=1;let D=null;try{await nh(r)}catch(R){D=String((R==null?void 0:R.message)||R||"Sign-out request failed")}B.current=!0;try{await Q()}finally{B.current=!1}le(D),Z(!1)},[r,Q]),Te=h.useRef(!1);h.useEffect(()=>{Te.current||(Te.current=!0,Q())},[Q]);const Me=h.useCallback(()=>{N(!0)},[]),ve=h.useCallback(()=>{const D=C.current;l==="blocking"&&D==="disconnected"||(D==="disconnected"&&(L.current=!0),N(!1))},[l]),ce=h.useMemo(()=>({isOpen:x,onClose:ve,blocking:l==="blocking"&&y!=="connected",appName:s.appName,connectionPath:r,defaultGatewayUrl:s.defaultGatewayUrl,initialStatus:p,onStatusChange:q}),[x,ve,l,y,s.appName,r,s.defaultGatewayUrl,p,q]);return{status:p,phase:y,connected:y==="connected",modalOpen:x,signingOut:E,signOutError:oe,openModal:Me,refresh:Q,signOut:pe,modalProps:ce}}const ju={neutral:"var(--text-secondary)",muted:"var(--text-muted)",accent:"var(--accent)",info:"var(--info)",success:"var(--success)",warning:"var(--warning)",error:"var(--error)"},g_=/^var\(--[a-z0-9-]+\)$/i;function v_(a,s){const r=a||"neutral";if(r==="custom"){const l=String(s||"").trim();return g_.test(l)?l:ju.neutral}return ju[r]||ju.neutral}function y_(a,s,r){return[a,`${a}--${s.tone||"neutral"}`,s.size==="sm"?`${a}--sm`:"",r||"",s.className||""].filter(Boolean).join(" ")}function x_(a){return{"--af-chip-hue":v_(a.tone,a.hue)}}function In(a){return e.jsxs("span",{className:y_("af-chip",a,a.onRemove?"af-chip--removable":""),style:x_(a),title:a.title,children:[e.jsx("span",{className:"af-chip__label",children:a.children}),a.onRemove?e.jsx("button",{type:"button",className:"af-chip__remove","aria-label":a.removeLabel||"Remove",onClick:s=>{var r;s.stopPropagation(),(r=a.onRemove)==null||r.call(a)},children:e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.6",strokeLinecap:"round",children:[e.jsx("path",{d:"M18 6L6 18"}),e.jsx("path",{d:"M6 6l12 12"})]})}):null]})}function b_(a){const s=a.closeOnEscape!==!1,r=h.useRef(null);return h.useEffect(()=>{if(!a.open||!s)return;const l=c=>{c.key!=="Escape"||c.defaultPrevented||(c.preventDefault(),a.onClose())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a.open,s,a.onClose]),h.useEffect(()=>{const l=r.current;l&&(a.open?l.removeAttribute("inert"):l.setAttribute("inert",""))},[a.open]),e.jsxs("div",{ref:r,className:`af-drawer${a.open?" af-drawer--open":""}${a.className?` ${a.className}`:""}`,style:{width:a.width||420,top:a.topOffset||0,display:a.open?void 0:"none"},role:"complementary","aria-label":a.label,"aria-hidden":a.open?void 0:!0,children:[a.title!==void 0?e.jsxs("div",{className:"af-drawer__header",children:[e.jsx("div",{className:"af-drawer__title",children:a.title}),e.jsxs("div",{className:"af-drawer__header-actions",children:[a.headerActions,e.jsx("button",{type:"button",className:"af-drawer__close","aria-label":"Close panel",onClick:a.onClose,children:"×"})]})]}):null,e.jsx("div",{className:"af-drawer__body",children:a.children})]})}const w_={name:"AbstractFramework",website:"https://abstractframework.ai",author:"Laurent-Philippe Albou, PhD",years:"2023-2026",copyright:"© 2023-2026 Laurent-Philippe Albou, PhD. Released under the MIT License.",contact_email:"contact@abstractframework.ai"},j_={abstractframework:{name:"AbstractFramework",website:"https://abstractframework.ai",repo:"https://github.com/lpalbou/AbstractFramework",docs:"https://github.com/lpalbou/AbstractFramework/tree/main/docs",issues:"https://github.com/lpalbou/AbstractFramework/issues",feedback:"https://github.com/lpalbou/AbstractFramework/issues/new?labels=feedback"},abstractgateway:{name:"AbstractGateway",website:"https://abstractframework.ai/gateway",repo:"https://github.com/lpalbou/AbstractGateway",docs:"https://www.lpalbou.info/AbstractGateway/",issues:"https://github.com/lpalbou/AbstractGateway/issues",feedback:"https://github.com/lpalbou/AbstractGateway/issues/new?labels=feedback"},abstractcode:{name:"AbstractCode",website:"https://abstractframework.ai/code",repo:"https://github.com/lpalbou/AbstractCode",docs:"https://github.com/lpalbou/AbstractCode/tree/main/docs",issues:"https://github.com/lpalbou/AbstractCode/issues",feedback:"https://github.com/lpalbou/AbstractCode/issues/new?labels=feedback"},abstractassistant:{name:"AbstractAssistant",website:"https://abstractframework.ai/assistant",repo:"https://github.com/lpalbou/AbstractAssistant",docs:"https://github.com/lpalbou/AbstractAssistant/blob/main/docs/README.md",issues:"https://github.com/lpalbou/AbstractAssistant/issues",feedback:"https://github.com/lpalbou/AbstractAssistant/issues/new?labels=feedback"},abstractflow:{name:"AbstractFlow",website:"https://abstractframework.ai/flow",repo:"https://github.com/lpalbou/AbstractFlow",docs:"https://github.com/lpalbou/AbstractFlow#readme",issues:"https://github.com/lpalbou/AbstractFlow/issues",feedback:"https://github.com/lpalbou/AbstractFlow/issues/new?labels=feedback"},abstractcontinuum:{name:"AbstractContinuum",website:"https://abstractframework.ai",repo:"https://github.com/lpalbou/AbstractContinuum",docs:"https://github.com/lpalbou/AbstractContinuum/tree/main/docs",issues:"https://github.com/lpalbou/AbstractContinuum/issues",feedback:"https://github.com/lpalbou/AbstractContinuum/issues/new?labels=feedback"},abstractentity:{name:"AbstractEntity",website:"https://abstractframework.ai",repo:"https://github.com/lpalbou/AbstractEntity",docs:"https://github.com/lpalbou/AbstractEntity/tree/main/docs",issues:"https://github.com/lpalbou/AbstractEntity/issues",feedback:"https://github.com/lpalbou/AbstractEntity/issues/new?labels=feedback"},abstractobserver:{name:"AbstractObserver",website:"https://abstractframework.ai/observer",repo:"https://github.com/lpalbou/AbstractObserver",docs:"https://github.com/lpalbou/AbstractObserver#readme",issues:"https://github.com/lpalbou/AbstractObserver/issues",feedback:"https://github.com/lpalbou/AbstractObserver/issues/new?labels=feedback"},abstractcore:{name:"AbstractCore",website:"https://www.abstractcore.ai",repo:"https://github.com/lpalbou/AbstractCore",docs:"https://github.com/lpalbou/AbstractCore/tree/main/docs",issues:"https://github.com/lpalbou/AbstractCore/issues",feedback:"https://github.com/lpalbou/AbstractCore/issues/new?labels=feedback"},abstractuic:{name:"AbstractUIC",website:"https://abstractframework.ai",repo:"https://github.com/lpalbou/AbstractUIC",docs:"https://github.com/lpalbou/AbstractUIC/tree/main/docs",issues:"https://github.com/lpalbou/AbstractUIC/issues",feedback:"https://github.com/lpalbou/AbstractUIC/issues/new?labels=feedback"}},k_={framework:w_,apps:j_},Qo=k_;function S_(){return Object.keys(Qo.apps).sort()}function N_(a,s){const r=Object.prototype.hasOwnProperty.call(Qo.apps,a)?Qo.apps[a]:void 0;if(!r)throw new Error(`appIdentity: unknown application id "${a}" (known: ${S_().join(", ")})`);return{id:a,name:r.name,version:s,website:r.website,repo:r.repo,docs:r.docs,issues:r.issues,feedback:r.feedback}}function C_(a,s){const r=Qo.framework,l=[["Application",`${a.name} ${a.version}`],["Part of",`${r.name} — ${r.website}`],["Author",`${r.author} (${r.years})`],["Copyright",r.copyright],["Website",a.website],["Source",a.repo],["Documentation",a.docs],["Report an issue",a.issues],["Give feedback",a.feedback],["Contact",r.contact_email]];for(const[c,d]of s||[])l.push([String(c),String(d)]);return l}function ku(a){return typeof a=="string"?a.trim():""}function rf(a,s){if(s!=null)return[["Gateway",`unavailable (${String(s).trim()||"unknown error"})`]];const r=a&&typeof a=="object"&&!Array.isArray(a)?a:{},l=ku(r.abstractgateway);if(!l)return[["Gateway","unavailable (the gateway did not report its version)"]];const c=ku(r.abstractframework),d=[["Gateway",`AbstractGateway ${l}`],["Gateway framework",c?`AbstractFramework ${c}`:"not installed on the gateway host"]],m=r.packages&&typeof r.packages=="object"&&!Array.isArray(r.packages)?r.packages:{},p=Object.keys(m).filter(_=>_!=="abstractgateway"&&_!=="abstractframework").sort((_,y)=>_<y?-1:_>y?1:0);for(const _ of p){const y=ku(m[_]);y&&d.push([`Gateway package ${_}`,y])}return d}const $_='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function E_(a,s,r){if(a.key!=="Tab"||!s)return;const l=Array.from(s.querySelectorAll($_));if(l.length===0){a.preventDefault();return}const c=l[0],d=l[l.length-1],m=!!r&&s.contains(r);a.shiftKey?(r===c||!m)&&(a.preventDefault(),d.focus()):(r===d||!m)&&(a.preventDefault(),c.focus())}const T_=/https?:\/\/[^\s<>"]+/g;function A_(a,s){if(a==="Contact")return[{text:s,href:`mailto:${s}`}];const r=[];let l=0;for(const c of s.matchAll(T_)){const d=c.index??0;d>l&&r.push({text:s.slice(l,d)}),r.push({text:c[0],href:c[0]}),l=d+c[0].length}return(l<s.length||r.length===0)&&r.push({text:s.slice(l)}),r}function R_({label:a,value:s}){return e.jsx("span",{children:A_(a,s).map((r,l)=>r.href===void 0?e.jsx(Kt.Fragment,{children:r.text},l):r.href.startsWith("mailto:")?e.jsx("a",{className:"af-about__link",href:r.href,children:r.text},l):e.jsx("a",{className:"af-about__link",href:r.href,target:"_blank",rel:"noopener noreferrer",children:r.text},l))})}function L_(a){const s=h.useRef(null),r=h.useRef(null),l=h.useId(),c=h.useRef(a.onClose);if(c.current=a.onClose,h.useEffect(()=>{var y;if(!a.open)return;const p=document.activeElement;(y=s.current)==null||y.focus();const _=b=>{if(!b.defaultPrevented){if(b.key==="Escape"){b.preventDefault(),c.current();return}E_(b,r.current,document.activeElement)}};return window.addEventListener("keydown",_),()=>{window.removeEventListener("keydown",_),p&&typeof p.focus=="function"&&p.focus()}},[a.open]),!a.open)return null;const d=a.title||`About ${a.identity.name}`,m=C_(a.identity,a.extraRows);return e.jsx("div",{className:"af-appearance-overlay af-about-overlay",onClick:a.onClose,role:"presentation",children:e.jsxs("div",{ref:r,className:"af-appearance af-about",role:"dialog","aria-modal":"true","aria-labelledby":l,onClick:p=>p.stopPropagation(),children:[e.jsx("div",{className:"af-appearance__title",id:l,children:d}),e.jsx("dl",{className:"af-about__rows",children:m.map(([p,_],y)=>e.jsxs("div",{className:"af-about__row",children:[e.jsx("dt",{className:"af-about__label",children:p}),e.jsx("dd",{className:"af-about__value",children:e.jsx(R_,{label:p,value:_})})]},`${y}:${p}`))}),e.jsx("div",{className:"af-appearance__actions",children:e.jsx("button",{ref:s,type:"button",className:"af-appearance__close",onClick:a.onClose,children:"Close"})})]})})}function M_(a){const{connection:s}=a,r=s.phase,l=s.signingOut===!0,[c,d]=h.useState(!1),m=a.about,p=l?"Signing out…":r==="connected"?"Disconnect":r==="loading"?"Connecting…":"Connect",_=r==="connected"?"Disconnect from gateway":r==="loading"?"Checking gateway session…":"Connect to gateway";return e.jsxs("div",{className:`af-topbar${a.className?` ${a.className}`:""}`,role:"group","aria-label":"App actions",children:[a.assistant?e.jsx("button",{type:"button",className:`af-topbar__btn${a.assistant.open?" is-active":""}`,"aria-pressed":a.assistant.open,"aria-label":a.assistant.label||"Open assistant",title:a.assistant.label||"Assistant",onClick:a.assistant.onToggle,children:e.jsx(rt,{name:"sparkle",size:16})}):null,a.appearance?e.jsx("button",{type:"button",className:"af-topbar__btn","aria-label":a.appearance.label||"Appearance (theme and typography)",title:a.appearance.label||"Appearance",onClick:a.appearance.onOpen,children:e.jsx(rt,{name:"contrast",size:16})}):null,m?e.jsx("button",{type:"button",className:"af-topbar__btn af-topbar__btn--about","aria-label":m.label||`About ${m.identity.name}`,title:m.label||"About","aria-haspopup":"dialog",onClick:()=>{var y;d(!0),(y=m.onOpen)==null||y.call(m)},children:e.jsx(rt,{name:"info",size:16})}):null,a.extraActions,e.jsxs("button",{type:"button",className:`af-topbar__pill af-topbar__pill--${r}`,onClick:r==="connected"?s.onDisconnect:s.onConnect,disabled:l,title:_,"aria-label":_,children:[e.jsx("span",{className:`af-topbar__dot af-topbar__dot--${r}`,"aria-hidden":"true"}),e.jsx("span",{className:"af-topbar__pill-label",children:p})]}),m?e.jsx(L_,{open:c,onClose:()=>d(!1),identity:m.identity,extraRows:m.extraRows}):null]})}const Vo={theme:"dark",font_scale:"md",header_density:"standard"};function z_(a){const s=a&&typeof a=="object"?a:{};return{theme:typeof s.theme=="string"&&s.theme?s.theme:Vo.theme,font_scale:typeof s.font_scale=="string"&&s.font_scale?s.font_scale:Vo.font_scale,header_density:typeof s.header_density=="string"&&s.header_density?s.header_density:Vo.header_density}}function P_(a){return`af_appearance_${a}_v1`}function I_(a,s){const r=P_(a),l=h.useMemo(()=>({...Vo}),[JSON.stringify({})]),[c,d]=h.useState(()=>{let m=l;try{const p=localStorage.getItem(r)??(s!=null&&s.legacyKey?localStorage.getItem(s.legacyKey):null);p&&(m=z_({...l,...JSON.parse(p)}))}catch{}try{ef(m.theme),tf({font_scale:m.font_scale,header_density:m.header_density})}catch{}return m});return h.useEffect(()=>{ef(c.theme),tf({font_scale:c.font_scale,header_density:c.header_density});try{localStorage.setItem(r,JSON.stringify(c))}catch{}},[r,c]),[c,d]}function O_(a){return h.useEffect(()=>{if(!a.open)return;const s=r=>{r.key!=="Escape"||r.defaultPrevented||(r.preventDefault(),a.onClose())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[a.open,a.onClose]),a.open?e.jsx("div",{className:"af-appearance-overlay",onClick:a.onClose,role:"presentation",children:e.jsxs("div",{className:"af-appearance",role:"dialog","aria-modal":"true","aria-label":a.title||"Appearance",onClick:s=>s.stopPropagation(),children:[e.jsx("div",{className:"af-appearance__title",children:a.title||"Appearance"}),e.jsx("div",{className:"af-appearance__note",children:a.note||"Stored locally in this browser, per app."}),e.jsxs("div",{className:"af-appearance__grid",children:[e.jsx("label",{className:"af-appearance__label",children:"Theme"}),e.jsx(Qp,{value:a.value.theme,onChange:s=>a.onChange({...a.value,theme:s})}),e.jsx("label",{className:"af-appearance__label",children:"Font size"}),e.jsx(Jp,{value:a.value.font_scale,onChange:s=>a.onChange({...a.value,font_scale:s})}),e.jsx("label",{className:"af-appearance__label",children:"Header size"}),e.jsx(Yp,{value:a.value.header_density,onChange:s=>a.onChange({...a.value,header_density:s})})]}),e.jsx("div",{className:"af-appearance__actions",children:e.jsx("button",{type:"button",className:"af-appearance__close",onClick:a.onClose,children:"Close"})})]})}):null}async function*D_(a){const s=new AbortController;try{const r=await fetch(a.path,{method:"POST",headers:{"Content-Type":"application/json",...a.csrfToken?{"x-abstract-csrf":a.csrfToken}:{},...a.headers||{}},body:JSON.stringify(a.body),signal:s.signal});if(!r.ok){const m=await r.json().catch(()=>null),p=m&&typeof m=="object"&&m.detail?String(m.detail):`HTTP ${r.status}`;throw new Error(p)}if(!r.body)throw new Error("TTS stream has no body");const l=r.body.getReader(),c=new TextDecoder;let d="";for(;;){const{done:m,value:p}=await l.read();if(m)break;d+=c.decode(p,{stream:!0});let _;for(;(_=d.indexOf(`
|
|
41
|
-
`))>=0;){const y=d.slice(0,_).trim();if(d=d.slice(_+1),!y)continue;let b=null;try{b=JSON.parse(y)}catch{continue}if(b&&b.type==="error")throw new Error(String(b.error||"TTS stream error"));const x=b&&typeof b.audio_b64=="string"?b.audio_b64:"";if(x){const N=atob(x),L=new Uint8Array(N.length);for(let I=0;I<N.length;I+=1)L[I]=N.charCodeAt(I);yield L.buffer}if(b&&(b.type==="done"||b.type==="cancelled"))return}}}finally{s.abort()}}function F_(){var s;if(typeof window>"u")return!1;const a=navigator;return!!((s=a==null?void 0:a.mediaDevices)!=null&&s.getUserMedia)&&typeof window.MediaRecorder=="function"}function q_(){if(typeof window>"u")return!1;const a=window;return!!(a!=null&&a.AudioContext||a!=null&&a.webkitAudioContext)}function B_(){const a=window.MediaRecorder,s=l=>{var c;try{return!!((c=a==null?void 0:a.isTypeSupported)!=null&&c.call(a,l))}catch{return!1}},r=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus","audio/ogg"];for(const l of r)if(s(l))return l;return""}async function Su(a,s){var c;const r=s.slice(0),l=(c=a.decodeAudioData)==null?void 0:c.bind(a);if(typeof l!="function")throw new Error("decodeAudioData not available");try{const d=l(r);if(d&&typeof d.then=="function")return await d}catch{}return await new Promise((d,m)=>{try{l(r,d,m)}catch(p){m(p)}})}function U_(a){const s=new Uint8Array(a);if(s.length<44)return null;const r=d=>String.fromCharCode(s[d],s[d+1],s[d+2],s[d+3]);if(r(0)!=="RIFF"||r(8)!=="WAVE")return null;const l=new DataView(a);let c=12;for(;c+8<=s.length;){const d=r(c),m=l.getUint32(c+4,!0);if(d==="data")return s.slice(0,c+8);c+=8+m+m%2}return null}function W_(a,s){const r=new Uint8Array(s),l=new Uint8Array(a.length+r.length);l.set(a,0),l.set(r,a.length);const c=new DataView(l.buffer);return c.setUint32(4,l.length-8,!0),c.setUint32(a.length-4,r.length,!0),l.buffer}function sh(a){const s=h.useRef(a);s.current=a;const r=fe=>{var Re,Ie;return(Ie=(Re=s.current).on_error)==null?void 0:Ie.call(Re,fe)},l=h.useMemo(()=>q_()&&(typeof a.tts=="function"||typeof a.tts_stream=="function"),[a.tts,a.tts_stream]),c=h.useMemo(()=>F_()&&typeof a.transcribe=="function",[a.transcribe]),[d,m]=h.useState({key:"",status:"idle"}),p=h.useRef(d),_=h.useCallback(fe=>{p.current=fe,m(Re=>Re.key===fe.key&&Re.status===fe.status?Re:fe)},[]),y=h.useRef(""),b=h.useRef(""),x=h.useRef(null),N=h.useRef(null),L=h.useRef(null),I=h.useRef(null),C=h.useRef(0),z=h.useRef(0),B=h.useRef(0),F=h.useRef([]),q=h.useRef(0),Q=h.useRef(!0),E=h.useRef(!1),Z=()=>{try{const fe=globalThis,Re=(fe==null?void 0:fe.AudioContext)||(fe==null?void 0:fe.webkitAudioContext);if(!Re)return null;if(!x.current){const ye=new Re,_e=ye.createGain();_e.gain.value=1,_e.connect(ye.destination),x.current=ye,N.current=_e}const Ie=x.current,se=N.current;if(!Ie||!se)return null;try{Ie.state==="suspended"&&Ie.resume()}catch{}return{ctx:Ie,gain:se}}catch{return null}},oe=h.useCallback(()=>{const fe=L.current;if(L.current=null,!!fe){try{fe.onended=null}catch{}try{fe.stop()}catch{}try{fe.disconnect()}catch{}}},[]),le=h.useCallback(()=>{oe(),B.current+=1,F.current=[],q.current=0,Q.current=!0,E.current=!1,b.current="",y.current="",I.current=null,C.current=0,z.current=0,_({key:"",status:"idle"})},[oe,_]);h.useEffect(()=>()=>{var fe,Re;le();try{(fe=N.current)==null||fe.disconnect()}catch{}try{(Re=x.current)==null||Re.close()}catch{}x.current=null,N.current=null,I.current=null},[]);const pe=async(fe,Re,Ie)=>{const se=B.current,ye=Z();if(!ye)throw new Error("TTS playback is not supported in this browser");const{ctx:_e,gain:qe}=ye;try{_e.state==="suspended"&&await _e.resume()}catch{}if(se!==B.current)return;oe();const Ye=_e.createBufferSource();Ye.buffer=Re,Ye.connect(qe);const ie=Number.isFinite(Number(Re.duration))?Number(Re.duration):0,me=Math.max(0,Math.min(Number(Ie||0),ie>0?Math.max(0,ie-.01):0));z.current=_e.currentTime-me,C.current=me,L.current=Ye,y.current=fe,Ye.onended=()=>{L.current===Ye&&(L.current=null,C.current=0,z.current=0,y.current="",_({key:"",status:"idle"}))},Ye.start(0,me),_({key:fe,status:"playing"})},Te=(fe,Re)=>{if(Re!==B.current)return;const Ie=Z();if(!Ie)return;const se=F.current,ye=q.current;if(ye>=se.length){Q.current&&(y.current="",C.current=0,z.current=0,_({key:"",status:"idle"}));return}const _e=se[ye],{ctx:qe,gain:Ye}=Ie;oe();const ie=qe.createBufferSource();ie.buffer=_e,ie.connect(Ye);const me=Number.isFinite(Number(_e.duration))?Number(_e.duration):0,be=Math.max(0,Math.min(Number(C.current||0),me>0?Math.max(0,me-.01):0));z.current=qe.currentTime-be,L.current=ie,y.current=fe,ie.onended=()=>{Re===B.current&&L.current===ie&&(L.current=null,q.current=ye+1,C.current=0,Te(fe,Re))};try{qe.state==="suspended"&&qe.resume()}catch{}ie.start(0,be),_({key:fe,status:"playing"})},Me=async(fe,Re,Ie)=>{const se=Z();if(!se){r==null||r("TTS playback is not supported in this browser.");return}oe();const ye=++B.current;F.current=[],q.current=0,Q.current=!1,E.current=!1,I.current=null,C.current=0,z.current=0,y.current=fe,b.current=fe,_({key:fe,status:"loading"}),r==null||r("");let _e=null;try{for await(const qe of Ie(Re)){if(ye!==B.current)return;let Ye;try{Ye=await Su(se.ctx,qe),_e||(_e=U_(qe))}catch{if(!_e)continue;try{Ye=await Su(se.ctx,W_(_e,qe))}catch{continue}}if(ye!==B.current)return;F.current.push(Ye),!L.current&&!E.current&&(b.current="",Te(fe,ye))}if(ye!==B.current)return;if(Q.current=!0,F.current.length===0){r==null||r("TTS stream produced no audio."),le();return}!L.current&&!E.current&&Te(fe,ye)}catch(qe){if(ye!==B.current)return;r==null||r(String((qe==null?void 0:qe.message)||qe||"TTS stream failed")),le()}},ve=h.useCallback(async(fe,Re)=>{const Ie=String(fe||"").trim(),se=String(Re||"").trim();if(!Ie||!se)return;const ye=s.current.tts,_e=s.current.tts_stream;if(typeof ye!="function"&&typeof _e!="function"){r==null||r("TTS is not available.");return}const qe=Z();if(!qe){r==null||r("TTS playback is not supported in this browser.");return}const Ye=p.current,ie=Ye.key===Ie;if(ie&&Ye.status==="playing"){if(L.current){const be=Math.max(0,qe.ctx.currentTime-Number(z.current||0));C.current=be}else C.current=0;E.current=!0,oe(),_({key:Ie,status:"paused"});return}if(ie&&Ye.status==="paused"){if(F.current.length>0){r==null||r(""),E.current=!1,_({key:Ie,status:"playing"}),Te(Ie,B.current);return}const be=I.current;if(be){r==null||r(""),E.current=!1;try{await pe(Ie,be,C.current)}catch(G){r==null||r(String((G==null?void 0:G.message)||G||"TTS play failed")),_({key:"",status:"idle"})}return}}if(ie&&Ye.status==="loading")return;if(typeof _e=="function"){await Me(Ie,se,_e);return}oe(),B.current+=1;const me=B.current;F.current=[],q.current=0,Q.current=!0,E.current=!1,I.current=null,C.current=0,z.current=0,y.current=Ie,b.current=Ie,_({key:Ie,status:"loading"}),r==null||r("");try{const be=await ye(se);if(b.current!==Ie||B.current!==me)return;const G=await Su(qe.ctx,be);if(b.current!==Ie||B.current!==me)return;I.current=G,C.current=0,await pe(Ie,G,0)}catch(be){if(B.current!==me)return;b.current===Ie&&(b.current="",y.current="",_({key:"",status:"idle"})),r==null||r(String((be==null?void 0:be.message)||be||"TTS failed"))}},[]),[ce,D]=h.useState(!1),[R,U]=h.useState(!1),X=h.useRef(!1),M=h.useRef(c);M.current=c;const ue=h.useCallback(fe=>{X.current=fe,D(Re=>Re===fe?Re:fe)},[]),V=h.useRef(!1),w=h.useRef(null),A=h.useRef(null),ee=h.useRef([]),ge=h.useRef(""),he=h.useRef(0),O=h.useRef(!1);function je(){var fe,Re;try{(Re=(fe=w.current)==null?void 0:fe.getTracks)==null||Re.call(fe).forEach(Ie=>{try{Ie.stop()}catch{}})}catch{}w.current=null}const te=h.useCallback(()=>{he.current+=1,O.current=!1;const fe=A.current;if(fe){fe.onstop=null,fe.ondataavailable=null,fe.onerror=null;try{fe.stop()}catch{}}A.current=null,je(),ue(!1),V.current=!1,U(!1),ee.current=[]},[ue]);h.useEffect(()=>()=>te(),[te]);async function Ce(fe,Re){var ye,_e;if(r==null||r(""),!fe||!fe.size||V.current)return;const Ie=s.current.transcribe;if(typeof Ie!="function"){r==null||r("Transcription is not available.");return}V.current=!0;const se=he.current;U(!0);try{const qe=String(await Ie(fe,Re)||"").trim();se===he.current&&qe&&((_e=(ye=s.current).on_transcript)==null||_e.call(ye,qe))}catch(qe){se===he.current&&(r==null||r(String((qe==null?void 0:qe.message)||qe||"Transcription failed")))}finally{se===he.current&&(V.current=!1,U(!1))}}const Ae=h.useCallback(async()=>{if(r==null||r(""),!M.current){r==null||r("Voice recording is not supported in this browser (MediaRecorder/getUserMedia unavailable).");return}if(V.current||O.current||X.current||A.current)return;ee.current=[];const fe=he.current;O.current=!0;try{const Re=await navigator.mediaDevices.getUserMedia({audio:!0});if(fe!==he.current){Re.getTracks().forEach(ye=>ye.stop());return}w.current=Re;const Ie=B_();ge.current=Ie;const se=Ie?new MediaRecorder(Re,{mimeType:Ie}):new MediaRecorder(Re);A.current=se,se.ondataavailable=ye=>{if(fe===he.current)try{ye!=null&&ye.data&&ee.current.push(ye.data)}catch{}},se.onerror=()=>{fe===he.current&&(r==null||r("Recording failed."))},se.onstop=()=>{if(fe===he.current){ue(!1),je(),A.current=null;try{const ye=new Blob(ee.current,{type:ge.current||""});Ce(ye,ge.current)}catch(ye){r==null||r(String((ye==null?void 0:ye.message)||ye||"Failed to build recording"))}}},se.start(),ue(!0)}catch(Re){if(fe!==he.current)return;je(),A.current=null,ue(!1);const Ie=String((Re==null?void 0:Re.message)||Re||"Failed to access microphone");r==null||r(Ie.toLowerCase().includes("permission")?`Microphone permission denied: ${Ie}`:Ie)}finally{fe===he.current&&(O.current=!1)}},[]),Ge=h.useCallback(()=>{const fe=A.current;if(!(!X.current||!fe)){ue(!1);try{fe.stop()}catch(Re){r==null||r(String((Re==null?void 0:Re.message)||Re||"Failed to stop recording"))}}},[]);return h.useEffect(()=>{if(!ce)return;const fe=()=>Ge();return window.addEventListener("pointerup",fe),window.addEventListener("pointercancel",fe),()=>{window.removeEventListener("pointerup",fe),window.removeEventListener("pointercancel",fe)}},[ce]),{tts_supported:l,tts_playback:d,toggle_tts:ve,stop_tts:le,voice_ptt_supported:c,voice_ptt_recording:ce,voice_ptt_busy:R,start_voice_ptt_recording:Ae,stop_voice_ptt_recording:Ge,cancel_voice_ptt_recording:te}}function H_(a){const s=String(a??"").trim();if(!s||!(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]")))return null;try{return JSON.parse(s)}catch{return null}}async function mn(a){const s=String(a||"");if(!s)return!1;try{return await navigator.clipboard.writeText(s),!0}catch{try{const r=document.createElement("textarea");return r.value=s,r.style.position="fixed",r.style.left="-9999px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),!0}catch{return!1}}}const V_=3,G_=Number.MAX_SAFE_INTEGER;function ah(a){return!!a&&typeof a=="object"&&!Array.isArray(a)}function rh(a){return Array.isArray(a)}function K_(a){if(a==null)return"";if(typeof a=="string")return a;try{return JSON.stringify(a,null,2)}catch{return String(a)}}function yi({kind:a,children:s}){return e.jsx("span",{className:`pc-json-token ${a}`,children:s})}function Q_(a){const s=JSON.stringify(a.value),r=s.length>96||s.includes("\\n")||s.includes("\\r")||s.includes("\\t"),[l,c]=h.useState(!r||a.expansionMode==="unfolded");return h.useEffect(()=>{r&&c(a.expansionMode==="unfolded")},[r,a.expansionMode,a.expansionVersion]),r?e.jsxs("span",{className:`pc-json-string ${l?"open":"collapsed"}`,children:[e.jsx("button",{type:"button",className:"pc-json-string__toggle",onClick:()=>c(d=>!d),"aria-label":l?"Collapse string value":"Expand string value","aria-expanded":l,children:l?"▾":"▸"}),l?e.jsx("span",{className:"pc-json-token string pc-json-string__value",children:s}):e.jsxs("button",{type:"button",className:"pc-json-string__preview",onClick:()=>c(!0),"aria-label":"Expand string value",children:[e.jsx("span",{className:"pc-json-token string pc-json-string__preview_text",children:s}),e.jsx("span",{className:"pc-json-string__suffix",children:"(...)"})]})]}):e.jsx(yi,{kind:"string",children:s})}function J_(a,s,r){return a===null?e.jsx(yi,{kind:"null",children:"null"}):typeof a=="string"?e.jsx(Q_,{value:a,expansionMode:s,expansionVersion:r}):typeof a=="number"?e.jsx(yi,{kind:"number",children:String(a)}):typeof a=="boolean"?e.jsx(yi,{kind:"boolean",children:a?"true":"false"}):e.jsx(yi,{kind:"string",children:JSON.stringify(String(a))})}function Y_(a){return rh(a)?a.length===1?"1 item":`${a.length} items`:ah(a)?Object.keys(a).length===1?"1 key":`${Object.keys(a).length} keys`:""}function ih(a){const{label:s,value:r,depth:l,collapseAfterDepth:c,expansionMode:d,expansionVersion:m,trailingComma:p}=a,_=l*14,y=ah(r),b=rh(r),x=y||b,N=l<c,[L,I]=h.useState(N);h.useEffect(()=>{I(N)},[N,m]);const C=s?e.jsxs(e.Fragment,{children:[e.jsx(yi,{kind:"key",children:JSON.stringify(s)}),": "]}):null;if(!x)return e.jsxs("div",{className:"pc-json-viewer__line",style:{paddingLeft:_},children:[C,J_(r,d,m),p?",":""]});const z=b?"[":"{",B=b?"]":"}",F=Y_(r),q=L?`${z}`:`${z}…${B}${F?` (${F})`:""}`,Q=b?r.map((E,Z)=>({key:String(Z),label:void 0,value:E})):Object.entries(r).map(([E,Z])=>({key:E,label:E,value:Z}));return e.jsxs("details",{className:"pc-json-viewer__details",open:L,onToggle:E=>I(E.currentTarget.open),children:[e.jsxs("summary",{className:"pc-json-viewer__summary",style:{paddingLeft:_},children:[C,e.jsx("span",{className:"pc-json-viewer__caret","aria-hidden":"true",children:L?"▾":"▸"}),e.jsx("span",{className:"pc-json-viewer__punct",children:q}),!L&&p?e.jsx("span",{className:"pc-json-viewer__punct",children:","}):null]}),L?e.jsx("div",{className:"pc-json-viewer__children",children:Q.length===0?e.jsxs("div",{className:"pc-json-viewer__line",style:{paddingLeft:_},children:[e.jsx("span",{className:"pc-json-viewer__punct",children:B}),p?",":""]}):e.jsxs(e.Fragment,{children:[Q.map((E,Z)=>{const oe=Z===Q.length-1;return e.jsx(ih,{label:E.label,value:E.value,depth:l+1,collapseAfterDepth:c,expansionMode:d,expansionVersion:m,trailingComma:!oe},`${l}:${s||"root"}:${E.key}`)}),e.jsxs("div",{className:"pc-json-viewer__line",style:{paddingLeft:_},children:[e.jsx("span",{className:"pc-json-viewer__punct",children:B}),p?",":""]})]})}):null]})}function X_(a){const s=a.trim();if(!s)return a;if(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]"))try{return JSON.parse(s)}catch{return a}return a}function Go(a){const{value:s,className:r,showCopy:l=!0}=a,[c,d]=h.useState({mode:"folded",version:0}),m=typeof a.collapseAfterDepth=="number"&&(Number.isFinite(a.collapseAfterDepth)||a.collapseAfterDepth===1/0)&&a.collapseAfterDepth>=0?a.collapseAfterDepth===1/0?Number.MAX_SAFE_INTEGER:Math.trunc(a.collapseAfterDepth):V_,p=c.mode==="unfolded"?G_:m,_=h.useMemo(()=>typeof s=="string"?X_(s):s,[s]),y=h.useMemo(()=>K_(s),[s]),b=["pc-json-viewer",r].filter(Boolean).join(" ");h.useEffect(()=>{d(N=>({mode:"folded",version:N.version+1}))},[_]);const x=()=>{d(N=>({mode:N.mode==="unfolded"?"folded":"unfolded",version:N.version+1}))};return e.jsxs("div",{className:b,children:[e.jsxs("div",{className:"pc-json-viewer__toolbar",children:[e.jsx("button",{type:"button",className:"pc-btn pc-json-viewer__toggle-all",onClick:x,"aria-expanded":c.mode==="unfolded",children:c.mode==="unfolded"?"Fold all":"Unfold all"}),l?e.jsx("button",{type:"button",className:"pc-btn pc-json-viewer__copy",onClick:()=>void mn(y),children:"Copy JSON"}):null]}),e.jsx("div",{className:"pc-json-viewer__tree",role:"tree","aria-label":"JSON viewer",children:e.jsx(ih,{value:_,depth:0,collapseAfterDepth:p,expansionMode:c.mode,expansionVersion:c.version,trailingComma:!1})})]})}function xl(a,s){const r=String(a??"");if(!s||!s.needles.length)return[r];const l=[],c=r.toLowerCase();let d=0;for(;d<r.length;){let m=-1,p="";for(let b=0;b<s.needlesLower.length;b++){const x=s.needlesLower[b];if(!x)continue;const N=c.indexOf(x,d);if(N===-1)continue;const L=s.needles[b]||"";L&&(m===-1||N<m||N===m&&L.length>p.length)&&(m=N,p=L)}if(m===-1||!p){l.push(r.slice(d));break}m>d&&l.push(r.slice(d,m));const _=s.hits===0&&s.id?s.id:void 0,y=r.slice(m,m+p.length);l.push(e.jsx("span",{id:_,className:s.className,children:y},`hl:${s.hits}`)),s.hits+=1,d=m+p.length}return l}function lh(a){const s=String(a||"").trim();if(s&&/^(https?:|mailto:|tel:|#|\/)/i.test(s))return s}const Hu="http://same-origin.invalid/";function Z_(a){try{const s=new URL(a,Hu);return s.protocol==="http:"&&s.origin===new URL(Hu).origin}catch{return!1}}function oh(a){const s=String(a||"").trim();return lh(s)??(s&&Z_(s)?s:void 0)}let Er=null;function eg(a){const s=String(a||"").trim();if(!s)return!1;const r=typeof document<"u"&&document.baseURI?document.baseURI:null;if(r===null&&/^[a-z][a-z0-9+.-]*:/i.test(s))return!1;const l=r??Hu;let c,d;try{c=new URL(l).origin,d=new URL(s,l)}catch{return!1}return d.protocol!=="http:"&&d.protocol!=="https:"?!1:d.origin===c}function ch(a,s,r){return e.jsx("a",{className:"pc-md_link pc-md_image_link",href:s,target:"_blank",rel:"noopener noreferrer",children:`image: ${r||s}`},a)}function qa(a,s){const r=[],l=String(a??"");let c=0,d="";const m=()=>{if(d){for(const p of xl(d,s))r.push(p);d=""}};for(;c<l.length;){const p=l[c];if(p==="!"&&l[c+1]==="["){const _=l.indexOf("]",c+2);if(_!==-1&&l[_+1]==="("){const y=l.indexOf(")",_+2);if(y!==-1){const b=l.slice(c+2,_),x=oh(l.slice(_+2,y));if(x&&Er&&!Er(x)){m(),r.push(ch(`img:${c}`,x,b)),c=y+1;continue}if(x){m(),r.push(e.jsxs("span",{className:"pc-md_image_inline",children:[e.jsx("img",{className:"pc-md_img",src:x,alt:b,loading:"lazy"}),b?e.jsx("span",{className:"pc-md_img_caption",children:s?xl(b,s):b}):null]},`img:${c}`)),c=y+1;continue}}}}if(p==="["){const _=l.indexOf("]",c+1);if(_!==-1&&l[_+1]==="("){const y=l.indexOf(")",_+2);if(y!==-1){const b=l.slice(c+1,_),x=lh(l.slice(_+2,y));if(x){m(),r.push(e.jsx("a",{className:"pc-md_link",href:x,target:x.startsWith("#")?void 0:"_blank",rel:"noreferrer",children:qa(b,s)},`link:${c}`)),c=y+1;continue}}}}if(p==="`"){const _=l.indexOf("`",c+1);if(_!==-1){m();const y=l.slice(c+1,_);r.push(e.jsx("code",{children:s?xl(y,s):y},`code:${c}`)),c=_+1;continue}}if(p==="*"&&l[c+1]==="*"){const _=l.indexOf("**",c+2);if(_!==-1){m();const y=l.slice(c+2,_);r.push(e.jsx("strong",{children:s?xl(y,s):y},`bold:${c}`)),c=_+2;continue}}if(p==="*"&&l[c+1]!=="*"){const _=l.indexOf("*",c+1);if(_!==-1){m();const y=l.slice(c+1,_);r.push(e.jsx("em",{children:s?xl(y,s):y},`em:${c}`)),c=_+1;continue}}d+=p,c+=1}return m(),r}function tg(a){return String(a??"").replace(/\r\n/g,`
|
|
42
|
-
`).replace(/\r/g,`
|
|
43
|
-
`).split(`
|
|
44
|
-
`)}function Ko(a){const r=String(a??"").match(/^([ \t]*)(?:([-*+])|(\d{1,9})[.)])\s+(.*)$/);return r?{indent:r[1].replace(/\t/g," ").length,ordered:!!r[3],start:r[3]?Math.max(1,parseInt(r[3],10)||1):1,content:r[4]??""}:null}function ng(a){const s=[];for(const c of a){const d=Ko(c);d?s.push(d):s.length>0&&c.trim()&&(s[s.length-1].content+=` ${c.trim()}`)}const r=[],l=[];for(const c of s){for(;l.length>0&&c.indent<l[l.length-1].indent;)l.pop();let d=l.length>0?l[l.length-1]:null;if(d&&c.indent>d.indent){const m=d.node.items,p=m[m.length-1];if(p){const _={ordered:c.ordered,start:c.start,items:[]};p.children.push(_),l.push({indent:c.indent,node:_}),d=l[l.length-1]}}else if(d&&d.node.ordered!==c.ordered){l.pop();const m=l.length>0?l[l.length-1]:null,p={ordered:c.ordered,start:c.start,items:[]};if(m){const _=m.node.items,y=_[_.length-1];y?y.children.push(p):m.node.items.push({content:"",children:[p]})}else r.push(p);l.push({indent:c.indent,node:p}),d=l[l.length-1]}if(!d){const m={ordered:c.ordered,start:c.start,items:[]};r.push(m),l.push({indent:c.indent,node:m}),d=l[l.length-1]}d.node.items.push({content:c.content,children:[]})}return r}function uh(a,s,r){const l=a.items.map((c,d)=>e.jsxs("li",{children:[qa(c.content,s),c.children.map((m,p)=>uh(m,s,`${r}:${d}:${p}`))]},`${r}:li:${d}`));return a.ordered?e.jsx("ol",{className:"pc-md_ol",start:a.start!==1?a.start:void 0,children:l},r):e.jsx("ul",{className:"pc-md_ul",children:l},r)}function sg(a,s,r){return ng(a).map((l,c)=>uh(l,s,`${r}:${c}`))}function lf(a){let s=String(a??"").trim();return s?(s.startsWith("|")&&(s=s.slice(1)),s.endsWith("|")&&(s=s.slice(0,-1)),s.split("|").map(r=>String(r??"").trim())):[]}function of(a){let s=String(a??"").trim();if(!s)return!1;s.startsWith("|")&&(s=s.slice(1)),s.endsWith("|")&&(s=s.slice(0,-1));const r=s.split("|").map(l=>String(l??"").trim());return r.length<2?!1:r.every(l=>/^:?-{3,}:?$/.test(l))}const cf=/^(#{1,5})\s+(.*)$/;function uf(a){return a.trim().startsWith("```")}function df(a){return a.trimStart().startsWith(">")}function ds(a){const s=Er;Er=a.images==="link"?a.inlineImage||eg:null;try{return ag(a)}finally{Er=s}}function ag({text:a,className:s,highlight:r,highlights:l,highlightClassName:c,highlightId:d}){const m=tg(a),p=[],_=[];Array.isArray(l)&&_.push(...l),typeof r=="string"&&r.trim()&&_.push(r);const y=Array.from(new Set(_.map(L=>String(L??"").trim()).filter(Boolean))).filter(L=>L.length>=4),b=y.length?{needles:y,needlesLower:y.map(L=>L.toLowerCase()),className:c||"pc-md_hl",id:d,hits:0}:null;let x=0;for(;x<m.length;){const L=String(m[x]??"");if(!L.trim()){x+=1;continue}const I=L.trim();if(/^([-_*])(\s*\1){2,}$/.test(I)){p.push(e.jsx("hr",{className:"pc-md_hr"},`hr:${x}`)),x+=1;continue}const C=L.match(/^\s*!\[([^\]]*)\]\(([^)]+)\)\s*$/);if(C){const F=oh(C[2]||"");if(F&&Er&&!Er(F)){p.push(e.jsx("p",{className:"pc-md_p",children:ch(`img:${x}`,F,C[1]||"")},`p:${x}`)),x+=1;continue}if(F){const q=C[1]||"";p.push(e.jsxs("figure",{className:"pc-md_figure",children:[e.jsx("img",{className:"pc-md_img",src:F,alt:q,loading:"lazy"}),q?e.jsx("figcaption",{children:qa(q,b)}):null]},`figure:${x}`)),x+=1;continue}}if(uf(L)){const q=L.trim().replace(/```/g,"").trim(),Q=[];for(x+=1;x<m.length&&!String(m[x]??"").trim().startsWith("```");)Q.push(String(m[x]??"")),x+=1;x<m.length&&(x+=1);const E=Q.join(`
|
|
45
|
-
`);p.push(e.jsx("pre",{className:"pc-md_pre",children:e.jsx("code",{className:q?`language-${q}`:void 0,children:E})},`pre:${x}`));continue}const z=L.match(cf);if(z){const F=z[1].length,q=z[2]||"",Q=qa(q,b);F===1?p.push(e.jsx("h1",{children:Q},`h1:${x}`)):F===2?p.push(e.jsx("h2",{children:Q},`h2:${x}`)):F===3?p.push(e.jsx("h3",{children:Q},`h3:${x}`)):F===4?p.push(e.jsx("h4",{children:Q},`h4:${x}`)):p.push(e.jsx("h5",{children:Q},`h5:${x}`)),x+=1;continue}if(df(L)){const F=[];for(;x<m.length&&String(m[x]??"").trimStart().startsWith(">");){const Q=String(m[x]??"").trimStart();F.push(Q.replace(/^>\s?/,"")),x+=1}p.push(e.jsx("blockquote",{className:"pc-md_quote",children:F.map((q,Q)=>e.jsxs(Kt.Fragment,{children:[qa(q,b),Q<F.length-1?e.jsx("br",{}):null]},`q:${x}:${Q}`))},`quote:${x}`));continue}if(L.includes("|")&&x+1<m.length&&of(String(m[x+1]??""))){const F=lf(L),q=Math.max(1,F.length),Q=[];for(x+=2;x<m.length;){const E=String(m[x]??"");if(!E.trim()||!E.includes("|"))break;const Z=lf(E),oe=[];for(let le=0;le<q;le++)oe.push(Z[le]??"");Q.push(oe),x+=1}p.push(e.jsx("div",{className:"pc-md_table_wrap",children:e.jsxs("table",{className:"pc-md_table",children:[e.jsx("thead",{children:e.jsx("tr",{children:F.slice(0,q).map((E,Z)=>e.jsx("th",{children:qa(E,b)},`th:${x}:${Z}`))})}),e.jsx("tbody",{children:Q.map((E,Z)=>e.jsx("tr",{children:E.map((oe,le)=>e.jsx("td",{children:qa(oe,b)},`td:${x}:${Z}:${le}`))},`tr:${x}:${Z}`))})]})},`table:${x}`));continue}if(Ko(L)){const F=[];for(;x<m.length;){const q=String(m[x]??"");if(!q.trim()||q.trimStart().startsWith("```"))break;if(Ko(q)||/^\s{2,}\S/.test(q)){F.push(q),x+=1;continue}break}p.push(e.jsx(Kt.Fragment,{children:sg(F,b,`list:${x}`)},`list:${x}`));continue}const B=[];for(;x<m.length&&String(m[x]??"").trim()&&!(B.length>0&&Ko(String(m[x]??"")));){const F=String(m[x]??"");if(B.length>0&&(cf.test(F)||uf(F)||df(F))||B.length>0&&F.includes("|")&&x+1<m.length&&of(String(m[x+1]??"")))break;B.push(F),x+=1}p.push(e.jsx("p",{className:"pc-md_p",children:B.map((F,q)=>e.jsxs(Kt.Fragment,{children:[qa(F,b),q<B.length-1?e.jsx("br",{}):null]},`pl:${x}:${q}`))},`p:${x}`))}const N=["pc-md",s].filter(Boolean).join(" ");return e.jsx("div",{className:N,children:p})}function rg(a){const s=String(a.text??""),r=h.useMemo(()=>H_(s),[s]),l=["pc-chat-content",a.className].filter(Boolean).join(" ");return r!==null?e.jsx("div",{className:l,children:e.jsx(Go,{value:r,collapseAfterDepth:a.jsonCollapseAfterDepth})}):a.renderMarkdown?e.jsx("div",{className:l,children:a.renderMarkdown(s)}):e.jsx("div",{className:l,children:e.jsx(ds,{text:s,images:a.images,inlineImage:a.inlineImage})})}function dh(a){if(typeof a!="string")return a;try{return JSON.parse(a)}catch{return a}}function ig(a){const s=dh(a);if(!s||typeof s!="object"||Array.isArray(s))return{label:"input",value:s==null?"":String(s)};const r=Object.entries(s),c=["command","query","url","file_path","path","pattern","name"].map(d=>r.find(([m])=>m===d)).find(Boolean)||r[0];return c?{label:c[0].replace(/_/g," "),value:typeof c[1]=="string"?c[1]:JSON.stringify(c[1])??""}:{label:"",value:""}}function mh({tool:a,showCopy:s=!0}){const[r,l]=h.useState(!1),c=dh(a.arguments),d=ig(a.arguments),m=["file path","path"].includes(d.label)&&d.value.length>60?`${d.value.split(/[\\/]/).pop()} · ${d.value.slice(0,24)}…`:d.value,p=a.error&&/^File ['"].+['"] does not exist\.?$/.test(a.error)?"File not found. Expand for the exact path.":a.error&&a.error.length>180?`${a.error.slice(0,100)}…${a.error.slice(-70)}`:a.error,_={running:"Running",waiting:"Approval needed",completed:"Done",failed:"Failed"},y=a.startedAt&&a.endedAt?Date.parse(a.endedAt)-Date.parse(a.startedAt):NaN,b=c&&typeof c=="object"&&!Array.isArray(c)?Object.entries(c):null;return e.jsxs("details",{className:`pc-tool-activity pc-tool-activity--${a.status}`,children:[e.jsxs("summary",{className:"pc-tool-activity__summary",children:[e.jsx("span",{className:"pc-tool-activity__state-icon","aria-hidden":"true",children:e.jsx(rt,{name:a.status==="completed"?"check":a.status==="failed"?"x":a.status==="waiting"?"warning":"loader",size:15})}),e.jsx("strong",{children:a.name}),e.jsx("span",{className:"pc-tool-activity__preview",title:d.value,children:d.value?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"pc-tool-activity__key",children:d.label}),m]}):"No parameters"}),e.jsx("span",{className:"pc-tool-activity__status",children:_[a.status]}),Number.isFinite(y)&&y>=0?e.jsxs("span",{className:"pc-tool-activity__duration",children:[(y/1e3).toFixed(1),"s"]}):null,e.jsx("span",{className:"pc-tool-activity__chevron","aria-hidden":"true",children:e.jsx(rt,{name:"chevronRight",size:13})}),a.error?e.jsx("span",{className:"pc-tool-activity__error",title:a.error,children:p}):null]}),e.jsxs("div",{className:"pc-tool-activity__detail",children:[a.error?e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Error"}),e.jsx("pre",{className:"pc-tool-activity__output",children:a.error})]}):null,e.jsxs("div",{className:"pc-tool-activity__detail-heading",children:[e.jsx("h4",{children:"Parameters"}),s?e.jsxs("button",{type:"button",onClick:async()=>l(await mn(JSON.stringify(a,null,2))),children:[e.jsx(rt,{name:"copy",size:13}),r?"Copied":"Copy details"]}):null]}),b?e.jsx("dl",{className:"pc-tool-activity__parameters",children:b.map(([x,N])=>e.jsxs(Kt.Fragment,{children:[e.jsx("dt",{children:x}),e.jsx("dd",{children:N&&typeof N=="object"?e.jsx(Go,{value:N}):e.jsx("code",{children:typeof N=="string"?N:JSON.stringify(N)})})]},x))}):a.arguments===void 0?e.jsx("p",{children:"Arguments are unavailable in this ledger."}):e.jsx(Go,{value:c}),a.output!==void 0?e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Result"}),typeof a.output=="string"?e.jsx("pre",{className:"pc-tool-activity__output",children:a.output}):e.jsx("div",{className:"pc-tool-activity__output",children:e.jsx(Go,{value:a.output})})]}):null]})]})}function lg({tools:a,showCopy:s}){const r=l=>a.filter(c=>c.status===l).length;return e.jsxs("section",{className:"pc-tool-group","aria-label":"Tool activity",children:[e.jsxs("div",{className:"pc-tool-group__heading",children:[e.jsx(rt,{name:"terminal",size:14}),e.jsx("strong",{children:"Tools"}),e.jsxs("span",{children:[a.length," ",a.length===1?"call":"calls"]}),e.jsx("div",{}),r("running")?e.jsxs("span",{className:"pc-tool-group__running",children:[r("running")," running"]}):null,r("waiting")?e.jsxs("span",{className:"pc-tool-group__waiting",children:[r("waiting")," need approval"]}):null,r("failed")?e.jsxs("span",{className:"pc-tool-group__failed",children:[r("failed")," failed"]}):null,r("completed")?e.jsxs("span",{className:"pc-tool-group__completed",children:[r("completed")," done"]}):null]}),a.map(l=>e.jsx(mh,{tool:l,showCopy:s},l.id))]})}const xn="not reported",En=a=>a===void 0?xn:Math.round(a).toLocaleString(),Dn=a=>{if(a===void 0)return xn;if(a<6e4)return`${(a/1e3).toFixed(1)}s`;const s=Math.round(a/1e3);return`${Math.floor(s/60)}m ${String(s%60).padStart(2,"0")}s`},fh=a=>a===void 0?xn:`${Math.round(a).toLocaleString()} tok/s`,og=(a,s)=>s>0?`${Math.round(a/s*100)}%`:"",Tr=(a,s,r=`${s}s`)=>`${a.toLocaleString()} ${a===1?s:r}`,cg=a=>{const s=a.split("#")[0].replace(/\/+$/,"");return s.slice(s.lastIndexOf("/")+1)||a};function ug(a){const s=new Map;for(const r of a)r&&s.set(r,(s.get(r)||0)+1);return[...s].map(([r,l])=>l>1?`${r} ×${l}`:r).join(" · ")}function Jo(a){const s=[],r=(a.models||[]).map(cg),l=a.providers||[];return(r.length||l.length)&&s.push([r.join(", ")||"model not reported",l.join(", ")].filter(Boolean).join(" · ")),s.push("From the run ledger; summed across this turn and its child runs."),s}function dg(a){const s=a.modelCalls||[],r=[],l=[{label:"Input",value:En(a.inputTokens)},{label:"Output",value:En(a.outputTokens)}];if(a.reasoningTokens!==void 0&&l.push({label:"Reasoning",value:En(a.reasoningTokens),hint:"part of output"}),l.push({label:"Total",value:En(a.totalTokens)}),r.push({heading:`Usage · ${Tr(a.llmCalls,"model call")}`,rows:l}),a.measuredCacheCalls){const d=a.cachedTokens||0,m=a.fedTokens||0,p=[{label:"Reused from cache",value:`${En(d)}${d+m?` (${og(d,d+m)})`:""}`},{label:"Newly processed",value:En(a.fedTokens)},{label:"Outcome",value:ug(s.map(_=>_.cacheOutcome))||(a.cacheOutcomes||[]).join(" · ")||xn},{label:"Backend",value:(a.cacheBackends||[]).join(", ")||xn}];a.measuredCacheCalls!==a.llmCalls&&p.push({label:"Measured on",value:`${a.measuredCacheCalls} of ${a.llmCalls} calls`}),r.push({heading:"Prompt cache",rows:p})}else a.llmCalls&&r.push({heading:"Prompt cache",rows:[{label:"Cache reuse",value:xn}]});const c=s.filter(d=>d.inputTokens!==void 0);return c.length===1&&s.length===1?r.push({heading:"Context",rows:[{label:"Prompt size",value:`${En(c[0].inputTokens)} tokens`}]}):c.length>1&&r.push({heading:"Context",rows:[{label:"First → last call",value:`${En(c[0].inputTokens)} → ${En(c[c.length-1].inputTokens)} tokens`}],note:"Each call re-sends the conversation, so the input total counts the context once per call."}),s.length>1&&r.push({heading:"Per call",table:{columns:["#","Input","Cached","New","Output","Cache"],rows:s.map((d,m)=>[String(m+1),En(d.inputTokens),d.cachedTokens===void 0?"—":En(d.cachedTokens),d.fedTokens===void 0?"—":En(d.fedTokens),En(d.outputTokens),d.cacheOutcome||"—"])}}),{kind:"tokens",title:"Tokens",headline:a.totalTokens===void 0?xn:`${a.totalTokens.toLocaleString()} total`,sections:r,footer:Jo(a)}}function Do(a,s,r,l){if(a===void 0)return xn;const c=[Dn(a)];return s!==void 0&&c.push(`${s.toLocaleString()} ${l}${r!==void 0?` at ${fh(r)}`:""}`),c.join(" · ")}function mg(a){var y,b,x;const s=a.modelCalls||[],r=[],l=a.durationMs,c=[{label:"Wall clock",value:Dn(l)}];if(c.push({label:"Model",value:a.genTimeMs===void 0?xn:`${Dn(a.genTimeMs)} · ${Tr(a.timedCalls||0,"call")}${a.timedCalls!==a.llmCalls?` (of ${a.llmCalls})`:""}`}),c.push({label:"Tools",value:a.toolTimeMs!==void 0?`${Dn(a.toolTimeMs)} · ${Tr(a.toolBatches||0,"batch","batches")}`:a.toolCalls?xn:"none",hint:a.toolTimeIncludesApproval?"includes approval wait":void 0}),l!==void 0&&a.genTimeMs!==void 0){const N=l-a.genTimeMs-(a.toolTimeMs||0);c.push({label:"Orchestration",value:N>=0?Dn(N):"overlaps (parallel runs)",hint:"wall − model − tools: routing, hand-offs, model load"})}r.push({heading:"Turn",rows:c});const d=[],m=a.ttftCalls||0,p=a.promptPhaseCalls||0;a.promptPhaseMs!==void 0?d.push({label:m&&m===p?"Prefill (TTFT)":"Prefill",value:Do(a.promptPhaseMs,a.promptPhaseNewTokens,a.promptPhaseTokensPerSecond,"new tok"),hint:m===p?"measured time to first token":m?`TTFT measured on ${m} of ${p}; rest from provider rate`:"derived: prompt ÷ provider rate"}):a.prefillMs!==void 0&&a.prefillNewTokensPerSecond!==void 0?d.push({label:"Prefill",value:Do(a.prefillMs,a.prefillNewTokens,a.prefillNewTokensPerSecond,"new tok"),hint:"derived: prompt ÷ provider rate"}):a.prefillMs!==void 0?d.push({label:"Prefill",value:`${Dn(a.prefillMs)}${a.promptTokensPerSecond!==void 0?` at ${fh(a.promptTokensPerSecond)}`:""}`,hint:"provider rate over all prompt tokens, restored included"}):d.push({label:"Prefill",value:xn}),a.cachedTokens&&(a.promptPhaseMs??a.prefillMs)!==void 0&&d.push({label:"Restored",value:`${a.cachedTokens.toLocaleString()} tok from cache`,hint:"not recomputed"}),d.push({label:"Generation",value:a.generationPhaseMs!==void 0?Do(a.generationPhaseMs,a.generationPhaseTokens,a.generationPhaseTokensPerSecond,"tok"):Do(a.decodeMs,a.outputTokens,a.generationTokensPerSecond,"tok")}),a.measuredSpeedCalls&&a.measuredSpeedCalls!==a.llmCalls&&d.push({label:"Speeds from",value:`${a.measuredSpeedCalls} of ${a.llmCalls} calls`}),r.push({heading:"Model",rows:d});const _=a.speculation;if(_){const N=(_.draftKinds||[]).map(I=>I.toUpperCase()).join(", "),L=[{label:"Mode",value:`${_.used?"on":"off"}${N?` · ${N}`:""}${(y=_.modes)!=null&&y.length?` (${_.modes.join(", ")})`:""}`,hint:_.calls!==a.llmCalls||_.used!==_.calls?`used on ${_.used} of ${a.llmCalls} calls`:void 0},{label:"Acceptance",value:_.acceptanceRate===void 0?xn:`${Math.round(_.acceptanceRate*100)}% · ${En(_.acceptedTokens)} of ${En(_.draftedTokens)} drafted`}];((b=_.draftLengths)!=null&&b.length||_.rounds!==void 0)&&L.push({label:"Draft length",value:`${(x=_.draftLengths)!=null&&x.length?`${_.draftLengths.join("/")} tok/round`:xn}${_.rounds!==void 0?` · ${_.rounds.toLocaleString()} rounds`:""}`}),r.push({heading:"Speculation",rows:L})}return a.slowestToolBatch&&r.push({heading:"Tools",rows:[{label:"Total",value:`${Dn(a.toolTimeMs)} · ${Tr(a.toolBatches||0,"batch","batches")}`},{label:"Slowest",value:`${Dn(a.slowestToolBatch.ms)} · ${hh(a.slowestToolBatch)}`}],note:a.toolTimeIncludesApproval?"Gated calls are timed from request to result, so this includes waiting for your approval.":void 0}),s.length>1&&r.push({heading:"Per call",table:{columns:["#","Prefill","New tok/s","Gen","Gen tok/s","Cache"],rows:s.map((N,L)=>[String(L+1),N.promptMs===void 0?"—":`${Dn(N.promptMs)}${N.promptSource==="rate"?"*":""}`,N.promptNewTokensPerSecond===void 0?"—":Math.round(N.promptNewTokensPerSecond).toLocaleString(),N.generationMs===void 0?"—":Dn(N.generationMs),N.generationTokensPerSecond===void 0?"—":Math.round(N.generationTokensPerSecond).toLocaleString(),N.cacheOutcome||"—"])},note:s.some(N=>N.promptSource==="rate")?"* derived from the provider's prompt rate (no TTFT event).":void 0}),{kind:"time",title:"Time",headline:l===void 0?xn:`${Dn(l)} wall clock`,sections:r,footer:Jo(a)}}function hh(a){return a.tools.length===1?`${a.tools[0]} ×${a.calls}`:`${Tr(a.calls,"call")} (${a.tools.join(", ")})`}function fg(a){const s=[],r=(a.toolsWaiting||0)+(a.toolsRunning||0);if(!a.toolCalls&&!r)return s.push({heading:"Outcome",rows:[{label:"Tools called",value:"none"}]}),{kind:"tools",title:"Tools",headline:"none",sections:s,footer:Jo(a)};const l=[{label:"Succeeded",value:(a.toolCalls-(a.toolsFailed||0)).toLocaleString()},{label:"Failed",value:(a.toolsFailed||0).toLocaleString()}];a.toolsRunning&&l.push({label:"Running",value:a.toolsRunning.toLocaleString()}),a.toolsWaiting&&l.push({label:"Awaiting approval",value:a.toolsWaiting.toLocaleString(),hint:"not run yet — not a failure"}),s.push({heading:"Outcome",rows:l});const c=Object.entries(a.toolBreakdown||{}).sort((p,_)=>_[1].calls-p[1].calls||p[0].localeCompare(_[0]));c.length&&s.push({heading:"By tool",table:{columns:["Tool","Calls","Failed","Time"],rows:c.map(([p,_])=>[p,_.calls.toLocaleString(),_.failed.toLocaleString(),_.ms!==void 0?`${Dn(_.ms)}${_.sharedBatches?" +shared":""}`:_.sharedBatches?"shared":xn])},note:c.some(([,p])=>p.sharedBatches)?"A batch that mixed tools ran them together; its time is not split between them.":void 0});const d=c.filter(([,p])=>p.errors&&Object.keys(p.errors).length);d.length&&s.push({heading:"Failures",rows:d.map(([p,_])=>({label:p,value:Object.entries(_.errors).sort((y,b)=>b[1]-y[1]).map(([y,b])=>b>1?`${y} ×${b}`:y).join(" · ")}))});const m=[{label:"Tool time",value:a.toolTimeMs===void 0?xn:`${Dn(a.toolTimeMs)} · ${Tr(a.toolBatches||0,"batch","batches")}`}];return a.slowestToolBatch&&m.push({label:"Slowest batch",value:`${Dn(a.slowestToolBatch.ms)} · ${hh(a.slowestToolBatch)}`}),s.push({heading:"Timing",rows:m,note:a.toolTimeIncludesApproval?"Gated calls are timed from request to result, so this includes waiting for your approval.":void 0}),{kind:"tools",title:"Tools",headline:`${Tr(a.toolCalls,"call")}${a.toolsFailed?` · ${a.toolsFailed} failed`:""}`,sections:s,footer:Jo(a)}}function Nu(a,s){return a==="tokens"?dg(s):a==="time"?mg(s):fg(s)}function hg(a){const s=a.detail;return e.jsxs("div",{ref:a.panelRef,id:a.id,role:"tooltip",className:`pc-stat-detail pc-stat-detail--${s.kind}`,style:a.style,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,children:[e.jsxs("div",{className:"pc-stat-detail-head",children:[e.jsx("span",{className:"pc-stat-detail-title",children:s.title}),e.jsx("span",{className:"pc-stat-detail-headline",children:s.headline})]}),s.sections.map(r=>{var l;return e.jsxs("div",{className:"pc-stat-detail-section",children:[e.jsx("div",{className:"pc-stat-detail-heading",children:r.heading}),(l=r.rows)!=null&&l.length?e.jsx("dl",{className:"pc-stat-detail-rows",children:r.rows.map(c=>e.jsxs(Kt.Fragment,{children:[e.jsx("dt",{children:c.label}),e.jsxs("dd",{children:[e.jsx("span",{className:c.value===xn?"pc-stat-detail-value pc-stat-detail-value--absent":"pc-stat-detail-value",children:c.value}),c.hint?e.jsx("span",{className:"pc-stat-detail-hint",children:c.hint}):null]})]},c.label))}):null,r.table?e.jsxs("table",{className:"pc-stat-detail-table",children:[e.jsx("thead",{children:e.jsx("tr",{children:r.table.columns.map(c=>e.jsx("th",{scope:"col",children:c},c))})}),e.jsx("tbody",{children:r.table.rows.map((c,d)=>e.jsx("tr",{children:c.map((m,p)=>e.jsx("td",{children:m},p))},d))})]}):null,r.note?e.jsx("p",{className:"pc-stat-detail-note",children:r.note}):null]},r.heading)}),e.jsx("div",{className:"pc-stat-detail-foot",children:s.footer.map(r=>e.jsx("div",{children:r},r))})]})}const ca=8;function pg(a){const[s,r]=h.useState(!!a.defaultOpen),[l,c]=h.useState(null),d=h.useRef(null),m=h.useRef(null),p=h.useRef(null),_=`pc-stat-${h.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,y=h.useCallback(()=>{p.current!==null&&window.clearTimeout(p.current),p.current=null},[]),b=h.useCallback(()=>{y(),r(!0)},[y]),x=h.useCallback(()=>{y(),p.current=window.setTimeout(()=>r(!1),120)},[y]);h.useEffect(()=>y,[y]),h.useLayoutEffect(()=>{if(!s){c(null);return}const C=()=>{const z=d.current,B=m.current;if(!z||!B)return;const F=z.getBoundingClientRect(),q=B.offsetWidth,Q=B.offsetHeight,E=window.innerWidth,Z=window.innerHeight,oe=F.top-ca-Q,le=F.bottom+ca,pe=oe>=ca?oe:le+Q<=Z-ca?le:Math.max(ca,Z-ca-Q),Te=Math.min(Math.max(ca,F.left),Math.max(ca,E-ca-q));c({top:pe,left:Te})};return C(),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[s]),h.useEffect(()=>{if(!s)return;const C=z=>{z.key==="Escape"&&r(!1)};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[s]);const N=typeof a.onClick=="function",L=N?"button":"span",I=s?e.jsx(hg,{detail:a.detail,id:_,panelRef:m,onMouseEnter:y,onMouseLeave:x,style:{position:"fixed",top:(l==null?void 0:l.top)??0,left:(l==null?void 0:l.left)??0,visibility:l?"visible":"hidden"}}):null;return e.jsxs(e.Fragment,{children:[e.jsxs(L,{ref:d,...N?{type:"button"}:{tabIndex:0},className:["pc-chat-stat","pc-chat-stat--detail",N?"pc-chat-stat--clickable":"",a.className].filter(Boolean).join(" "),"aria-label":`${a.label} — ${a.detail.title.toLowerCase()} details`,"aria-describedby":s?_:void 0,"data-stat-kind":a.detail.kind,onMouseEnter:b,onMouseLeave:x,onFocus:b,onBlur:()=>r(!1),onKeyDown:C=>{C.key==="Escape"&&r(!1)},onClick:N?()=>{var C;return(C=a.onClick)==null?void 0:C.call(a)}:void 0,children:[a.icon?e.jsx("span",{className:"pc-chat-stat-icon","aria-hidden":"true",children:a.icon}):null,e.jsx("span",{className:"pc-chat-stat-label",children:a.label})]}),I&&typeof document<"u"?eh.createPortal(I,document.body):I]})}function _g(a){const s=a.totalTokens!==void 0?Nu("tokens",a):null,r=Nu("tools",a),l=a.durationMs!==void 0?Nu("time",a):null;return[...s?[{label:`${a.totalTokens.toLocaleString()} tokens`,detail:s}]:[],{label:`${a.toolCalls} ${a.toolCalls===1?"tool":"tools"}`,detail:r},...a.changedFiles.length?[{label:`${a.changedFiles.length} ${a.changedFiles.length===1?"file":"files"} changed`,title:a.changedFiles.join(`
|
|
46
|
-
`)}]:[],...l?[{label:`${(a.durationMs/1e3).toFixed(a.durationMs<1e4?1:0)}s`,detail:l}]:[]]}function gg(a){const s=String(a.role||"").trim().toLowerCase()||"system",r=String(a.kind||"").trim().toLowerCase(),l=String(a.level||"").trim().toLowerCase();return s==="system"&&r==="report_bug"?{label:String(a.title||"").trim()||"Bug report",icon:"warning",variant:"report_bug"}:s==="system"&&r==="report_feature"?{label:String(a.title||"").trim()||"Feature request",icon:"check",variant:"report_feature"}:s==="user"?{label:String(a.title||"").trim()||"You",icon:"user",variant:"user"}:s==="assistant"?{label:String(a.title||"").trim()||"Agent",icon:"bot",variant:"assistant"}:{label:String(a.title||"").trim()||(l==="error"?"Error":l==="warn"?"Warning":"System"),icon:l==="error"?"error":l==="warn"?"warning":"info",variant:l==="error"?"error":l==="warn"?"warn":"status"}}function vg(a){var B;const s=a.message,r=h.useMemo(()=>gg(s),[s.kind,s.level,s.role,s.title]),l=String(s.ts||"").trim(),c=h.useMemo(()=>{if(!l)return"";const F=new Date(l);return Number.isFinite(F.getTime())?F.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):""},[l]),[d,m]=h.useState("idle"),p=h.useRef(null);h.useEffect(()=>()=>{p.current!==null&&window.clearTimeout(p.current)},[]);const _=s.live,y=!_&&typeof a.onSpeakToggle=="function"&&r.variant==="assistant"&&!!String(s.content||"").trim(),b=y&&((B=a.getSpeakState)==null?void 0:B.call(a,s))||"idle",x=b==="loading"?"loader":b==="playing"?"pause":"speaker",N=b==="loading"?"Generating audio…":b==="playing"?"Pause":b==="paused"?"Resume":"Speak (TTS)",L=a.showCopy!==!1,I=Array.isArray(a.attachments)?a.attachments:[],C=s.statistics,z=h.useMemo(()=>Array.isArray(a.stats)?a.stats:C?_g(C):[],[a.stats,C]);return s.toolActivity?e.jsx(mh,{tool:s.toolActivity,showCopy:a.showCopy}):e.jsxs("div",{className:["pc-chat-item",`pc-chat-item--${r.variant}`,_?"pc-chat-item--live":"",a.className].filter(Boolean).join(" "),..._?{"aria-busy":!0}:{},children:[e.jsxs("div",{className:"pc-chat-header",children:[e.jsx("div",{className:"pc-chat-avatar","aria-hidden":"true",children:e.jsx(rt,{name:r.icon,size:14})}),e.jsx("span",{className:"pc-chat-role",children:r.label}),_?e.jsxs("span",{className:"pc-chat-live-indicator",title:"The reply is still being written",children:[e.jsx("span",{className:"pc-chat-live-dot","aria-hidden":"true"}),"streaming"]}):null,_!=null&&_.caption?e.jsx("span",{className:"pc-chat-live-caption",children:_.caption}):null,e.jsx("span",{className:"pc-chat-header-spacer"}),c?e.jsx("span",{className:"pc-chat-time",children:c}):null,e.jsxs("div",{className:"pc-chat-header-actions",children:[y?e.jsx("button",{className:"pc-chat-icon-btn",type:"button","aria-label":N,title:N,onClick:()=>{var F;return(F=a.onSpeakToggle)==null?void 0:F.call(a,s)},children:e.jsx(rt,{name:x,size:22})}):null,L?e.jsx("button",{className:`pc-chat-icon-btn ${d!=="idle"?`pc-chat-icon-btn--${d}`:""}`.trim(),type:"button","aria-label":"Copy message",title:d==="idle"?"Copy":d==="copied"?"Copied":"Copy failed",onClick:async()=>{const F=await mn(String(s.content||""));m(F?"copied":"failed"),p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>m("idle"),900)},children:e.jsx(rt,{name:"copy",size:22})}):null]})]}),_!=null&&_.reasoning?e.jsxs("details",{className:"pc-chat-thinking",children:[e.jsx("summary",{children:"Thinking"}),e.jsx("div",{className:"pc-chat-thinking-body",children:_.reasoning})]}):null,!_||String(s.content||"").trim()?e.jsx("div",{className:"pc-chat-body",children:e.jsx(rg,{text:String(s.content||""),renderMarkdown:a.renderMarkdown,jsonCollapseAfterDepth:a.jsonCollapseAfterDepth,images:a.images||(r.variant==="user"?"inline":"link"),inlineImage:a.inlineImage})}):null,I.length?e.jsx("div",{className:"pc-chat-attachments","aria-label":"Attachments",children:I.slice(0,24).map((F,q)=>{const Q=String(F.label||"").trim()||"attachment",E=String(F.target||"").trim(),Z=String(F.title||"").trim(),oe=!!F.disabled||typeof F.onClick!="function";return e.jsxs("button",{type:"button",className:"pc-chat-attachment-chip",title:Z||Q,onClick:oe?void 0:F.onClick,disabled:oe,children:[e.jsx(rt,{name:"paperclip",size:14}),E?e.jsx("span",{className:`pc-chat-attachment-target pc-chat-attachment-target--${E}`,children:E}):null,e.jsx("span",{className:"pc-chat-attachment-name",children:Q})]},F.id||`${Q}:${q}`)})}):null,z.length?e.jsx("div",{className:"pc-chat-stats","aria-label":"Stats",children:z.slice(0,12).map((F,q)=>{const Q=String(F.label||"").trim();if(!Q)return null;if(F.detail)return e.jsx(pg,{label:Q,detail:F.detail,icon:F.icon,onClick:F.onClick},F.id||`${Q}:${q}`);const E=String(F.title||"").trim(),Z=typeof F.onClick=="function",oe=Z?"button":"span";return e.jsxs(oe,{...Z?{type:"button"}:{},className:["pc-chat-stat",Z?"pc-chat-stat--clickable":""].filter(Boolean).join(" "),title:E||void 0,onClick:Z?()=>{var le;return(le=F.onClick)==null?void 0:le.call(F)}:void 0,children:[F.icon?e.jsx("span",{className:"pc-chat-stat-icon","aria-hidden":"true",children:F.icon}):null,e.jsx("span",{className:"pc-chat-stat-label",children:Q})]},F.id||`${Q}:${q}`)})}):null]})}function yg(a,s){const r=Math.max(0,Math.trunc(s));return a.scrollHeight-a.scrollTop-a.clientHeight<=r}function ld(a){const s=typeof a.autoScrollThresholdPx=="number"&&Number.isFinite(a.autoScrollThresholdPx)?a.autoScrollThresholdPx:120,r=a.autoScroll!==!1,l=h.useRef(null),c=h.useRef(null),[d,m]=h.useState(!0),p=h.useMemo(()=>Array.isArray(a.messages)?a.messages:[],[a.messages]),_=h.useMemo(()=>{var x;const b=[];for(const N of p){const L=b[b.length-1];N.toolActivity&&((x=L==null?void 0:L[0])!=null&&x.toolActivity)&&L[0].runId===N.runId?L.push(N):b.push([N])}return b},[p]);h.useEffect(()=>{if(!r)return;const b=l.current;if(!b)return;const x=()=>{m(yg(b,s))};return b.addEventListener("scroll",x,{passive:!0}),x(),()=>b.removeEventListener("scroll",x)},[r,s]);const y=h.useMemo(()=>{let b=0;for(const x of p)b+=String(x.content??"").length;return`${p.length}:${b}:${String(a.afterKey??"")}`},[p,a.afterKey]);return h.useEffect(()=>{if(!r||!d)return;const b=l.current;b&&(b.scrollTop=b.scrollHeight)},[r,d,y]),e.jsxs("div",{ref:l,className:["pc-chat-thread",a.className].filter(Boolean).join(" "),children:[p.length?null:a.empty||null,_.map((b,x)=>{var I;const N=b[0],L=String(N.id||"")||String(N.ts||"")+":"+String(N.role||"")+":"+x;return N.toolActivity?e.jsx(lg,{tools:b.map(C=>C.toolActivity),showCopy:(I=a.messageProps)==null?void 0:I.showCopy},L):e.jsx(vg,{message:N,...a.messageProps||{}},L)}),a.after,e.jsx("div",{ref:c})]})}const Yo=Kt.forwardRef(function(s,r){const l=typeof s.rows=="number"&&Number.isFinite(s.rows)?Math.max(1,Math.trunc(s.rows)):3,c=!!s.disabled,d=!!s.busy,m=!c&&!d&&!!String(s.value||"").trim();return e.jsxs("div",{className:["pc-composer",s.className].filter(Boolean).join(" "),children:[s.leading,e.jsx("textarea",{ref:r,className:["pc-composer__textarea",s.textareaClassName].filter(Boolean).join(" "),value:s.value,onChange:p=>s.onChange(p.target.value),rows:l,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",autoComplete:"off",placeholder:s.placeholder||"","aria-label":s.ariaLabel||s.placeholder||"Message",disabled:c,autoFocus:!!s.autoFocus,onPaste:s.onPaste,onKeyDown:p=>{p.key!=="Enter"||p.shiftKey||p.nativeEvent.isComposing||p.keyCode===229||(p.preventDefault(),m&&s.onSubmit())}}),e.jsxs("div",{className:"pc-composer__row",children:[e.jsx("div",{className:"pc-composer__actions",children:s.actions}),e.jsx("button",{type:"button",className:s.sendButtonClassName||"pc-btn",disabled:!m,onClick:()=>s.onSubmit(),children:d?s.busyLabel||"Thinking…":s.sendLabel||"Send"})]}),s.overlay]})});function xg(a){return!!(a&&typeof a[Symbol.asyncIterator]=="function")}function bg(a){const[s,r]=h.useState([]),l=a.messages??s,c=C=>{a.onMessagesChange&&a.onMessagesChange(C),a.messages===void 0&&r(C)},d=h.useRef(l);d.current=l;const[m,p]=h.useState(""),[_,y]=h.useState(!1),b=h.useRef(null),x=a.assistantName||"Assistant",N=!!a.blockedNotice,L=async C=>{const z=String(C||"").trim();if(!z||_||N)return;p("");const B=d.current,F=[...B,{role:"user",content:z,ts:new Date().toISOString()}];c(F),y(!0);const q=new AbortController;b.current=q;try{const Q=a.ask(z,{signal:q.signal,history:B});if(xg(Q)){let E="";const Z=[...F,{role:"assistant",title:x,content:"",ts:new Date().toISOString()}];c(Z);for await(const oe of Q){if(q.signal.aborted)break;E+=String(oe??""),c([...F,{role:"assistant",title:x,content:E,ts:new Date().toISOString()}])}!E.trim()&&!q.signal.aborted&&c([...F,{role:"assistant",title:x,content:"#FALLBACK the assistant returned no answer.",level:"warn",ts:new Date().toISOString()}])}else{const E=String(await Q??"").trim();c([...F,E?{role:"assistant",title:x,content:E,ts:new Date().toISOString()}:{role:"assistant",title:x,content:"#FALLBACK the assistant returned no answer.",level:"warn",ts:new Date().toISOString()}])}}catch(Q){q.signal.aborted||c([...d.current,{role:"assistant",title:x,content:`#FALLBACK assistant request failed: ${String((Q==null?void 0:Q.message)||Q||"unknown error")}`,level:"error",ts:new Date().toISOString()}])}finally{b.current===q&&(b.current=null),y(!1)}},I=h.useMemo(()=>l.length>0?null:e.jsxs("div",{className:"pc-assistant__empty",children:[e.jsx("div",{className:"pc-assistant__empty-text",children:a.emptyState||"Ask about this app — answers are grounded in its documentation."}),a.suggestions&&a.suggestions.length>0?e.jsx("div",{className:"pc-assistant__suggestions",children:a.suggestions.map(C=>e.jsx("button",{type:"button",className:"pc-assistant__suggestion",onClick:()=>void L(C),disabled:_||N,children:C},C))}):null]}),[l.length,a.emptyState,a.suggestions,_,N]);return e.jsxs("div",{className:`pc-assistant${a.className?` ${a.className}`:""}`,children:[e.jsxs("div",{className:"pc-assistant__thread",children:[I,e.jsx(ld,{messages:l,autoScroll:!0}),N?e.jsx("div",{className:"pc-assistant__blocked",children:a.blockedNotice}):null]}),e.jsx("div",{className:"pc-assistant__composer",children:e.jsx(Yo,{value:m,onChange:p,onSubmit:()=>void L(m),placeholder:a.placeholder||"Ask about this app…",disabled:N,busy:_,rows:2,actions:_?e.jsx("button",{type:"button",className:"pc-btn",onClick:()=>{var C;(C=b.current)==null||C.abort()},children:"Stop"}):null})})]})}function wg(a){const s=a.trim();if(!s)throw new Error("AbstractContinuum was built without __APP_VERSION__ (see vite.config.ts define)");return s}const jg=wg("0.4.0");function gi(a){return a?a.value!==void 0&&a.value!==null?!!a.value:a.enabled!==void 0?!!a.enabled:a.configured!==void 0?!!a.configured:a.path!==void 0?!!a.path:null:null}function bl(a){if(!a)return"";const s=a.value!==void 0&&a.value!==null?a.value:a.id??a.path??"";return typeof s=="string"?s.trim():""}const mf="abstractcontinuum_gateway_csrf",kg="x-abstractcontinuum-csrf",Sg="x-abstract-csrf";function ff(a){var l;const s=(a||"").trim(),r={};s&&(r.Authorization=`Bearer ${s}`);try{const c=(l=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(`${mf}=`)))==null?void 0:l.slice(`${mf}=`.length);if(c){const d=decodeURIComponent(c);r[kg]=d,r[Sg]=d}}catch{}return r}function hf(a){const s={},r=(l,c)=>{const d=String(c||"").trim();d&&(s[l]=d)};return r("provider",a==null?void 0:a.provider),r("model",a==null?void 0:a.model),r("profile",a==null?void 0:a.profile),r("voice",a==null?void 0:a.voice),r("quality_preset",a==null?void 0:a.quality_preset),s}async function Ng(a){try{const s=await a.text();return s!=null&&s.trim()?s.trim():`${a.status}`}catch{return`${a.status}`}}class ph extends Error{constructor(r,l,c){super(r);Nr(this,"status");Nr(this,"body");this.name="GatewayRequestError",this.status=l,this.body=c}}const Cu=[15,30,60,120];class Cg{constructor(s){Nr(this,"_cfg");Nr(this,"_backoff_until",0);Nr(this,"_backoff_step",0);this._cfg={...s,base_url:(s.base_url||"").trim()}}is_backing_off(){return Date.now()<this._backoff_until}backoff_until(){return this.is_backing_off()?this._backoff_until:0}async _fetch(s,r,l){const c=await fetch(af(this._cfg.base_url,r),{...l,headers:{...l==null?void 0:l.headers,...ff(this._cfg.auth_token)}});if(c.ok)return this._backoff_step=0,this._backoff_until=0,c;const d=await Ng(c);let m=null;try{m=JSON.parse(d)}catch{}let p=d;if(m&&typeof m=="object"&&m.detail!==void 0&&(p=typeof m.detail=="string"?m.detail:JSON.stringify(m.detail)),c.status===429||/too many requests|auth lockout|locked/i.test(p)){const y=Cu[Math.min(this._backoff_step,Cu.length-1)];this._backoff_until=Date.now()+y*1e3,this._backoff_step<Cu.length-1&&(this._backoff_step+=1)}throw new ph(`${s} failed: ${p}`,c.status,m)}async _get_json(s,r){return await(await this._fetch(s,r)).json()}async _post_json(s,r,l){return await(await this._fetch(s,r,{method:"POST",headers:l===void 0?void 0:{"Content-Type":"application/json"},body:l===void 0?void 0:JSON.stringify(l)})).json()}async _post_form(s,r,l){return await(await this._fetch(s,r,{method:"POST",body:l})).json()}async list_runs(s){const r=new URLSearchParams;r.set("limit",String(typeof(s==null?void 0:s.limit)=="number"?s.limit:50));const l=String((s==null?void 0:s.status)||"").trim();l&&r.set("status",l);const c=String((s==null?void 0:s.session_id)||"").trim();return c&&r.set("session_id",c),(s==null?void 0:s.root_only)===!0&&r.set("root_only","true"),await this._get_json("list_runs",`api/gateway/runs?${r.toString()}`)}async download_run_artifact_content(s,r,l){const c=String(s||"").trim(),d=String(r||"").trim();if(!c)throw new Error("download_run_artifact_content: run_id is required");if(!d)throw new Error("download_run_artifact_content: artifact_id is required");const m=String((l==null?void 0:l.access)||"").trim(),p=m?`?access=${encodeURIComponent(m)}`:"";return await(await this._fetch("download_run_artifact_content",`api/gateway/runs/${encodeURIComponent(c)}/artifacts/${encodeURIComponent(d)}/content${p}`)).blob()}async attachments_upload(s,r,l){const c=String(s||"").trim();if(!c)throw new Error("attachments_upload: session_id is required");if(!r)throw new Error("attachments_upload: file is required");const d=String((l==null?void 0:l.filename)||"").trim()||String((r==null?void 0:r.name)||"").trim()||"upload.bin",m=String((l==null?void 0:l.content_type)||"").trim()||String((r==null?void 0:r.type)||"").trim(),p=new FormData;p.append("session_id",c),p.append("file",r,d),p.append("filename",d),m&&p.append("content_type",m);const _=await this._post_form("attachments_upload","api/gateway/attachments/upload",p),y=_==null?void 0:_.attachment;if(!y||typeof y!="object")throw new Error("attachments_upload: missing attachment");if(!String(y.$artifact||"").trim())throw new Error("attachments_upload: missing attachment.$artifact");return y}async audio_transcribe(s,r){const l=String(s||"").trim();if(!l)throw new Error("audio_transcribe: run_id is required");const c=r==null?void 0:r.audio_artifact;if(!c||typeof c!="object")throw new Error("audio_transcribe: audio_artifact is required");if(!String(c.$artifact||"").trim())throw new Error("audio_transcribe: audio_artifact.$artifact is required");const m={audio_artifact:c},p=String((r==null?void 0:r.language)||"").trim();p&&(m.language=p);const _=String((r==null?void 0:r.request_id)||"").trim();_&&(m.request_id=_);const y=await this._post_json("audio_transcribe",`api/gateway/runs/${encodeURIComponent(l)}/audio/transcribe`,m);return{ok:!!(y!=null&&y.ok),run_id:String((y==null?void 0:y.run_id)||""),request_id:String((y==null?void 0:y.request_id)||""),text:String((y==null?void 0:y.text)||""),transcript_artifact:y==null?void 0:y.transcript_artifact}}async voice_tts(s,r){const l=String(s||"").trim();if(!l)throw new Error("voice_tts: run_id is required");const c=String((r==null?void 0:r.text)||"").trim();if(!c)throw new Error("voice_tts: text is required");const d={text:c,...hf(r)},m=String((r==null?void 0:r.format)||"").trim();m&&(d.format=m),typeof(r==null?void 0:r.timeout_s)=="number"&&r.timeout_s>0&&(d.timeout_s=r.timeout_s);const p=String((r==null?void 0:r.request_id)||"").trim();p&&(d.request_id=p);const _=await this._post_json("voice_tts",`api/gateway/runs/${encodeURIComponent(l)}/voice/tts`,d);return{ok:!!(_!=null&&_.ok),run_id:String((_==null?void 0:_.run_id)||""),request_id:String((_==null?void 0:_.request_id)||""),audio_artifact:_==null?void 0:_.audio_artifact}}async capability_defaults(){return await this._get_json("capability_defaults","api/gateway/config/capability-defaults")}async voice_voices(s){const r=new URLSearchParams({compact:"true"}),l=String((s==null?void 0:s.provider)||"").trim(),c=String((s==null?void 0:s.model)||"").trim();return l&&r.set("provider",l),c&&r.set("model",c),s!=null&&s.providers_only&&r.set("providers_only","true"),await this._get_json("voice_voices",`api/gateway/voice/voices?${r.toString()}`)}voice_stream_transport(s,r){const l=String(s||"").trim();if(!l)throw new Error("voice_stream_transport: run_id is required");return{path:af(this._cfg.base_url,`api/gateway/runs/${encodeURIComponent(l)}/voice/tts/stream`),body:{text:String((r==null?void 0:r.text)||""),format:"wav",...hf(r)},headers:ff(this._cfg.auth_token)}}async list_bug_reports(){return await this._get_json("list_bug_reports","api/gateway/reports/bugs")}async list_feature_requests(){return await this._get_json("list_feature_requests","api/gateway/reports/features")}async get_bug_report_content(s){const r=String(s||"").trim();if(!r)throw new Error("get_bug_report_content: filename is required");return await this._get_json("get_bug_report_content",`api/gateway/reports/bugs/${encodeURIComponent(r)}/content`)}async get_feature_request_content(s){const r=String(s||"").trim();if(!r)throw new Error("get_feature_request_content: filename is required");return await this._get_json("get_feature_request_content",`api/gateway/reports/features/${encodeURIComponent(r)}/content`)}async bug_report_create(s){return await this._post_json("bug_report_create","api/gateway/bugs/report",pf(s,"bug_report_create"))}async feature_report_create(s){return await this._post_json("feature_report_create","api/gateway/features/report",pf(s,"feature_report_create"))}async email_list_accounts(){return await this._get_json("email_list_accounts","api/gateway/email/accounts")}async email_list_messages(s){const r=new URLSearchParams,l=String((s==null?void 0:s.account)||"").trim();l&&r.set("account",l);const c=String((s==null?void 0:s.mailbox)||"").trim();c&&r.set("mailbox",c);const d=String((s==null?void 0:s.since)||"").trim();d&&r.set("since",d);const m=String((s==null?void 0:s.status)||"").trim();return m&&r.set("status",m),r.set("limit",String(typeof(s==null?void 0:s.limit)=="number"&&Number.isFinite(s.limit)?Number(s.limit):20)),await this._get_json("email_list_messages",`api/gateway/email/messages?${r.toString()}`)}async email_read_message(s,r){const l=String(s||"").trim();if(!l)throw new Error("email_read_message: uid is required");const c=new URLSearchParams,d=String((r==null?void 0:r.account)||"").trim();d&&c.set("account",d);const m=String((r==null?void 0:r.mailbox)||"").trim();m&&c.set("mailbox",m);const p=typeof(r==null?void 0:r.max_body_chars)=="number"&&Number.isFinite(r.max_body_chars)?Number(r.max_body_chars):2e4;return c.set("max_body_chars",String(p)),await this._get_json("email_read_message",`api/gateway/email/messages/${encodeURIComponent(l)}?${c.toString()}`)}async email_send(s){if(!String((s==null?void 0:s.subject)||"").trim())throw new Error("email_send: subject is required");return await this._post_json("email_send","api/gateway/email/send",s||{})}async triage_run(s){const r={};return typeof(s==null?void 0:s.write_drafts)=="boolean"&&(r.write_drafts=!!s.write_drafts),typeof(s==null?void 0:s.enable_llm)=="boolean"&&(r.enable_llm=!!s.enable_llm),await this._post_json("triage_run","api/gateway/triage/run",r)}async list_triage_decisions(s){const r=new URLSearchParams,l=String((s==null?void 0:s.status)||"").trim();return l&&r.set("status",l),r.set("limit",String(typeof(s==null?void 0:s.limit)=="number"&&Number.isFinite(s.limit)?Number(s.limit):200)),await this._get_json("list_triage_decisions",`api/gateway/triage/decisions?${r.toString()}`)}async apply_triage_decision(s,r){const l=String(s||"").trim();if(!l)throw new Error("apply_triage_decision: decision_id is required");const c=String((r==null?void 0:r.action)||"").trim();if(!c)throw new Error("apply_triage_decision: action is required");const d={action:c};if(c==="defer"){const m=r==null?void 0:r.defer_days;typeof m=="number"&&Number.isFinite(m)&&m>0&&(d.defer_days=Number(m))}return await this._post_json("apply_triage_decision",`api/gateway/triage/decisions/${encodeURIComponent(l)}/apply`,d)}async backlog_list(s){const r=String(s||"").trim();if(!r)throw new Error("backlog_list: kind is required");return await this._get_json("backlog_list",`api/gateway/backlog/${encodeURIComponent(r)}`)}async backlog_content(s,r){const l=String(s||"").trim(),c=String(r||"").trim();if(!l)throw new Error("backlog_content: kind is required");if(!c)throw new Error("backlog_content: filename is required");return await this._get_json("backlog_content",`api/gateway/backlog/${encodeURIComponent(l)}/${encodeURIComponent(c)}/content`)}async backlog_template(){return await this._get_json("backlog_template","api/gateway/backlog/template")}async backlog_status(){return await this._get_json("backlog_status","api/gateway/backlog/status")}async backlog_move(s){const r=String((s==null?void 0:s.from_kind)||"").trim(),l=String((s==null?void 0:s.to_kind)||"").trim(),c=String((s==null?void 0:s.filename)||"").trim();if(!r)throw new Error("backlog_move: from_kind is required");if(!l)throw new Error("backlog_move: to_kind is required");if(!c)throw new Error("backlog_move: filename is required");return await this._post_json("backlog_move","api/gateway/backlog/move",{from_kind:r,to_kind:l,filename:c})}async backlog_update(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.filename)||"").trim();if(!r)throw new Error("backlog_update: kind is required");if(!l)throw new Error("backlog_update: filename is required");const c={content:String((s==null?void 0:s.content)??"")},d=String((s==null?void 0:s.expected_sha256)||"").trim();return d&&(c.expected_sha256=d),await this._post_json("backlog_update",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(l)}/update`,c)}async backlog_create(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.package)||"").trim(),c=String((s==null?void 0:s.title)||"").trim();if(!r)throw new Error("backlog_create: kind is required");if(!l)throw new Error("backlog_create: package is required");if(!c)throw new Error("backlog_create: title is required");const d={kind:r,package:l,title:c},m=String((s==null?void 0:s.task_type)||"").trim();m&&(d.task_type=m);const p=String((s==null?void 0:s.summary)||"").trim();p&&(d.summary=p);const _=(s==null?void 0:s.content)==null?"":String((s==null?void 0:s.content)??"");return _.trim()&&(d.content=_),await this._post_json("backlog_create","api/gateway/backlog/create",d)}async backlog_merge(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.package)||"").trim(),c=String((s==null?void 0:s.title)||"").trim(),d=Array.isArray(s==null?void 0:s.items)?s.items:[];if(!r)throw new Error("backlog_merge: kind is required");if(!l)throw new Error("backlog_merge: package is required");if(!c)throw new Error("backlog_merge: title is required");if(d.length<2)throw new Error("backlog_merge: at least 2 items are required");const m={kind:r,package:l,title:c,items:d.map(y=>({kind:String((y==null?void 0:y.kind)||"").trim(),filename:String((y==null?void 0:y.filename)||"").trim()}))},p=String((s==null?void 0:s.task_type)||"").trim();p&&(m.task_type=p);const _=String((s==null?void 0:s.summary)||"").trim();return _&&(m.summary=_),await this._post_json("backlog_merge","api/gateway/backlog/merge",m)}async backlog_upload_attachment(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.filename)||"").trim(),c=s==null?void 0:s.file;if(!r)throw new Error("backlog_upload_attachment: kind is required");if(!l)throw new Error("backlog_upload_attachment: filename is required");if(!c)throw new Error("backlog_upload_attachment: file is required");const d=new FormData;return d.set("overwrite",(s==null?void 0:s.overwrite)===!0?"true":"false"),d.set("file",c,c.name||"attachment"),await this._post_form("backlog_upload_attachment",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(l)}/attachments/upload`,d)}async backlog_assist(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.package)||"").trim(),c=String((s==null?void 0:s.title)||"").trim();if(!r)throw new Error("backlog_assist: kind is required");if(!l)throw new Error("backlog_assist: package is required");if(!c)throw new Error("backlog_assist: title is required");const d={kind:r,package:l,title:c,messages:Array.isArray(s==null?void 0:s.messages)?s.messages:[]},m=String((s==null?void 0:s.summary)||"").trim();m&&(d.summary=m);const p=(s==null?void 0:s.draft_markdown)==null?"":String(s.draft_markdown??"");p.trim()&&(d.draft_markdown=p);const _=String((s==null?void 0:s.provider)||"").trim();_&&(d.provider=_);const y=String((s==null?void 0:s.model)||"").trim();y&&(d.model=y);const b=String((s==null?void 0:s.thinking)||"").trim();return b&&(d.thinking=b),await this._post_json("backlog_assist","api/gateway/backlog/assist",d)}async backlog_maintain(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.filename)||"").trim(),c=String((s==null?void 0:s.package)||"").trim(),d=String((s==null?void 0:s.title)||"").trim();if(!r)throw new Error("backlog_maintain: kind is required");if(!l)throw new Error("backlog_maintain: filename is required");if(!c)throw new Error("backlog_maintain: package is required");if(!d)throw new Error("backlog_maintain: title is required");const m={kind:r,filename:l,package:c,title:d,messages:Array.isArray(s==null?void 0:s.messages)?s.messages:[]},p=String((s==null?void 0:s.summary)||"").trim();p&&(m.summary=p);const _=(s==null?void 0:s.draft_markdown)==null?"":String(s.draft_markdown??"");_.trim()&&(m.draft_markdown=_);const y=String((s==null?void 0:s.provider)||"").trim();y&&(m.provider=y);const b=String((s==null?void 0:s.model)||"").trim();return b&&(m.model=b),await this._post_json("backlog_maintain","api/gateway/backlog/maintain",m)}async backlog_advisor(s){const r={messages:Array.isArray(s==null?void 0:s.messages)?s.messages:[]},l=String((s==null?void 0:s.provider)||"").trim();l&&(r.provider=l);const c=String((s==null?void 0:s.model)||"").trim();c&&(r.model=c);const d=String((s==null?void 0:s.thinking)||"").trim();d&&(r.thinking=d);const m=String((s==null?void 0:s.agent)||"").trim();m&&(r.agent=m),(s==null?void 0:s.include_trace)===!0&&(r.include_trace=!0);const p=String((s==null?void 0:s.focus_kind)||"").trim();p&&(r.focus_kind=p);const _=String((s==null?void 0:s.focus_type)||"").trim();return _&&(r.focus_type=_),await this._post_json("backlog_advisor","api/gateway/backlog/advisor",r)}async backlog_execute(s){const r=String((s==null?void 0:s.kind)||"").trim(),l=String((s==null?void 0:s.filename)||"").trim();if(!r)throw new Error("backlog_execute: kind is required");if(!l)throw new Error("backlog_execute: filename is required");const c=new URLSearchParams,d=String((s==null?void 0:s.execution_mode)||"").trim();d&&c.set("execution_mode",d);const m=String((s==null?void 0:s.executor)||"").trim();m&&c.set("executor",m);const p=String((s==null?void 0:s.target_model)||"").trim();p&&c.set("target_model",p);const _=String((s==null?void 0:s.target_reasoning_effort)||"").trim();return _&&c.set("target_reasoning_effort",_),(s==null?void 0:s.dor)==="check"&&c.set("dor","check"),(s==null?void 0:s.override)===!0&&c.set("override","true"),await(await this._fetch("backlog_execute",`api/gateway/backlog/${encodeURIComponent(r)}/${encodeURIComponent(l)}/execute${c.toString()?`?${c.toString()}`:""}`,{method:"POST"})).json()}async backlog_execute_batch(s){const r=Array.isArray(s==null?void 0:s.items)?s.items:[];if(!r.length)throw new Error("backlog_execute_batch: items are required");const l={items:r.map(_=>({kind:String((_==null?void 0:_.kind)||"").trim(),filename:String((_==null?void 0:_.filename)||"").trim()}))},c=String((s==null?void 0:s.execution_mode)||"").trim();c&&(l.execution_mode=c);const d=String((s==null?void 0:s.executor)||"").trim();d&&(l.executor=d);const m=String((s==null?void 0:s.target_model)||"").trim();m&&(l.target_model=m);const p=String((s==null?void 0:s.target_reasoning_effort)||"").trim();return p&&(l.target_reasoning_effort=p),(s==null?void 0:s.dor)==="check"&&(l.dor="check"),(s==null?void 0:s.override)===!0&&(l.override=!0),await this._post_json("backlog_execute_batch","api/gateway/backlog/execute_batch",l)}async backlog_exec_config(){return await this._get_json("backlog_exec_config","api/gateway/backlog/exec/config")}async backlog_exec_requests(s){const r=new URLSearchParams,l=String((s==null?void 0:s.status)||"").trim();return l&&r.set("status",l),r.set("limit",String(typeof(s==null?void 0:s.limit)=="number"&&Number.isFinite(s.limit)?Number(s.limit):200)),await this._get_json("backlog_exec_requests",`api/gateway/backlog/exec/requests?${r.toString()}`)}async backlog_exec_request(s,r){const l=String(s||"").trim();if(!l)throw new Error("backlog_exec_request: request_id is required");const c=new URLSearchParams;return(r==null?void 0:r.include_prompt)===!0&&c.set("include_prompt","true"),await this._get_json("backlog_exec_request",`api/gateway/backlog/exec/requests/${encodeURIComponent(l)}?${c.toString()}`)}async backlog_exec_feedback(s){const r=String((s==null?void 0:s.request_id)||"").trim();if(!r)throw new Error("backlog_exec_feedback: request_id is required");const l=String((s==null?void 0:s.feedback)??"");if(!l.trim())throw new Error("backlog_exec_feedback: feedback is required");return await this._post_json("backlog_exec_feedback",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/feedback`,{feedback:l})}async backlog_exec_promote(s){const r=String((s==null?void 0:s.request_id)||"").trim();if(!r)throw new Error("backlog_exec_promote: request_id is required");const l={};return(s==null?void 0:s.redeploy)===!0&&(l.redeploy=!0),await this._post_json("backlog_exec_promote",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/promote`,l)}async backlog_exec_deploy_uat(s){const r=String((s==null?void 0:s.request_id)||"").trim();if(!r)throw new Error("backlog_exec_deploy_uat: request_id is required");return await this._post_json("backlog_exec_deploy_uat",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/uat/deploy`,{})}async backlog_exec_log_tail(s){const r=String((s==null?void 0:s.request_id)||"").trim();if(!r)throw new Error("backlog_exec_log_tail: request_id is required");const l=new URLSearchParams,c=String((s==null?void 0:s.name)||"").trim();c&&l.set("name",c);const d=typeof(s==null?void 0:s.max_bytes)=="number"&&Number.isFinite(s.max_bytes)?Number(s.max_bytes):0;d>0&&l.set("max_bytes",String(Math.floor(d)));const m=typeof(s==null?void 0:s.after_bytes)=="number"&&Number.isFinite(s.after_bytes)?Math.max(0,Math.floor(s.after_bytes)):null;return m!==null&&l.set("after_bytes",String(m)),await this._get_json("backlog_exec_log_tail",`api/gateway/backlog/exec/requests/${encodeURIComponent(r)}/logs/tail?${l.toString()}`)}async backlog_exec_active_items(s){const r=new URLSearchParams,l=String((s==null?void 0:s.status)||"").trim();return l&&r.set("status",l),r.set("limit",String(typeof(s==null?void 0:s.limit)=="number"&&Number.isFinite(s.limit)?Number(s.limit):600)),await this._get_json("backlog_exec_active_items",`api/gateway/backlog/exec/active_items?${r.toString()}`)}async discovery_providers(){return await(await this._fetch("discovery_providers","api/gateway/discovery/providers")).json()}async discovery_model_capabilities(s){const r=String(s||"").trim();if(!r)throw new Error("discovery_model_capabilities: model_name is required");return await(await this._fetch("discovery_model_capabilities",`api/gateway/discovery/models/capabilities?model_name=${encodeURIComponent(r)}`)).json()}async discovery_provider_models(s){const r=String(s||"").trim();if(!r)throw new Error("discovery_provider_models: provider is required");return await(await this._fetch("discovery_provider_models",`api/gateway/discovery/providers/${encodeURIComponent(r)}/models`)).json()}async list_entities(){return await(await this._fetch("list_entities","api/gateway/entities")).json()}async admin_runtime_config(){return await(await this._fetch("admin_runtime_config","api/gateway/admin/runtime-config")).json()}async admin_executors(){return await(await this._fetch("admin_executors","api/gateway/admin/executors")).json()}async admin_runtime_config_update(s){return await(await this._fetch("admin_runtime_config_update","api/gateway/admin/runtime-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s||{})})).json()}async entity_state(s,r){return await(await this._fetch("entity_state",`api/gateway/entities/${encodeURIComponent(s)}/state`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})).json()}async entity_skills(s){return await(await this._fetch("entity_skills",`api/gateway/entities/${encodeURIComponent(s)}/skills`)).json()}async put_entity_skills(s,r){return await(await this._fetch("put_entity_skills",`api/gateway/entities/${encodeURIComponent(s)}/skills`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({skills:r})})).json()}async list_bundles(){return await(await this._fetch("list_bundles","api/gateway/bundles")).json()}async admin_data_homes(){return await(await this._fetch("admin_data_homes","api/gateway/admin/data-homes")).json()}async gateway_about(){return await this._get_json("gateway_about","api/gateway/about")}async list_processes(){return await this._get_json("list_processes","api/gateway/processes")}async list_process_env_vars(){return await this._get_json("list_process_env_vars","api/gateway/processes/env")}async update_process_env_vars(s){const r={},l=s!=null&&s.set&&typeof s.set=="object"?s.set:{},c=Array.isArray(s==null?void 0:s.unset)?s==null?void 0:s.unset:[];return l&&Object.keys(l).length&&(r.set=l),c&&c.length&&(r.unset=c),await this._post_json("update_process_env_vars","api/gateway/processes/env",r)}async start_process(s){const r=String(s||"").trim();return await this._post_json("start_process",`api/gateway/processes/${encodeURIComponent(r)}/start`)}async stop_process(s){const r=String(s||"").trim();return await this._post_json("stop_process",`api/gateway/processes/${encodeURIComponent(r)}/stop`)}async restart_process(s){const r=String(s||"").trim();return await this._post_json("restart_process",`api/gateway/processes/${encodeURIComponent(r)}/restart`)}async redeploy_process(s){const r=String(s||"").trim();return await this._post_json("redeploy_process",`api/gateway/processes/${encodeURIComponent(r)}/redeploy`)}async process_log_tail(s,r){const l=String(s||"").trim(),c=typeof(r==null?void 0:r.max_bytes)=="number"?Math.max(1024,Math.min(4e5,Math.floor(r.max_bytes))):8e4;return await this._get_json("process_log_tail",`api/gateway/processes/${encodeURIComponent(l)}/logs/tail?max_bytes=${encodeURIComponent(String(c))}`)}}function pf(a,s){const r=String((a==null?void 0:a.session_id)||"").trim();if(!r)throw new Error(`${s}: session_id is required`);const l=String((a==null?void 0:a.description)||"").trim();if(!l)throw new Error(`${s}: description is required`);const c={session_id:r,description:l};for(const m of["active_run_id","workflow_id","client","client_version","user_agent","url","provider","model","template"]){const p=String((a==null?void 0:a[m])||"").trim();p&&(c[m]=p)}const d=a==null?void 0:a.context;return d&&typeof d=="object"&&(c.context=d),c}const _f=[["Gateway","checking…"]];function $g(a){if(a instanceof ph){const r=a.message.replace(/^gateway_about failed:\s*/,"").trim();return`HTTP ${a.status}${r&&r!==String(a.status)?`: ${r}`:""}`}return(a instanceof Error?a.message:String(a))||"request failed"}async function Eg(a){let s;try{s=await a.gateway_about()}catch(r){return rf(null,$g(r))}return rf(s)}const Tg=/^[a-zA-Z0-9_-]+$/;function gf(a){return Tg.test(String(a||"").trim())}async function Ag(a){const s=String(a||""),r=new TextEncoder().encode(s),l=globalThis.crypto;if(!l||!l.subtle||typeof l.subtle.digest!="function")return"";const c=await l.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(c)).map(d=>d.toString(16).padStart(2,"0")).join("")}async function od(a){const s=String(a||"").trim();if(!s)throw new Error("session_id is required");if(gf(s)){const l=`session_memory_${s}`;if(gf(l))return l}return`session_memory_sha_${(await Ag(s)).slice(0,32)}`}const Ba=["bug","feature","improvement","task"];function Ll(a){return String(a||"").trim().toLowerCase()}function _h(a){return Ba.includes(Ll(a))}function gh(a){const s=Ll(a);return _h(s)?s:"task"}function vh(a){return a.toUpperCase()}function yh(a){return a==="bug"?"danger":a==="feature"?"ok":a==="improvement"?"info":a==="task"?"task":"muted"}function xh(a){return _h(a)?void 0:`"${a}" is not in the ruled type vocabulary (${Ba.join(" / ")})`}function bh(a){const s=String(a||"").trim();return s.replace(/^\[(bug|feature|improvement|task)\]\s*/i,"").trim()||s}function da(a,s){const r=String(a||"");return r.length<=s?r:`${r.slice(0,Math.max(0,s-1))}…`}function Vu(a=new Date){const s=p=>String(p).padStart(2,"0"),r=-a.getTimezoneOffset(),l=r>=0?"+":"-",c=Math.abs(r),d=s(Math.floor(c/60)),m=s(c%60);return`${a.getFullYear()}-${s(a.getMonth()+1)}-${s(a.getDate())} ${s(a.getHours())}:${s(a.getMinutes())}:${s(a.getSeconds())} ${l}${d}${m}`}function Rg(a){try{return JSON.parse(a)}catch{return null}}function vf(a,s){return a.scrollHeight-a.scrollTop-a.clientHeight<=s}function $u(a){const s=typeof a=="string"?a.trim():"";if(!s)return null;const r=s.replace(/(\.\d{3})\d+/,"$1"),l=Date.parse(r);return Number.isFinite(l)?l:null}function Is(a){if(!Number.isFinite(a))return"";const s=Math.max(0,Math.floor(a/1e3)),r=s%60,l=Math.floor(s/60),c=l%60,d=Math.floor(l/60),m=d%24,p=Math.floor(d/24);return p>0?`${p}d ${m}h`:d>0?`${d}h ${c}m`:l>0?`${l}m ${r}s`:`${s}s`}async function Gu(a){const s=String(a||""),r=new TextEncoder().encode(s),l=globalThis.crypto;if(!l||!l.subtle||typeof l.subtle.digest!="function")return"";const c=await l.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(c)).map(d=>d.toString(16).padStart(2,"0")).join("")}function Al(a){const s=String(a||"").trim().toLowerCase();return s==="completed"||s==="promoted"?"ok":s==="failed"?"danger":s==="running"?"info":s==="queued"||s==="awaiting_qa"?"warn":"muted"}function Lg(a,s){return a==="processing"?"queued,running,awaiting_qa":a==="failed"?"failed":a==="completed"&&s==="runs"?"completed,promoted":""}function wl(a,s){const r=a&&typeof a=="object"?a:{},l=r.backlog&&typeof r.backlog=="object"?r.backlog:{},c=r.result&&typeof r.result=="object"?r.result:{},d=r.executor&&typeof r.executor=="object"?r.executor:{},m=String(c.last_message||"").trim(),p=String(r.target_model||d.model||"").trim(),_=String(r.target_reasoning_effort||d.reasoning_effort||"").trim();return{request_id:s,status:String(r.status||"unknown"),created_at:r.created_at??null,started_at:r.started_at??null,finished_at:r.finished_at??null,backlog_relpath:l.relpath??null,backlog_kind:l.kind??null,backlog_filename:l.filename??null,target_agent:r.target_agent??null,target_model:p||null,target_reasoning_effort:_||null,executor_type:d.type??null,ok:typeof c.ok=="boolean"?c.ok:null,exit_code:typeof c.exit_code=="number"?c.exit_code:c.exit_code??null,error:typeof c.error=="string"?c.error:c.error??null,run_dir_relpath:r.run_dir_relpath??null,last_message:Mg(m)}}const Eu=1200;function Mg(a){const s=String(a||"");return s?s.length<=Eu?s:`${s.slice(0,Eu)}
|
|
47
|
-
… [#TRUNCATION: ${Eu} of ${s.length} chars; the full last_message is in the run directory]`:null}function zg(a){const s=String(a||""),r=s.split(/\r?\n/).filter(d=>String(d||"").trim().length>0),l=[];let c=0;for(let d=0;d<r.length;d+=1){const m=String(r[d]||"").trim(),p=Rg(m);if(!p||typeof p!="object"){c+=1,l.push({idx:d,type:"raw",payload:null,raw:m});continue}const _=String(p.type||p.event||"event");l.push({idx:d,type:_,payload:p,raw:m})}return{total:r.length,bad:c,events:l,raw:s}}function Pg(a){if(!a)return null;let s=0,r=0,l=0,c=0,d=0;for(const p of a.events){const _=p.payload,y=_&&typeof _.usage=="object"?_.usage:null;y&&(Number.isFinite(Number(y.input_tokens))&&(s+=Number(y.input_tokens)),Number.isFinite(Number(y.cached_input_tokens))&&(r+=Number(y.cached_input_tokens)),Number.isFinite(Number(y.output_tokens))&&(l+=Number(y.output_tokens)));const b=_&&typeof _.item=="object"?_.item:null;b&&String(b.type||"").trim()==="command_execution"&&(c+=1,String(b.status||"").trim().toLowerCase()==="failed"&&(d+=1))}return{has_tokens:s>0||l>0||r>0,input_tokens:s,cached_input_tokens:r,output_tokens:l,total_tokens:s+l,command_count:c,command_fail_count:d}}function Ml(a,s=Date.now()){const r=$u(a==null?void 0:a.created_at),l=$u(a==null?void 0:a.started_at),c=$u(a==null?void 0:a.finished_at),d=String((a==null?void 0:a.status)||"").trim().toLowerCase(),m=c??(d==="running"?s:null),p=c!=null,_=r!=null&&l!=null?Math.max(0,l-r):null,y=l!=null&&m!=null?Math.max(0,m-l):null,b=r!=null&&m!=null?Math.max(0,m-r):null,x=!p&&r!=null?Math.max(0,s-r):null;return{is_done:p,queue_delay_ms:_,run_ms:y,total_ms:b,age_ms:x}}function Ig(a,s){const r=String(s.package_name).trim()||"{Package}",l=bh(String(s.title||"").trim()||"{Title}"),c=String(s.summary||"").trim(),d=gh(s.task_type),m=`# {ID}-${r}: [${vh(d)}] ${l}`.trim();let p=String(a||"");p=p.split("{Package}").join(r).split("{Title}").join(l);const _=p.split(/\r?\n/);let y=!1;for(let I=0;I<_.length;I+=1){const C=String(_[I]||"");if(C.trim().startsWith("# ")){_[I]=m,y=!0;break}if(C.trim())break}y||(_.unshift("",m),_.shift());const b=`> Created: ${String(s.created_at||"").trim()}`.trim();let x=!1;for(let I=0;I<Math.min(_.length,40);I+=1)if(String(_[I]||"").trim().toLowerCase().startsWith("> created:")){_[I]=b,x=!0;break}if(!x){const I=_.length>1&&!String(_[1]||"").trim()?2:1;_.splice(I,0,b,"")}const N=`> Type: ${d}`.trim();let L=!1;for(let I=0;I<Math.min(_.length,60);I+=1)if(String(_[I]||"").trim().toLowerCase().startsWith("> type:")){_[I]=N,L=!0;break}if(!L){let I=-1;for(let C=0;C<Math.min(_.length,60);C+=1)if(String(_[C]||"").trim().toLowerCase().startsWith("> created:")){I=C;break}if(I>=0){const C=I+1;C<_.length&&!String(_[C]||"").trim()?_.splice(C,0,N):_.splice(C,0,N,"")}else{const C=_.length>1&&!String(_[1]||"").trim()?2:1;_.splice(C,0,N,"")}}if(c){for(let I=0;I<_.length;I+=1)if(String(_[I]||"").trim().toLowerCase()==="## summary"){let C=I+1;for(;C<_.length&&!String(_[C]||"").trim();)C+=1;(C<_.length?String(_[C]||""):"").trim().toLowerCase().startsWith("one paragraph describing")?_[C]=c:_.splice(I+1,0,c,"");break}}return p=_.join(`
|
|
48
|
-
`),p.endsWith(`
|
|
49
|
-
`)||(p+=`
|
|
50
|
-
`),p}function Oa(a){return String(a||"").split(/\r?\n/).map(s=>s.trim()).filter(Boolean)}function Og(a){const s=String(a.package_name||"").trim()||"{Package}",r=bh(String(a.title||"").trim()||"{Title}"),l=gh(a.task_type),c=String(a.created_at||"").trim()||Vu(),d=String(a.diagram||"").trim(),m=String(a.context||"").trim(),p=[];return p.push(`# {ID}-${s}: [${vh(l)}] ${r}`),p.push(""),p.push(`> Created: ${c}`),p.push(`> Type: ${l}`),p.push(""),p.push("## Summary"),p.push(a.summary.trim()||"One paragraph describing what this task accomplishes (user value + outcome)."),p.push(""),p.push("## Diagram"),p.push("```"),p.push(d||`ASCII diagram of the system change.
|
|
51
|
-
Show inputs/outputs and where code lives.`),p.push("```"),p.push(""),p.push("## Context"),p.push(m||"(why is this needed? link to evidence: bug/feature report paths, discussions, etc.)"),p.push(""),p.push("## Scope"),p.push("### Included"),a.included.length?p.push(...a.included.map(_=>`- ${_}`)):p.push("- "),p.push(""),p.push("### Excluded"),a.excluded.length?p.push(...a.excluded.map(_=>`- ${_}`)):p.push("- "),p.push(""),p.push("## Implementation Plan"),a.plan.length?p.push(...a.plan.map((_,y)=>`${y+1}. ${_}`)):p.push("1. "),p.push(""),p.push("## Dependencies"),a.dependencies.length?p.push(...a.dependencies.map(_=>`- ${_}`)):p.push("- Related backlog items / ADRs"),p.push(""),p.push("## Acceptance Criteria"),a.acceptance.length?p.push(...a.acceptance.map(_=>`- [ ] ${_}`)):p.push("- [ ] Criterion 1 (clear, testable)"),p.push(""),p.push("## Testing (ADR-0019)"),p.push("- Level A:"),a.tests_a.length?p.push(...a.tests_a.map(_=>` - \`${_}\``)):p.push(" - `...`"),p.push("- Level B:"),a.tests_b.length?p.push(...a.tests_b.map(_=>` - \`${_}\``)):p.push(" - `...`"),p.push("- Level C (optional / opt-in):"),a.tests_c.length?p.push(...a.tests_c.map(_=>` - \`${_}\``)):p.push(" - n/a"),p.push(""),p.push("## Related"),p.push("- ADRs:"),p.push("- Code:"),p.push("- Reports:"),a.attachments.length&&(p.push("- Attachments:"),p.push(...a.attachments.map(_=>` - ${_}`))),p.push(""),p.push("---"),p.push("## Report (added when completed)"),p.push(""),p.push("> Completed: YYYY-MM-DD"),p.push(""),p.push("### What changed"),p.push("- "),p.push(""),p.push("### Security / hardening"),p.push("- "),p.push(""),p.push("### Testing (ADR-0019)"),p.push("Levels executed:"),p.push("- A:"),p.push("- B:"),p.push("- C (if any):"),p.push(""),p.push("Commands run:"),p.push("- `...`"),p.push(""),p.push("### Follow-ups"),p.push("- "),p.push(""),p.join(`
|
|
52
|
-
`)}function Dg(a,s){const r=s.map(_=>String(_||"").trim()).filter(Boolean);if(!r.length)return a;const l=String(a||"").split(/\r?\n/),c=l.map(_=>_.toLowerCase()),d=c.findIndex(_=>_.trim()==="## related");if(d<0)return`${String(a||"").trimEnd()}
|
|
53
|
-
|
|
54
|
-
## Related
|
|
55
|
-
- Attachments:
|
|
56
|
-
${r.map(y=>` - ${y}`).join(`
|
|
57
|
-
`)}
|
|
58
|
-
`;let m=-1;for(let _=d+1;_<l.length;_+=1){const y=c[_].trim();if(y.startsWith("## ")||y.startsWith("---"))break;if(y.startsWith("- attachments:")){m=_;break}}const p=["- Attachments:",...r.map(_=>` - ${_}`)];if(m>=0){let _=m+1;for(;_<l.length&&/^\s+-\s/.test(l[_]);)_+=1;l.splice(_,0,...r.map(y=>` - ${y}`))}else{let _=d+1;for(let y=d+1;y<l.length;y+=1){const b=c[y].trim();if(b.startsWith("## ")||b.startsWith("---")){_=y;break}_=y+1}l.splice(_,0,...p,"")}return l.join(`
|
|
59
|
-
`)}function Fg(a,s){const r=th(a);if(!r.ok)return null;const l=r.payload.phases.map(m=>m.id),c=new Map;for(const m of s)c.set(`${m.section}\0${m.item}\0${m.phase}`,m.op);const d=[];for(const m of r.payload.sections)for(const p of m.items){const _=[];for(const y of l){const b=p.cells[y];if(!b)continue;const x=c.get(`${m.id}\0${p.id}\0${y}`);(x?x==="grant":!!b.assigned)&&_.push(y)}_.length&&(_.length===l.length?d.push({name:p.id}):d.push({name:p.id,phases:_}))}return d}function qg(a){var E,Z;const{gateway:s,entity_name:r}=a,[l,c]=h.useState(null),[d,m]=h.useState(""),[p,_]=h.useState(!1),[y,b]=h.useState([]),[x,N]=h.useState(!1),[L,I]=h.useState(""),[C,z]=h.useState(""),B=h.useCallback(async()=>{_(!0),m("");try{c(await s.entity_skills(r))}catch(oe){c(null),m(String((oe==null?void 0:oe.message)||oe))}finally{_(!1)}},[s,r]);h.useEffect(()=>{b([]),z(""),I(""),B()},[B]);async function F(){if(!(l!=null&&l.matrix))return;const oe=Fg(l.matrix,y);if(oe===null){I("Cannot serialize the selection: the matrix payload failed validation — refresh and retry.");return}N(!0),I("");try{const le=await s.put_entity_skills(r,oe);c(le),b([]),z("Selection saved — recorded as a host marker on the entity's stream."),setTimeout(()=>z(""),5e3)}catch(le){I(String((le==null?void 0:le.message)||le))}finally{N(!1)}}const q=Array.isArray((E=l==null?void 0:l.selection)==null?void 0:E.warnings)?l.selection.warnings.map(String):[],Q=Array.isArray((Z=l==null?void 0:l.resolved)==null?void 0:Z.skills)?l.resolved.skills:[];return e.jsxs("div",{className:"entity_skills_panel",children:[e.jsxs("div",{className:"entity_skills_head",children:[e.jsxs("span",{className:"pane_title",children:["Skills — ",r]}),e.jsx("span",{className:"muted",style:{fontSize:"var(--font-size-xs)"},children:"what this mind is taught, per phase; the trust gate resolves server-side"}),e.jsxs("span",{style:{marginLeft:"auto",display:"inline-flex",gap:6},children:[e.jsx("button",{className:"btn",onClick:()=>void B(),disabled:p||x,title:"Reload the resolved view (discards pending edits)",children:p?"Loading…":"Refresh"}),e.jsx("button",{className:"btn",onClick:a.on_close,children:"Close"})]})]}),d?e.jsxs("div",{className:"page_error",children:["Skills unavailable: ",d]}):null,q.length?e.jsx("div",{className:"detail_warn",style:{marginTop:4},children:q.join(" · ")}):null,Q.length?e.jsx("div",{className:"entity_skills_resolved",children:Q.map(oe=>{const le=String((oe==null?void 0:oe.name)||""),pe=!!(oe!=null&&oe.active),Te=!!(oe!=null&&oe.blocked),Me=!!(oe!=null&&oe.requires_review),ve=oe==null?void 0:oe.requires_unmet,ce=Array.isArray(ve)?ve.map(String):ve&&typeof ve=="object"?Object.entries(ve).map(([X,M])=>`${X}: ${String(M)}`):[],D=pe?"ok":Te?"danger":ce.length||Me?"warn":"muted",R=pe?"active":Te?"blocked":ce.length?"requires unmet":Me?"requires review":"inactive",U=[...Array.isArray(oe==null?void 0:oe.reasons)?oe.reasons.map(String):[],...ce].join("; ");return e.jsxs("span",{className:`chip mono ${D}`,title:U||void 0,children:[le," · ",R]},le)})}):null,e.jsx(d_,{payload:l==null?void 0:l.matrix,patches:y,onPatchesChange:b,disabled:x||p,title:"Phase capabilities",subtitle:"Grant/Deny per phase; Default clears the operator word (unselected). Save replaces the whole selection."}),e.jsxs("div",{className:"entity_skills_actions",children:[e.jsx("button",{className:"btn primary",onClick:()=>void F(),disabled:x||!y.length,title:y.length?`Save ${y.length} pending change(s)`:"No pending changes",children:x?"Saving…":y.length?`Save ${y.length} change${y.length>1?"s":""}`:"Save"}),y.length?e.jsx("button",{className:"btn",onClick:()=>b([]),disabled:x,children:"Discard edits"}):null,L?e.jsx("span",{className:"page_error",style:{margin:0},children:L}):null,C?e.jsx("span",{className:"chip mono ok",children:C}):null]})]})}function Bg(a){const s=new Map;for(const r of a){const l=String(r.target_agent||(r.target_model?`${String(r.executor_type||"agent").trim()||"agent"}:${r.target_model}`:"")||"(unattributed)").trim();let c=s.get(l);c||(c={agent:l,model:String(r.target_model||"").trim(),runs:0,active:0,promoted:0,completed:0,failed:0,awaiting_qa:0,total_run_ms:0,timed_runs:0,last_active:""},s.set(l,c)),c.runs+=1;const d=String(r.status||"").toLowerCase();d==="queued"||d==="running"?c.active+=1:d==="promoted"?c.promoted+=1:d==="completed"?c.completed+=1:d==="failed"?c.failed+=1:d==="awaiting_qa"&&(c.awaiting_qa+=1);const m=Ml(r);m.run_ms!=null&&(c.total_run_ms+=m.run_ms,c.timed_runs+=1);const p=String(r.finished_at||r.started_at||r.created_at||"");p>c.last_active&&(c.last_active=p)}return[...s.values()].sort((r,l)=>l.runs-r.runs)}function Ug(a){const{gateway:s,gateway_connected:r}=a,l=String(a.backlog_advisor_agent||"").trim()||"basic-agent",[c,d]=h.useState(null),[m,p]=h.useState([]),[_,y]=h.useState([]),[b,x]=h.useState(""),[N,L]=h.useState(null),[I,C]=h.useState(!1),[z,B]=h.useState(""),[F,q]=h.useState(!1),[Q,E]=h.useState(""),[Z,oe]=h.useState(null),le=h.useRef(0);async function pe(){if(!r||I)return;const w=++le.current;C(!0),B("");try{const[A,ee,ge]=await Promise.all([s.backlog_exec_config(),s.backlog_exec_requests({status:"queued,running,awaiting_qa",limit:200}),s.backlog_exec_requests({status:"promoted,completed,failed",limit:200})]);if(w!==le.current)return;d(A),p([...Array.isArray(ee==null?void 0:ee.requests)?ee.requests:[],...Array.isArray(ge==null?void 0:ge.requests)?ge.requests:[]])}catch(A){w===le.current&&B(String((A==null?void 0:A.message)||A||"Failed to load agents"))}finally{le.current,C(!1)}try{const A=await s.list_entities();if(w!==le.current)return;y(Array.isArray(A==null?void 0:A.entities)?A.entities:[]),x("")}catch(A){if(w!==le.current)return;y([]),x(`#FALLBACK entity registry unavailable: ${String((A==null?void 0:A.message)||A)}`)}try{const A=await s.admin_executors();if(w!==le.current)return;const ee=Array.isArray(A)?A:Array.isArray(A==null?void 0:A.executors)?A.executors:[];L(ee)}catch{w===le.current&&L(A=>A===null?null:A)}try{const A=await s.admin_runtime_config();w===le.current&&q((A==null?void 0:A.writable)===!0)}catch{w===le.current&&q(!1)}}async function Te(){le.current+=1;try{const w=await s.list_entities();y(Array.isArray(w==null?void 0:w.entities)?w.entities:[]),x("")}catch(w){x(`#FALLBACK entity registry unavailable: ${String((w==null?void 0:w.message)||w)}`)}}async function Me(){le.current+=1;try{const w=await s.admin_executors(),A=Array.isArray(w)?w:Array.isArray(w==null?void 0:w.executors)?w.executors:[];L(A)}catch{}try{d(await s.backlog_exec_config())}catch{}}async function ve(w){if(Q)return;const A=`executor:${w}`;E(A),oe(null);try{await s.admin_runtime_config_update({executor:w}),await Me()}catch(ee){oe({key:A,text:String((ee==null?void 0:ee.message)||ee||"Executor change refused")})}finally{E("")}}const[ce,D]=h.useState(null);async function R(w,A){if(Q)return;const ee=String(w.slug||w.name||"").trim();if(!ee)return;const ge=`entity:${ee}`;E(ge),oe(null);try{await s.entity_state(ee,{state:A,reason:"by the operator via Continuum (Agents & Entities)"}),await Te()}catch(he){oe({key:ge,text:String((he==null?void 0:he.message)||he||"State change refused")})}finally{E("")}}h.useEffect(()=>{pe()},[r]);const U=h.useMemo(()=>Bg(m),[m]),X=!!(c!=null&&c.runner_alive),M=String((c==null?void 0:c.executor)||"").trim(),ue=!M||M==="none",V=ue?"No execution agent":M;return e.jsx("div",{className:"page page_scroll",children:e.jsxs("div",{className:"page_inner page_pad constrained",children:[e.jsxs("div",{className:"page_toolbar",children:[e.jsx("span",{className:"page_hint",children:"The workforce behind the pipeline — the executor is a pluggable seam; this console renders whatever the gateway reports."}),z?e.jsx("span",{className:"page_error mono",children:z}):null,e.jsx("div",{className:"page_toolbar_spacer"}),e.jsx("button",{className:`btn btn_icon ${I?"is_loading":""}`,onClick:()=>void pe(),disabled:!r||I,title:"Refresh","aria-label":"Refresh",children:e.jsx(rt,{name:"refresh",size:16})})]}),e.jsxs("div",{className:"agents_grid",children:[N!==null&&N.length?N.map(w=>e.jsxs("div",{className:"entity_card",children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"agent_avatar","aria-hidden":"true",children:e.jsx(rt,{name:"terminal",size:16})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{className:"entity_card_title",children:w.display||w.id}),e.jsxs("div",{className:"entity_card_sub",children:["execution agent",w.default?" · gateway default":""]})]}),e.jsx("span",{className:`chip mono ${w.available?"ok":"danger"}`,style:{marginLeft:"auto"},children:w.available?"available":"unavailable"})]}),e.jsx("div",{className:"agent_facts",children:Array.isArray(w.models)&&w.models.length?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"models:"})," ",w.models.slice(0,4).join(", "),w.models.length>4?` +${w.models.length-4}`:""]}):null}),e.jsx("div",{className:"entity_card_actions",children:w.default?e.jsx("span",{className:"chip mono ok",title:"New executions run under this agent unless the request overrides it.",children:"gateway default"}):F?e.jsx("button",{className:"btn",disabled:!!Q||w.available===!1,title:w.available===!1?"Unavailable on the gateway host — the binary is not on its PATH":Q&&Q!==`executor:${w.id}`?"Another action is in flight":"Make this the gateway's default executor (admin, persisted gateway-side)",onClick:()=>void ve(w.id),children:Q===`executor:${w.id}`?"Setting…":"Set as default"}):e.jsx("span",{className:"chip mono muted",title:"Changing the default executor is admin-only — the gateway authorizes it (Settings → Gateway administration).",children:"admin only"})}),(Z==null?void 0:Z.key)===`executor:${w.id}`?e.jsx("div",{className:"detail_warn",children:Z.text}):null]},w.id)):c?e.jsxs("div",{className:"entity_card",children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"agent_avatar","aria-hidden":"true",children:e.jsx(rt,{name:"terminal",size:16})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{className:"entity_card_title",children:V}),e.jsx("div",{className:"entity_card_sub",children:ue?"enable one from Settings → Gateway administration":"execution agent (gateway-configured)"})]}),e.jsx("span",{className:`chip mono ${X?"ok":ue?"warn":"danger"}`,style:{marginLeft:"auto"},children:X?"available":ue?"not configured":"offline"})]}),e.jsxs("div",{className:"agent_facts",children:[c.codex_model?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"model:"})," ",c.codex_model]}):null,c.codex_reasoning_effort?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"reasoning:"})," ",c.codex_reasoning_effort]}):null,e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"can execute:"})," ",c.can_execute?"yes":"no"]}),c.runner_error?e.jsx("div",{className:"page_error",children:c.runner_error}):null]})]}):null,e.jsxs("div",{className:"entity_card",children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"agent_avatar","aria-hidden":"true",children:e.jsx(rt,{name:"edit",size:16})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{className:"entity_card_title",children:l}),e.jsx("div",{className:"entity_card_sub",children:"backlog advisor (read-only chat agent)"})]}),e.jsx("span",{className:"chip mono muted",style:{marginLeft:"auto"},children:"advisory"})]}),e.jsxs("div",{className:"agent_facts",children:[e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"surface:"})," assistant drawer + Backlog advisor"]}),e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"writes:"})," none (advice only)"]})]}),e.jsx("div",{className:"entity_card_actions",children:e.jsx("button",{className:"btn",onClick:()=>{var w;return(w=a.on_open_assistant)==null?void 0:w.call(a)},disabled:!a.on_open_assistant,title:"Open the assistant drawer and ask this advisor a question",children:"Ask the advisor"})})]})]}),e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Summoned entities"}),e.jsxs("span",{className:"pane_count",children:[_.length," on this gateway"]}),e.jsx("span",{className:"pane_header_actions muted",style:{fontSize:"var(--font-size-xs)"},children:"persistent minds with full package history — recruitable for development alongside agents"})]}),e.jsxs("div",{className:"pane_body",children:[b?e.jsx("div",{className:"page_error",style:{fontSize:"var(--font-size-sm)"},children:b}):null,!b&&!_.length?e.jsx("div",{className:"empty_note",children:"No summoned entities on this gateway yet. Entities are created and summoned through the gateway (its CLI/console); once they exist they appear here as recruitable developers."}):null,_.length?e.jsx("div",{className:"agents_grid",style:{marginTop:0},children:_.map(w=>{var O,je,te,Ce,Ae,Ge;if(w.error)return e.jsxs("div",{className:"entity_card",style:{borderColor:"var(--danger, rgb(248,113,113))"},children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"agent_avatar","aria-hidden":"true",children:e.jsx(rt,{name:"warning",size:16})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{className:"entity_card_title",children:w.name||w.slug||"(unreadable home)"}),e.jsx("div",{className:"entity_card_sub mono",children:w.entity_id||w.slug})]}),e.jsx("span",{className:"chip mono danger",style:{marginLeft:"auto"},children:"error"})]}),e.jsx("div",{className:"detail_warn",style:{marginTop:0},children:w.error})]},w.entity_id||w.slug||w.name);const A=String(((O=w.state)==null?void 0:O.state)||"unknown").toLowerCase(),ee=A==="awake"?"ok":A==="asleep"?"info":A==="paused"?"warn":"muted",he=String(w.liveness||((je=w.state)==null?void 0:je.liveness)||"").toLowerCase()==="stopped";return e.jsxs("div",{className:"entity_card",children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"agent_avatar","aria-hidden":"true",children:e.jsx(rt,{name:"agent",size:16})}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{className:"entity_card_title",children:w.name||w.slug}),e.jsx("div",{className:"entity_card_sub mono",children:w.entity_id})]}),he?e.jsx("span",{className:"chip mono danger",style:{marginLeft:"auto"},title:`The kill switch: served liveness=stopped (state: ${A}). Restore lives on the gateway console.`,children:"STOPPED"}):e.jsx("span",{className:`chip mono ${ee}`,style:{marginLeft:"auto"},children:A})]}),e.jsxs("div",{className:"agent_facts",children:[w.created_at?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"born:"})," ",new Date(w.created_at).toLocaleDateString()]}):null,(te=w.state)!=null&&te.reason?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"state reason:"})," ",w.state.reason]}):null,e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"home:"})," spark ",(Ce=w.files)!=null&&Ce.spark?"✓":"—"," · memory ",(Ae=w.files)!=null&&Ae.memory?"✓":"—"," · book ",(Ge=w.files)!=null&&Ge.book?"✓":"—"]})]}),e.jsxs("div",{className:"entity_card_actions",children:[!he&&(A==="asleep"||A==="paused")?e.jsx("button",{className:"btn",disabled:!!Q,title:Q&&Q!==`entity:${w.slug||w.name}`?"Another action is in flight":"Wake this entity (operator act, recorded as a host marker; the gateway authorizes or refuses)",onClick:()=>void R(w,"awake"),children:Q===`entity:${w.slug||w.name}`?"Waking…":"Wake"}):null,!he&&A==="awake"?e.jsx("button",{className:"btn",disabled:!!Q,title:Q&&Q!==`entity:${w.slug||w.name}`?"Another action is in flight":"Graceful sleep (in-flight work finishes; reflection runs). The gateway refuses if a visit is live.",onClick:()=>void R(w,"asleep"),children:Q===`entity:${w.slug||w.name}`?"Sending…":"Sleep"}):null,he?e.jsx("span",{className:"chip mono warn",title:"Restore lives on the gateway console — the kill switch keeps one management surface.",children:"restore via gateway console"}):null,e.jsx("button",{className:"btn",onClick:()=>D(fe=>fe===(w.name||w.slug)?null:w.name||w.slug||null),title:"What this mind is taught, per phase (selection persists in the entity's home; changes record as host markers)",children:ce===(w.name||w.slug)?"Hide skills":"Skills"})]}),(Z==null?void 0:Z.key)===`entity:${w.slug||w.name}`?e.jsx("div",{className:"detail_warn",children:Z.text}):null]},w.entity_id||w.slug)})}):null,ce?e.jsx(qg,{gateway:s,entity_name:ce,on_close:()=>D(null)}):null]})]}),e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Capabilities"}),e.jsx("span",{className:"pane_subtitle",children:"live features link to their surface; pending ones name their owner"})]}),e.jsx("div",{className:"pane_body",children:e.jsxs("div",{className:"cap_rows",children:[e.jsxs("div",{className:"cap_row",children:[e.jsxs("div",{className:"cap_row_head",children:[e.jsx("span",{className:"cap_row_name",children:"Executor choice per task"}),e.jsx("span",{className:"chip mono ok",children:"live"}),a.on_open_executions?e.jsx("button",{className:"btn cap_row_action",onClick:a.on_open_executions,title:"Watch runs execute under their chosen agent",children:"Open Executions"}):null]}),e.jsx("div",{className:"cap_row_detail",children:"Every Execute dialog (Board and Backlog) carries an Execution agent dropdown — codex, claude, cursor-agent, abstractcode, probed live by the gateway. The default is set on the executor cards above; runs attribute canonically in the track record."})]}),e.jsxs("div",{className:"cap_row",children:[e.jsxs("div",{className:"cap_row_head",children:[e.jsx("span",{className:"cap_row_name",children:"Skills per run and per member"}),e.jsx("span",{className:"chip mono warn",children:"partial"}),a.on_open_executions?e.jsx("button",{className:"btn cap_row_action",onClick:a.on_open_executions,title:"Run detail → Skills section shows which teachings rode each run",children:"View on a run"}):null]}),e.jsx("div",{className:"cap_row_detail",children:"Which skills rode each run renders in the run detail today (requested vs active, held verdicts verbatim). Per-MEMBER skill grants (trust levels, review badges) land when the gateway serves the abstractskill union contract over HTTP (c1778) — the cards above grow a Skills action that day."})]}),e.jsxs("div",{className:"cap_row",children:[e.jsxs("div",{className:"cap_row_head",children:[e.jsx("span",{className:"cap_row_name",children:"MCP access grants"}),e.jsx("span",{className:"chip mono muted",children:"pending contract"})]}),e.jsx("div",{className:"cap_row_detail",children:"Per-member MCP grants — the ruled home is the gateway's phases config family, endpoint mirroring tool-policy (c1554). No continuum surface until the gateway serves it; this row turns live then."})]}),e.jsxs("div",{className:"cap_row",children:[e.jsxs("div",{className:"cap_row_head",children:[e.jsx("span",{className:"cap_row_name",children:"Agora charters and recruitment"}),e.jsx("span",{className:"chip mono info",children:"read live"}),a.on_open_team?e.jsx("button",{className:"btn cap_row_action",onClick:a.on_open_team,title:"Team page → ⓘ About shows each channel's charter, purpose, SLA, and members",children:"Open Team"}):null]}),e.jsx("div",{className:"cap_row_detail",children:"Per-channel charters, purpose, SLA, and members render on the Team page (ⓘ About on any channel). Charter WRITES and recruitment criteria are the next hub-proxy slice — writes are governance acts and get their own confirmation surface."})]})]})})]}),e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Track record"}),e.jsxs("span",{className:"pane_count",children:[U.length," agent",U.length===1?"":"s"]}),e.jsx("span",{className:"pane_header_actions muted",style:{fontSize:"var(--font-size-xs)"},children:"all live + last 200 finished — counts, not quality"})]}),e.jsx("div",{className:"pane_body",style:{padding:0},children:U.length?e.jsx("div",{className:"table_scroll",children:e.jsxs("table",{className:"data_table track_table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"agent"}),e.jsx("th",{children:"runs"}),e.jsx("th",{className:"col_aux",children:"active"}),e.jsx("th",{className:"col_aux",children:"promoted"}),e.jsx("th",{className:"col_aux",children:"completed"}),e.jsx("th",{className:"col_aux",children:"in review"}),e.jsx("th",{children:"failed"}),e.jsx("th",{className:"col_aux2",children:"avg run"}),e.jsx("th",{className:"col_aux2",children:"last active"})]})}),e.jsx("tbody",{children:U.map(w=>e.jsxs("tr",{children:[e.jsx("td",{className:"td_agent mono",children:w.agent}),e.jsx("td",{children:w.runs}),e.jsx("td",{className:"col_aux",children:w.active||""}),e.jsx("td",{className:"col_aux",children:w.promoted||""}),e.jsx("td",{className:"col_aux",children:w.completed||""}),e.jsx("td",{className:"col_aux",children:w.awaiting_qa||""}),e.jsx("td",{className:w.failed?"page_error":"",children:w.failed||""}),e.jsx("td",{className:"col_aux2 td_time",children:w.timed_runs?Is(w.total_run_ms/w.timed_runs):""}),e.jsx("td",{className:"col_aux2 td_time",children:w.last_active?new Date(w.last_active).toLocaleString():""})]},w.agent))})]})}):e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)",padding:"12px"},children:"No execution history yet."})})]})]})})}function Os(a){const s=String(a||"").trim(),r=s.lastIndexOf("-");if(r<=0||r===s.length-1)return null;const l=s.slice(0,r),c=s.slice(r+1);return!/^[0-9]+$/.test(c)||!/^[a-z0-9][a-z0-9_.-]*$/.test(l)?null:{package:l,num:c}}function yf(a,s){const r=String(s||"").match(/^(\d{1,4})[-_]/);return!r||!a?null:`${a.toLowerCase()}-${r[1].padStart(4,"0")}`}function Wg(a){return String(a||"").replace(/\\/g,"/").split("/").filter(Boolean).pop()||""}function Hg(a){const r=String(a||"").replace(/\\/g,"/").match(/(?:^|\/)(proposed|planned|completed|deprecated|recurrent)\/([^/]+\.md)$/i);return r?{kind:r[1].toLowerCase(),filename:r[2]}:null}const Vg=/\b([a-z][a-z0-9_.-]{3,60}-\d{4})\b/g,Gg=6;function Kg(a){const s=[];for(const r of String(a||"").matchAll(Vg)){const l=r[1];if(Os(l)&&(s.includes(l)||s.push(l),s.length>=Gg))break}return s}function wh(a,s,r=24){const l=a.started_at;if(l==null||l==="")return null;let c;if(typeof l=="number")c=l>1e12?l:l*1e3;else{const p=Date.parse(String(l));if(Number.isNaN(p))return null;c=p}const d=Math.max(0,(s-c)/36e5);return{label:d<1?`claimed ${Math.max(1,Math.round(d*60))}m`:d<48?`claimed ${Math.round(d)}h`:`claimed ${Math.round(d/24)}d`,stale:d>=r}}const zl=["P0","P1","P2","P3"],jh={P0:"P0 · critical",P1:"P1 · high",P2:"P2 · normal",P3:"P3 · low"},kh=/^>\s*priority:\s*(p[0-3])\b/i,Sh=/^>\s*labels:\s*(.+)$/i;function cd(a){return String(a||"").split(",").map(s=>s.trim().toLowerCase().replace(/\s+/g,"-")).filter(s=>!!s&&s.length<=40).slice(0,12)}function Tu(a,s){const r=[];let l=!1;for(const c of a){const d=c.trim();if(/^#{1,6}\s/.test(d)){l=s.test(d);continue}l&&r.push(c)}return r}const Qg=["one paragraph describing","criterion 1 (clear, testable)"];function xf(a){const s=a.trim().toLowerCase();return s?Qg.some(r=>s.startsWith(r)):!0}function wi(a){const s=String(a||"").split(/\r?\n/);let r=null,l=[];for(const _ of s.slice(0,60)){const y=_.trim();if(/^##+\s/.test(y))break;const b=kh.exec(y);b&&!r&&(r=b[1].toUpperCase());const x=Sh.exec(y);x&&!l.length&&(l=cd(x[1]))}const c=[];for(const _ of Tu(s,/acceptance criteria/i)){const y=/^\s*[-*]\s*\[( |x|X)\]\s*(.+)$/.exec(_);if(!y)continue;const b=y[2].trim();xf(b)||c.push({text:b,checked:y[1].toLowerCase()==="x"})}const d=[];for(const _ of Tu(s,/testing/i))for(const y of _.matchAll(/`([^`]+)`/g)){const b=y[1].trim();!b||b==="..."||b.toLowerCase()==="n/a"||d.push(b)}const m=Tu(s,/^#{1,6}\s*summary\b/i).map(_=>_.trim()).filter(Boolean),p=m.length>0&&!m.every(xf);return{priority:r,labels:l,acceptance:c,test_commands:d,has_summary:p}}function ud(a,s){const r=String(a.task_type||"").trim().toLowerCase(),l=[{id:"type",label:`Work type is set (${Ba.join(" / ")})`,ok:Ba.includes(r),evidence:r?`type: ${r}`:"no type"},{id:"summary",label:"Summary describes the outcome (not the template placeholder)",ok:s.has_summary,evidence:s.has_summary?"summary present":"empty or template placeholder"},{id:"acceptance",label:"At least one acceptance criterion",ok:s.acceptance.length>0,evidence:s.acceptance.length?`found ${s.acceptance.length}: "${bf(s.acceptance[0].text,60)}"${s.acceptance.length>1?", …":""}`:"none found under ## Acceptance Criteria"},{id:"tests",label:"At least one concrete test command (Testing A/B)",ok:s.test_commands.length>0,evidence:s.test_commands.length?`found ${s.test_commands.length}: \`${bf(s.test_commands[0],60)}\``:"none found under ## Testing"}];return{ok:l.every(c=>c.ok),checks:l}}function bf(a,s){const r=String(a||"");return r.length<=s?r:`${r.slice(0,Math.max(0,s-1))}…`}function Ku(a){const s=a;if(!s||s.status!==409)return null;const r=s.body,l=r&&typeof r=="object"&&r.detail&&typeof r.detail=="object"?r.detail:r;if(!l||l.error!=="definition_of_ready_failed")return null;const d=(Array.isArray(l.checks)?l.checks:Array.isArray(l.members)?l.members.flatMap(m=>(Array.isArray(m==null?void 0:m.checks)?m.checks:[]).map(p=>({...p,label:m!=null&&m.relpath?`${m.relpath}: ${String((p==null?void 0:p.label)||"")}`:p==null?void 0:p.label}))):[]).map(m=>({id:String((m==null?void 0:m.id)||""),label:String((m==null?void 0:m.label)||""),ok:(m==null?void 0:m.ok)===!0,evidence:m!=null&&m.evidence?String(m.evidence):void 0}));return d.length?{ok:d.every(m=>m.ok),checks:d}:null}function Qu(a,s){const l=[...String(a||"").split(/\r?\n/)];function c(d,m){const p=[];for(let y=0;y<Math.min(l.length,60);y+=1){const b=l[y].trim();if(/^##+\s/.test(b))break;d.test(b)&&p.push(y)}if(p.length){for(let y=p.length-1;y>=1;y-=1)l.splice(p[y],1);m?l[p[0]]=m:l.splice(p[0],1);return}if(!m)return;let _=-1;for(let y=0;y<Math.min(l.length,60);y+=1){const b=l[y].trim();if(b.startsWith("> ")&&(_=y),/^##\s/.test(b))break}if(_<0){const y=l.findIndex(b=>b.trim().startsWith("# "));if(y>=0)_=y;else{l.unshift(m);return}}l.splice(_+1,0,m)}return c(kh,s.priority?`> Priority: ${s.priority}`:null),c(Sh,s.labels.length?`> Labels: ${s.labels.join(", ")}`:null),l.join(`
|
|
60
|
-
`)}const wf=[{id:"triage",label:"Triage",hint:"Proposed — needs a decision (merge/advisor tooling lives on the Backlog page)"},{id:"ready",label:"Ready",hint:"Planned — executable. A ⚠ badge counts recent failed attempts."},{id:"in_progress",label:"In Progress",hint:"Queued/running executions + seat-claimed items (live hub pointer claims — the ⛏ chip names the owner)"},{id:"in_review",label:"In Review",hint:"Awaiting QA decision (receipts-posted seat work joins when the /work index is live)"},{id:"done",label:"Done",hint:"Recent promotions/completions (attempts). The full archive lives in Backlog → Completed."},{id:"failed",label:"Failed",hint:"Recent failed attempts (history) — the item itself stays executable in Ready"}];function Ju(a){const s=String(a||"").trim().toUpperCase();return zl.includes(s)?s:null}function Yu(a){return a.priority!==void 0||a.labels!==void 0}const Jg="decision-gate";function Yg(a){return Array.isArray(a)&&a.some(s=>String(s||"").trim().toLowerCase()===Jg)}function Nh(a,s){return Yg(a.labels!==void 0?a.labels:s==null?void 0:s.labels)}function Ch(a){return a.priority!==void 0||a.labels!==void 0}function Xu(a,s){return a.priority!==void 0?a.priority:(s==null?void 0:s.priority)??null}function Zu(a,s){return a.labels!==void 0?a.labels:(s==null?void 0:s.labels)??[]}const Xg=new Set(["queued","running"]);function Zg(a){const s=String(a||"").split("/").filter(Boolean);return s.length?s[s.length-1]:""}const ev=/^batch\((\d+)\)$/i;function jf(a){const s=ev.exec(String(a||"").trim());return s?Number(s[1]):null}function tv(a){const s=a.recent_limit??12,r=[],l=new Set;for(const b of a.active_items){const x=String(b.filename||"").trim();x&&l.add(x)}const c=(b,x,N)=>{const L=String(b.backlog_filename||"").trim()||Zg(String(b.backlog_relpath||"")),I=jf(L),C=I!==null?"":L;return C&&N&&l.add(C),{key:C&&N?`file:${C}`:`req:${b.request_id}`,column:x,title:I!==null?`Batch execution (${I} items)`:C||`Execution ${b.request_id.slice(0,8)}…`,filename:C||void 0,request_id:b.request_id,exec_status:String(b.status||"").trim().toLowerCase(),created_at:b.created_at??null,started_at:b.started_at??null,finished_at:b.finished_at??null,target_agent:b.target_agent??(b.target_model?`${String(b.executor_type||"agent").trim()||"agent"}:${b.target_model}`:null),batch_size:I!==null?I:void 0}};for(const b of a.active_requests){const x=String(b.status||"").trim().toLowerCase();Xg.has(x)?r.push(c(b,"in_progress",!0)):x==="awaiting_qa"&&r.push(c(b,"in_review",!0))}const d=[...a.terminal_requests].sort((b,x)=>{const N=String(b.finished_at||b.started_at||b.created_at||"");return String(x.finished_at||x.started_at||x.created_at||"").localeCompare(N)}),m=new Map;let p=0,_=0;for(const b of d){const x=String(b.status||"").trim().toLowerCase();if(x==="failed"){const N=String(b.backlog_filename||"").trim();N&&jf(N)===null&&m.set(N,(m.get(N)||0)+1),_<s&&(r.push(c(b,"failed",!1)),_+=1)}else(x==="promoted"||x==="completed")&&p<s&&(r.push(c(b,"done",!1)),p+=1)}for(const b of a.planned){const x=String(b.filename||"").trim();!x||l.has(x)||r.push({key:`file:${x}`,column:"ready",title:b.title||x,kind:"planned",filename:x,item_id:b.item_id,package:b.package,task_type:b.task_type,summary:b.summary,recent_failures:m.get(x)||void 0,priority:Yu(b)?Ju(b.priority):void 0,labels:Array.isArray(b.labels)?b.labels:void 0})}for(const b of a.proposed){const x=String(b.filename||"").trim();!x||l.has(x)||r.push({key:`file:${x}`,column:"triage",title:b.title||x,kind:"proposed",filename:x,item_id:b.item_id,package:b.package,task_type:b.task_type,summary:b.summary,priority:Yu(b)?Ju(b.priority):void 0,labels:Array.isArray(b.labels)?b.labels:void 0})}const y=new Map;for(const b of[...a.planned,...a.proposed])y.set(String(b.filename||"").trim(),b);for(const b of r){if(!b.filename||b.kind)continue;const x=y.get(b.filename);x&&(b.title=x.title||b.title,b.item_id=x.item_id,b.package=x.package,b.task_type=x.task_type,b.summary=x.summary)}return r}const nv=200;function sv(a,s){var b;const{live:r,done:l}=s,c=s.work||new Map;if(!r.size&&!l.length&&!c.size)return a;const d=new Set,m=new Set;for(const x of a){if(!x.filename||!x.package)continue;const N=yf(x.package,x.filename);N&&m.add(N)}const p=a.map(x=>{if(x.column!=="ready"||x.kind!=="planned"||!x.filename||!x.package)return x;const N=yf(x.package,x.filename);if(!N)return x;const L=r.get(N);return!L||!L.owner?x:(d.add(N),{...x,column:"in_progress",work_id:N,claim_owner:L.owner,claim_started_at:L.started_at})}),_=new Map;p.forEach((x,N)=>{x.filename&&_.set(x.filename,N)});for(const[x,N]of c){const L=N.card?_.get(Wg(N.card)):void 0;if(m.has(x)||L!==void 0){if(L!==void 0){const z=p[L],B={...z,work_id:z.work_id||x,card_path:z.card_path||N.card},F=r.get(x);F!=null&&F.owner&&(d.add(x),B.claim_owner||(B.claim_owner=F.owner,B.claim_started_at=F.started_at)),p[L]=B}continue}if(N.status==="deprecated")continue;const I=r.get(x),C=N.status==="completed"?"done":N.status==="planned"?I!=null&&I.owner?"in_progress":"ready":"triage";I!=null&&I.owner&&d.add(x),p.push({key:`work:${x}`,column:C,title:N.title||x,work_id:x,package:(b=Os(x))==null?void 0:b.package,summary:N.receipt,card_path:N.card,claim_owner:(I==null?void 0:I.owner)||(N.status==="completed"?N.owner:void 0),claim_started_at:I==null?void 0:I.started_at})}for(const[x,N]of r){if(d.has(x)||!N.owner)continue;const L=Os(x);p.push({key:`claim:${x}`,column:"in_progress",title:typeof N.task=="string"&&N.task?N.task:x,work_id:L?x:void 0,package:L==null?void 0:L.package,claim_owner:N.owner,claim_started_at:N.started_at})}const y=new Set(p.filter(x=>x.column==="done").map(x=>x.work_id).filter(Boolean));for(const x of l.slice(0,nv)){if(y.has(x.item))continue;const N=Os(x.item);p.push({key:`claim-done:${x.item}`,column:"done",title:x.item,work_id:N?x.item:void 0,package:N==null?void 0:N.package,claim_owner:x.owner,summary:x.receipt})}return p}function bi(a){const s=String((a==null?void 0:a.message)??a??"");return/backlog folder not available|backlog browsing not configured/i.test(s)}function kf(a){return String((a==null?void 0:a.message)??a??"").trim().replace(/^[a-z_]+ failed: /,"")}function dd(a,s,r){const[l,c]=h.useState({status:null,legacy:!1});return h.useEffect(()=>{if(!s)return;let d=!1;return(async()=>{try{const m=await a.backlog_status();d||c({status:m,legacy:!1})}catch(m){d||c({status:null,legacy:Number(m==null?void 0:m.status)===404})}})(),()=>{d=!0}},[a,s,r]),l}function av(){return e.jsxs(e.Fragment,{children:["Ask the gateway admin to set the backlog folder (gateway console → Apps → Backlog settings, or"," ",e.jsx("code",{className:"mono",children:"abstractgateway config set triage_repo_root PATH"})," on the gateway's computer)."]})}function md(a){const{gateway:s,surface:r,status:l,legacy:c,on_changed:d}=a,[m,p]=h.useState(!1),[_,y]=h.useState(""),[b,x]=h.useState(!1),[N,L]=h.useState(""),[I,C]=h.useState((l==null?void 0:l.writable)??null);h.useEffect(()=>{if((l==null?void 0:l.writable)!==void 0){C(!!l.writable);return}if(!c)return;let q=!1;return s.admin_runtime_config().then(Q=>{q||C((Q==null?void 0:Q.writable)===!0)}).catch(()=>{q||C(!1)}),()=>{q=!0}},[s,l==null?void 0:l.writable,c]);async function z(q){if(!b){x(!0),L("");try{await s.admin_runtime_config_update({triage_repo_root:q}),p(!1),d==null||d()}catch(Q){L(kf(Q))}finally{x(!1)}}}const B=String((l==null?void 0:l.reason)||"").trim()||(a.error?kf(a.error):""),F=String((l==null?void 0:l.default_path)||"").trim();return e.jsxs("div",{className:"pane setup_callout","data-testid":"backlog_unavailable",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"This gateway's backlog folder is not available"}),e.jsxs("span",{className:"chip mono warn",children:[r," has no data"]})]}),e.jsxs("div",{className:"pane_body",children:[e.jsxs("div",{style:{fontSize:"var(--font-size-md)"},children:[l!=null&&l.path?e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"mono",children:l.path})," —"," "]}):null,B||"the gateway did not say why."]}),I===!0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"callout_actions",style:{marginTop:"10px"},children:[F?e.jsx("button",{className:"btn primary",disabled:b,onClick:()=>void z(F),title:F,children:"Use the gateway's own folder"}):null,e.jsx("button",{className:"btn",disabled:b,onClick:()=>p(q=>!q),children:"Choose a folder…"})]}),F?e.jsxs("div",{className:"muted",style:{fontSize:"var(--font-size-sm)",marginTop:"6px"},children:["The gateway's own folder is ",e.jsx("code",{className:"mono",children:F}),"; it is created with a starter overview and item template."]}):null,m?e.jsxs("form",{className:"field",style:{marginTop:"10px"},onSubmit:q=>{q.preventDefault(),_.trim()&&z(_.trim())},children:[e.jsx("label",{htmlFor:"backlog_folder_path",children:"Folder on the gateway's computer that contains docs/backlog"}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("input",{id:"backlog_folder_path",className:"mono",value:_,onChange:q=>y(String(q.target.value||"")),placeholder:"/path/to/your/project",autoFocus:!0}),e.jsx("button",{className:"btn primary",type:"submit",disabled:b||!_.trim(),children:b?"Saving…":"Use this folder"})]})]}):null,N?e.jsx("div",{className:"page_error mono",role:"alert",style:{marginTop:"8px"},children:N}):null]}):I===!1?e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:e.jsx(av,{})}):null]})]})}function rv(a){const{status:s,on_create:r}=a,[l,c]=h.useState(!1),d=String((s==null?void 0:s.path)||"").trim(),m=d?`${d.replace(/\/+$/,"")}/docs/backlog/proposed/`:"docs/backlog/proposed/",p=d?`${d.replace(/\/+$/,"")}/${(s==null?void 0:s.template_relpath)||"docs/backlog/template.md"}`:(s==null?void 0:s.template_relpath)||"docs/backlog/template.md";return e.jsxs("div",{className:"pane setup_callout","data-testid":"backlog_empty",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Your backlog is empty"}),s!=null&&s.is_default?e.jsx("span",{className:"chip mono muted",children:"the gateway's own folder"}):null]}),e.jsxs("div",{className:"pane_body",children:[d?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[e.jsx("span",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:"Backlog folder"}),e.jsx("code",{className:"mono",children:d}),e.jsx("button",{className:"btn",onClick:()=>{mn(d),c(!0)},children:l?"Copied":"Copy"})]}):null,e.jsxs("div",{className:"callout_text",style:{marginTop:"8px"},children:["Each item is a Markdown file: new ones land in ",e.jsx("code",{className:"mono",children:m})," (Triage), accepted ones move to"," ",e.jsx("code",{className:"mono",children:"planned/"})," (Ready). Start from the template ",e.jsx("code",{className:"mono",children:p}),", or let Continuum write it for you."]}),r?e.jsx("div",{className:"callout_actions",style:{marginTop:"10px"},children:e.jsx("button",{className:"btn primary",onClick:r,children:"Create your first item"})}):null]})]})}function iv(a){return a.kind?[a.kind]:["completed","planned","proposed"]}function $h(a){const{gateway:s,can_use_gateway:r,target:l,on_close:c,on_mutated:d,on_open_executions:m}=a,p=!!l,[_,y]=h.useState("spec"),[b,x]=h.useState(""),[N,L]=h.useState(""),[I,C]=h.useState(null),[z,B]=h.useState(!1),[F,q]=h.useState(""),[Q,E]=h.useState(!1),[Z,oe]=h.useState(""),[le,pe]=h.useState(!1),[Te,Me]=h.useState(""),[ve,ce]=h.useState(""),[D,R]=h.useState(!1),[U,X]=h.useState([]),[M,ue]=h.useState(!1),[V,w]=h.useState(null),[A,ee]=h.useState(null),[ge,he]=h.useState(""),[O,je]=h.useState(!1),[te,Ce]=h.useState(""),[Ae,Ge]=h.useState({}),fe=h.useMemo(()=>wi(b),[b]);h.useEffect(()=>{!p||!l||(y(l.initial_tab||"spec"),E(!1),q(""),Ce(""),he(""),Ge({}),qe(!1),w(null),ee(null),C(null),Re(l),Ie(l))},[p,l==null?void 0:l.filename,l==null?void 0:l.kind,l==null?void 0:l.request_id]);async function Re(me){if(!me.filename){x(""),L("");return}B(!0);try{let be=null,G=null;for(const Xe of iv(me))try{const J=await s.backlog_content(Xe,me.filename);be={kind:Xe,text:String((J==null?void 0:J.content)||"")};break}catch(J){G=J}if(!be)throw G||new Error("Spec not found in any backlog kind");C(be.kind),x(be.text),L(await Gu(be.text));const ke=wi(be.text);Me(ke.priority||""),ce(ke.labels.join(", "))}catch(be){q(String((be==null?void 0:be.message)||be||"Failed to load the spec"))}finally{B(!1)}}async function Ie(me){ue(!0);try{const[be,G]=await Promise.all([s.backlog_exec_requests({status:"queued,running,awaiting_qa",limit:200}),s.backlog_exec_requests({status:"promoted,completed,failed",limit:200})]),Xe=[...Array.isArray(be==null?void 0:be.requests)?be.requests:[],...Array.isArray(G==null?void 0:G.requests)?G.requests:[]].filter(T=>me.filename&&String(T.backlog_filename||"").trim()===me.filename||T.request_id===me.request_id);Xe.sort((T,Y)=>String(Y.created_at||"").localeCompare(String(T.created_at||""))),X(Xe);const J=Xe.find(T=>String(T.status||"").toLowerCase()==="awaiting_qa")||null;if(w(J),J)try{const T=await s.backlog_exec_request(J.request_id);ee((T==null?void 0:T.payload)??null)}catch{ee(null)}}catch{X([])}finally{ue(!1)}}async function se(){if(!l||le)return;const me=I||l.kind;if(me){pe(!0),q("");try{const be=await s.backlog_update({kind:me,filename:l.filename,content:Z,expected_sha256:N||null}),G=Z.endsWith(`
|
|
61
|
-
`)?Z:`${Z}
|
|
62
|
-
`;x(G),L(String((be==null?void 0:be.sha256)||"")),E(!1),await d()}catch(be){q(String((be==null?void 0:be.message)||be||"Save failed"))}finally{pe(!1)}}}async function ye(){if(!l||D)return;const me=I||l.kind;if(me){R(!0),q("");try{const be=Qu(b,{priority:Te||null,labels:cd(ve)}),G=await s.backlog_update({kind:me,filename:l.filename,content:be,expected_sha256:N||null});x(be.endsWith(`
|
|
63
|
-
`)?be:`${be}
|
|
64
|
-
`),L(String((G==null?void 0:G.sha256)||"")),await d()}catch(be){q(String((be==null?void 0:be.message)||be||"Metadata save failed"))}finally{R(!1)}}}const[_e,qe]=h.useState(!1);async function Ye(me){if(!(!V||O)){if(me==="feedback"&&!ge.trim()){Ce("Feedback is required.");return}je(!0),Ce("");try{me==="feedback"?await s.backlog_exec_feedback({request_id:V.request_id,feedback:ge}):me==="promote"?await s.backlog_exec_promote({request_id:V.request_id,redeploy:!0}):await s.backlog_exec_deploy_uat({request_id:V.request_id}),he(""),qe(!1),l&&await Ie(l),await d()}catch(be){Ce(String((be==null?void 0:be.message)||be||"QA action failed"));try{const G=await s.backlog_exec_request(V.request_id);ee((G==null?void 0:G.payload)??null)}catch{}}finally{je(!1)}}}if(!p||!l)return null;const ie=fe.acceptance.filter((me,be)=>!Ae[`${be}:${me.text}`]).length;return e.jsx("div",{className:"drawer_backdrop",onMouseDown:me=>{me.target===me.currentTarget&&c()},children:e.jsxs("div",{className:"drawer_panel work_drawer",children:[e.jsxs("div",{className:"drawer_header",children:[e.jsxs("div",{className:"col",style:{gap:2,minWidth:0},children:[e.jsx("div",{className:"drawer_title",title:l.filename,children:l.title}),e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:[I||l.kind||"locating…",l.filename?` • ${l.filename}`:""]})]}),e.jsxs("div",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[l.filename?e.jsx("button",{className:"btn",onClick:()=>mn(`docs/backlog/${I||l.kind||"planned"}/${l.filename}`),title:"Copy repo path",children:"Copy path"}):null,e.jsx("button",{className:"btn",onClick:c,children:"Close"})]})]}),e.jsxs("div",{className:"tab_bar work_drawer_tabs",children:[e.jsx("button",{className:`tab ${_==="spec"?"active":""}`,onClick:()=>y("spec"),children:"Spec"}),e.jsxs("button",{className:`tab ${_==="runs"?"active":""}`,onClick:()=>y("runs"),children:["Runs ",U.length?`(${U.length})`:""]}),e.jsxs("button",{className:`tab ${_==="review"?"active":""}`,onClick:()=>y("review"),children:["Review",V?" ●":""]})]}),e.jsxs("div",{className:"drawer_body work_drawer_body",children:[F?e.jsx("div",{className:"mono board_error",children:F}):null,_==="spec"?e.jsxs(e.Fragment,{children:[l.has_live_request?e.jsx("div",{className:"mono",style:{color:"rgb(250, 204, 21)",fontSize:"var(--font-size-sm)",marginBottom:"8px"},children:"An execution holds a queue-time snapshot of this spec — edits here will NOT reach the running agent; they apply to the next run (and QA iterations re-run from the snapshot plus your feedback)."}):null,l.filename?e.jsxs("div",{className:"work_meta_editor",children:[e.jsxs("select",{value:Te,onChange:me=>Me(me.target.value),disabled:D,title:"Priority",children:[e.jsx("option",{value:"",children:"priority: unset"}),zl.map(me=>e.jsx("option",{value:me,children:jh[me]},me))]}),e.jsx("input",{value:ve,onChange:me=>ce(me.target.value),placeholder:"labels (comma-separated; sprints: sprint-29)",disabled:D}),e.jsx("button",{className:"btn",onClick:()=>void ye(),disabled:D||!r||z,children:D?"Saving…":"Save metadata"}),Q?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:()=>E(!1),disabled:le,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:()=>void se(),disabled:le,children:le?"Saving…":"Save spec"})]}):e.jsx("button",{className:"btn",onClick:()=>{oe(b),E(!0)},disabled:z,children:"Edit spec"})]}):null,z?e.jsx("div",{className:"mono muted",children:"Loading…"}):Q?e.jsx("textarea",{className:"mono work_spec_editor",value:Z,onChange:me=>oe(me.target.value),rows:24}):b?e.jsxs(e.Fragment,{children:[e.jsx(ds,{className:"md_doc",text:b}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-xs)",marginTop:"10px"},children:"Deep tooling (maintenance AI chat, attachments, advisor) lives on the Backlog page."})]}):e.jsx("div",{className:"mono muted",children:"No spec file for this card (batch execution). See Runs."})]}):null,_==="runs"?e.jsxs(e.Fragment,{children:[M?e.jsx("div",{className:"mono muted",children:"Loading…"}):null,!M&&!U.length?e.jsx("div",{className:"mono muted",children:"No executions for this item in recent history (window: live + last 200 finished)."}):null,U.map(me=>{const be=String(me.status||"").toLowerCase(),G=Ml(me);return e.jsxs("div",{className:"work_run_row",children:[e.jsx("span",{className:`chip mono ${Al(be)}`,children:be}),e.jsx("span",{className:"mono muted",children:da(me.request_id,18)}),e.jsx("span",{className:"mono muted",children:me.created_at?new Date(me.created_at).toLocaleString():""}),e.jsx("span",{className:"mono muted",children:G.run_ms!=null?`ran ${Is(G.run_ms)}`:""}),me.target_agent?e.jsx("span",{className:"chip mono muted",children:me.target_agent}):null,be==="running"||be==="queued"||be==="awaiting_qa"?e.jsx("button",{className:"btn",onClick:()=>m(me.request_id),children:be==="awaiting_qa"?"View logs":"Follow live"}):null]},me.request_id)})]}):null,_==="review"?V?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_title",style:{marginTop:0},children:"Definition of Done — acceptance criteria"}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-xs)",marginBottom:"6px"},children:"Criteria come from the current spec file; if the agent refined them inside the candidate, review against the candidate patch too. Ticks live in this drawer session only."}),fe.acceptance.length?e.jsx("div",{className:"work_dod_list",children:fe.acceptance.map((me,be)=>e.jsxs("label",{className:"work_dod_item",children:[e.jsx("input",{type:"checkbox",checked:!!Ae[`${be}:${me.text}`],onChange:G=>Ge(ke=>({...ke,[`${be}:${me.text}`]:G.target.checked}))}),e.jsx("span",{children:me.text})]},`dod:${be}:${me.text}`))}):e.jsx("div",{className:"mono muted",children:"This spec declares no acceptance criteria — review against the diff and logs."}),(()=>{const me=String((A==null?void 0:A.execution_mode)||"uat").toLowerCase(),be=String((A==null?void 0:A.candidate_relpath)||"").trim(),G=A==null?void 0:A.promotion_report,ke=!!(G!=null&&G.blocked);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"row",style:{alignItems:"center",gap:"10px",flexWrap:"wrap",marginTop:"8px"},children:[e.jsxs("span",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:["mode: ",me,be?` • candidate: ${be}`:""]}),e.jsx("button",{className:"btn",onClick:()=>m(V.request_id),title:"Open this run's logs and events in Executions",children:"View run logs"})]}),ke?e.jsxs("div",{className:"mono board_error",style:{marginTop:"6px"},children:["Promotion blocked: ",String((G==null?void 0:G.reason)||"conflicts")," — iterate on top of current prod or resolve manually."]}):null]})})(),fe.acceptance.length&&ie>0?e.jsxs("div",{className:"mono",style:{color:"rgb(250, 204, 21)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:[ie," acceptance criteri",ie===1?"on":"a"," unconfirmed — promoting anyway is an override."]}):null,e.jsx("textarea",{value:ge,onChange:me=>he(me.target.value),rows:3,placeholder:"QA feedback (what to change / fix)…",style:{width:"100%",marginTop:"10px"},disabled:O}),te?e.jsx("div",{className:"mono board_error",children:te}):null,e.jsxs("div",{className:"row",style:{gap:8,marginTop:"10px",flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{className:"btn",onClick:()=>void Ye("deploy_uat"),disabled:O,children:"Restart UAT"}),_e?e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn danger",onClick:()=>void Ye("promote"),disabled:O,children:["Confirm: promote to prod",ie>0?` (${ie} unconfirmed)`:""," + redeploy"]}),e.jsx("button",{className:"btn",onClick:()=>qe(!1),disabled:O,children:"Cancel"})]}):e.jsx("button",{className:"btn primary",onClick:()=>qe(!0),disabled:O,children:fe.acceptance.length&&ie>0?"Promote (override)…":"Approve → promote…"}),e.jsx("button",{className:"btn",onClick:()=>void Ye("feedback"),disabled:O,children:"Iterate (send feedback)"})]})]}):e.jsx("div",{className:"mono muted",children:"Nothing awaiting review for this item."}):null]})]})})}function $r(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`id_${Date.now()}_${Math.random().toString(16).slice(2)}`}async function lv(a){const s=[],r=[];for(const l of a){const c=String((l==null?void 0:l.name)||"").trim()||"attachment";r.push(c);try{const d=await l.text();s.push(`[attached file: ${c}]
|
|
65
|
-
|
|
66
|
-
\`\`\`
|
|
67
|
-
${d}
|
|
68
|
-
\`\`\``)}catch{s.push(`[attached file: ${c}] (unreadable in browser)`)}}return{picked:r,text:s.join(`
|
|
69
|
-
|
|
70
|
-
`)}}function ov(a){const{gateway:s,can_use_gateway:r,is_compact_layout:l,maint_provider:c,maint_model:d,maint_reasoning:m,advisor_agent:p,focus_kind:_,focus_type:y}=a,[b,x]=h.useState(!1),[N,L]=h.useState([]),[I,C]=h.useState(""),[z,B]=h.useState(!1),[F,q]=h.useState(""),[Q,E]=h.useState(!1),[Z,oe]=h.useState([]),le=h.useRef(null),pe=h.useRef(null),Te=String(a.voice_session_id||"").trim()||"abstractcontinuum_backlog_advisor",[Me,ve]=h.useState(""),[ce,D]=h.useState("");h.useEffect(()=>{(async()=>{try{const A=await od(Te);ve(A)}catch{ve("")}})()},[Te]);const R=h.useMemo(()=>{if(!r)return{};const A=String(Me||"").trim(),ee=Te;return{tts:async ge=>{if(!A)throw new Error("Voice store not available (missing run_id).");const he=await s.voice_tts(A,{text:ge,request_id:$r()}),O=he==null?void 0:he.audio_artifact,je=O&&typeof O=="object"&&!Array.isArray(O)?String(O.$artifact||"").trim():"";if(!je)throw new Error("TTS failed: missing audio artifact");return await(await s.download_run_artifact_content(A,je)).arrayBuffer()},transcribe:async(ge,he)=>{if(!A)throw new Error("Voice input unavailable (missing run_id).");const O=String(he||ge.type||"").toLowerCase(),je=O.includes("mp4")?"m4a":O.includes("ogg")?"ogg":O.includes("wav")?"wav":"webm",te=new File([ge],`recording.${je}`,{type:O||"audio/webm"}),Ce=await s.attachments_upload(ee,te,{filename:te.name,content_type:te.type}),Ae=await s.audio_transcribe(A,{audio_artifact:Ce,request_id:$r()});return String((Ae==null?void 0:Ae.text)||"").trim()}}},[r,s,Me,Te]),U=sh({...R,on_error:D,on_transcript:A=>{const ee=String(A||"").trim();ee&&(C(ge=>{const he=String(ge||"");return he.trim()?`${he.trimEnd()}
|
|
71
|
-
${ee}`:ee}),window.setTimeout(()=>{var ge;return(ge=le.current)==null?void 0:ge.focus()},0))}});h.useEffect(()=>{if(!b)return;const A=ee=>{ee.key==="Escape"&&(w(),x(!1))};return window.addEventListener("keydown",A),setTimeout(()=>{var ee;return(ee=le.current)==null?void 0:ee.focus()},0),()=>window.removeEventListener("keydown",A)},[b]);async function X(){if(z||!r)return;if(U.voice_ptt_busy){D("Wait for transcription to finish.");return}q(""),D("");const A=I.trim();if(!A)return;const ee={id:$r(),role:"user",content:A,ts:new Date().toISOString()},ge=[...N,ee];L(ge),C(""),B(!0);try{const he=await s.backlog_advisor({messages:ge.map(Ce=>({role:Ce.role,content:Ce.content})),provider:c||null,model:d||null,thinking:m||null,agent:p||null,include_trace:Q,focus_kind:_,focus_type:y}),O=Q&&Array.isArray(he==null?void 0:he.tool_trace)?he.tool_trace:[],je=String((he==null?void 0:he.run_id)||"").trim(),te=String((he==null?void 0:he.reply)||"").trim();if(Q&&O.length){const Ce={id:$r(),role:"system",title:"Tool execution",level:"info",ts:new Date().toISOString(),content:JSON.stringify({run_id:je||null,tool_trace:O},null,2)};L(Ae=>[...Ae,Ce])}te&&L(Ce=>[...Ce,{id:$r(),role:"assistant",content:te,ts:new Date().toISOString()}])}catch(he){q(String((he==null?void 0:he.message)||he||"Backlog advisor failed"))}finally{B(!1)}}async function M(A){var O;const ee=Array.from(A||[]);if(!ee.length)return;const{picked:ge,text:he}=await lv(ee);oe(je=>[...ge,...je].slice(0,12)),C(je=>{const te=String(je||"").trim();return te?`${te}
|
|
72
|
-
|
|
73
|
-
${he}`:he});try{(O=le.current)==null||O.focus()}catch{}}function ue(A){const ee=String(A.id||A.ts||"").trim(),ge=String(A.content||"").trim();!ee||!ge||(D(""),U.toggle_tts(ee,ge))}function V(A){const ee=String(A.id||A.ts||"").trim(),ge=U.tts_playback;return!ee||!ge.key||ge.key!==ee?"idle":ge.status}function w(){U.stop_voice_ptt_recording(),U.stop_tts()}return e.jsxs(e.Fragment,{children:[e.jsx("button",{className:`advisor_toggle ${b?"open":""}`,onClick:()=>{x(A=>{const ee=!A;return ee||w(),ee})},title:"Open backlog advisor (read-only)","aria-label":"Open backlog advisor",children:e.jsx("span",{className:"advisor_toggle_label",children:"Advisor"})}),b?e.jsx("div",{className:"drawer_backdrop",onMouseDown:A=>{A.target===A.currentTarget&&(w(),x(!1))},children:e.jsxs("div",{className:"drawer_panel",children:[e.jsxs("div",{className:"drawer_header",children:[e.jsxs("div",{className:"col",style:{gap:2},children:[e.jsx("div",{className:"drawer_title",children:"Backlog advisor"}),e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:["Read-only. Agent: ",p||"basic-agent"," • Using: ",c||"(gateway default)"," / ",d||"(gateway default)"]})]}),e.jsxs("div",{className:"row",style:{gap:8,justifyContent:"flex-end"},children:[e.jsxs("button",{className:`btn btn_icon ${Q?"primary":""}`,onClick:()=>E(A=>!A),disabled:z,title:Q?"Hide tool execution":"Show tool execution","aria-label":Q?"Hide tool execution":"Show tool execution",children:[e.jsx(rt,{name:"terminal",size:16}),l?null:Q?"Tools on":"Tools"]}),e.jsx("button",{className:"btn",onClick:()=>L([]),disabled:z||!N.length,children:"Clear"}),e.jsx("button",{className:"btn",onClick:()=>{w(),x(!1)},children:"Close"})]})]}),e.jsxs("div",{className:"drawer_body",children:[e.jsx(ld,{messages:N,className:"drawer_chat_thread",messageProps:U.tts_supported&&r&&Me.trim()?{onSpeakToggle:ue,getSpeakState:V,jsonCollapseAfterDepth:4}:{jsonCollapseAfterDepth:4},empty:e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Ask about the backlog, e.g. “What are the top 5 planned items to focus on next and why?”"})}),e.jsxs("div",{className:"drawer_footer",children:[e.jsx("input",{ref:pe,type:"file",multiple:!0,style:{display:"none"},onChange:A=>{const ee=Array.from(A.currentTarget.files||[]);A.currentTarget.value="",ee.length&&M(ee)}}),e.jsx(Yo,{ref:le,value:I,onChange:C,onSubmit:()=>void X(),placeholder:"Message to backlog advisor…",disabled:!r,busy:z||U.voice_ptt_busy,rows:3,sendButtonClassName:"btn primary",busyLabel:U.voice_ptt_busy?"Transcribing…":"Thinking…",actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:`btn btn_icon voice_btn${U.voice_ptt_recording?" danger":""}`,type:"button",disabled:!r||!Me.trim()||z||U.voice_ptt_busy||!U.voice_ptt_supported,title:U.voice_ptt_supported?U.voice_ptt_busy?"Transcribing…":U.voice_ptt_recording?"Recording… release to transcribe":"Hold to talk (record + transcribe)":"Voice recording is not supported in this browser","aria-label":"Voice input",onPointerDown:A=>{var ee,ge;if(!(!r||!Me.trim()||z||U.voice_ptt_busy||!U.voice_ptt_supported)){A.preventDefault();try{(ge=(ee=A.currentTarget)==null?void 0:ee.setPointerCapture)==null||ge.call(ee,A.pointerId)}catch{}U.start_voice_ptt_recording()}},onPointerUp:A=>{A.preventDefault(),U.stop_voice_ptt_recording()},onPointerCancel:A=>{A.preventDefault(),U.stop_voice_ptt_recording()},children:[e.jsx(rt,{name:U.voice_ptt_recording?"x":"mic",size:16}),l?null:U.voice_ptt_busy?"Transcribing…":U.voice_ptt_recording?"Recording…":"Voice"]}),e.jsxs("button",{className:"btn btn_icon",type:"button",onClick:()=>{var A;return(A=pe.current)==null?void 0:A.click()},disabled:z,title:"Attach a local file to your message","aria-label":"Attach file",children:[e.jsx(rt,{name:"paperclip",size:16}),l?null:"Attach"]})]})}),Z.length?e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"6px"},children:["Last attached: ",Z[0]]}):null,F?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:F}):null,ce?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:ce}):null,r?null:e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:"Connect the gateway in Settings to use the advisor."})]})]})]})}):null]})}function Ua({open:a,title:s,children:r,actions:l,variant:c="default",onClose:d}){if(h.useEffect(()=>{if(!a)return;const p=_=>{_.key==="Escape"&&d()};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[a,d]),!a)return null;const m=c==="fullscreen";return e.jsx("div",{className:`modal_backdrop${m?" fullscreen":""}`,onMouseDown:p=>{p.target===p.currentTarget&&d()},children:e.jsxs("div",{className:`modal_panel${m?" fullscreen":""}`,children:[e.jsxs("div",{className:"modal_header",children:[e.jsx("div",{className:"modal_title",children:s}),e.jsx("button",{className:"btn",onClick:d,children:"Close"})]}),e.jsx("div",{className:"modal_body",children:r}),l?e.jsx("div",{className:"modal_footer",children:l}):null]})})}function cv(a){const{readiness:s,server_refused:r,on_open_spec:l}=a;return s?e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginBottom:"6px"},children:["Definition of Ready"," ",e.jsx("span",{style:{opacity:.7},children:r?"(the gateway refused this execute — server-evaluated checks below)":"(advisory — parsed from the spec)"})]}),s.checks.map(c=>e.jsxs("div",{className:"mono",style:{fontSize:"var(--font-size-sm)",color:c.ok?"rgb(74, 222, 128)":"rgb(250, 204, 21)"},children:[c.ok?"✓":"○"," ",c.label,c.evidence?e.jsxs("span",{style:{opacity:.75},children:[" — ",c.evidence]}):null]},c.id)),s.ok?null:e.jsxs("div",{className:"row",style:{alignItems:"center",gap:"10px",marginTop:"6px",flexWrap:"wrap"},children:[e.jsx("span",{className:"mono",style:{color:"rgb(250, 204, 21)",fontSize:"var(--font-size-sm)"},children:"This spec is not ready — executing anyway is an override."}),l?e.jsx("button",{className:"btn",type:"button",onClick:l,children:"Open spec to fix"}):null]})]}):e.jsx("div",{style:{marginTop:"10px"},children:e.jsx("div",{className:"mono",style:{color:"rgb(250, 204, 21)",fontSize:"var(--font-size-sm)"},children:"Definition of Ready: NOT EVALUATED — the spec could not be scanned. The server gate still checks on execute."})})}function Eh(a){const{exec_cfg:s,with_setup:r}=a,l=["abstractgateway config set backlog_exec_runner on # or: Settings → Gateway administration → Enable","abstractgateway config set executor codex # canonical: codex | claude | cursor-agent | abstractcode"];return e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx("div",{className:"detail_warn",style:{marginTop:0},children:(s==null?void 0:s.runner_enabled)!==!0?"Backlog exec runner is disabled on this gateway — admins can enable it live from Settings → Gateway administration.":(s==null?void 0:s.runner_alive)===!1?"Backlog exec runner is not running on this gateway.":(s==null?void 0:s.codex_available)===!1?`The configured executor is not available on the gateway host (${String((s==null?void 0:s.codex_bin)||(s==null?void 0:s.executor)||"binary")} not found).`:"Backlog exec is not available on this gateway."}),s!=null&&s.runner_error?e.jsx("div",{className:"detail_hint",children:s.runner_error}):null,r?e.jsxs("details",{style:{marginTop:"8px"},children:[e.jsx("summary",{className:"muted",style:{fontSize:"var(--font-size-sm)",cursor:"pointer"},children:"Setup from the gateway's computer (terminal)"}),e.jsxs("div",{style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:[e.jsx("pre",{className:"mono setup_callout_pre",style:{marginTop:0},children:l.join(`
|
|
74
|
-
`)}),e.jsx("button",{className:"btn",style:{marginTop:"4px"},onClick:()=>mn(l.join(`
|
|
75
|
-
`)),children:"Copy setup"})]})]}):null]})}function Th(a){const{value:s,onChange:r,disabled:l,inplace_warning:c,uat_note:d}=a;return e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginBottom:"6px"},children:"Execution mode"}),e.jsxs("select",{className:"input",value:s,onChange:m=>r(m.target.value),disabled:l,style:{width:"100%"},children:[e.jsx("option",{value:"uat",children:"UAT (staged, safe)"}),e.jsx("option",{value:"inplace",children:"Inplace (dangerous, edits prod)"})]}),s==="inplace"?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:c}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:d})]})}const uv=["minimal","low","medium","high"];function Ah(a){const{executors:s,value:r,onChange:l,disabled:c}=a;if(!s||!s.length)return null;const d=s.find(m=>m.default);return e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginBottom:"6px"},children:"Execution agent"}),e.jsxs("select",{className:"input",value:r,onChange:m=>l(m.target.value),disabled:c,style:{width:"100%"},children:[e.jsxs("option",{value:"",children:["gateway default",d?` (${d.display||d.id})`:""]}),s.map(m=>e.jsxs("option",{value:m.id,disabled:m.available===!1,children:[m.display||m.id,m.available===!1?" (unavailable on the gateway host)":""]},m.id))]})]})}function dv(a){const{exec_cfg:s,model:r,set_model:l,effort:c,set_effort:d,disabled:m}=a;return e.jsxs("details",{style:{marginTop:"8px"},open:!!(r||c),children:[e.jsx("summary",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",cursor:"pointer"},children:"Assign a different agent (operator override)"}),e.jsxs("div",{className:"row",style:{gap:"10px",flexWrap:"wrap",marginTop:"8px"},children:[e.jsx("div",{className:"col",style:{minWidth:200},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Model"}),e.jsx("input",{value:r,onChange:p=>l(p.target.value),placeholder:String((s==null?void 0:s.codex_model)||"gateway default"),disabled:m})]})}),e.jsx("div",{className:"col",style:{minWidth:160},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Reasoning effort"}),e.jsxs("select",{value:c,onChange:p=>d(p.target.value),disabled:m,children:[e.jsx("option",{value:"",children:"gateway default"}),uv.map(p=>e.jsx("option",{value:p,children:p},p))]})]})})]}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"4px"},children:"Overrides validate against the gateway's model allowlist; a refusal is shown verbatim below."})]})}function Rh(a){const{open:s,target:r,execute_mode:l,set_execute_mode:c,action_loading:d,action_error:m,exec_cfg:p,exec_cfg_loading:_,exec_cfg_error:y,on_confirm:b,on_close:x}=a,N=a.readiness??null,L=a.show_readiness===!0,[I,C]=Kt.useState(""),[z,B]=Kt.useState(""),[F,q]=Kt.useState(""),Q=(r==null?void 0:r.filename)||"";Kt.useEffect(()=>{C(""),B(""),q("")},[Q]);const E=I.trim()||z||F?{executor:F||void 0,target_model:I.trim()||void 0,target_reasoning_effort:z||void 0}:void 0;return e.jsxs(Ua,{open:s,title:"Execute backlog item?",onClose:x,actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:x,disabled:d,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:()=>b(E),disabled:d||_||!r||(p==null?void 0:p.can_execute)!==!0,children:d?"Executing…":L&&!N?"Execute (readiness unknown)":N&&!N.ok?"Execute anyway (override)":"Execute"})]}),children:[e.jsxs("div",{className:"mono",style:{fontSize:"var(--font-size-sm)"},children:["Target:"," ",e.jsx("span",{className:"mono",style:{fontWeight:700},children:r?r.title:"(unknown)"})]}),p?e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"6px"},children:["Agent: ",String(p.executor||"executor"),p.codex_model?` · ${p.codex_model}`:"",p.codex_reasoning_effort?` (reasoning ${p.codex_reasoning_effort})`:""]}):null,e.jsx(Ah,{executors:a.executors??null,value:F,onChange:q,disabled:d}),e.jsx(dv,{exec_cfg:p,model:I,set_model:C,effort:z,set_effort:B,disabled:d}),L?e.jsx(cv,{readiness:N,server_refused:a.server_refused,on_open_spec:a.on_open_spec}):null,e.jsx(Th,{value:l,onChange:c,disabled:d,inplace_warning:"Warning: inplace runs directly in the prod workspace. Use only when you understand the risk.",uat_note:"The run will execute in a candidate workspace. When it reaches “awaiting QA”, click “Restart UAT” to deploy it to the shared UAT stack. After you promote or iterate, UAT services are stopped automatically."}),_?e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"10px"},children:"Checking worker…"}):null,!_&&(p==null?void 0:p.can_execute)!==!0?e.jsx(Eh,{exec_cfg:p,with_setup:!0}):null,y?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"10px"},children:y}):null,m?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"10px"},children:m}):null]})}function mv(a){const{open:s,batch_selected_items:r,batch_execute_mode:l,set_batch_execute_mode:c,batch_execute_loading:d,batch_execute_error:m,exec_cfg:p,exec_cfg_loading:_,exec_cfg_error:y,on_confirm:b,on_close:x}=a,[N,L]=Kt.useState("");return Kt.useEffect(()=>{s||L("")},[s]),e.jsxs(Ua,{open:s,title:"Execute batch (single context)?",onClose:x,actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:x,disabled:d,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:()=>b(N||void 0),disabled:d||_||r.length<2||(p==null?void 0:p.can_execute)!==!0,children:d?"Executing…":"Execute batch"})]}),children:[e.jsxs("div",{className:"mono",style:{fontSize:"var(--font-size-sm)"},children:["Items:"," ",e.jsx("span",{className:"mono",style:{fontWeight:700},children:r.length})]}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:"This queues a single exec request whose prompt includes all selected backlog items (in order), so the agent keeps a shared growing context."}),e.jsx(Ah,{executors:a.executors??null,value:N,onChange:L,disabled:d}),e.jsx(Th,{value:l,onChange:c,disabled:d,inplace_warning:"Warning: inplace runs directly in the prod workspace (for the entire batch). Use only when you understand the risk.",uat_note:"The batch will execute in a candidate workspace. When it reaches “awaiting QA”, click “Restart UAT” to deploy it to the shared UAT stack. After you promote or iterate, UAT services are stopped automatically."}),r.length?e.jsx("div",{className:"mono",style:{fontSize:"var(--font-size-sm)",marginTop:"10px"},children:r.map(I=>e.jsxs("div",{children:["- docs/backlog/planned/",I.filename]},`batchitem:${I.filename}`))}):null,_?e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"10px"},children:"Checking worker…"}):null,!_&&(p==null?void 0:p.can_execute)!==!0?e.jsx(Eh,{exec_cfg:p}):null,y?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"10px"},children:y}):null,m?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"10px"},children:m}):null]})}function fv(a){const{open:s,batch_selected_items:r,merge_package:l,set_merge_package:c,merge_task_type:d,set_merge_task_type:m,merge_title:p,set_merge_title:_,merge_summary:y,set_merge_summary:b,merge_loading:x,merge_error:N,on_confirm:L,on_close:I}=a;return e.jsxs(Ua,{open:s,title:"Merge planned items into master backlog?",onClose:I,actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:I,disabled:x,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:L,disabled:x||r.length<2||!p.trim()||!l.trim(),children:x?"Merging…":"Create master"})]}),children:[e.jsxs("div",{className:"row",style:{gap:"10px",flexWrap:"wrap"},children:[e.jsx("div",{className:"col",style:{minWidth:220},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Package"}),e.jsx("input",{value:l,onChange:C=>c(C.target.value),placeholder:"framework"})]})}),e.jsx("div",{className:"col",style:{minWidth:220},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Type"}),e.jsx("select",{value:d,onChange:C=>m(C.target.value),children:Ba.map(C=>e.jsx("option",{value:C,children:C},C))})]})})]}),e.jsxs("div",{className:"field",style:{marginTop:"10px"},children:[e.jsx("label",{children:"Title"}),e.jsx("input",{value:p,onChange:C=>_(C.target.value),placeholder:"Master backlog"})]}),e.jsxs("div",{className:"field",style:{marginTop:"10px"},children:[e.jsx("label",{children:"Summary (optional)"}),e.jsx("textarea",{value:y,onChange:C=>b(C.target.value),rows:3})]}),r.length?e.jsxs("div",{style:{marginTop:"10px"},children:[e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Referenced backlog items:"}),e.jsx("div",{className:"mono",style:{fontSize:"var(--font-size-sm)",marginTop:"6px"},children:r.map(C=>e.jsxs("div",{children:["- docs/backlog/planned/",C.filename]},`mergeitem:${C.filename}`))})]}):null,N?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"10px"},children:N}):null]})}function fd(a){const s=()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(a).matches,[r,l]=h.useState(s);return h.useEffect(()=>{var m;if(typeof window>"u"||typeof window.matchMedia!="function")return;const c=window.matchMedia(a),d=()=>l(c.matches);return d(),typeof c.addEventListener=="function"?c.addEventListener("change",d):(m=c.addListener)==null||m.call(c,d),()=>{var p;typeof c.removeEventListener=="function"?c.removeEventListener("change",d):(p=c.removeListener)==null||p.call(c,d)}},[a]),r}function Lh(a,s){const[r,l]=h.useState(null);return h.useEffect(()=>{if(!s){l(null);return}let c=!1;return(async()=>{try{const d=await a.admin_executors(),m=Array.isArray(d)?d:Array.isArray(d==null?void 0:d.executors)?d.executors:[];c||l(m)}catch{c||l(null)}})(),()=>{c=!0}},[s]),r}function hd(a){const{gateway:s,can_use_gateway:r,kind:l,completed_view:c,is_exec_view:d,is_compact_layout:m,set_compact_pane:p,on_status_transfer:_}=a,[y,b]=h.useState(null),[x,N]=h.useState(!1),[L,I]=h.useState(""),[C,z]=h.useState([]),[B,F]=h.useState(!1),[q,Q]=h.useState(""),[E,Z]=h.useState(null),[oe,le]=h.useState(null),[pe,Te]=h.useState(!1),[Me,ve]=h.useState(""),[ce,D]=h.useState(""),[R,U]=h.useState(!1),[X,M]=h.useState(""),[ue,V]=h.useState("events"),[w,A]=h.useState(""),[ee,ge]=h.useState(!1),[he,O]=h.useState(""),[je,te]=h.useState(!1),[Ce,Ae]=h.useState(!0),Ge=h.useRef(null),fe=h.useRef(!0),Re=h.useRef(null),Ie=h.useRef(!1),se=h.useRef(!1),ye=1e6,_e=h.useMemo(()=>ue!=="events"?null:zg(w),[w,ue]),qe=h.useMemo(()=>Pg(_e),[_e]),Ye=Ml(E);function ie(){Z(null),le(null),ve(""),A(""),O(""),te(!1),Re.current=null}async function me(){if(!r)return null;if(x)return y;I(""),N(!0);try{const Y=await s.backlog_exec_config();return b(Y),Y}catch(Y){const Se=String((Y==null?void 0:Y.message)||Y||"Failed to load backlog exec config");return I(Se),b(null),null}finally{N(!1)}}async function be(Y,Se,ze){if(se.current)return C;se.current=!0,ze!=null&&ze.background||F(!0);const Ke=Y||l;try{const nt=Lg(Ke,Se||c),dt=await s.backlog_exec_requests({status:nt,limit:200}),yt=Array.isArray(dt==null?void 0:dt.requests)?dt.requests:[];Q(""),z(yt);const ht=String((E==null?void 0:E.status)||"").trim().toLowerCase(),Et=ht==="failed"||ht==="completed"||ht==="promoted";if(Ke==="processing"&&(E!=null&&E.request_id)&&!Et&&!yt.some(Ut=>Ut.request_id===E.request_id))try{const Ut=await s.backlog_exec_request(E.request_id),De=Ut==null?void 0:Ut.payload,it=String((De==null?void 0:De.status)||"").trim().toLowerCase();(it==="failed"||it==="completed"||it==="promoted")&&(_(it),le(De),Z(wl(De,E.request_id)))}catch{}if(E!=null&&E.request_id){const Ut=yt.find(De=>De.request_id===E.request_id)||null;Ut&&Z(Ut)}return yt}catch(nt){return Q(String((nt==null?void 0:nt.message)||nt||"Failed to load backlog exec requests")),[]}finally{se.current=!1,ze!=null&&ze.background||F(!1)}}async function G(Y){if(r){Z(Y),m&&p("detail"),le(null),ve(""),Te(!0),M(""),D(""),A(""),O(""),te(!1),Re.current=null;try{const Se=await s.backlog_exec_request(Y.request_id);le((Se==null?void 0:Se.payload)??null)}catch(Se){ve(String((Se==null?void 0:Se.message)||Se||"Failed to load request"))}finally{Te(!1)}}}async function ke(Y){if(!r)return;const Se=String((E==null?void 0:E.request_id)||"").trim();if(!Se||R)return;const ze=String(ce||"");if(!ze.trim()){M("Feedback is required.");return}M(""),U(!0);try{const Ke=await s.backlog_exec_feedback({request_id:Se,feedback:ze}),nt=(Ke==null?void 0:Ke.payload)??null;le(nt),nt&&Z(wl(nt,Se)),D(""),await Y()}catch(Ke){M(String((Ke==null?void 0:Ke.message)||Ke||"Failed to send feedback"))}finally{U(!1)}}async function Xe(Y){if(!r)return;const Se=String((E==null?void 0:E.request_id)||"").trim();if(Se&&!R){M(""),U(!0);try{const ze=await s.backlog_exec_promote({request_id:Se,redeploy:!0}),Ke=(ze==null?void 0:ze.payload)??null;le(Ke),Ke&&Z(wl(Ke,Se)),D(""),await Y()}catch(ze){M(String((ze==null?void 0:ze.message)||ze||"Failed to promote to prod"));try{const Ke=await s.backlog_exec_request(Se),nt=(Ke==null?void 0:Ke.payload)??null;le(nt),nt&&Z(wl(nt,Se))}catch{}}finally{U(!1)}}}async function J(Y){if(!r)return;const Se=String((E==null?void 0:E.request_id)||"").trim();if(Se&&!R){M(""),U(!0);try{const ze=await s.backlog_exec_deploy_uat({request_id:Se}),Ke=(ze==null?void 0:ze.payload)??null;le(Ke),Ke&&Z(wl(Ke,Se)),await Y()}catch(ze){M(String((ze==null?void 0:ze.message)||ze||"Failed to deploy to UAT"))}finally{U(!1)}}}async function T(Y){if(!r)return;const Se=String((Y==null?void 0:Y.request_id)||(E==null?void 0:E.request_id)||"").trim();if(!Se)return;const ze=(Y==null?void 0:Y.name)||ue,Ke=typeof(Y==null?void 0:Y.max_bytes)=="number"&&Number.isFinite(Y.max_bytes)?Number(Y.max_bytes):16e4;if(!Ie.current){Ie.current=!0,O(""),ge(!0);try{const nt=`${Se}::${String(ze)}`,dt=Re.current,yt=dt!==null&&dt.key===nt,ht=await s.backlog_exec_log_tail({request_id:Se,name:String(ze),max_bytes:Ke,...yt?{after_bytes:dt.offset}:{}}),Et=typeof(ht==null?void 0:ht.next_offset)=="number"&&Number.isFinite(ht.next_offset),Ut=String((ht==null?void 0:ht.content)||"");yt&&Et&&(ht==null?void 0:ht.reset)!==!0?(Ut&&A(De=>{let it=De+Ut;if(it.length>ye){const tt=it.length-ye,jt=it.indexOf(`
|
|
76
|
-
`,tt);it=jt>=0?it.slice(jt+1):it.slice(tt),te(!0)}return it}),Re.current={key:nt,offset:Number(ht.next_offset)}):(A(Ut),te(!!(ht!=null&&ht.truncated)),Re.current=Et?{key:nt,offset:Number(ht.next_offset)}:null)}catch(nt){O(String((nt==null?void 0:nt.message)||nt||"Failed to load logs"))}finally{Ie.current=!1,ge(!1)}}}return h.useEffect(()=>{r&&d&&me()},[d,r]),h.useEffect(()=>{if(!r||!d)return;const Se=setInterval(()=>{s.is_backing_off()||be(l,void 0,{background:!0})},l==="processing"?2e3:5e3);return()=>clearInterval(Se)},[l,c,r,d,E==null?void 0:E.request_id]),h.useEffect(()=>{r&&d&&E!=null&&E.request_id&&T({request_id:E.request_id,name:ue})},[E==null?void 0:E.request_id,ue,d,r]),h.useEffect(()=>{fe.current=!0},[E==null?void 0:E.request_id,ue]),h.useEffect(()=>{if(!Ge.current||!fe.current)return;const Se=window.requestAnimationFrame(()=>{const ze=Ge.current;ze&&(ze.scrollTop=ze.scrollHeight)});return()=>window.cancelAnimationFrame(Se)},[w,ue,E==null?void 0:E.request_id]),h.useEffect(()=>{if(!r||!d||!(E!=null&&E.request_id))return;const Y=String(E.status||"").trim().toLowerCase();if(Y==="completed"||Y==="promoted"||Y==="failed"||Y!=="running"&&Ce!==!0)return;const ze=setInterval(()=>{s.is_backing_off()||T({request_id:E.request_id,name:ue})},Y==="running"?1500:2500);return()=>clearInterval(ze)},[E==null?void 0:E.request_id,E==null?void 0:E.status,ue,d,r,Ce]),{exec_cfg:y,exec_cfg_loading:x,exec_cfg_error:L,exec_requests:C,exec_loading:B,exec_error:q,exec_selected:E,set_exec_selected:Z,exec_detail:oe,set_exec_detail:le,exec_detail_loading:pe,exec_detail_error:Me,set_exec_detail_error:ve,exec_qa_feedback:ce,set_exec_qa_feedback:D,exec_qa_loading:R,exec_qa_error:X,exec_log_name:ue,set_exec_log_name:V,exec_log_text:w,exec_log_loading:ee,exec_log_error:he,exec_log_truncated:je,exec_log_auto:Ce,set_exec_log_auto:Ae,exec_log_scroll_el_ref:Ge,exec_log_follow_ref:fe,parsed_exec_events:_e,event_stats:qe,time_stats:Ye,clear_exec_selection:ie,load_exec_config:me,refresh_exec_list:be,load_exec_request:G,exec_send_feedback:ke,exec_promote_to_prod:Xe,exec_deploy_uat_now:J,load_exec_log_tail:T}}const Sf=[{id:"planned",label:"Planned"},{id:"proposed",label:"Proposed"},{id:"recurrent",label:"Recurrent"},{id:"completed",label:"Completed"},{id:"deprecated",label:"Deprecated"},{id:"trash",label:"Trash"}];function hv(a){var Zt;const s=a.gateway,r=a.gateway_connected,l=String(a.maintenance_ai_provider||"").trim(),c=String(a.maintenance_ai_model||"").trim(),d=String(a.maintenance_ai_reasoning||"").trim(),m=String(a.backlog_advisor_agent||"").trim()||"basic-agent",p=a.default_execution_mode==="inplace"?"inplace":"uat",_=fd("(max-width: 900px)"),[y,b]=h.useState("planned"),[x,N]=h.useState([]),[L,I]=h.useState(!1),[C,z]=h.useState(""),[B,F]=h.useState(""),[q,Q]=h.useState("all"),[E,Z]=h.useState(""),[oe,le]=h.useState(new Set),pe=h.useRef(0),[Te,Me]=h.useState(null),[ve,ce]=h.useState([]),[D,R]=h.useState(null),[U,X]=h.useState(p),[M,ue]=h.useState(!1),V=Lh(s,r),[w,A]=h.useState(""),[ee,ge]=h.useState(!1),[he,O]=h.useState(p),[je,te]=h.useState(!1),[Ce,Ae]=h.useState(""),[Ge,fe]=h.useState(!1),[Re,Ie]=h.useState(!1),[se,ye]=h.useState("framework"),[_e,qe]=h.useState("task"),[Ye,ie]=h.useState(""),[me,be]=h.useState(""),[G,ke]=h.useState(!1),[Xe,J]=h.useState(""),T=hd({gateway:s,can_use_gateway:r,kind:"planned",completed_view:"tasks",is_exec_view:!1,is_compact_layout:_,set_compact_pane:()=>{},on_status_transfer:()=>{}});async function Y(){if(!r)return;const we=++pe.current;I(!0),z("");try{const $e=await s.backlog_list(y);if(we!==pe.current)return;N(Array.isArray($e==null?void 0:$e.items)?$e.items:[])}catch($e){if(we!==pe.current)return;N([]),z(String(($e==null?void 0:$e.message)||$e||"Failed to load backlog"))}finally{we===pe.current&&I(!1)}if(y==="planned")try{const $e=await s.backlog_exec_active_items();if(we!==pe.current)return;const Oe=new Set;for(const mt of Array.isArray($e==null?void 0:$e.items)?$e.items:[]){const pt=String((mt==null?void 0:mt.filename)||"").trim();pt&&Oe.add(pt)}le(Oe)}catch{we===pe.current&&le(new Set)}else le(new Set)}h.useEffect(()=>{ce([]),Z(""),Y()},[y,r]),h.useEffect(()=>{ce(we=>{const $e=new Set(x.map(mt=>String(mt.filename||"").trim())),Oe=we.filter(mt=>$e.has(mt));return Oe.length===we.length?we:Oe})},[x]);const Se=h.useMemo(()=>{const we=B.trim().toLowerCase(),$e=q.trim().toLowerCase();return x.filter(Oe=>{if($e&&$e!=="all"&&Ll(Oe.task_type)!==$e)return!1;if(!we)return!0;const mt=Array.isArray(Oe.labels)?Oe.labels.join(" "):"";return`${Oe.item_id||""} ${Oe.package||""} ${Oe.title||""} ${Oe.task_type||""} ${Oe.summary||""} ${Oe.filename||""} ${mt} ${Oe.priority||""}`.toLowerCase().includes(we)})},[x,B,q]),ze=h.useMemo(()=>x.filter(we=>ve.includes(String(we.filename||"").trim())),[x,ve]),Ke=bi(C),[nt,dt]=h.useState(0),yt=dd(s,r&&Ke,nt);function ht(we){Me({filename:String(we.filename||""),kind:y,title:we.title||we.filename,initial_tab:"spec"})}async function Et(we,$e){Z("");try{await s.backlog_move({from_kind:y,to_kind:$e,filename:String(we.filename||"")}),await Y()}catch(Oe){Z(String((Oe==null?void 0:Oe.message)||Oe||"Move failed"))}}async function Ut(we){const $e=String(we.filename||"").trim();if(!$e)return;let Oe=null;try{const mt=await s.backlog_content("planned",$e);Oe=ud({task_type:we.task_type},wi(String((mt==null?void 0:mt.content)||"")))}catch{Oe=null}A(""),X(p),R({filename:$e,title:we.title||$e,readiness:Oe}),T.load_exec_config()}async function De(we){if(!(!D||M)){ue(!0),A("");try{const $e=T.exec_cfg||await T.load_exec_config();if(!$e||$e.can_execute!==!0){A(($e==null?void 0:$e.runner_error)||"Backlog exec is not available on this gateway.");return}const Oe=!!(D.readiness&&!D.readiness.ok);await s.backlog_execute({kind:"planned",filename:D.filename,execution_mode:U,executor:we==null?void 0:we.executor,target_model:we==null?void 0:we.target_model,target_reasoning_effort:we==null?void 0:we.target_reasoning_effort,dor:"check",override:Oe}),R(null),await Y()}catch($e){const Oe=Ku($e);Oe?(R(mt=>mt&&{...mt,readiness:Oe,server_refused:!0}),A("")):A(String(($e==null?void 0:$e.message)||$e||"Execute failed"))}finally{ue(!1)}}}async function it(we){if(!(je||ze.length<2)){Ae(""),te(!0);try{const $e=T.exec_cfg||await T.load_exec_config();if(!$e||$e.can_execute!==!0){Ae(($e==null?void 0:$e.runner_error)||"Backlog exec is not available on this gateway.");return}await s.backlog_execute_batch({items:ze.map(Oe=>({kind:"planned",filename:String(Oe.filename||"")})),execution_mode:he,executor:we,dor:"check",override:Ge}),ge(!1),ce([]),fe(!1),await Y()}catch($e){const Oe=Ku($e);if(Oe){const mt=Oe.checks.filter(pt=>!pt.ok);fe(!0),Ae(`Definition of Ready refused by the gateway:
|
|
77
|
-
${mt.map(pt=>`○ ${pt.label}${pt.evidence?` — ${pt.evidence}`:""}`).join(`
|
|
78
|
-
`)}
|
|
79
|
-
Execute batch again to override (recorded as dor_overridden).`)}else Ae(String(($e==null?void 0:$e.message)||$e||"Execute batch failed"))}finally{te(!1)}}}async function tt(){if(G||ze.length<2)return;const we=Ye.trim();if(!we){J("Title is required.");return}J(""),ke(!0);try{await s.backlog_merge({kind:"planned",items:ze.map($e=>({kind:"planned",filename:String($e.filename||"")})),package:se.trim()||"framework",task_type:_e,title:we,summary:me.trim()||void 0}),Ie(!1),ce([]),await Y()}catch($e){J(String(($e==null?void 0:$e.message)||$e||"Merge failed"))}finally{ke(!1)}}function jt(we){const $e=String(we||"").trim();ce(Oe=>Oe.includes($e)?Oe.filter(mt=>mt!==$e):[...Oe,$e])}function ft(we){if(y==="planned"){const $e=oe.has(String(we.filename||"").trim());return e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:()=>void Ut(we),disabled:!r||$e,title:$e?"A live execution request already exists for this item":void 0,children:$e?"Processing…":"Execute"}),e.jsx("button",{className:"btn",title:"Move back to Triage (proposed)",onClick:()=>void Et(we,"proposed"),disabled:!r,children:"→ Triage"}),e.jsx("button",{className:"btn",title:"Move to trash",onClick:()=>void Et(we,"trash"),disabled:!r,children:"Trash"})]})}return y==="proposed"?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",title:"Promote to Ready (planned)",onClick:()=>void Et(we,"planned"),disabled:!r,children:"→ Ready"}),e.jsx("button",{className:"btn",title:"Deprecate",onClick:()=>void Et(we,"deprecated"),disabled:!r,children:"Deprecate"}),e.jsx("button",{className:"btn",title:"Move to trash",onClick:()=>void Et(we,"trash"),disabled:!r,children:"Trash"})]}):y==="recurrent"?e.jsx("button",{className:"btn",title:"Move to trash",onClick:()=>void Et(we,"trash"),disabled:!r,children:"Trash"}):y==="deprecated"||y==="trash"?e.jsx("button",{className:"btn",title:"Restore to Triage (proposed)",onClick:()=>void Et(we,"proposed"),disabled:!r,children:"Restore"}):null}return e.jsxs("div",{className:"page page_pad backlog_page",children:[e.jsxs("div",{className:"page_toolbar",children:[e.jsx("div",{className:"seg seg_scroll",role:"group","aria-label":"Backlog kinds",children:Sf.map(we=>e.jsx("button",{"aria-pressed":y===we.id,className:`seg_btn ${y===we.id?"active":""}`,onClick:()=>b(we.id),children:we.label},we.id))}),r?null:e.jsx("span",{className:"page_hint mono",children:"Not connected — use the connection control (top right)."}),e.jsx("div",{className:"page_toolbar_spacer"}),e.jsxs("button",{className:`btn btn_icon ${L?"is_loading":""}`,onClick:()=>void Y(),disabled:!r||L,title:"Refresh","aria-label":"Refresh",children:[e.jsx(rt,{name:"refresh",size:16}),L?"Refreshing":"Refresh"]})]}),Ke?e.jsx(md,{gateway:s,surface:"the backlog archive",status:yt.status,legacy:yt.legacy,error:C,on_changed:()=>{dt(we=>we+1),Y()}}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"page_toolbar",children:[e.jsx("input",{className:"board_search",value:B,onChange:we=>F(we.target.value),placeholder:"Search backlog (id/title/package/filename…)"}),e.jsxs("select",{value:q,onChange:we=>Q(we.target.value),title:"Filter by type",children:[e.jsx("option",{value:"all",children:"all types"}),Ba.map(we=>e.jsx("option",{value:we,children:we},we))]}),e.jsx("div",{className:"page_toolbar_spacer"}),y==="planned"&&ve.length?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"chip mono info",children:[ve.length," selected"]}),e.jsx("button",{className:"btn primary",disabled:ve.length<2,onClick:()=>{Ae(""),O(p),fe(!1),ge(!0),T.load_exec_config()},children:"Execute batch"}),e.jsx("button",{className:"btn",disabled:ve.length<2,onClick:()=>{const we=ze.map($e=>String($e.package||"").trim()).filter(Boolean);ye(we.length&&we.every($e=>$e===we[0])?we[0]:"framework"),qe("task"),ie(`Master backlog (${ze.length} items)`),be(""),J(""),Ie(!0)},children:"Merge → master"})]}):null,e.jsxs("span",{className:"mono muted backlog_count",style:{fontSize:"var(--font-size-sm)"},children:[Se.length,"/",x.length]})]}),C&&!Ke?e.jsx("div",{className:"page_error mono",children:C}):null,E?e.jsx("div",{className:"page_error mono",children:E}):null,e.jsxs("div",{className:"pane backlog_table_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:(Zt=Sf.find(we=>we.id===y))==null?void 0:Zt.label}),e.jsxs("span",{className:"pane_count",children:[Se.length," item",Se.length===1?"":"s"]})]}),e.jsx("div",{className:"pane_body",style:{padding:0},children:Se.length?e.jsxs("table",{className:"data_table backlog_table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[y==="planned"?e.jsx("th",{className:"backlog_table_sel col_sel"}):null,e.jsx("th",{className:"col_id",children:"#"}),e.jsx("th",{className:"col_type",children:"type"}),e.jsx("th",{className:"col_package",children:"package"}),e.jsx("th",{children:"title"}),e.jsx("th",{className:"col_priority",children:"priority"}),e.jsx("th",{className:"col_labels",children:"labels"}),y!=="completed"?e.jsx("th",{className:"backlog_table_actions col_actions",children:"actions"}):null]})}),e.jsx("tbody",{children:Se.map(we=>{const $e=String(we.filename||"").trim(),Oe=Ll(we.task_type),mt=Yu(we)?Ju(we.priority):null,pt=Array.isArray(we.labels)?we.labels:[];return e.jsxs("tr",{className:"backlog_row",onClick:()=>ht(we),children:[y==="planned"?e.jsx("td",{className:"backlog_table_sel col_sel",onClick:_t=>_t.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:ve.includes($e),onChange:()=>jt($e),"aria-label":`Select ${$e}`})}):null,e.jsx("td",{className:"mono muted col_id",children:we.item_id||""}),e.jsx("td",{className:"col_type",children:Oe?e.jsx("span",{className:`chip mono ${yh(Oe)}`,title:xh(Oe),children:Oe}):null}),e.jsx("td",{className:"mono muted col_package",title:we.package||"",children:we.package||""}),e.jsx("td",{className:"backlog_table_title",title:$e,children:we.title||$e}),e.jsx("td",{className:"col_priority",children:mt?e.jsx("span",{className:`chip mono board_prio_${mt.toLowerCase()}`,children:mt}):null}),e.jsxs("td",{className:"col_labels",title:pt.join(", "),children:[pt.slice(0,2).map(_t=>e.jsx("span",{className:"chip mono info",style:{marginRight:4},children:_t},_t)),pt.length>2?e.jsxs("span",{className:"chip mono muted",children:["+",pt.length-2]}):null]}),y!=="completed"?e.jsx("td",{className:"backlog_table_actions col_actions",onClick:_t=>_t.stopPropagation(),children:e.jsx("div",{className:"entity_card_actions",children:ft(we)})}):null]},`${y}:${$e}`)})})]}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",padding:"12px"},children:L?"Loading…":"No items."})})]})]}),e.jsx(Rh,{open:!!D,target:D?{kind:"planned",filename:D.filename,title:D.title}:null,execute_mode:U,set_execute_mode:X,action_loading:M,action_error:w,exec_cfg:T.exec_cfg,exec_cfg_loading:T.exec_cfg_loading,exec_cfg_error:T.exec_cfg_error,executors:V,readiness:(D==null?void 0:D.readiness)??null,server_refused:(D==null?void 0:D.server_refused)===!0,show_readiness:!0,on_open_spec:D?()=>{const we=D;R(null),Me({filename:we.filename,kind:"planned",title:we.title,initial_tab:"spec"})}:void 0,on_confirm:we=>void De(we),on_close:()=>R(null)}),e.jsx(mv,{open:ee,batch_selected_items:ze,batch_execute_mode:he,set_batch_execute_mode:O,batch_execute_loading:je,batch_execute_error:Ce,executors:V,exec_cfg:T.exec_cfg,exec_cfg_loading:T.exec_cfg_loading,exec_cfg_error:T.exec_cfg_error,on_confirm:we=>void it(we),on_close:()=>{ge(!1),Ae(""),fe(!1)}}),e.jsx(fv,{open:Re,batch_selected_items:ze,merge_package:se,set_merge_package:ye,merge_task_type:_e,set_merge_task_type:qe,merge_title:Ye,set_merge_title:ie,merge_summary:me,set_merge_summary:be,merge_loading:G,merge_error:Xe,on_confirm:()=>void tt(),on_close:()=>{Ie(!1),J("")}}),e.jsx($h,{gateway:s,can_use_gateway:r,target:Te,on_close:()=>Me(null),on_mutated:async()=>{await Y()},on_open_executions:we=>{var $e;return($e=a.on_open_executions)==null?void 0:$e.call(a,we)}}),e.jsx(ov,{gateway:s,can_use_gateway:r,is_compact_layout:_,maint_provider:l,maint_model:c,maint_reasoning:d,advisor_agent:m,focus_kind:y,focus_type:q,voice_session_id:a.voice_session_id})]})}function pv(a){const{open:s,gateway:r,can_use_gateway:l,maint_provider:c,maint_model:d,maint_reasoning:m,on_close:p,on_created:_}=a,[y,b]=h.useState(""),[x,N]=h.useState(!1),[L,I]=h.useState(""),[C,z]=h.useState("proposed"),[B,F]=h.useState("feature"),[q,Q]=h.useState("framework"),[E,Z]=h.useState(""),[oe,le]=h.useState(""),[pe,Te]=h.useState(""),[Me,ve]=h.useState(""),[ce,D]=h.useState(""),[R,U]=h.useState(""),[X,M]=h.useState(!1),[ue,V]=h.useState(""),[w,A]=h.useState(""),[ee,ge]=h.useState(""),[he,O]=h.useState(""),[je,te]=h.useState(""),[Ce,Ae]=h.useState(""),[Ge,fe]=h.useState(""),[Re,Ie]=h.useState(""),[se,ye]=h.useState(""),[_e,qe]=h.useState(""),[Ye,ie]=h.useState([]),[me,be]=h.useState(!1),[G,ke]=h.useState(""),[Xe,J]=h.useState([]),[T,Y]=h.useState(""),[Se,ze]=h.useState(!1);function Ke(){z("proposed"),F("feature"),Q("framework"),Z(""),le(""),Te(""),ve(""),D(""),U(""),M(!1),V(""),A(""),ge(""),O(""),te(""),Ae(""),fe(""),Ie(""),ye(""),qe(""),ie([]),be(!1),ke(""),J([]),Y(""),ze(!1)}function nt(){p(),Ke()}async function dt(){const De=String(y||"").trim();if(De)return De;if(x)return"";I(""),N(!0);try{const it=await r.backlog_template(),tt=String((it==null?void 0:it.content)||"");return b(tt),tt}catch(it){return I(String((it==null?void 0:it.message)||it||"Failed to load backlog template")),""}finally{N(!1)}}async function yt(De){if(!l)return;const it=(De==null?void 0:De.force)===!0;if(!it&&ce.trim())return;const tt=await dt();if(!tt.trim())return;const jt=String(q||"").trim().toLowerCase()||"{Package}",ft=Vu(),Zt=Ig(tt,{package_name:jt,title:E,task_type:B,summary:oe,created_at:ft});D(we=>it||!String(we||"").trim()?Zt:we)}h.useEffect(()=>{s&&l&&yt()},[s,l]);function ht(De){if(ce.trim()&&!globalThis.confirm("Overwrite the current draft markdown with a guided draft?"))return;const it=String(q||"").trim().toLowerCase()||"{Package}",tt=Vu(),jt=Og({package_name:it,title:E,task_type:B,summary:oe,diagram:ue,context:w,included:Oa(ee),excluded:Oa(he),plan:Oa(je),dependencies:Oa(Ce),acceptance:Oa(Ge),tests_a:Oa(Re),tests_b:Oa(se),tests_c:Oa(_e),created_at:tt,attachments:[]});D(jt)}async function Et(){var it;if(X)return;U(""),M(!0),ke("");let De="";try{const tt=String(q||"").trim().toLowerCase(),jt=cd(Me),ft=!!(pe||jt.length);let Zt=ce||"";ft&&Zt.trim()&&(Zt=Qu(Zt,{priority:pe||null,labels:jt}));const we=await r.backlog_create({kind:C,package:tt,title:E,task_type:B,summary:oe||null,content:Zt||null}),$e=String((we==null?void 0:we.kind)||"").trim(),Oe=String((we==null?void 0:we.filename)||"").trim();if(ft&&!Zt.trim()&&$e&&Oe)try{const pt=await r.backlog_content($e,Oe),_t=String((pt==null?void 0:pt.content)||""),nn=await Gu(_t),fn=Qu(_t,{priority:pe||null,labels:jt});await r.backlog_update({kind:$e,filename:Oe,content:fn,expected_sha256:nn||null})}catch(pt){De=[De,`metadata lines not written: ${String((pt==null?void 0:pt.message)||pt)}`].filter(Boolean).join("; ")}const mt=[...Ye||[]];if($e&&Oe&&mt.length){be(!0);const pt=[];try{for(const _t of mt){const nn=await r.backlog_upload_attachment({kind:$e,filename:Oe,file:_t,overwrite:!1}),fn=String(((it=nn==null?void 0:nn.stored)==null?void 0:it.relpath)||"").trim();fn&&pt.push(fn)}}catch(_t){De=[De,String((_t==null?void 0:_t.message)||_t||"Attachment upload failed")].filter(Boolean).join("; "),ke(De)}finally{if(pt.length)try{const _t=await r.backlog_content($e,Oe),nn=String((_t==null?void 0:_t.content)||""),fn=await Gu(nn),Wt=Dg(nn,pt);await r.backlog_update({kind:$e,filename:Oe,content:Wt,expected_sha256:fn||null})}catch(_t){De=[De,`uploaded files not linked: ${String((_t==null?void 0:_t.message)||_t)}`].filter(Boolean).join("; ")}be(!1)}}p(),Ke();try{await _($e,Oe,De)}catch{}}catch(tt){U(String((tt==null?void 0:tt.message)||tt||"Create failed"))}finally{M(!1)}}async function Ut(){if(Se)return;U("");const De=T.trim();if(!De)return;if(!E.trim()){U("Title is required before using AI assist.");return}const it=String(q||"").trim().toLowerCase();if(!it){U("Package is required before using AI assist.");return}const tt={id:$r(),role:"user",content:De,ts:new Date().toISOString()},jt=[...Xe,tt];J(jt),Y(""),ze(!0);try{const ft=await r.backlog_assist({kind:C,package:it,title:E,summary:oe||null,draft_markdown:ce||null,messages:jt.map($e=>({role:$e.role,content:$e.content})),provider:c||null,model:d||null,thinking:m||null}),Zt=String((ft==null?void 0:ft.reply)||"").trim(),we=String((ft==null?void 0:ft.draft_markdown)||"").trim();Zt&&J($e=>[...$e,{id:$r(),role:"assistant",content:Zt,ts:new Date().toISOString()}]),we&&D(we)}catch(ft){U(String((ft==null?void 0:ft.message)||ft||"AI assist failed"))}finally{ze(!1)}}return e.jsxs(Ua,{open:s,title:"New backlog task",onClose:nt,actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:nt,disabled:X||Se,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:()=>void Et(),disabled:X||!E.trim()||!q.trim(),children:X?"Creating…":"Create"})]}),children:[e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col",style:{minWidth:220},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Kind (proposed → board Triage · planned → board Ready · recurrent → Backlog page)"}),e.jsxs("select",{value:C,onChange:De=>z(De.target.value),children:[e.jsx("option",{value:"proposed",children:"proposed"}),e.jsx("option",{value:"planned",children:"planned"}),e.jsx("option",{value:"recurrent",children:"recurrent"})]})]})}),e.jsx("div",{className:"col",style:{minWidth:220},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Type"}),e.jsx("select",{value:B,onChange:De=>F(De.target.value),children:Ba.map(De=>e.jsx("option",{value:De,children:De},De))})]})}),e.jsx("div",{className:"col",style:{minWidth:220},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Package"}),e.jsx("input",{value:q,onChange:De=>Q(De.target.value),placeholder:"framework"})]})})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{value:E,onChange:De=>Z(De.target.value),placeholder:"Short descriptive title"})]}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col",style:{minWidth:220},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Priority"}),e.jsxs("select",{value:pe,onChange:De=>Te(De.target.value),children:[e.jsx("option",{value:"",children:"unset"}),zl.map(De=>e.jsx("option",{value:De,children:jh[De]},De))]})]})}),e.jsx("div",{className:"col",style:{minWidth:320},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Labels (comma-separated; sprints: sprint-29)"}),e.jsx("input",{value:Me,onChange:De=>ve(De.target.value),placeholder:"ui, security, sprint-29",className:"mono"})]})})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Summary (optional)"}),e.jsx("textarea",{value:oe,onChange:De=>le(De.target.value),rows:3,placeholder:"One paragraph summary"})]}),e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Guided fields (optional)"}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Use this to generate a structured draft without editing markdown directly. One item per line for list fields."}),e.jsx("div",{style:{marginTop:"8px"},children:e.jsxs("details",{children:[e.jsx("summary",{className:"mono",style:{cursor:"pointer"},children:"Show guided fields"}),e.jsxs("div",{className:"field",style:{marginTop:"10px"},children:[e.jsx("label",{children:"Diagram (ASCII)"}),e.jsx("textarea",{value:ue,onChange:De=>V(De.target.value),rows:4,className:"mono",placeholder:"(optional) ascii diagram"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Context"}),e.jsx("textarea",{value:w,onChange:De=>A(De.target.value),rows:4,placeholder:"Why is this needed? Link to evidence (reports, discussions, etc.)."})]}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col",style:{minWidth:260},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Scope: Included (1 per line)"}),e.jsx("textarea",{value:ee,onChange:De=>ge(De.target.value),rows:4,className:"mono",placeholder:"..."})]})}),e.jsx("div",{className:"col",style:{minWidth:260},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Scope: Excluded (1 per line)"}),e.jsx("textarea",{value:he,onChange:De=>O(De.target.value),rows:4,className:"mono",placeholder:"..."})]})})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Implementation Plan (1 per line)"}),e.jsx("textarea",{value:je,onChange:De=>te(De.target.value),rows:4,className:"mono",placeholder:"..."})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Dependencies (1 per line)"}),e.jsx("textarea",{value:Ce,onChange:De=>Ae(De.target.value),rows:3,className:"mono",placeholder:"Related backlog items / ADRs / external libs…"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Acceptance Criteria (1 per line)"}),e.jsx("textarea",{value:Ge,onChange:De=>fe(De.target.value),rows:4,className:"mono",placeholder:"..."})]}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col",style:{minWidth:260},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Testing Level A (1 per line)"}),e.jsx("textarea",{value:Re,onChange:De=>Ie(De.target.value),rows:3,className:"mono",placeholder:"cd pkg && pytest -q ..."})]})}),e.jsx("div",{className:"col",style:{minWidth:260},children:e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Testing Level B (1 per line)"}),e.jsx("textarea",{value:se,onChange:De=>ye(De.target.value),rows:3,className:"mono",placeholder:"run local gateway + manual verification..."})]})})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Testing Level C (1 per line)"}),e.jsx("textarea",{value:_e,onChange:De=>qe(De.target.value),rows:2,className:"mono",placeholder:"(optional / opt-in)"})]}),e.jsx("div",{className:"row",style:{marginTop:"10px",justifyContent:"flex-end"},children:e.jsx("button",{className:"btn",onClick:()=>ht(),disabled:X||Se,children:"Generate draft from guided fields"})})]})}),e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Attachments (optional)"}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Upload screenshots/diagrams to `docs/backlog/assets/<id>/` and link them under `## Related` after the task is created."}),e.jsx("div",{className:"field",style:{marginTop:"8px"},children:e.jsx("input",{type:"file",multiple:!0,onChange:De=>{const it=Array.from(De.target.files||[]);it.length&&(ie(tt=>[...tt,...it]),De.currentTarget.value="")}})}),Ye.length?e.jsx("div",{className:"mono",style:{fontSize:"var(--font-size-sm)",marginTop:"6px"},children:Ye.map((De,it)=>e.jsxs("div",{className:"row",style:{alignItems:"center",justifyContent:"space-between",marginTop:"4px"},children:[e.jsxs("span",{className:"mono muted",style:{paddingRight:"10px"},children:[De.name," (",Math.round(De.size/1024)," KB)"]}),e.jsx("button",{className:"btn",onClick:()=>ie(tt=>tt.filter((jt,ft)=>ft!==it)),disabled:X||me,children:"Remove"})]},`${De.name}_${De.size}_${it}`))}):null,me?e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:"Uploading attachments…"}):null,G?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:G}):null,e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Draft (Markdown)"}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Prefilled from `docs/backlog/template.md` (editable). AI assist can also refine the draft."}),x?e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:"Loading template…"}):null,L?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:L}):null,e.jsx("div",{className:"row",style:{marginTop:"10px",justifyContent:"flex-end",gap:"8px"},children:e.jsx("button",{className:"btn",onClick:()=>{ce.trim()&&!globalThis.confirm("Reset the draft markdown to the backlog template?")||yt({force:!0})},disabled:X||Se||x||!l,children:"Reset from template"})}),e.jsx("div",{className:"field",children:e.jsx("textarea",{value:ce,onChange:De=>D(De.target.value),rows:10,className:"mono",placeholder:"(optional) full markdown draft"})}),e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"AI Assist (chat)"}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Use this to iteratively refine a backlog draft; assistant replies can also update the draft markdown."}),e.jsx(ld,{messages:Xe,className:"backlog_chat_thread_small",empty:e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No messages yet."})}),e.jsx("div",{style:{marginTop:"10px"},children:e.jsx(Yo,{value:T,onChange:Y,onSubmit:()=>void Ut(),placeholder:"Message to AI (e.g. refine acceptance criteria…)",disabled:!l||!E.trim(),busy:Se,rows:3,sendButtonClassName:"btn primary"})}),R?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:R}):null]})}class Mh extends Kt.Component{constructor(){super(...arguments);Nr(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,l){return l.error&&l.for_key!==void 0&&r.resetKey!==l.for_key?{error:null,for_key:r.resetKey}:l.for_key!==r.resetKey&&!l.error?{for_key:r.resetKey}:null}componentDidCatch(r,l){var c,d;try{(d=(c=this.props).onError)==null||d.call(c,r,l)}catch{}}render(){const{error:r}=this.state;if(r){const{fallback:l}=this.props;return typeof l=="function"?l(r):l}return this.props.children}}class pd{async _fetch(s,r,l){const c=await fetch(`api/hub${r}`,{...l,signal:(l==null?void 0:l.signal)??AbortSignal.timeout(2e4),headers:{...l!=null&&l.body?{"Content-Type":"application/json"}:{}}}),d=await c.text();let m=null;try{m=JSON.parse(d)}catch{}if(!c.ok){const p=m&&typeof m=="object"&&(m.detail||m.error)||d,_=new Error(`${s} failed: ${p}`);throw _.status=c.status,_}return m}async meta(){return await this._fetch("hub_meta","/meta")}async healthz(){return await this._fetch("hub_healthz","/healthz")}async ledger(s){return await this._fetch("hub_ledger",`/channels/${encodeURIComponent(s)}/ledger`)}async channel_info(s){return await this._fetch("hub_channel_info",`/channels/${encodeURIComponent(s)}/info`)}async digest(s){return await this._fetch("hub_digest",`/channels/${encodeURIComponent(s)}/digest`)}async fs_list(s,r=""){const l=r?`?prefix=${encodeURIComponent(r)}`:"",c=await this._fetch("hub_fs_list",`/channels/${encodeURIComponent(s)}/fs${l}`);return Array.isArray(c)?c:[]}async fs_read(s,r){const l=r.split("/").map(encodeURIComponent).join("/");return await this._fetch("hub_fs_read",`/channels/${encodeURIComponent(s)}/fs/${l}`)}async inbox(){const s=await this._fetch("hub_inbox","/inbox");return Array.isArray(s)?s:[]}async channels(){const s=await this._fetch("hub_channels","/channels");return Array.isArray(s)?s:[]}async messages(s,r){const l=new URLSearchParams;(r==null?void 0:r.since)!==void 0&&l.set("since",String(r.since)),r!=null&&r.limit&&l.set("limit",String(r.limit)),r!=null&&r.sort&&l.set("sort",r.sort);const c=await this._fetch("hub_messages",`/channels/${encodeURIComponent(s)}/messages?${l.toString()}`);return Array.isArray(c)?c:[]}async search(s){const r=new URLSearchParams;r.set("q",s.q);for(const l of s.channel??[])r.append("channel",l);return s.sender&&r.set("sender",s.sender),s.kind&&r.set("kind",s.kind),s.since!==void 0&&r.set("since",String(s.since)),s.until!==void 0&&r.set("until",String(s.until)),s.ref&&r.set("ref",s.ref),s.rated&&r.set("rated",s.rated),s.min_votes&&r.set("min_votes",String(s.min_votes)),s.sort&&r.set("sort",s.sort),s.limit&&r.set("limit",String(s.limit)),s.cursor&&r.set("cursor",s.cursor),await this._fetch("hub_search",`/search?${r.toString()}`)}async read_message(s,r){const l=await this._fetch("hub_read_message",`/channels/${encodeURIComponent(s)}/messages/${encodeURIComponent(r)}`);return(Array.isArray(l)?l[0]:l)??null}async post_message(s,r){return await this._fetch("hub_post",`/channels/${encodeURIComponent(s)}/messages`,{method:"POST",body:JSON.stringify(r)})}async upload_attachment(s,r){const l=`api/hub/channels/${encodeURIComponent(s)}/attachments?filename=${encodeURIComponent(r.name)}`,c=await fetch(l,{method:"POST",headers:{"Content-Type":r.type||"application/octet-stream"},body:r,signal:AbortSignal.timeout(6e4)}),d=await c.text();let m=null;try{m=JSON.parse(d)}catch{}if(!c.ok){const p=m&&typeof m=="object"&&(m.detail||m.error)||d,_=new Error(`upload failed: ${p}`);throw _.status=c.status,_}if(!m||typeof m!="object"||!m.id)throw new Error("upload returned no attachment id (unexpected hub response shape)");return m}attachment_url(s,r){return`api/hub/channels/${encodeURIComponent(s)}/attachments/${encodeURIComponent(r)}`}async ack(s,r){return await this._fetch("hub_ack","/inbox/ack",{method:"POST",body:JSON.stringify({cursors:{[s]:r}})})}async members(s){const r=await this._fetch("hub_members",`/channels/${encodeURIComponent(s)}/members`);return Array.isArray(r)?r:[]}async create_channel(s,r){return await this._fetch("hub_create_channel","/channels",{method:"POST",body:JSON.stringify({name:s,private:r})})}async put_channel_meta(s,r,l){const c={value:r};return typeof l=="number"&&(c.expect_version=l),await this._fetch("hub_channel_meta_put",`/channels/${encodeURIComponent(s)}/store/${encodeURIComponent("channel:meta")}`,{method:"PUT",body:JSON.stringify(c)})}async channel_meta(s){return await this._fetch("hub_channel_meta",`/channels/${encodeURIComponent(s)}/store/${encodeURIComponent("channel:meta")}`)}async block(s,r,l){return await this._fetch("hub_block",`/channels/${encodeURIComponent(s)}/blocks`,{method:"POST",body:JSON.stringify({agent:r,seconds:l==null?void 0:l.seconds,reason:l==null?void 0:l.reason})})}async unblock(s,r){return await this._fetch("hub_unblock",`/channels/${encodeURIComponent(s)}/blocks/${encodeURIComponent(r)}`,{method:"DELETE"})}async hub_block(s,r){return await this._fetch("hub_hub_block","/hub/blocks",{method:"POST",body:JSON.stringify({agent:s,seconds:r==null?void 0:r.seconds,reason:r==null?void 0:r.reason})})}async hub_unblock(s){return await this._fetch("hub_hub_unblock",`/hub/blocks/${encodeURIComponent(s)}`,{method:"DELETE"})}async leave(s){return await this._fetch("hub_leave",`/channels/${encodeURIComponent(s)}/leave`,{method:"POST"})}async archive(s){return await this._fetch("hub_archive",`/channels/${encodeURIComponent(s)}/archive`,{method:"POST"})}async unarchive(s){return await this._fetch("hub_unarchive",`/channels/${encodeURIComponent(s)}/archive`,{method:"DELETE"})}async retire_agent(s,r){return await this._fetch("hub_retire",`/agents/${encodeURIComponent(s)}/retire`,{method:"POST",body:JSON.stringify(r?{reason:r}:{})})}async unretire_agent(s){return await this._fetch("hub_unretire",`/agents/${encodeURIComponent(s)}/retire`,{method:"DELETE"})}async retired_agents(){const s=await this._fetch("hub_retired","/agents/retired");return Array.isArray(s)?s:[]}async delete_agent(s){return await this._fetch("hub_delete_agent",`/agents/${encodeURIComponent(s)}`,{method:"DELETE"})}async list_blocks(s){const r=s?`?scope=${encodeURIComponent(s)}`:"",l=await this._fetch("hub_blocks",`/blocks${r}`);return Array.isArray(l)?l:[]}async send_dm(s,r){return await this._fetch("hub_send_dm",`/dms/${encodeURIComponent(s)}/messages`,{method:"POST",body:JSON.stringify({body:r.body,title:r.title||void 0,status:r.status||"open"})})}async store_keys(s){const r=await this._fetch("hub_store_keys",`/channels/${encodeURIComponent(s)}/store`);return Array.isArray(r)?r:[]}async store_get(s,r){return await this._fetch("hub_store_get",`/channels/${encodeURIComponent(s)}/store/${encodeURIComponent(r)}`)}async delegations(){const s=await this._fetch("hub_delegations","/delegations");return Array.isArray(s)?s:[]}async set_delegation(s,r,l){return await this._fetch("hub_set_delegation","/admin/delegation",{method:"PUT",body:JSON.stringify({agent_id:s,powers:r,ttl_seconds:(l==null?void 0:l.ttl_seconds)??null,note:(l==null?void 0:l.note)??""})})}async revoke_delegation(s){return await this._fetch("hub_revoke_delegation",`/admin/delegation/${encodeURIComponent(s)}`,{method:"DELETE"})}async retract_message(s,r){return await this._fetch("hub_retract",`/channels/${encodeURIComponent(s)}/messages/${encodeURIComponent(r)}/retract`,{method:"POST",body:JSON.stringify({})})}async desk(){const s=await this._fetch("hub_desk","/desk");return Array.isArray(s)?{rows:s,satisfied:[]}:{...s,rows:Array.isArray(s==null?void 0:s.rows)?s.rows:[],satisfied:Array.isArray(s==null?void 0:s.satisfied)?s.satisfied:[]}}async owed(){const s=await this._fetch("hub_owed","/owed"),r=s&&typeof s=="object"?s:{};return{...r,to_answer:Array.isArray(r.to_answer)?r.to_answer:[],to_consume:Array.isArray(r.to_consume)?r.to_consume:[],waiting_on:Array.isArray(r.waiting_on)?r.waiting_on:[]}}async create_group(s){return await this._fetch("hub_create_group","/groups",{method:"POST",body:JSON.stringify({name:s.name,members:s.members,purpose:s.purpose,opening_post:s.opening_post||s.purpose,private:s.private!==!1})})}async work_rows(s){const r=await this._fetch("hub_work_rows",`/channels/${encodeURIComponent(s)}/work`);return Array.isArray(r)?r:[]}async work(s){return await this._fetch("hub_work",`/work/${encodeURIComponent(s)}`)}async create_invite(s,r){const l=await this._fetch("hub_create_invite",`/channels/${encodeURIComponent(s)}/invites`,{method:"POST",body:JSON.stringify({agent_id:r})}),c=l&&typeof l=="object"?String(l.invite_token||""):"";if(!c)throw new Error("invite mint returned no token (unexpected hub response shape)");return c}async presence(){const s=await this._fetch("hub_presence","/presence");return Array.isArray(s)?s:[]}async reputation(s){return await this._fetch("hub_reputation",`/channels/${encodeURIComponent(s)}/reputation`)}async reputation_hub(){return await this._fetch("hub_reputation_hub","/reputation")}async reputation_votes(s,r){const l=await this._fetch("hub_reputation_votes",`/channels/${encodeURIComponent(s)}/reputation/${encodeURIComponent(r)}/votes`);return Array.isArray(l)?l:[]}async rate_message(s,r,l,c=""){const d={value:l,note:c};return await this._fetch("hub_rate_message",`/channels/${encodeURIComponent(s)}/messages/${encodeURIComponent(r)}/rating`,{method:"PUT",body:JSON.stringify(d)})}async unrate_message(s,r){return await this._fetch("hub_unrate_message",`/channels/${encodeURIComponent(s)}/messages/${encodeURIComponent(r)}/rating`,{method:"DELETE"})}async rate(s,r,l,c,d=""){return await this._fetch("hub_rate",`/channels/${encodeURIComponent(s)}/reputation/${encodeURIComponent(r)}`,{method:"PUT",body:JSON.stringify({axis:l,value:c,note:d})})}async _delete_reputation(s,r,l){return await this._fetch("hub_unrate",`/channels/${encodeURIComponent(s)}/reputation/${encodeURIComponent(r)}?axis=${encodeURIComponent(l)}`,{method:"DELETE"})}ws_url(){const s=new URL("api/hub/ws",document.baseURI);return s.protocol=s.protocol==="https:"?"wss:":"ws:",s.href}}const _v=["commons"],gv=3e4,vv=5*6e4,Nf={live:new Map,done:[],work:new Map},Cf=new Set(["proposed","planned","completed","deprecated"]);function yv(a,s){const r=s&&typeof s=="object"?String(s.item||""):"";if(r&&Os(r))return r;const l=a.startsWith("claim:")?a.slice(6):"";return l&&Os(l)?l:null}function xv(a){const[s,r]=h.useState(Nf),l=h.useRef(new pd),c=h.useRef(new Map),d=h.useRef(0),m=h.useRef(!1);return h.useEffect(()=>{let p=!0;const _=async()=>{if(!(m.current||Date.now()<d.current)){m.current=!0;try{const b=new Map,x=[],N=new Map;for(const L of _v){let I=!1;try{const z=await l.current.work_rows(L);for(const B of z){const F=String(B.id||B.item||""),q=String(B.status||"").toLowerCase();!Os(F)||!Cf.has(q)||N.set(F,{item:F,title:typeof B.title=="string"?B.title:void 0,status:q,owner:typeof B.owner=="string"?B.owner:void 0,receipt:typeof B.receipt=="string"?B.receipt:void 0,card:typeof B.card=="string"?B.card:void 0,updated_at:B.updated_at})}I=!0}catch{}const C=await l.current.store_keys(L);for(const z of C){const B=String(z.key||"");if(B.startsWith("work:")){if(I)continue;const le=B.slice(5);if(!Os(le))continue;const pe=Number(z.version||0),Te=`${L}\0${B}`,Me=c.current.get(Te);let ve;if(Me&&Me.version===pe)ve=Me.value;else{const D=await l.current.store_get(L,B);ve=D==null?void 0:D.value,c.current.set(Te,{version:pe,value:ve})}const ce=ve&&typeof ve=="object"?String(ve.status||"").toLowerCase():"";if(!Cf.has(ce))continue;N.set(le,{item:le,title:typeof ve.title=="string"?ve.title:void 0,status:ce,owner:typeof ve.owner=="string"?ve.owner:void 0,receipt:typeof ve.receipt=="string"?ve.receipt:void 0,card:typeof ve.card=="string"?ve.card:void 0,updated_at:z.updated_at});continue}if(!B.startsWith("claim:"))continue;const F=Number(z.version||0),q=`${L}\0${B}`,Q=c.current.get(q);let E;if(Q&&Q.version===F)E=Q.value;else{const le=await l.current.store_get(L,B);E=le==null?void 0:le.value,c.current.set(q,{version:F,value:E})}if(!E||typeof E!="object"||typeof E.owner!="string"||!E.owner)continue;const Z=yv(B,E)||B.slice(6);if(!Z)continue;!!E.done||String(E.status||"").toLowerCase()==="done"?x.push({item:Z,owner:E.owner,receipt:typeof E.receipt=="string"?E.receipt:void 0,updated_at:z.updated_at}):b.has(Z)||b.set(Z,E)}}x.sort((L,I)=>(I.updated_at||0)-(L.updated_at||0)),p&&r(L=>L.live.size===b.size&&[...b.keys()].every(C=>JSON.stringify(L.live.get(C))===JSON.stringify(b.get(C)))&&JSON.stringify(L.done)===JSON.stringify(x)&&L.work.size===N.size&&[...N.keys()].every(C=>JSON.stringify(L.work.get(C))===JSON.stringify(N.get(C)))?L:{live:b,done:x,work:N})}catch{d.current=Date.now()+vv,p&&r(b=>b.live.size||b.done.length||b.work.size?Nf:b)}finally{m.current=!1}}};_();const y=setInterval(()=>void _(),gv);return()=>{p=!1,clearInterval(y)}},[a]),s}const bv=40,wv=4;function jv(a){const{gateway:s,can_use_gateway:r,data_nonce:l}=a,[c,d]=h.useState([]),[m,p]=h.useState(!1),[_,y]=h.useState(""),[b,x]=h.useState(""),[N,L]=h.useState(null),[I,C]=h.useState(null),[z,B]=h.useState({}),F=h.useRef({}),q=h.useRef(!1),Q=h.useCallback(async le=>{if(r&&!q.current){q.current=!0,le!=null&&le.background||p(!0);try{const[pe,Te,Me,ve,ce]=await Promise.allSettled([s.backlog_list("proposed"),s.backlog_list("planned"),s.backlog_exec_requests({status:"queued,running,awaiting_qa",limit:200}),s.backlog_exec_requests({status:"promoted,completed,failed",limit:60}),s.backlog_exec_active_items({status:"queued,running,awaiting_qa",limit:1200})]),D=[],R=[],U=(je,te)=>je.status==="fulfilled"?je.value:(D.push(te),R.push(je.reason),null),X=U(pe,"proposed list"),M=U(Te,"planned list"),ue=U(Me,"live requests"),V=U(ve,"recent history"),w=U(ce,"busy set");if(L(R.find(je=>bi(je))??null),!X&&!M&&!ue&&!V){y("Failed to load the board (all sources failed)");return}y("");const A=Array.isArray(ue==null?void 0:ue.requests)?ue.requests:[];let ee=Array.isArray(w==null?void 0:w.items)?w.items:[];w||(ee=A.map(je=>({request_id:String(je.request_id||""),status:String(je.status||""),kind:"planned",filename:String(je.backlog_filename||"").trim(),relpath:String(je.backlog_relpath||"").trim()})).filter(je=>je.filename&&!/^batch\(\d+\)$/i.test(je.filename)));const ge=Array.isArray(X==null?void 0:X.items)?X.items:[],he=Array.isArray(M==null?void 0:M.items)?M.items:[];C(X&&M?ge.length+he.length:null);const O=tv({proposed:ge,planned:he,active_requests:A,terminal_requests:Array.isArray(V==null?void 0:V.requests)?V.requests:[],active_items:ee});d(O),x(D.length?`#FALLBACK partial board — failed: ${D.join(", ")}`:""),E(O,ge,he)}finally{q.current=!1,le!=null&&le.background||p(!1)}}},[s,r]);async function E(le,pe,Te){const Me=new Map;for(const R of pe)Me.set(String(R.filename||"").trim(),"proposed");for(const R of Te)Me.set(String(R.filename||"").trim(),"planned");const ve=le.filter(R=>R.filename&&!F.current[R.filename]&&Me.has(R.filename)).filter(R=>!Ch(R)||R.column==="ready").slice(0,bv).map(R=>({filename:R.filename,kind:Me.get(R.filename)}));if(!ve.length)return;const ce=[...ve],D=Array.from({length:Math.min(wv,ce.length)},async()=>{for(;;){const R=ce.shift();if(!R)return;try{const U=await s.backlog_content(R.kind,R.filename),X=wi(String((U==null?void 0:U.content)||""));F.current={...F.current,[R.filename]:X}}catch{}}});await Promise.all(D),B(F.current)}const Z=h.useCallback(async(le,pe)=>{try{const Te=await s.backlog_content(le,pe),Me=wi(String((Te==null?void 0:Te.content)||""));F.current={...F.current,[pe]:Me},B(F.current)}catch{}},[s]);return h.useEffect(()=>{Q()},[Q,l]),h.useEffect(()=>{if(!r)return;const le=setInterval(()=>{s.is_backing_off()||Q({background:!0})},1e4);return()=>clearInterval(le)},[r,Q,s]),{cards:c,loading:m,error:_,degraded:b,unconfigured:N!==null,unavailable:N,item_count:I,metadata:z,refresh:Q,refresh_item_metadata:Z}}function $f(a,s){return a.length<=s?a:`${a.slice(0,s-1).trimEnd()}…`}const kv=new pd;function Sv(a){if(!a)return"";const s=Math.max(0,Date.now()/1e3-a);return s<3600?`${Math.max(1,Math.round(s/60))}m`:s<172800?`${Math.round(s/3600)}h`:`${Math.round(s/86400)}d`}function Nv(a){const{card:s}=a,r=s.work_id||"",l=!!(r&&Os(r)),[c,d]=h.useState({loading:l,error:"",claims:[],decisions:[],messages:[]});h.useEffect(()=>{let _=!0;if(l)return d(y=>({...y,loading:!0,error:""})),kv.work(r).then(y=>{_&&d({loading:!1,error:"",claims:Array.isArray(y==null?void 0:y.claims)?y.claims:[],decisions:Array.isArray(y==null?void 0:y.decisions)?y.decisions:[],messages:(Array.isArray(y==null?void 0:y.messages)?y.messages:[]).slice().sort((b,x)=>(x.created_at||0)-(b.created_at||0))})}).catch(y=>{_&&d({loading:!1,error:String((y==null?void 0:y.message)||y||"activity unavailable"),claims:[],decisions:[],messages:[]})}),()=>{_=!1}},[r,l]);const m=c.messages[0],p=s.claim_started_at!==void 0&&s.claim_owner?wh({owner:s.claim_owner,started_at:s.claim_started_at},Date.now()):null;return e.jsx("div",{className:"modal_backdrop",onClick:a.on_close,children:e.jsxs("div",{className:"modal_panel board_claim_panel board_activity_panel",onClick:_=>_.stopPropagation(),children:[e.jsxs("div",{className:"modal_head",children:[e.jsx("span",{className:"modal_title",children:s.title}),e.jsx("button",{className:"btn",onClick:a.on_close,children:"Close"})]}),e.jsxs("div",{className:"board_claim_facts",children:[r?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"work id:"})," ",e.jsx("span",{className:"mono",children:r})]}):null,s.claim_owner?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:s.column==="done"?"completed by:":"held by:"})," ",s.claim_owner,p?e.jsxs("span",{className:"muted",children:[" · ",p.label]}):null]}):null,s.summary?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"receipt:"})," ",s.summary]}):null,s.card_path?e.jsxs("div",{children:[e.jsx("span",{className:"muted",children:"item file:"})," ",e.jsx("span",{className:"mono",children:s.card_path}),e.jsxs("span",{className:"muted",children:[" (in ",s.package||"its own","'s repository)"]})]}):null]}),e.jsxs("div",{className:"board_activity_section",children:[e.jsxs("div",{className:"muted team_note",style:{marginBottom:4},children:["Discussion & receipts ",c.loading?"· loading…":c.messages.length?`· ${c.messages.length} citing message(s)`:""]}),c.error?e.jsxs("div",{className:"muted team_note",children:["#FALLBACK hub activity unavailable (",c.error.slice(0,80),") — the Team thread button below still works."]}):null,!c.loading&&!c.error&&l&&!c.messages.length?e.jsx("div",{className:"muted team_note",children:"No citing messages on the hub yet."}):null,l?null:e.jsx("div",{className:"muted team_note",children:"This claim has no ruled work id — discussion lives in the coordination channel."}),c.messages.slice(0,8).map(_=>e.jsxs("div",{className:"board_activity_msg",children:[e.jsxs("div",{className:"board_activity_msg_head mono",children:[e.jsx("span",{children:_.sender}),e.jsxs("span",{className:"muted",children:[_.channel," #",_.seq," · ",Sv(_.created_at)]}),a.on_open_team?e.jsx("button",{className:"team_row_expand",onClick:()=>a.on_open_team({channel:String(_.channel||""),message_id:String(_.id||""),seq:Number(_.seq)}),title:"Open this message in its Team channel",children:"open ↗"}):null]}),_.title?e.jsx("div",{className:"board_activity_msg_title",children:$f(String(_.title),140)}):null,_.body?e.jsx("div",{className:"board_activity_msg_body muted",children:$f(String(_.body),220)}):null]},_.id||_.seq))]}),e.jsx("div",{className:"entity_skills_actions",children:a.on_open_team?e.jsx("button",{className:"btn primary",onClick:()=>a.on_open_team(m?{channel:String(m.channel||"commons"),message_id:String(m.id||""),seq:Number(m.seq)}:{channel:"commons"}),title:m?"Open the most recent citing message in its channel":"Open the coordination channel",children:"Open discussion in Team"}):null})]})})}function Cv(a){var be;const{gateway:s,gateway_connected:r,data_nonce:l,on_mutated:c,on_open_executions:d}=a,m=a.default_execution_mode==="inplace"?"inplace":"uat",p=fd("(max-width: 900px)"),_=Lh(s,r),y=jv({gateway:s,can_use_gateway:r,data_nonce:l}),[b,x]=h.useState(0),N=dd(s,r,l+b),L=y.unconfigured||((be=N.status)==null?void 0:be.available)===!1,I=!L&&y.item_count===0&&!y.error,C=xv(!0),z=h.useMemo(()=>sv(y.cards,C),[y.cards,C]),B=hd({gateway:s,can_use_gateway:r,kind:"planned",completed_view:"tasks",is_exec_view:!1,is_compact_layout:p,set_compact_pane:()=>{},on_status_transfer:()=>{}}),[F,q]=h.useState("");h.useEffect(()=>{var ke;if(!a.query_preset)return;const G=Os(a.query_preset);q(G?G.num.padStart(4,"0"):a.query_preset),(ke=a.on_query_preset_consumed)==null||ke.call(a)},[a.query_preset]);const[Q,E]=h.useState("all"),[Z,oe]=h.useState("all"),[le,pe]=h.useState(""),[Te,Me]=h.useState(!1),[ve,ce]=h.useState(null),[D,R]=h.useState(null),[U,X]=h.useState(null),[M,ue]=h.useState("uat"),[V,w]=h.useState(!1),[A,ee]=h.useState(""),[ge,he]=h.useState(""),[O,je]=h.useState(null),te=h.useRef(null),Ce=z.some(G=>G.column==="in_progress"),[,Ae]=h.useState(0);h.useEffect(()=>{if(!Ce)return;const G=setInterval(()=>Ae(ke=>(ke+1)%3600),1e3);return()=>clearInterval(G)},[Ce]);const Ge=h.useMemo(()=>{const G=new Set;for(const ke of z)ke.package&&G.add(ke.package);return[...G].sort()},[z]),fe=h.useMemo(()=>z.filter(G=>G.filename&&G.kind).length,[z]),Re=h.useMemo(()=>z.filter(G=>G.filename&&G.kind&&(Ch(G)||y.metadata[G.filename])).length,[z,y.metadata]),Ie=h.useMemo(()=>{const G=new Map;for(const ke of z)if(ke.filename)for(const Xe of Zu(ke,y.metadata[ke.filename]))G.set(Xe,(G.get(Xe)||0)+1);return[...G.entries()].sort((ke,Xe)=>Xe[1]-ke[1]).slice(0,12)},[z,y.metadata]),se=h.useMemo(()=>{const G=F.trim().toLowerCase();return z.filter(ke=>{if(Q!=="all"&&(ke.package||"")!==Q||Z!=="all"&&String(ke.task_type||"").toLowerCase()!==Z)return!1;const Xe=ke.filename?y.metadata[ke.filename]:void 0,J=Zu(ke,Xe);return le&&!J.includes(le)||Te&&!J.some(Y=>{const Se=Y.toLowerCase();return Se==="decision-gate"||Se.startsWith("wave-")||Se.startsWith("seat-")})?!1:G?`${ke.item_id||""} ${ke.title} ${ke.filename||""} ${ke.package||""} ${ke.summary||""} ${ke.exec_status||""} ${J.join(" ")} ${Xu(ke,Xe)||""}`.toLowerCase().includes(G):!0})},[z,y.metadata,F,Q,Z,le,Te]),ye=h.useMemo(()=>{var Xe;const G=new Map;for(const J of wf)G.set(J.id,[]);for(const J of se)(Xe=G.get(J.column))==null||Xe.push(J);const ke=J=>{const T=J.filename?Xu(J,y.metadata[J.filename]):null;return T?zl.indexOf(T):zl.length};for(const[J,T]of G)(J==="triage"||J==="ready")&&T.sort((Y,Se)=>ke(Y)-ke(Se)||(Se.item_id||0)-(Y.item_id||0));return G},[se,y.metadata]);async function _e(G,ke){if(!(!G.filename||!G.kind||G.kind==="completed")&&G.kind!==ke){he("");try{await s.backlog_move({from_kind:G.kind,to_kind:ke,filename:G.filename}),await y.refresh(),c()}catch(Xe){he(String((Xe==null?void 0:Xe.message)||Xe||"Move failed"))}}}async function qe(G){if(!G.filename)return;let ke=y.metadata[G.filename];if(!ke)try{const J=await s.backlog_content("planned",G.filename);ke=wi(String((J==null?void 0:J.content)||""))}catch{ke=void 0}const Xe=ke?ud({task_type:G.task_type},ke):null;ee(""),ue(m),X({filename:G.filename,title:G.title,readiness:Xe}),B.load_exec_config()}async function Ye(G){if(!(!U||V)){w(!0),ee("");try{const ke=B.exec_cfg||await B.load_exec_config();if(!ke||ke.can_execute!==!0){ee((ke==null?void 0:ke.runner_error)||"Backlog exec is not available on this gateway.");return}const Xe=!!(U.readiness&&!U.readiness.ok);await s.backlog_execute({kind:"planned",filename:U.filename,execution_mode:M,executor:G==null?void 0:G.executor,target_model:G==null?void 0:G.target_model,target_reasoning_effort:G==null?void 0:G.target_reasoning_effort,dor:"check",override:Xe}),X(null),await y.refresh(),c()}catch(ke){const Xe=Ku(ke);Xe?(X(J=>J&&{...J,readiness:Xe,server_refused:!0}),ee("")):ee(String((ke==null?void 0:ke.message)||ke||"Execute failed"))}finally{w(!1)}}}function ie(G){if(!G.filename&&!G.request_id){const ke=Hg(G.card_path);if(ke&&r){s.backlog_content(ke.kind,ke.filename).then(()=>{ce({filename:ke.filename,kind:ke.kind,title:G.title,work_id:G.work_id,has_live_request:!1,initial_tab:"spec"})}).catch(()=>R(G));return}R(G);return}ce({filename:G.filename||"",kind:G.kind||null,request_id:G.request_id,title:G.title,work_id:G.work_id,has_live_request:G.column==="in_progress"||G.column==="in_review",initial_tab:G.column==="in_review"?"review":G.column==="in_progress"?"runs":"spec"})}const me={ready:"planned",triage:"proposed"};return e.jsxs("div",{className:"page board_page_root",children:[e.jsxs("div",{className:"board_toolbar",children:[e.jsx("input",{className:"board_search",value:F,onChange:G=>q(G.target.value),placeholder:"Search the board…"}),e.jsxs("select",{value:Q,onChange:G=>E(G.target.value),title:"Package",children:[e.jsx("option",{value:"all",children:"all packages"}),Ge.map(G=>e.jsx("option",{value:G,children:G},G))]}),e.jsxs("select",{value:Z,onChange:G=>oe(G.target.value),title:"Type",children:[e.jsx("option",{value:"all",children:"all types"}),Ba.map(G=>e.jsx("option",{value:G,children:G},G))]}),e.jsx("button",{className:`chip mono board_facet ${Te?"active":"muted"}`,onClick:()=>Me(G=>!G),"aria-pressed":Te,title:"Room supervision: only operator decision gates + wave items (labels decision-gate / wave-* / seat-*)",children:"Supervision"}),e.jsx("div",{className:"board_toolbar_spacer"}),y.degraded&&!L?e.jsx("span",{className:"mono board_warn",title:y.degraded,children:"partial board"}):null,y.error&&!L?e.jsx("span",{className:"mono board_error",children:y.error}):null,ge?e.jsx("span",{className:"mono board_error",children:ge}):null,e.jsx("button",{className:`btn btn_icon ${y.loading?"is_loading":""}`,onClick:()=>void y.refresh(),disabled:!r||y.loading,children:y.loading?"Refreshing…":"Refresh"})]}),L?e.jsx(md,{gateway:s,surface:"the board",status:N.status,legacy:N.legacy,error:y.unavailable,on_changed:()=>{x(G=>G+1),y.refresh()}}):null,I?e.jsx(rv,{status:N.status,on_create:a.on_new_task}):null,!L&&(Ie.length||fe)?e.jsxs("div",{className:"board_facets",children:[e.jsx("span",{className:"mono muted board_facets_caption",children:"labels:"}),Ie.map(([G,ke])=>e.jsxs("button",{className:`chip mono board_facet ${le===G?"active":"info"}`,onClick:()=>pe(Xe=>Xe===G?"":G),title:`${ke} scanned card(s) carry ${G} — click to filter (sprints are labels: sprint-N)`,children:[G," ",e.jsx("span",{className:"muted",children:ke})]},G)),le?e.jsx("button",{className:"chip mono warn board_facet",onClick:()=>pe(""),children:"clear ✕"}):null,Re<fe?e.jsxs("span",{className:"chip mono warn",title:"Label chips/filters cover only scanned cards — this gateway does not serve list-level metadata yet (#FALLBACK content scan; exact on gateways ≥ c1090)",children:["scanned ",Re,"/",fe]}):null]}):null,e.jsx("div",{className:"board_columns",style:L?{display:"none"}:void 0,children:wf.map(G=>{const ke=ye.get(G.id)||[],Xe=me[G.id];return e.jsxs("div",{className:`board_column board_column_${G.id} ${O===G.id?"drag_over":""}`,onDragOver:J=>{!Xe||!te.current||(J.preventDefault(),je(G.id))},onDragLeave:()=>je(J=>J===G.id?null:J),onDrop:J=>{J.preventDefault(),je(null);const T=te.current;te.current=null,T&&Xe&&_e(T,Xe)},children:[e.jsxs("div",{className:"board_column_header",title:G.hint,children:[e.jsx("span",{className:"board_column_title",children:G.label}),e.jsx("span",{className:"board_column_count mono",children:ke.length})]}),e.jsxs("div",{className:"board_column_body",children:[ke.map(J=>{const T=Nh(J,J.filename?y.metadata[J.filename]:void 0);return e.jsx($v,{card:J,metadata:J.filename?y.metadata[J.filename]:void 0,draggable:!T&&!!(J.kind&&J.filename&&(J.column==="triage"||J.column==="ready")),on_drag_start:()=>{te.current=J},on_drag_end:()=>{te.current=null,je(null)},on_open:()=>ie(J),on_promote:!T&&G.id==="triage"?()=>void _e(J,"planned"):void 0,on_demote:!T&&G.id==="ready"?()=>void _e(J,"proposed"):void 0,on_execute:!T&&G.id==="ready"?()=>void qe(J):void 0,on_follow:J.exec_status==="running"||J.exec_status==="queued"?()=>d(J.request_id):void 0},J.key)}),ke.length?null:e.jsx("div",{className:"board_column_empty mono muted",children:"—"})]})]},G.id)})}),e.jsx(Rh,{open:!!U,target:U?{kind:"planned",filename:U.filename,title:U.title}:null,execute_mode:M,set_execute_mode:ue,action_loading:V,action_error:A,exec_cfg:B.exec_cfg,exec_cfg_loading:B.exec_cfg_loading,exec_cfg_error:B.exec_cfg_error,executors:_,readiness:(U==null?void 0:U.readiness)??null,server_refused:(U==null?void 0:U.server_refused)===!0,show_readiness:!0,on_open_spec:U?()=>{const G=U;X(null),ce({filename:G.filename,kind:"planned",title:G.title,initial_tab:"spec"})}:void 0,on_confirm:G=>void Ye(G),on_close:()=>X(null)}),e.jsx($h,{gateway:s,can_use_gateway:r,target:ve,on_close:()=>ce(null),on_mutated:async()=>{ve!=null&&ve.filename&&(ve.kind==="proposed"||ve.kind==="planned")&&await y.refresh_item_metadata(ve.kind,ve.filename),await y.refresh(),c()},on_open_executions:d}),D?e.jsx(Nv,{card:D,on_close:()=>R(null),on_open_team:a.on_open_team}):null]})}function $v(a){const{card:s,metadata:r,draggable:l,on_drag_start:c,on_drag_end:d,on_open:m,on_promote:p,on_demote:_,on_execute:y,on_follow:b}=a,x=Xu(s,r),N=Nh(s,r),L=!N&&r?ud({task_type:s.task_type},r):null,I=Ll(s.task_type),C=s.exec_status==="running"&&s.started_at?Math.max(0,Date.now()-Date.parse(s.started_at)):null;return e.jsxs("div",{className:`board_card ${l?"draggable":""} ${N?"gate":""}`,onClick:m,role:"button",tabIndex:0,onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),m())},draggable:l,onDragStart:l?c:void 0,onDragEnd:l?d:void 0,children:[e.jsxs("div",{className:"board_card_title",children:[L?e.jsx("span",{className:`board_ready_dot ${L.ok?"ok":"warn"}`,title:L.ok?"Definition of Ready: satisfied":`Not ready: ${L.checks.filter(z=>!z.ok).map(z=>z.label).join("; ")}`}):null,e.jsx("span",{className:"board_card_title_text",children:s.title})]}),e.jsxs("div",{className:"board_card_chips",children:[N?e.jsx("span",{className:"chip mono warn",title:"Operator decision gate — resolved by the operator's ruling, never assignable or executable (c1631)",children:"⛬ operator gate"}):null,s.item_id?e.jsxs("span",{className:"chip mono muted",children:["#",s.item_id]}):null,I&&!N?e.jsx("span",{className:`chip mono ${yh(I)}`,title:xh(I),children:I}):null,x?e.jsx("span",{className:`chip mono board_prio_${x.toLowerCase()}`,children:x}):null,s.package?e.jsx("span",{className:"chip mono muted",children:s.package}):null,s.batch_size?e.jsxs("span",{className:"chip mono info",children:[s.batch_size," items"]}):null,Zu(s,r).filter(z=>!N||z.toLowerCase()!=="decision-gate").slice(0,3).map(z=>e.jsx("span",{className:"chip mono info",children:z},z)),s.exec_status?e.jsx("span",{className:`chip mono ${s.exec_status==="failed"?"danger":s.exec_status==="awaiting_qa"?"warn":"info"}`,children:s.exec_status}):null,C!==null?e.jsx("span",{className:"chip mono info",children:Is(C)}):null,s.recent_failures?e.jsxs("span",{className:"chip mono danger",title:`${s.recent_failures} recent failed attempt(s) — see the Failed lane`,children:["⚠ ",s.recent_failures]}):null,s.target_agent?e.jsx("span",{className:"chip mono muted",children:s.target_agent}):null,s.claim_owner?(()=>{const z=wh({owner:s.claim_owner,started_at:s.claim_started_at},Date.now());return e.jsxs("span",{className:`chip mono ${z!=null&&z.stale?"warn":"info"}`,title:`Live hub claim${s.work_id?` (claim:${s.work_id})`:""}${z!=null&&z.stale?" — stale: claimed long ago with no receipt yet; open to re-claim on the record per the ruled process":""}`,children:["⛏ ",s.claim_owner,z?` · ${z.label.replace("claimed ","")}`:""]})})():null]}),p||_||y||b?e.jsxs("div",{className:"board_card_actions",onClick:z=>z.stopPropagation(),children:[p?e.jsx("button",{className:"btn",onClick:p,title:"Move to Ready (planned)",children:"→ Ready"}):null,y?e.jsx("button",{className:"btn primary",onClick:y,children:"Execute"}):null,_?e.jsx("button",{className:"btn",onClick:_,title:"Move back to Triage (proposed)",children:"→ Triage"}):null,b?e.jsx("button",{className:"btn",onClick:b,children:"Follow live"}):null]}):null]})}function Au(a,s){const r=String(a||"").replace(/\r/g,"").trim();if(!r)return"";const c=(r.split(`
|
|
80
|
-
`,1)[0]||"").trim();return c.length<=s?c:`${c.slice(0,Math.max(0,s-1))}…`}function Ev(a){const s=String(a||"").trim();if(s.length<2)return s;const r=s[0],l=s[s.length-1];return r==="'"&&l==="'"||r==='"'&&l==='"'?s.slice(1,-1):s}function zh(a){const s=String(a||"").trim();if(!s)return"";const r=s.match(/^(?:\/bin\/)?(?:zsh|bash)\s+-lc\s+([\s\S]+)$/);return r?Ev(String(r[1]||"").trim()):s}function Tv(a,s){const r=String(a||"").trim().toLowerCase();if(r==="error"||r==="turn.failed")return"error";if(r==="turn.completed"||r==="turn.succeeded"||r==="turn.success")return"ok";const l=s&&typeof s=="object"?s:null,c=l&&typeof l.item=="object"?l.item:null;if(c&&String(c.type||"").trim()==="command_execution"){const d=String(c.status||"").trim().toLowerCase();if(d==="failed")return"error";const m=c.exit_code,p=typeof m=="number"?m:Number.isFinite(Number(m))?Number(m):null;if(p!=null)return p===0?"ok":"error";if(d==="completed")return"ok"}return"info"}function Av(a,s){var y;const r=s&&typeof s=="object"?s:{},l=r.item&&typeof r.item=="object"?r.item:null,c=l?String(l.type||"").trim():"",d=l?String(l.text||"").trim():"",m=l?String(l.command||"").trim():"",p=l&&Array.isArray(l.items)?l.items:[],_=String((r==null?void 0:r.message)||((y=r==null?void 0:r.error)==null?void 0:y.message)||"").trim();if(c==="command_execution"&&m)return zh(m)||m;if(c==="todo_list"&&p.length>0){const b=p.length,x=p.filter(B=>(B&&B.completed)===!0).length,N=p.find(B=>(B&&B.completed)!==!0),L=String((N==null?void 0:N.text)||"").trim(),I=b>1?` (+${b-1})`:"",C=b>0?` (${x}/${b})`:"",z=L?`todo: ${L}${I}`:`todo list (${b})`;return Au(`${z}${C}`,96)}return d?Au(d,96)||d:_?Au(_,96)||_:c||String(a||"").trim()||"event"}function Ef(a){const s=new Date(a),r=l=>String(l).padStart(2,"0");return`${r(s.getHours())}:${r(s.getMinutes())}`}function Rv(a){var l,c,d;const s=a&&typeof a=="object"?a:{},r=[s.at,s.created_at,s.timestamp,s.time,s.ts,s.datetime,(l=s.item)==null?void 0:l.at,(c=s.item)==null?void 0:c.created_at,(d=s.item)==null?void 0:d.timestamp];for(const m of r)if(m!=null){if(typeof m=="number"&&Number.isFinite(m)){const p=m>1e11?m:m*1e3;return Ef(p)}if(typeof m=="string"){const p=m.trim();if(!p)continue;const _=Date.parse(p.replace(/(\.\d{3})\d+/,"$1"));if(Number.isFinite(_))return Ef(_)}}return null}function Lv(a){var z;const{exec_selected:s,exec_detail:r,is_compact_layout:l,exec_log_name:c,set_exec_log_name:d,exec_log_text:m,exec_log_loading:p,exec_log_error:_,exec_log_truncated:y,exec_log_auto:b,set_exec_log_auto:x,exec_log_scroll_el_ref:N,exec_log_follow_ref:L,parsed_exec_events:I,load_exec_log_tail:C}=a;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"row",style:{alignItems:"center",justifyContent:"space-between",gap:"8px",marginTop:"8px"},children:[e.jsx("div",{className:"section_title",style:{marginTop:0},children:"Live logs"}),e.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",justifyContent:"flex-end",flexWrap:"wrap"},children:[e.jsxs("select",{value:c,onChange:B=>d(B.target.value),children:[e.jsx("option",{value:"events",children:"events"}),e.jsx("option",{value:"stderr",children:"stderr"}),e.jsx("option",{value:"last_message",children:"last message"})]}),e.jsx("button",{className:`btn ${b?"primary":""}`,onClick:()=>x(B=>!B),disabled:!(s!=null&&s.request_id),children:b?"Auto on":"Auto off"}),e.jsxs("button",{className:`btn btn_icon ${p?"is_loading":""}`,onClick:()=>C(),disabled:p||!(s!=null&&s.request_id),"aria-label":"Refresh logs",title:"Refresh logs",children:[e.jsx(rt,{name:"refresh",size:16}),l?null:p?"Loading…":"Refresh"]})]})]}),_?e.jsx("div",{className:"detail_warn",children:_}):null,!_&&y?e.jsx("div",{className:"detail_hint",children:"#TRUNCATION: log tail truncated"}):null,c==="events"&&I?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"exec_log_scroll",ref:N,onScroll:B=>{L.current=vf(B.currentTarget,12)},children:I.events.length===0?e.jsx("div",{className:"empty_note",children:"No events yet."}):I.events.map(B=>{var ue;const F=B.payload,q=F&&typeof F.item=="object"?F.item:null,Q=q?String(q.type||"").trim():"",E=q?String(q.id||"").trim():"",Z=F?String(F.thread_id||"").trim():"",oe=Tv(B.type,F),le=oe==="error"?"danger":oe==="ok"?"ok":"info",pe=Rv(F),Te=Av(B.type,F),Me=String((F==null?void 0:F.message)||((ue=F==null?void 0:F.error)==null?void 0:ue.message)||"").trim(),ve=q?String(q.text||"").trim():"",ce=q?String(q.command||"").trim():"",D=q?String(q.status||"").trim():"",R=q&&q.exit_code!=null?String(q.exit_code):"",U=q?String(q.aggregated_output||"").trim():"",X=q&&Array.isArray(q.items)?q.items:[],M=ce?zh(ce)||ce:"";return e.jsxs("details",{className:`exec_event ${oe}`,children:[e.jsxs("summary",{className:"exec_event_summary",children:[pe?e.jsx("span",{className:"exec_event_when mono muted",children:pe}):null,pe?e.jsx("span",{className:"exec_event_sep mono muted",children:"|"}):null,e.jsx("span",{className:"exec_event_main mono",title:Te,children:Te}),e.jsx("span",{className:`chip mono ${le}`,children:Q||B.type}),R?e.jsxs("span",{className:"mono muted exec_event_right",children:["exit=",R]}):null]}),e.jsxs("div",{className:"exec_event_body",children:[e.jsxs("div",{className:"row exec_event_meta",children:[e.jsx("span",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:B.type}),E?e.jsx("span",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:E}):null,Z?e.jsxs("span",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:["thread ",da(Z,18)]}):null]}),Me?e.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:Me}):null,X&&X.length>0?e.jsx("div",{className:"mono",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:X.map((V,w)=>e.jsxs("div",{children:[(V&&V.completed)===!0?"✓":"○"," ",String((V==null?void 0:V.text)||"").trim()]},`${B.idx}-todo-${w}`))}):null,ce?e.jsxs("div",{style:{marginTop:"8px"},children:[e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:["command_execution ",D?`(${D})`:""," ",R?`exit=${R}`:""]}),e.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",fontSize:"var(--font-size-sm)",marginTop:"6px"},children:M})]}):null,U?e.jsxs("details",{style:{marginTop:"8px"},children:[e.jsxs("summary",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",cursor:"pointer"},children:["output (",U.length.toLocaleString()," chars)"]}),e.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:U})]}):null,ve?e.jsx("div",{style:{marginTop:"8px"},children:e.jsx(ds,{className:"md_doc",text:ve})}):null]})]},`${B.idx}-${E}-${B.type}`)})}),e.jsxs("details",{style:{marginTop:"8px"},children:[e.jsxs("summary",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",cursor:"pointer"},children:["Raw JSONL",I.bad?` (${I.bad} unparsable line(s))`:""]}),e.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",fontSize:"var(--font-size-sm)",marginTop:"8px",maxHeight:"240px",overflow:"auto"},children:I.raw||""})]})]}):e.jsx("div",{className:"exec_log_scroll",ref:N,onScroll:B=>{L.current=vf(B.currentTarget,12)},children:e.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",fontSize:"var(--font-size-sm)"},children:(()=>{var F;if(String(m||"").trim())return m;if(c==="last_message"){const q=String(((F=r==null?void 0:r.result)==null?void 0:F.last_message)||s.last_message||"").trim();if(q)return q;const Q=String(s.status||"").trim().toLowerCase();return Q==="queued"||Q==="running"?"(last message is written when the run finishes — use events for live output)":"(no last message yet)"}return c==="stderr"?"(no stderr yet)":"(no logs yet)"})()})}),(z=r==null?void 0:r.result)!=null&&z.logs?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Logs"}),e.jsxs("div",{className:"fact_grid",children:[r.result.logs.events_relpath?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"events"}),e.jsx("span",{className:"fact_value mono",children:r.result.logs.events_relpath})]}):null,r.result.logs.stderr_relpath?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"stderr"}),e.jsx("span",{className:"fact_value mono",children:r.result.logs.stderr_relpath})]}):null,r.result.logs.last_message_relpath?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"last message"}),e.jsx("span",{className:"fact_value mono",children:r.result.logs.last_message_relpath})]}):null]})]}):null]})}function Mv(a){const{pipeline:s,is_compact_layout:r,on_back_to_list:l,on_send_feedback:c,on_promote:d,on_deploy_uat:m}=a,p=s.exec_selected;if(!p)return e.jsx("div",{className:"empty_note",children:"Select an exec request."});const{exec_detail:_,exec_detail_loading:y,exec_detail_error:b,exec_qa_feedback:x,set_exec_qa_feedback:N,exec_qa_loading:L,exec_qa_error:I,event_stats:C,time_stats:z,exec_log_name:B}=s;return e.jsxs("div",{className:"inbox_detail",children:[e.jsxs("div",{className:"inbox_detail_header",children:[e.jsxs("div",{className:"inbox_detail_title",children:[e.jsx("span",{style:{fontWeight:650,fontSize:"var(--font-size-md)"},children:p.backlog_filename||p.backlog_relpath||p.request_id}),(()=>{const F=String(p.status||"").trim().toLowerCase();return e.jsx("span",{className:`chip mono ${Al(F)}`,children:F||"unknown"})})(),e.jsx("span",{className:"chip mono muted",children:da(p.request_id,16)})]}),e.jsxs("div",{className:"inbox_detail_actions",children:[r?e.jsx("button",{className:"btn",onClick:l,disabled:y,children:"Back"}):null,e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(p.request_id),disabled:y,"aria-label":"Copy request id",title:"Copy request id",children:[e.jsx(rt,{name:"copy",size:16}),r?null:"Copy request id"]}),p.backlog_relpath?e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(p.backlog_relpath||""),disabled:y,"aria-label":"Copy backlog path",title:"Copy backlog path",children:[e.jsx(rt,{name:"copy",size:16}),r?null:"Copy backlog path"]}):null,(()=>{var Q;const q=(Array.isArray((Q=_==null?void 0:_.backlog_queue)==null?void 0:Q.items)?_.backlog_queue.items:[]).map(E=>String((E==null?void 0:E.relpath)||"").trim()).filter(Boolean);return q.length?e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(q.join(`
|
|
81
|
-
`)),disabled:y,"aria-label":"Copy backlog paths",title:"Copy backlog paths",children:[e.jsx(rt,{name:"copy",size:16}),r?null:"Copy backlog paths"]}):null})(),p.run_dir_relpath?e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(p.run_dir_relpath||""),disabled:y,"aria-label":"Copy run dir",title:"Copy run dir",children:[e.jsx(rt,{name:"copy",size:16}),r?null:"Copy run dir"]}):null]})]}),e.jsxs("div",{className:"detail_hint",style:{marginTop:0},children:[p.created_at?`created ${new Date(p.created_at).toLocaleString()}`:"",p.started_at?` • started ${new Date(p.started_at).toLocaleString()}`:"",p.finished_at?` • finished ${new Date(p.finished_at).toLocaleString()}`:""]}),p.error?e.jsx("div",{className:"detail_warn",children:p.error}):null,b?e.jsx("div",{className:"detail_warn",children:b}):null,e.jsx("div",{style:{marginTop:"12px"},children:y?e.jsx("div",{className:"empty_note",children:"Loading…"}):e.jsxs(e.Fragment,{children:[e.jsx(zv,{exec_selected:p,exec_detail:_,exec_qa_feedback:x,set_exec_qa_feedback:N,exec_qa_loading:L,exec_qa_error:I,on_send_feedback:c,on_promote:d,on_deploy_uat:m}),e.jsx(Pv,{exec_selected:p,exec_detail:_}),e.jsx("div",{className:"section_title",children:"Execution"}),e.jsxs("div",{className:"fact_grid",children:[e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"status"}),e.jsx("span",{className:"fact_value",children:p.status||"unknown"})]}),p.executor_type?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"executor"}),e.jsx("span",{className:"fact_value",children:p.executor_type})]}):null,p.target_agent?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"target agent"}),e.jsx("span",{className:"fact_value",children:p.target_agent})]}):null,p.target_model?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"model"}),e.jsxs("span",{className:"fact_value",children:[p.target_model,p.target_reasoning_effort?` (reasoning ${p.target_reasoning_effort})`:""]})]}):null,p.exit_code!=null?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"exit code"}),e.jsx("span",{className:"fact_value",children:String(p.exit_code)})]}):null,z.age_ms!=null?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"age"}),e.jsx("span",{className:"fact_value",children:Is(z.age_ms)})]}):null,z.queue_delay_ms!=null?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"queue delay"}),e.jsx("span",{className:"fact_value",children:Is(z.queue_delay_ms)})]}):null,z.run_ms!=null?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"run time"}),e.jsx("span",{className:"fact_value",children:Is(z.run_ms)})]}):null,z.total_ms!=null&&z.is_done?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"total time"}),e.jsx("span",{className:"fact_value",children:Is(z.total_ms)})]}):null,C?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"commands"}),e.jsxs("span",{className:"fact_value",children:[C.command_count.toLocaleString(),C.command_fail_count?` (${C.command_fail_count.toLocaleString()} failed)`:""]})]}):null,e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"tokens"}),e.jsx("span",{className:"fact_value",children:C!=null&&C.has_tokens?e.jsxs(e.Fragment,{children:["in ",C.input_tokens.toLocaleString(),C.cached_input_tokens?` (cached ${C.cached_input_tokens.toLocaleString()})`:"",", out ",C.output_tokens.toLocaleString(),", total ",C.total_tokens.toLocaleString()]}):e.jsx("span",{className:"muted",children:B==="events"?"n/a":'select "events"'})})]}),p.run_dir_relpath?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"run dir"}),e.jsx("span",{className:"fact_value mono",children:p.run_dir_relpath})]}):null]}),e.jsx(Dv,{exec_detail:_}),e.jsx(Iv,{exec_detail:_,exec_qa_loading:L,status:String(p.status||"")}),e.jsx(Ov,{exec_detail:_}),e.jsx(Fv,{exec_selected:p,exec_detail:_}),e.jsx("div",{className:"section_divider"}),e.jsx(Lv,{exec_selected:p,exec_detail:_,is_compact_layout:r,exec_log_name:s.exec_log_name,set_exec_log_name:s.set_exec_log_name,exec_log_text:s.exec_log_text,exec_log_loading:s.exec_log_loading,exec_log_error:s.exec_log_error,exec_log_truncated:s.exec_log_truncated,exec_log_auto:s.exec_log_auto,set_exec_log_auto:F=>s.set_exec_log_auto(F),exec_log_scroll_el_ref:s.exec_log_scroll_el_ref,exec_log_follow_ref:s.exec_log_follow_ref,parsed_exec_events:s.parsed_exec_events,load_exec_log_tail:()=>void s.load_exec_log_tail()})]})})]})}function zv(a){const{exec_selected:s,exec_detail:r,exec_qa_feedback:l,set_exec_qa_feedback:c,exec_qa_loading:d,exec_qa_error:m,on_send_feedback:p,on_promote:_,on_deploy_uat:y}=a;if(String(s.status||"").trim().toLowerCase()!=="awaiting_qa")return null;const x=String((r==null?void 0:r.execution_mode)||"").trim().toLowerCase()||"uat",N=String((r==null?void 0:r.candidate_relpath)||"").trim(),L=String((r==null?void 0:r.candidate_patch_relpath)||"").trim(),I=String((r==null?void 0:r.candidate_manifest_relpath)||"").trim(),C=String((r==null?void 0:r.uat_current_relpath)||"").trim(),z=String((r==null?void 0:r.uat_lock_owner_request_id)||"").trim(),B=!!(r!=null&&r.uat_lock_acquired),F=!!(r!=null&&r.uat_pending),q=(r==null?void 0:r.uat_deploy)??null,Q=String((r==null?void 0:r.uat_deploy_error)||"").trim(),E=r==null?void 0:r.attempt,Z=(r==null?void 0:r.promotion_report)??null,oe=!!(Z!=null&&Z.blocked),le=String((Z==null?void 0:Z.reason)||"").trim(),pe=Array.isArray(Z==null?void 0:Z.conflicts)?(Z==null?void 0:Z.conflicts).slice(0,8):[],Te=typeof(Z==null?void 0:Z.conflicts_total)=="number"?Number(Z.conflicts_total):pe.length;let Me="",ve="";const ce=[];try{const D=q==null?void 0:q.processes;if(D&&typeof D=="object"&&!Array.isArray(D)){typeof D.status=="string"&&(Me=String(D.status||"").trim()),typeof D.reason=="string"&&(ve=String(D.reason||"").trim());for(const[R,U]of Object.entries(D)){if(!U||typeof U!="object"||Array.isArray(U))continue;const X=U.probe;!X||typeof X!="object"||X.ok===!1&&ce.push(String(R))}}}catch{}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_title",children:"QA decision"}),e.jsxs("div",{className:"fact_grid",children:[e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"mode"}),e.jsx("span",{className:"fact_value",children:x})]}),typeof E=="number"?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"attempt"}),e.jsx("span",{className:"fact_value",children:E})]}):null,x==="uat"&&z?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"uat lock"}),e.jsxs("span",{className:"fact_value",children:[da(z,18),B?" (owned)":F?" (pending)":""]})]}):null,N?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"candidate"}),e.jsx("span",{className:"fact_value mono",children:N})]}):null,I?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"manifest"}),e.jsx("span",{className:"fact_value mono",children:I})]}):null,L?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"patch"}),e.jsx("span",{className:"fact_value mono",children:L})]}):null,C?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"uat current"}),e.jsx("span",{className:"fact_value mono",children:C})]}):null]}),x==="inplace"?e.jsx("div",{className:"detail_warn",children:"Inplace mode: prod may already be mutated. Approving only finalizes the request status."}):x==="uat"&&F&&z&&!B?e.jsxs("div",{className:"detail_warn",children:["UAT currently points to ",da(z,16),". Click “Restart UAT” to switch the shared UAT stack to this request."]}):x==="uat"&&B?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"detail_hint",children:["UAT URLs: gateway ",e.jsx("code",{children:"http://localhost:6081"}),", observer ",e.jsx("code",{children:"http://localhost:6082"}),", code ",e.jsx("code",{children:"http://localhost:6083"}),", flow"," ",e.jsx("code",{children:"http://localhost:6084"})]}),e.jsx("div",{className:"detail_hint",children:"UAT is intentionally short-lived: promoting or iterating will stop the shared UAT services."}),ce.length?e.jsxs("div",{className:"detail_warn",children:["UAT may be unreachable: URL probe failed for ",ce.slice(0,4).join(", "),ce.length>4?"…":"",". Click “Restart UAT” and check process logs."]}):null]}):null,x==="uat"&&Me==="skipped"&&ve==="process_manager_disabled"?e.jsxs("div",{className:"detail_warn",children:["UAT services were not started: the process manager is off. An admin turns it on in Settings → Gateway administration (or"," ",e.jsx("code",{children:"abstractgateway config set process_manager on"}),")."]}):null,Q?e.jsxs("div",{className:"detail_warn",children:["UAT deploy failed: ",Q]}):null,oe&&le==="conflicts"?e.jsxs("div",{className:"detail_warn",children:["Promotion blocked: prod diverged from the candidate base (",Te," conflict",Te===1?"":"s","). Use “Iterate” to re-run the request on top of current prod, or resolve conflicts manually.",pe.length?e.jsx("ul",{style:{marginTop:"8px",paddingLeft:"18px"},children:pe.map((D,R)=>e.jsxs("li",{children:[String((D==null?void 0:D.repo)||""),"/",String((D==null?void 0:D.path)||"")," (",String((D==null?void 0:D.reason)||"conflict"),")"]},`c:${R}`))}):null]}):null,e.jsxs("div",{className:"row",style:{flexWrap:"wrap",gap:"6px",marginTop:"8px"},children:[L?e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(L),disabled:d,children:[e.jsx(rt,{name:"copy",size:16}),"Copy patch path"]}):null,I?e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(I),disabled:d,children:[e.jsx(rt,{name:"copy",size:16}),"Copy manifest path"]}):null,N?e.jsxs("button",{className:"btn btn_icon",onClick:()=>mn(N),disabled:d,children:[e.jsx(rt,{name:"copy",size:16}),"Copy candidate path"]}):null]}),e.jsx("div",{style:{marginTop:"10px"},children:e.jsx("textarea",{value:l,onChange:D=>c(D.target.value),rows:3,placeholder:"QA feedback (what to change / fix)…",style:{width:"100%",resize:"vertical",minHeight:"72px"},disabled:d})}),m?e.jsx("div",{className:"detail_warn",children:m}):null,e.jsxs("div",{className:"row",style:{flexWrap:"wrap",gap:"8px",marginTop:"10px"},children:[x==="uat"?e.jsx("button",{className:"btn",onClick:y,disabled:d,children:"Restart UAT"}):null,e.jsx("button",{className:"btn primary",onClick:_,disabled:d,children:x==="inplace"?"Approve (finalize)":"Approve → promote to prod"}),e.jsx("button",{className:"btn",onClick:p,disabled:d,children:"Iterate (send feedback)"})]}),e.jsx("div",{className:"section_divider"})]})}function Pv(a){const{exec_selected:s,exec_detail:r}=a;if(String(s.status||"").trim().toLowerCase()!=="promoted")return null;const c=String((r==null?void 0:r.promoted_at)||"").trim(),d=(r==null?void 0:r.promotion)??null,m=(r==null?void 0:r.promotion_report)??null,p=typeof(d==null?void 0:d.copied)=="number"?Number(d==null?void 0:d.copied):null,_=typeof(d==null?void 0:d.deleted)=="number"?Number(d==null?void 0:d.deleted):null,y=String((d==null?void 0:d.manifest_sha256)||"").trim(),b=String((d==null?void 0:d.mode)||"").trim(),x=(m==null?void 0:m.redeploy)??null,N=String((x==null?void 0:x.status)||"").trim(),L=String((x==null?void 0:x.reason)||"").trim(),I=String((m==null?void 0:m.redeploy_error)||"").trim();return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_title",children:"Promotion"}),e.jsxs("div",{className:"fact_grid",children:[c?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"promoted at"}),e.jsx("span",{className:"fact_value",children:new Date(c).toLocaleString()})]}):null,b?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"mode"}),e.jsx("span",{className:"fact_value",children:b})]}):null,y?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"manifest sha256"}),e.jsxs("span",{className:"fact_value",children:[y.slice(0,16),"…"]})]}):null,p!=null?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"copied"}),e.jsxs("span",{className:"fact_value",children:[p," files"]})]}):null,_!=null?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"deleted"}),e.jsxs("span",{className:"fact_value",children:[_," files"]})]}):null,N?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"redeploy"}),e.jsxs("span",{className:"fact_value",children:[N,L?` (${L})`:""]})]}):null,I?e.jsxs("div",{className:"fact fact_wide",children:[e.jsx("span",{className:"fact_label",children:"redeploy error"}),e.jsx("span",{className:"fact_value",style:{color:"var(--danger, rgb(248, 113, 113))"},children:I})]}):null]}),e.jsx("div",{className:"section_divider"})]})}function Iv(a){const{exec_detail:s,exec_qa_loading:r}=a;if(String(a.status||"").trim().toLowerCase()==="promoted")return null;const l=s&&typeof s.promotion=="object"?s.promotion:null;if(!l)return null;const c=s&&typeof s.promotion_report=="object"?s.promotion_report:null,d=String((l==null?void 0:l.mode)||"").trim(),m=(l==null?void 0:l.copied)!=null?String(l.copied):"",p=(l==null?void 0:l.deleted)!=null?String(l.deleted):"",_=String((l==null?void 0:l.manifest_sha256)||"").trim(),y=c&&typeof c.redeploy=="object"?c.redeploy:null,b=y?String(y.status||"").trim():"";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Promotion"}),e.jsxs("div",{className:"fact_grid",children:[d?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"mode"}),e.jsx("span",{className:"fact_value",children:d})]}):null,m?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"copied"}),e.jsxs("span",{className:"fact_value",children:[m," files"]})]}):null,p?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"deleted"}),e.jsxs("span",{className:"fact_value",children:[p," files"]})]}):null,_?e.jsxs("div",{className:"fact fact_wide",children:[e.jsxs("span",{className:"fact_label",children:["manifest sha256"," ",e.jsx("button",{className:"chip_icon_btn",onClick:()=>mn(_),disabled:r,title:"Copy the full sha","aria-label":"Copy manifest sha256",children:e.jsx(rt,{name:"copy",size:12})})]}),e.jsxs("span",{className:"fact_value mono",children:[_.slice(0,16),"…"]})]}):null,b?e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"redeploy"}),e.jsx("span",{className:"fact_value",children:b})]}):null]})]})}function Ov(a){var l,c;const r=(Array.isArray((c=(l=a.exec_detail)==null?void 0:l.backlog_queue)==null?void 0:c.items)?a.exec_detail.backlog_queue.items:[]).map(d=>String((d==null?void 0:d.relpath)||"").trim()).filter(Boolean);return r.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Backlog queue"}),e.jsx("div",{className:"path_list mono",children:r.map(d=>e.jsx("div",{children:d},`bq:${d}`))})]}):null}function Dv(a){var _,y,b;const s=((_=a.exec_detail)==null?void 0:_.skills)||((b=(y=a.exec_detail)==null?void 0:y.payload)==null?void 0:b.skills);if(!s||typeof s!="object")return null;const r=Array.isArray(s.requested)?s.requested:[],l=Array.isArray(s.active)?s.active:[],c=s.resolved_tree_hashes&&typeof s.resolved_tree_hashes=="object"?s.resolved_tree_hashes:{},d=Array.isArray(s.verdicts)?s.verdicts:[];if(!r.length&&!l.length&&!d.length)return null;const m=new Set(l.map(x=>String(x))),p=d.filter(x=>{const N=String((x==null?void 0:x.status)||(x==null?void 0:x.state)||"").toLowerCase();return N&&N!=="active"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Skills"}),s.source?e.jsx("div",{className:"fact_grid",children:e.jsxs("div",{className:"fact",children:[e.jsx("span",{className:"fact_label",children:"source"}),e.jsx("span",{className:"fact_value",children:String(s.source)})]})}):null,e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:4},children:r.map(x=>{const N=m.has(String(x)),L=c[String(x)];return e.jsxs("span",{className:`chip mono ${N?"ok":"warn"}`,title:N?L?`active · ${String(L).slice(0,12)}`:"active":"requested but not active — see verdict below",children:[x,N?"":" (held)"]},`skill:${x}`)})}),p.map((x,N)=>{const L=String((x==null?void 0:x.name)||(x==null?void 0:x.skill)||"skill"),I=String((x==null?void 0:x.reason)||(x==null?void 0:x.detail)||(x==null?void 0:x.status)||"held");return e.jsxs("div",{className:"detail_warn",children:[L,": ",I]},`verdict:${N}:${L}`)})]})}function Fv(a){var r,l;const s=String(((l=(r=a.exec_detail)==null?void 0:r.result)==null?void 0:l.last_message)||a.exec_selected.last_message||"").trim();return s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section_divider"}),e.jsx("div",{className:"section_title",children:"Last message"}),e.jsx("div",{className:"detail_prose",children:e.jsx(ds,{className:"md_doc",text:s})})]}):null}const qv=10;function Bv(a){const{gateway:s,gateway_connected:r}=a,l=fd("(max-width: 900px)"),[c,d]=h.useState("list"),[m,p]=h.useState(null);async function _(){try{const R=await s.admin_executors(),U=Array.isArray(R)?R:Array.isArray(R==null?void 0:R.executors)?R.executors:[];p(U)}catch{p(null)}}h.useEffect(()=>{if(!r){p(null);return}_()},[s,r]);const y=hd({gateway:s,can_use_gateway:r,kind:"processing",completed_view:"tasks",is_exec_view:!0,is_compact_layout:l,set_compact_pane:d,on_status_transfer:()=>{I()}}),[b,x]=h.useState([]),[N,L]=h.useState("");async function I(){if(r)try{const R=await s.backlog_exec_requests({status:"completed,promoted,failed",limit:50}),U=Array.isArray(R==null?void 0:R.requests)?R.requests:[];U.sort((X,M)=>{const ue=String(X.finished_at||X.started_at||X.created_at||"");return String(M.finished_at||M.started_at||M.created_at||"").localeCompare(ue)}),x(U.slice(0,qv)),L("")}catch(R){L(String((R==null?void 0:R.message)||R||"Failed to load recent executions"))}}h.useEffect(()=>{if(!r)return;(async()=>{var M;const U=await y.refresh_exec_list("processing");await I();const X=String(a.focus_request_id||"").trim();if(X){const ue=U.find(V=>V.request_id===X);if(ue)await y.load_exec_request(ue);else try{const V=await s.backlog_exec_request(X);V!=null&&V.payload&&await y.load_exec_request({request_id:X,status:String(V.payload.status||"unknown")})}catch{}(M=a.on_focus_consumed)==null||M.call(a)}})();const R=setInterval(()=>{s.is_backing_off()||I()},15e3);return()=>clearInterval(R)},[r,a.focus_request_id]);const C=y.exec_requests.some(R=>String(R.status||"").toLowerCase()==="running"),[,z]=h.useState(0);h.useEffect(()=>{if(!C)return;const R=setInterval(()=>z(U=>(U+1)%3600),1e3);return()=>clearInterval(R)},[C]);const B=y.exec_requests,F=h.useMemo(()=>{let R=0,U=0,X=0;for(const M of B){const ue=String(M.status||"").trim().toLowerCase();ue==="queued"?R+=1:ue==="running"?U+=1:ue==="awaiting_qa"&&(X+=1)}return{queued:R,running:U,awaiting:X}},[B]),q=y.exec_cfg,Q=!!(q!=null&&q.runner_alive),E=String((q==null?void 0:q.executor)||"").trim(),Z=!E||E==="none",oe=Z?"execution agent":E,le=!!(q!=null&&q.can_execute),pe=bi(y.exec_error)||bi(N),[Te,Me]=h.useState(0),ve=dd(s,r&&pe,Te),ce=!l||c==="list",D=!l||c==="detail";return e.jsxs("div",{className:"page page_pad exec_page",children:[e.jsxs("div",{className:"page_toolbar",children:[r&&q?e.jsxs("span",{className:`chip mono ${le?"ok":"warn"}`,title:q.codex_model?`${oe}: ${q.codex_model}${q.codex_reasoning_effort?` (reasoning ${q.codex_reasoning_effort})`:""}`:void 0,children:[Z?"no execution agent":`${oe} worker ${Q?"on":"off"}`,!l&&q.codex_model?` · ${q.codex_model}`:""]}):null,r?null:e.jsx("span",{className:"page_hint",children:"Not connected — use the connection control (top right)."}),!pe&&y.exec_error?e.jsx("span",{className:"page_error mono",children:y.exec_error}):null,e.jsx("div",{className:"page_toolbar_spacer"}),e.jsx("button",{className:`btn btn_icon ${y.exec_loading?"is_loading":""}`,onClick:()=>{y.refresh_exec_list("processing"),I(),y.load_exec_config(),_()},disabled:!r||y.exec_loading,title:"Refresh runs, worker config, and the executor registry","aria-label":"Refresh",children:e.jsx(rt,{name:"refresh",size:16})})]}),r&&q&&!le&&!pe?e.jsxs("div",{className:"callout callout_warn",children:[e.jsx("div",{className:"callout_icon","aria-hidden":"true",children:e.jsx(rt,{name:"warning",size:18})}),e.jsxs("div",{className:"callout_main",children:[e.jsxs("div",{className:"callout_title",children:[Z?m!=null&&m.length?"No default executor selected":"No execution agent on this gateway":Q?"The pipeline cannot execute":"The exec worker is not running",e.jsx("span",{className:"chip mono warn",children:Z?"setup required":Q?"cannot execute":"queued until it returns"})]}),e.jsx("p",{className:"callout_text",children:(()=>{if(!Z)return q.runner_error?`The worker reports: ${q.runner_error} — new executions queue until it comes back.`:Q?"The worker is alive but the gateway reports it cannot execute — check the executor configuration below.":"New executions will queue until the worker comes back.";if(!(m!=null&&m.length))return"The gateway serves the pipeline but has no executor configured — nothing can run until one is enabled on the gateway host.";const R=m.map(M=>M.display||M.id),U=R.slice(0,4).join(", ")+(R.length>4?` +${R.length-4} more`:"");return m.some(M=>M.available!==!1)?`The gateway's registry serves ${m.length} executor${m.length===1?"":"s"} (${U}), but no default is selected — pick one in Settings → Gateway administration (gateway admin).`:`The gateway's registry serves ${m.length} executor${m.length===1?"":"s"} (${U}), but none is currently available — install an executor binary on the gateway host (PATH), then pick it in Settings.`})()}),(!(m!=null&&m.length)||!m.some(R=>R.available!==!1))&&(Z||!Q)?e.jsx("pre",{className:"mono setup_callout_pre",children:`abstractgateway config set backlog_exec_runner on # enables the exec worker
|
|
82
|
-
abstractgateway config set executor codex # canonical ids: codex | claude | cursor-agent | abstractcode
|
|
83
|
-
# the agent program must be installed on the gateway's computer (on its PATH)`}):null,e.jsx("div",{className:"callout_actions",children:a.on_open_settings?e.jsx("button",{className:"btn primary",onClick:a.on_open_settings,title:"Settings → Gateway administration (admin-gated; the gateway authorizes every change)",children:"Open Settings"}):null}),e.jsxs("p",{className:"callout_text muted",children:["The gateway is the gatekeeper: admins enable the worker and pick the executor from Settings → Gateway administration — changes apply live, no gateway restart (the worker reconciles in-process). On the gateway's computer the same settings are"," ",e.jsx("code",{children:"abstractgateway config set …"}),"."]})]})]}):null,pe?e.jsx(md,{gateway:s,surface:"the execution pipeline",status:ve.status,legacy:ve.legacy,error:bi(y.exec_error)?y.exec_error:N,on_changed:()=>{Me(R=>R+1),y.refresh_exec_list("processing")}}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"stat_strip",children:[e.jsxs("div",{className:`stat_card ${F.running?"tone_info":""}`,children:[e.jsx("span",{className:"stat_value",children:F.running}),e.jsx("span",{className:"stat_label",children:"running"})]}),e.jsxs("div",{className:`stat_card ${F.awaiting?"tone_warn":""}`,children:[e.jsx("span",{className:"stat_value",children:F.awaiting}),e.jsx("span",{className:"stat_label",children:"awaiting QA"})]}),e.jsxs("div",{className:"stat_card",children:[e.jsx("span",{className:"stat_value",children:F.queued}),e.jsx("span",{className:"stat_label",children:"queued"})]}),e.jsxs("div",{className:`stat_card ${le?"tone_ok":"tone_danger"}`,children:[e.jsx("span",{className:"stat_value",children:le?"on":Z?"none":"off"}),e.jsxs("span",{className:"stat_label",children:[oe,Z?"":" worker"]})]})]}),e.jsxs("div",{className:"inbox_layout exec_layout",children:[ce?e.jsxs("div",{className:"exec_side",children:[e.jsxs("div",{className:"pane exec_pane_active",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Active"}),e.jsx("span",{className:"pane_count",children:B.length})]}),e.jsx("div",{className:"pane_body pane_body_list",children:B.length?B.map(R=>{var A;const U=String(R.status||"").trim().toLowerCase(),X=Ml(R),M=((A=y.exec_selected)==null?void 0:A.request_id)===R.request_id,ue=U==="running"&&R.started_at?Math.max(0,Date.now()-Date.parse(R.started_at)):null,V=String(R.backlog_filename||R.backlog_relpath||"").trim(),w=R.target_agent||(R.target_model?`${String(R.executor_type||"agent").trim()||"agent"}:${R.target_model}`:"");return e.jsxs("button",{className:`run_card ${M?"selected":""} ${U==="running"?"is_running":""}`,onClick:()=>void y.load_exec_request(R),children:[e.jsxs("div",{className:"run_card_head",children:[e.jsx("span",{className:"run_card_title",title:V,children:V||`request ${da(R.request_id,12)}`}),e.jsx("span",{className:`chip mono ${Al(U)}`,children:U||"unknown"})]}),e.jsxs("div",{className:"run_card_meta",children:[e.jsx("span",{className:"run_card_time",children:ue!==null?`running ${Is(ue)}`:X.queue_delay_ms!=null?`queued ${Is(X.queue_delay_ms)}`:" "}),w?e.jsx("span",{className:"chip mono muted",children:w}):null,e.jsx("span",{className:"run_card_id mono",children:da(R.request_id,14)})]})]},R.request_id)}):e.jsx("div",{className:"empty_note",children:"Nothing is executing right now. Execute a Ready item from the Board (or Backlog)."})})]}),e.jsxs("div",{className:"pane exec_pane_recent",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Recently finished"}),e.jsx("span",{className:"pane_count",children:b.length})]}),e.jsxs("div",{className:"pane_body",style:{padding:0},children:[N&&!pe?e.jsx("div",{className:"page_error mono",style:{padding:"10px 12px"},children:N}):null,!N&&!b.length?e.jsx("div",{className:"empty_note",style:{padding:"10px 12px"},children:"No finished executions yet."}):null,b.length?e.jsx("div",{className:"recent_list",children:b.map(R=>{var V;const U=String(R.status||"").trim().toLowerCase(),X=Ml(R),M=((V=y.exec_selected)==null?void 0:V.request_id)===R.request_id,ue=da(R.backlog_filename||R.backlog_relpath||"request",44);return e.jsxs("button",{className:`recent_row ${M?"selected":""}`,onClick:()=>void y.load_exec_request(R),title:String(R.backlog_filename||R.backlog_relpath||R.request_id),children:[e.jsx("span",{className:`chip mono ${Al(U)}`,children:U||"?"}),e.jsx("span",{className:"recent_row_name",children:ue}),e.jsx("span",{className:"recent_row_time mono",children:X.run_ms!=null?Is(X.run_ms):""})]},`recent:${R.request_id}`)})}):null]})]})]}):null,D?e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Run detail"}),y.exec_selected?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`chip mono ${Al(String(y.exec_selected.status||"").toLowerCase())}`,children:String(y.exec_selected.status||"?").toLowerCase()}),e.jsx("span",{className:"pane_count mono",children:da(y.exec_selected.request_id,20)})]}):e.jsx("span",{className:"pane_count",children:"select a run"})]}),e.jsx("div",{className:"pane_body",children:e.jsx(Mv,{pipeline:y,is_compact_layout:l,on_back_to_list:()=>d("list"),on_send_feedback:()=>void y.exec_send_feedback(async()=>{await y.refresh_exec_list("processing")}),on_promote:()=>void y.exec_promote_to_prod(async()=>{await y.refresh_exec_list("processing"),await I()}),on_deploy_uat:()=>void y.exec_deploy_uat_now(async()=>{await y.refresh_exec_list("processing")})})})]}):null]})]})]})}function Ru(a,s){const r=String(a||"");return r.length<=s?r:`${r.slice(0,Math.max(0,s-1))}…`}function Uv(a){const s=String(a||"").trim().toLowerCase();return s==="running"?{cls:"ok",label:"running"}:s==="stopped"?{cls:"muted",label:"stopped"}:s.includes("restart")?{cls:"warn",label:s}:s.includes("error")||s.includes("failed")?{cls:"danger",label:s||"error"}:{cls:"warn",label:s||"unknown"}}function Tf(a){const s=r=>{const l=String((r==null?void 0:r.id)||"").trim(),c=l.endsWith("_uat")?l.slice(0,-4):l;return c==="gateway"?0:c==="build"?1:c==="abstractobserver"?2:c==="abstractcode_web"?3:c==="abstractflow_backend"?4:c==="abstractflow_frontend"?5:10};return[...a||[]].sort((r,l)=>{const c=s(r),d=s(l);if(c!==d)return c-d;const m=String((r==null?void 0:r.label)||(r==null?void 0:r.id)||"").toLowerCase(),p=String((l==null?void 0:l.label)||(l==null?void 0:l.id)||"").toLowerCase();return m<p?-1:m>p?1:0})}function Wv(a){const s=String(a||"").trim().toLowerCase();return s==="override"?{cls:"ok",label:"override"}:s.startsWith("inherited")?{cls:"info",label:s}:s==="unset"?{cls:"warn",label:"unset"}:!s||s==="missing"?{cls:"muted",label:"missing"}:{cls:"muted",label:s}}function Hv({gateway:a,gateway_connected:s}){const[r,l]=h.useState("prod"),[c,d]=h.useState(null),[m,p]=h.useState([]),[_,y]=h.useState(!1),[b,x]=h.useState(""),[N,L]=h.useState(!1),[I,C]=h.useState(null),[z,B]=h.useState([]),[F,q]=h.useState(!1),[Q,E]=h.useState(""),[Z,oe]=h.useState({}),[le,pe]=h.useState(!1),[Te,Me]=h.useState(null),[ve,ce]=h.useState(""),[D,R]=h.useState(""),[U,X]=h.useState(!1),M=h.useRef(null),ue=h.useMemo(()=>Tf(m.filter(se=>!String((se==null?void 0:se.id)||"").trim().endsWith("_uat"))),[m]),V=h.useMemo(()=>Tf(m.filter(se=>String((se==null?void 0:se.id)||"").trim().endsWith("_uat"))),[m]),w=r==="uat"?V:ue,A=h.useCallback(async()=>{if(s){y(!0),x("");try{const se=await a.list_processes();d(!!(se!=null&&se.enabled));const ye=Array.isArray(se==null?void 0:se.processes)?se.processes:[];p(ye)}catch(se){x(String((se==null?void 0:se.message)||se||"Failed to list processes"))}finally{y(!1)}}},[a,s]),ee=h.useCallback(async()=>{if(s){q(!0),E("");try{const se=await a.list_process_env_vars();C(!!(se!=null&&se.enabled));const ye=Array.isArray(se==null?void 0:se.vars)?se.vars:[];B(ye);const _e=String((se==null?void 0:se.error)||"").trim();_e&&E(_e)}catch(se){E(String((se==null?void 0:se.message)||se||"Failed to list env vars"))}finally{q(!1)}}},[a,s]),ge=h.useCallback(async()=>{if(!s)return;const se=Te;if(se){X(!0);try{const ye=await a.process_log_tail(String(se.id||""),{max_bytes:16e4}),_e=String((ye==null?void 0:ye.content)||""),qe=typeof(ye==null?void 0:ye.bytes)=="number"?Number(ye.bytes):0,Ye=!!(ye!=null&&ye.truncated),ie=String((ye==null?void 0:ye.log_relpath)||"");ce(_e),R(`${qe.toLocaleString()} bytes${Ye?" (tail)":""}${ie?` • ${ie}`:""}`)}catch(ye){ce(""),R(String((ye==null?void 0:ye.message)||ye||"Failed to read logs"))}finally{X(!1)}}},[a,s,Te]),he=h.useCallback(async se=>{Me(se),pe(!0)},[]),O=h.useCallback(()=>{pe(!1),Me(null),ce(""),R("")},[]);h.useEffect(()=>{s&&A()},[s,A]),h.useEffect(()=>{if(!s||r==="env"||!N)return;const se=window.setInterval(()=>{a.is_backing_off()||A()},2e3);return()=>window.clearInterval(se)},[s,r,N,A,a]),h.useEffect(()=>{s&&r==="env"&&ee()},[s,r,ee]),h.useEffect(()=>{if(s&&le)return ge(),M.current&&window.clearInterval(M.current),M.current=window.setInterval(()=>{a.is_backing_off()||ge()},1500),()=>{M.current&&window.clearInterval(M.current),M.current=null}},[s,le,ge]);const je=h.useRef(!1),[te,Ce]=h.useState(!1);async function Ae(se,ye){if(!je.current){je.current=!0,Ce(!0),x("");try{ye==="start"?await a.start_process(se.id):ye==="stop"?await a.stop_process(se.id):ye==="restart"?await a.restart_process(se.id):ye==="redeploy"&&await a.redeploy_process(se.id),await A()}catch(_e){x(String((_e==null?void 0:_e.message)||_e||`Failed to ${ye}`))}finally{je.current=!1,Ce(!1)}}}async function Ge(se){const ye=String(se||"").trim();if(ye){E("");try{const _e=String((Z==null?void 0:Z[ye])??""),qe=await a.update_process_env_vars({set:{[ye]:_e}});C(!!(qe!=null&&qe.enabled)),B(Array.isArray(qe==null?void 0:qe.vars)?qe.vars:[]),oe(ie=>({...ie||{},[ye]:""}));const Ye=String((qe==null?void 0:qe.error)||"").trim();Ye&&E(Ye)}catch(_e){E(String((_e==null?void 0:_e.message)||_e||"Failed to set env var"))}}}async function fe(se){const ye=String(se||"").trim();if(ye){E("");try{const _e=await a.update_process_env_vars({unset:[ye]});C(!!(_e!=null&&_e.enabled)),B(Array.isArray(_e==null?void 0:_e.vars)?_e.vars:[]),oe(Ye=>({...Ye||{},[ye]:""}));const qe=String((_e==null?void 0:_e.error)||"").trim();qe&&E(qe)}catch(_e){E(String((_e==null?void 0:_e.message)||_e||"Failed to unset env var"))}}}const Re=c===null?"…":c?"enabled":"disabled",Ie=I===null?"…":I?"enabled":"disabled";return e.jsx("div",{className:"page page_scroll",children:e.jsxs("div",{className:"page_inner page_pad constrained",children:[e.jsxs("div",{className:"page_toolbar",children:[e.jsxs("div",{className:"seg",role:"group","aria-label":"Service views",children:[e.jsx("button",{"aria-pressed":r==="prod",className:`seg_btn ${r==="prod"?"active":""}`,onClick:()=>l("prod"),children:"Production"}),e.jsx("button",{"aria-pressed":r==="uat",className:`seg_btn ${r==="uat"?"active":""}`,onClick:()=>l("uat"),children:"UAT"}),e.jsx("button",{"aria-pressed":r==="env",className:`seg_btn ${r==="env"?"active":""}`,onClick:()=>l("env"),children:"ENV"})]}),s?null:e.jsx("span",{className:"page_hint mono",children:"Not connected — use the connection badge in the sidebar."}),s&&r!=="env"?e.jsxs("span",{className:`chip mono ${c===!1?"warn":"muted"}`,children:["manager ",Re]}):null,s&&r==="env"?e.jsxs("span",{className:`chip mono ${I===!1?"warn":"muted"}`,children:["env ",Ie]}):null,e.jsx("div",{className:"page_toolbar_spacer"}),r!=="env"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"btn btn_icon",style:{display:"inline-flex",alignItems:"center",gap:"8px"},children:[e.jsx("input",{type:"checkbox",checked:N,onChange:se=>L(!!se.target.checked)}),"auto"]}),e.jsxs("button",{className:`btn btn_icon ${_?"is_loading":""}`,onClick:()=>void A(),disabled:!s||_,children:[e.jsx(rt,{name:"refresh",size:16}),_?"Refreshing…":"Refresh"]})]}):e.jsxs("button",{className:`btn btn_icon ${F?"is_loading":""}`,onClick:()=>void ee(),disabled:!s||F,children:[e.jsx(rt,{name:"refresh",size:16}),F?"Refreshing…":"Refresh"]})]}),s&&r!=="env"&&c===!1?e.jsxs("div",{className:"page_hint mono",children:["The process manager is off on this gateway. An admin turns it on in Settings → Gateway administration (or"," ",e.jsx("span",{className:"mono",children:"abstractgateway config set process_manager on"}),"). Process control also needs the framework checkout it manages: set the backlog folder to it (Settings → Backlog folder)."]}):null,s&&r==="env"&&I===!1?e.jsxs("div",{className:"page_hint mono",children:["The process manager is off on this gateway. An admin turns it on in Settings → Gateway administration (or"," ",e.jsx("span",{className:"mono",children:"abstractgateway config set process_manager on"}),")."]}):null,r!=="env"&&b?e.jsx("div",{className:"page_error mono",children:b}):null,r==="env"&&Q?e.jsx("div",{className:"page_error mono",children:Q}):null,s&&r!=="env"?e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:r==="uat"?"UAT services":"Production services"}),e.jsx("span",{className:"pane_count",children:w.length})]}),e.jsxs("div",{className:"pane_body pane_body_list",children:[w.length?null:e.jsxs("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",padding:"6px 4px"},children:["No ",r==="uat"?"UAT":"production"," processes reported."]}),w.map(se=>{const ye=String(se.id||"").trim(),_e=String(se.label||ye).trim()||ye,qe=Uv(String(se.status||"")),ie=String(se.status||"").trim().toLowerCase()==="running",me=Array.isArray(se==null?void 0:se.actions)?se.actions.map(yt=>String(yt||"").trim()):[],be=me.includes("start"),G=me.includes("stop"),ke=me.includes("restart"),Xe=me.includes("redeploy"),J=me.includes("logs"),T=typeof(se==null?void 0:se.pid)=="number"?Number(se.pid):null,Y=String((se==null?void 0:se.url)||"").trim(),Se=String((se==null?void 0:se.description)||"").trim(),ze=String((se==null?void 0:se.last_error)||"").trim(),Ke=typeof(se==null?void 0:se.exit_code)=="number"?Number(se.exit_code):null,nt=[];T&&nt.push(`pid ${T}`),Ke!==null&&nt.push(`exit ${Ke}`);const dt=nt.join(" • ");return e.jsxs("div",{className:"entity_card",children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"entity_card_title",children:_e}),e.jsx("span",{className:`chip mono ${qe.cls}`,children:qe.label}),e.jsx("span",{className:"chip mono muted",children:ye}),dt?e.jsx("span",{className:"entity_card_sub mono",children:dt}):null]}),Se?e.jsx("div",{className:"entity_card_sub mono",children:Ru(Se,220)}):null,Y?e.jsx("div",{className:"entity_card_sub mono",children:ie?e.jsx("a",{href:Y,target:"_blank",rel:"noreferrer",className:"mono",style:{opacity:.95},children:Y}):e.jsx("span",{className:"mono",children:Y})}):null,ze?e.jsx("div",{className:"page_error mono",children:Ru(ze,360)}):null,e.jsxs("div",{className:"entity_card_actions",children:[be?e.jsx("button",{className:"btn primary",onClick:()=>void Ae(se,"start"),disabled:_||te,children:"Start"}):null,G?e.jsx("button",{className:"btn danger",onClick:()=>void Ae(se,"stop"),disabled:_||te,children:"Stop"}):null,ke?e.jsx("button",{className:"btn",onClick:()=>void Ae(se,"restart"),disabled:_||te,children:"Restart"}):null,Xe?e.jsx("button",{className:"btn",onClick:()=>void Ae(se,"redeploy"),disabled:_||te,children:"Redeploy"}):null,J?e.jsx("button",{className:"btn",onClick:()=>void he(se),disabled:_,children:"Logs"}):null]})]},ye)})]})]}):null,s&&r==="env"?e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Environment variables"}),e.jsx("span",{className:"pane_count",children:z.length}),e.jsx("span",{className:"pane_header_actions mono muted",style:{fontSize:"var(--font-size-xs)"},children:"write-only: the gateway will never return env var values to the browser"})]}),e.jsxs("div",{className:"pane_body pane_body_list",children:[z.map(se=>{const ye=String((se==null?void 0:se.key)||"").trim();if(!ye)return null;const _e=String((se==null?void 0:se.label)||ye).trim()||ye,qe=String((se==null?void 0:se.description)||"").trim(),Ye=String((se==null?void 0:se.source)||"").trim(),ie=!!(se!=null&&se.secret),me=String((se==null?void 0:se.updated_at)||"").trim(),be=Wv(Ye),G=String((Z==null?void 0:Z[ye])??"");return e.jsxs("div",{className:"entity_card",children:[e.jsxs("div",{className:"entity_card_head",children:[e.jsx("span",{className:"entity_card_title",children:_e}),e.jsx("span",{className:`chip mono ${be.cls}`,children:be.label}),e.jsx("span",{className:"chip mono muted",children:ye})]}),qe?e.jsx("div",{className:"entity_card_sub mono",children:Ru(qe,280)}):null,me?e.jsxs("div",{className:"entity_card_sub mono",children:["updated ",me]}):null,e.jsxs("div",{className:"entity_card_actions",children:[e.jsx("input",{className:"input",value:G,onChange:ke=>oe(Xe=>({...Xe||{},[ye]:String(ke.target.value||"")})),placeholder:ie?"••••••••":"value",type:ie?"password":"text",style:{flex:"1 1 320px",minWidth:"220px"},autoComplete:"off",spellCheck:!1}),e.jsx("button",{className:"btn primary",onClick:()=>void Ge(ye),disabled:F,children:"Set"}),e.jsx("button",{className:"btn",onClick:()=>void fe(ye),disabled:F,children:"Unset"})]})]},`env:${ye}`)}),z.length?null:e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)",padding:"6px 4px"},children:"No env vars available (process manager must be enabled)."})]})]}):null,le&&Te?e.jsxs(Ua,{open:le,title:`${String(Te.label||Te.id||"logs").trim()||"Logs"}`,onClose:O,children:[e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:D}),e.jsxs("div",{className:"actions",style:{marginTop:"10px"},children:[e.jsxs("button",{className:`btn btn_icon ${U?"is_loading":""}`,onClick:()=>void ge(),disabled:U,children:[e.jsx(rt,{name:"refresh",size:16}),U?"Refreshing…":"Refresh"]}),e.jsxs("button",{className:"btn btn_icon",onClick:()=>{try{navigator.clipboard.writeText(ve||"")}catch{}},disabled:!ve,children:[e.jsx(rt,{name:"copy",size:16}),"Copy"]})]}),e.jsx("pre",{className:"mono",style:{marginTop:"10px",padding:"10px",borderRadius:"10px",border:"1px solid rgba(255,255,255,0.12)",background:"rgba(0,0,0,0.22)",overflowX:"auto",maxHeight:"55vh",whiteSpace:"pre-wrap"},children:ve||"(no logs yet)"})]}):null]})})}function Af(a){const s=String(a||"").trim();if(!s)return"";const r=Date.parse(s);return Number.isFinite(r)?new Date(r).toLocaleString():s}function jl(a,s){const r=String(a||"");return r.length<=s?r:`${r.slice(0,Math.max(0,s-1))}…`}function Lu(a){const s=String(a||"").split(/[,\n]/g).map(r=>r.trim()).filter(Boolean);return s.length<=1?s[0]||"":s}function Vv(a){const s=a.gateway,[r,l]=h.useState([]),[c,d]=h.useState(""),[m,p]=h.useState(""),[_,y]=h.useState(""),[b,x]=h.useState("7d"),[N,L]=h.useState("unread"),[I,C]=h.useState(25),[z,B]=h.useState(!1),[F,q]=h.useState(!1),[Q,E]=h.useState(!1),[Z,oe]=h.useState(!1),[le,pe]=h.useState(""),[Te,Me]=h.useState(""),[ve,ce]=h.useState(""),[D,R]=h.useState([]),[U,X]=h.useState(""),[M,ue]=h.useState(null),[V,w]=h.useState(!1),[A,ee]=h.useState(""),[ge,he]=h.useState(""),[O,je]=h.useState(""),[te,Ce]=h.useState(""),[Ae,Ge]=h.useState(""),fe=a.enabled,Re=h.useMemo(()=>(Array.isArray(r)?r:[]).map(Y=>({account:String((Y==null?void 0:Y.account)||"").trim(),can_read:(Y==null?void 0:Y.can_read)!==!1,can_send:(Y==null?void 0:Y.can_send)!==!1,label:""})).filter(Y=>!!Y.account),[r]),Ie=h.useMemo(()=>{const T=String(m||"").trim();return T&&Re.find(Y=>Y.account===T)||null},[Re,m]),se=!!(Ie!=null&&Ie.can_read),ye=!!(Ie!=null&&Ie.can_send),_e=h.useMemo(()=>Re.map(T=>{const Y=T.can_read?T.can_send?"":" (read-only)":" (send-only)";return{...T,label:`${T.account}${Y}`}}),[Re]);async function qe(){if(fe){pe(""),B(!0);try{const T=await s.email_list_accounts();l(Array.isArray(T==null?void 0:T.accounts)?T.accounts:[]),d(String((T==null?void 0:T.default_account)||"").trim())}catch(T){pe(String((T==null?void 0:T.message)||T||"Failed to list email accounts")),l([]),d("")}finally{B(!1)}}}h.useEffect(()=>{qe()},[fe]),h.useEffect(()=>{if(!fe)return;const T=String(m||"").trim();if(T&&Re.some(Se=>Se.account===T))return;const Y=String(localStorage.getItem("abstractcontinuum_email_account")||"").trim();if(Y&&Re.some(Se=>Se.account===Y)){p(Y);return}if(c&&Re.some(Se=>Se.account===c)){p(c);return}Re.length&&p(Re[0].account)},[fe,m,c,Re]),h.useEffect(()=>{const T=String(m||"").trim();T&&localStorage.setItem("abstractcontinuum_email_account",T)},[m]);async function Ye(){if(!fe)return;const T=String(m||"").trim();if(T){if(!se){pe("Selected account is not allowed to read email."),R([]),X(""),ue(null);return}pe(""),q(!0);try{const Y=await s.email_list_messages({account:T,mailbox:String(_||"").trim()||void 0,since:String(b||"").trim()||void 0,status:N,limit:I}),Se=Array.isArray(Y==null?void 0:Y.messages)?Y.messages:[];R(Se);const ze=String(U||"").trim();ze&&!Se.some(Ke=>String((Ke==null?void 0:Ke.uid)||"").trim()===ze)&&(X(""),ue(null))}catch(Y){pe(String((Y==null?void 0:Y.message)||Y||"Failed to list emails")),R([]),X(""),ue(null)}finally{q(!1)}}}h.useEffect(()=>{fe&&String(m||"").trim()&&Ye()},[fe,m]);async function ie(T){if(!fe)return;const Y=String(m||"").trim(),Se=String(T||"").trim();if(!(!Y||!Se)&&se){X(Se),ue(null),Me(""),E(!0);try{const ze=await s.email_read_message(Se,{account:Y,mailbox:String(_||"").trim()||void 0,max_body_chars:2e4});ue(ze)}catch(ze){Me(String((ze==null?void 0:ze.message)||ze||"Failed to read email"))}finally{E(!1)}}}function me(T){ce(""),ee(String((T==null?void 0:T.to)||"").trim()),he(""),je(""),Ce(String((T==null?void 0:T.subject)||"").trim()),Ge(String((T==null?void 0:T.body)||"")),w(!0)}function be(){if(!M)return;const T=String((M==null?void 0:M.from)||"").trim(),Y=String((M==null?void 0:M.subject)||"").trim(),Se=Y.toLowerCase().startsWith("re:")?Y:`Re: ${Y||"(no subject)"}`,ze=String((M==null?void 0:M.body_text)||"").trim(),Ke=`
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
On ${Af((M==null?void 0:M.date)||"")}, ${T} wrote:
|
|
87
|
-
|
|
88
|
-
${ze}`;me({to:T,subject:Se,body:Ke})}async function G(){if(!fe||Z)return;const T=String(m||"").trim();if(T){if(!ye){ce("Selected account is not allowed to send email.");return}ce(""),oe(!0);try{const Y=Lu(A);if(!Y)throw new Error("to is required");const Se=String(te||"").trim();if(!Se)throw new Error("subject is required");const ze=String(Ae||"").trim();if(!ze)throw new Error("body is required");await s.email_send({account:T,to:Y,subject:Se,body_text:ze,cc:Lu(ge),bcc:Lu(O)}),w(!1),ee(""),he(""),je(""),Ce(""),Ge(""),await Ye()}catch(Y){ce(String((Y==null?void 0:Y.message)||Y||"Failed to send email"))}finally{oe(!1)}}}const ke=h.useMemo(()=>{const T=String(U||"").trim();return T&&D.find(Y=>String((Y==null?void 0:Y.uid)||"").trim()===T)||null},[D,U]),Xe=String((M==null?void 0:M.body_text)||"").trim()||String((M==null?void 0:M.body_html)||"").trim(),J=String((M==null?void 0:M.body_text)||"").trim()?"Body (text)":String((M==null?void 0:M.body_html)||"").trim()?"Body (html, raw)":"Body";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"inbox_layout exec_layout",children:[e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Email"}),e.jsx("span",{className:"pane_count",children:D.length})]}),e.jsxs("div",{className:"pane_body",style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsxs("div",{className:"row",style:{alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{className:"row",style:{gap:"8px",alignItems:"center"},children:[e.jsx("select",{value:m,onChange:T=>p(String(T.target.value||"")),disabled:!fe||z,children:_e.length?_e.map(T=>e.jsx("option",{value:T.account,children:T.label},T.account)):e.jsx("option",{value:"",children:"(no accounts)"})}),e.jsx("button",{className:"btn",onClick:()=>void qe(),disabled:!fe||z,children:z?"Loading…":"Accounts"})]}),e.jsxs("div",{className:"row",style:{gap:"8px",justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn",onClick:()=>void Ye(),disabled:!fe||F||!String(m||"").trim()||!se,children:F?"Refreshing…":"Refresh"}),e.jsx("button",{className:"btn primary",onClick:()=>me(),disabled:!fe||!String(m||"").trim()||!ye,children:"Compose"})]})]}),e.jsxs("div",{className:"row",style:{gap:"8px",alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{className:"field",style:{margin:0,minWidth:120,flex:"1 1 120px"},children:[e.jsx("label",{children:"Since"}),e.jsx("input",{value:b,onChange:T=>x(String(T.target.value||"")),placeholder:"7d"})]}),e.jsxs("div",{className:"field",style:{margin:0,minWidth:120,flex:"0 0 120px"},children:[e.jsx("label",{children:"Status"}),e.jsxs("select",{value:N,onChange:T=>L(String(T.target.value||"all")),children:[e.jsx("option",{value:"all",children:"all"}),e.jsx("option",{value:"unread",children:"unread"}),e.jsx("option",{value:"read",children:"read"})]})]}),e.jsxs("div",{className:"field",style:{margin:0,minWidth:120,flex:"0 0 120px"},children:[e.jsx("label",{children:"Limit"}),e.jsx("input",{value:String(I),onChange:T=>C(Number(T.target.value||"0")||25),inputMode:"numeric",placeholder:"25"})]}),e.jsxs("div",{className:"field",style:{margin:0,minWidth:160,flex:"1 1 160px"},children:[e.jsx("label",{children:"Mailbox"}),e.jsx("input",{value:_,onChange:T=>y(String(T.target.value||"")),placeholder:"INBOX"})]}),e.jsx("div",{className:"row",style:{gap:"8px",alignItems:"center",marginTop:"18px"},children:e.jsx("button",{className:"btn",onClick:()=>void Ye(),disabled:!fe||F||!String(m||"").trim()||!se,children:"Apply"})})]}),le?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)"},children:le}):null,e.jsx("div",{className:"inbox_list",children:D.length?D.map((T,Y)=>{const Se=String((T==null?void 0:T.uid)||"").trim(),ze=!!Se&&Se===String(U||"").trim(),Ke=String((T==null?void 0:T.subject)||"").trim()||"(no subject)",nt=String((T==null?void 0:T.from)||"").trim(),dt=String((T==null?void 0:T.date)||"").trim(),yt=!!(T!=null&&T.seen);return e.jsxs("button",{className:`inbox_item ${ze?"active":""}`,onClick:()=>void ie(Se),children:[e.jsxs("div",{className:"inbox_item_title",children:[e.jsx("span",{className:`pill ${yt?"approved":"pending"}`,children:yt?"read":"unread"}),e.jsx("span",{className:"item_title_text",children:jl(Ke,52)})]}),e.jsx("div",{className:"inbox_item_meta mono muted",children:jl(nt,60)||"(from?)"}),e.jsxs("div",{className:"inbox_item_meta mono muted",children:[jl(dt,36)||"(date?)"," • uid ",jl(Se,10)]})]},Se||`idx:${Y}`)}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No messages."})})]})]}),e.jsx("div",{className:"pane",children:e.jsx("div",{className:"pane_body",children:U?Q?e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Loading email…"}):Te?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)"},children:Te}):M?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"row",style:{alignItems:"center",justifyContent:"space-between",gap:"8px",flexWrap:"wrap"},children:[e.jsxs("div",{className:"row",style:{gap:"8px",alignItems:"center",flexWrap:"wrap"},children:[e.jsx("div",{className:"mono",style:{fontWeight:700},children:String((M==null?void 0:M.subject)||"").trim()||"(no subject)"}),e.jsx("span",{className:"pill muted",children:String((M==null?void 0:M.account)||"").trim()||m}),e.jsx("span",{className:"pill muted",children:String((M==null?void 0:M.mailbox)||"").trim()||"(mailbox?)"}),e.jsxs("span",{className:"pill muted",children:["uid ",jl(String((M==null?void 0:M.uid)||U),12)]})]}),e.jsxs("div",{className:"row",style:{gap:"8px",justifyContent:"flex-end"},children:[e.jsx("button",{className:"btn",onClick:()=>mn(String((M==null?void 0:M.message_id)||"")),disabled:!String((M==null?void 0:M.message_id)||"").trim(),title:"Copy Message-ID",children:"Copy msg-id"}),e.jsx("button",{className:"btn",onClick:()=>mn(String(U||"")),disabled:!String(U||"").trim(),title:"Copy UID",children:"Copy uid"}),e.jsx("button",{className:"btn primary",onClick:()=>be(),disabled:!ye||!String((M==null?void 0:M.from)||"").trim(),children:"Reply"})]})]}),e.jsx("div",{className:"section_divider"}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"From"}),e.jsx("div",{className:"mono",children:String((M==null?void 0:M.from)||"").trim()||"(from?)"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"To"}),e.jsx("div",{className:"mono",children:String((M==null?void 0:M.to)||"").trim()||"(to?)"})]}),String((M==null?void 0:M.cc)||"").trim()?e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Cc"}),e.jsx("div",{className:"mono",children:String((M==null?void 0:M.cc)||"").trim()})]}):null,e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Date"}),e.jsx("div",{className:"mono",children:Af(String((M==null?void 0:M.date)||(ke==null?void 0:ke.date)||"").trim())||String((M==null?void 0:M.date)||(ke==null?void 0:ke.date)||"").trim()||"(date?)"})]}),Array.isArray(M==null?void 0:M.attachments)&&M.attachments.length?e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Attachments"}),e.jsx("div",{className:"mono",children:M.attachments.map((T,Y)=>e.jsxs("div",{children:[String((T==null?void 0:T.filename)||"").trim()||"(file?)"," ",e.jsx("span",{className:"muted",children:String((T==null?void 0:T.content_type)||"").trim()?`(${String((T==null?void 0:T.content_type)||"").trim()})`:""})]},`${(T==null?void 0:T.filename)||""}:${Y}`))})]}):null,e.jsx("div",{className:"section_divider"}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:J}),e.jsx("pre",{className:"mono",style:{whiteSpace:"pre-wrap",wordBreak:"break-word",padding:"10px",borderRadius:"10px",border:"1px solid rgba(255, 255, 255, 0.10)",background:"rgba(0, 0, 0, 0.12)",maxHeight:"60vh",overflow:"auto"},children:Xe||"(empty)"})]})]}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Select an email to read."}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Select an email to read."})})})]}),e.jsxs(Ua,{open:V,title:`Compose (${String(m||"").trim()||"account"})`,onClose:()=>{Z||w(!1)},actions:e.jsxs("div",{className:"row",style:{gap:"8px",justifyContent:"flex-end"},children:[ve?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginRight:"auto"},children:ve}):null,e.jsx("button",{className:"btn",onClick:()=>w(!1),disabled:Z,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:()=>void G(),disabled:Z,children:Z?"Sending…":"Send"})]}),children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"To"}),e.jsx("input",{value:A,onChange:T=>ee(String(T.target.value||"")),placeholder:"you@example.com"})]}),e.jsxs("div",{className:"row",style:{gap:"10px",flexWrap:"wrap"},children:[e.jsxs("div",{className:"field",style:{flex:"1 1 220px"},children:[e.jsx("label",{children:"Cc"}),e.jsx("input",{value:ge,onChange:T=>he(String(T.target.value||"")),placeholder:"(optional)"})]}),e.jsxs("div",{className:"field",style:{flex:"1 1 220px"},children:[e.jsx("label",{children:"Bcc"}),e.jsx("input",{value:O,onChange:T=>je(String(T.target.value||"")),placeholder:"(optional)"})]})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Subject"}),e.jsx("input",{value:te,onChange:T=>Ce(String(T.target.value||"")),placeholder:"Subject"})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Body (text)"}),e.jsx("textarea",{value:Ae,onChange:T=>Ge(String(T.target.value||"")),placeholder:"Write your message…"})]}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-xs)"},children:"Tip: separate multiple recipients with commas or newlines."})]})]})}function Rf(a){const s=String(a||"").trim();if(!s)return"";const r=s.split("/").filter(Boolean);return r.length?r[r.length-1]:""}function Fo(a){const s=String(a||"").trim();if(!s)return"";const r=Date.parse(s);return Number.isFinite(r)?new Date(r).toLocaleString():s}function vi(a,s){const r=String(a||"");return r.length<=s?r:`${r.slice(0,Math.max(0,s-1))}…`}function Gv(a){const s=a.gateway,r=!!a.enable_triage,[l,c]=h.useState(r?"messages":"email"),[d,m]=h.useState([]),[p,_]=h.useState([]),[y,b]=h.useState([]),[x,N]=h.useState(!1),[L,I]=h.useState(""),[C,z]=h.useState(null),[B,F]=h.useState(""),[q,Q]=h.useState(!1),[E,Z]=h.useState(""),[oe,le]=h.useState("pending"),[pe,Te]=h.useState(null),[Me,ve]=h.useState(""),[ce,D]=h.useState(null),[R,U]=h.useState(""),[X,M]=h.useState(!1),[ue,V]=h.useState(!1),[w,A]=h.useState(""),[ee,ge]=h.useState(""),he=!!ee,[O,je]=h.useState(""),[te,Ce]=h.useState(""),[Ae,Ge]=h.useState(""),[fe,Re]=h.useState(!1),Ie=a.gateway_connected;h.useEffect(()=>{!r&&l!=="email"&&c("email")},[r,l]);const se=h.useMemo(()=>l==="bugs"?d:l==="features"?p:[],[l,d,p]);h.useEffect(()=>{l==="email"&&(I(""),N(!1))},[l]);async function ye(){const J=await s.list_bug_reports();m(Array.isArray(J==null?void 0:J.items)?J.items:[])}async function _e(){const J=await s.list_feature_requests();_(Array.isArray(J==null?void 0:J.items)?J.items:[])}async function qe(){const J=await s.list_triage_decisions({status:oe||void 0,limit:500}),T=Array.isArray(J==null?void 0:J.decisions)?J.decisions:[];b(T),pe&&!T.some(Y=>Y.decision_id===pe.decision_id)&&(Te(null),ve(""),D(null),U(""))}async function Ye(){if(Ie&&r&&l!=="email"){I(""),N(!0);try{l==="bugs"?await ye():l==="features"?await _e():await qe()}catch(J){I(String((J==null?void 0:J.message)||J||"Refresh failed"))}finally{N(!1)}}}h.useEffect(()=>{Ye()},[l,Ie,oe,r]);async function ie(J){z(J),F(""),Z(""),Q(!0);try{if(J.report_type==="bug"){const T=await s.get_bug_report_content(J.filename);F(String((T==null?void 0:T.content)||""))}else{const T=await s.get_feature_request_content(J.filename);F(String((T==null?void 0:T.content)||""))}}catch(T){Z(String((T==null?void 0:T.message)||T||"Failed to load report"))}finally{Q(!1)}}async function me(J){Te(J),ve(""),D(null),U("");const T=Rf(J.report_relpath);if(T)try{if(J.report_type==="bug"){const Y=await s.get_bug_report_content(T);ve(String((Y==null?void 0:Y.content)||""))}else if(J.report_type==="feature"){const Y=await s.get_feature_request_content(T);ve(String((Y==null?void 0:Y.content)||""))}}catch(Y){U(String((Y==null?void 0:Y.message)||Y||"Failed to load report"))}}async function be(J){U(""),D(null);const T=String(J.draft_relpath||"").trim();if(!T)return;const Y=Rf(T);if(Y)try{const Se=await s.backlog_content("proposed",Y);D(Se)}catch(Se){U(String((Se==null?void 0:Se.message)||Se||"Failed to load draft (is repo root configured on gateway?)"))}}async function G(J,T){if(pe&&!X){U(""),M(!0);try{const Y=await s.apply_triage_decision(pe.decision_id,{action:J,defer_days:T??null});await qe();const Se=String(oe||"").trim().toLowerCase(),ze=String((Y==null?void 0:Y.status)||"").trim().toLowerCase();if(!(!Se||Se===ze))Te(null),ve(""),D(null);else if(Te(Y),String(Y.draft_relpath||"").trim())try{await be(Y)}catch{}}catch(Y){U(String((Y==null?void 0:Y.message)||Y||"Decision action failed"))}finally{M(!1)}}}async function ke(){if(!ue){I(""),V(!0);try{const J=await s.triage_run({write_drafts:!1,enable_llm:!1});A(`Scanned ${(J==null?void 0:J.reports)??0} report(s); updated ${(J==null?void 0:J.updated_decisions)??0} decision(s).`),await qe()}catch(J){I(String((J==null?void 0:J.message)||J||"Triage failed"))}finally{V(!1)}}}h.useEffect(()=>{he&&(Ge(""),Ce(""),Re(!1),je(String(a.default_session_id||"").trim()))},[he,a.default_session_id]);async function Xe(){var J,T;if(ee&&!fe){Ge(""),Re(!0);try{const Y=String(O||"").trim();if(!Y)throw new Error("session_id is required");const Se=String(te||"").trim();if(!Se)throw new Error("description is required");const ze={session_id:Y,description:Se,active_run_id:String(a.default_active_run_id||"").trim()||void 0,workflow_id:String(a.default_workflow_id||"").trim()||void 0,client:"abstractcontinuum/web",client_version:"",user_agent:String(((J=globalThis==null?void 0:globalThis.navigator)==null?void 0:J.userAgent)||""),url:String(((T=globalThis==null?void 0:globalThis.location)==null?void 0:T.href)||"")};if(ee==="bug"){const Ke=await s.bug_report_create(ze),nt=String((Ke==null?void 0:Ke.filename)||"").trim();ge(""),c("bugs");const dt=await s.list_bug_reports(),yt=Array.isArray(dt==null?void 0:dt.items)?dt.items:[];m(yt);const ht=yt.find(Et=>Et.filename===nt)||null;ht&&await ie(ht)}else{const Ke=await s.feature_report_create(ze),nt=String((Ke==null?void 0:Ke.filename)||"").trim();ge(""),c("features");const dt=await s.list_feature_requests(),yt=Array.isArray(dt==null?void 0:dt.items)?dt.items:[];_(yt);const ht=yt.find(Et=>Et.filename===nt)||null;ht&&await ie(ht)}}catch(Y){Ge(String((Y==null?void 0:Y.message)||Y||"Failed to create report"))}finally{Re(!1)}}}return e.jsxs("div",{className:"page page_pad",children:[e.jsxs("div",{className:"page_toolbar",children:[e.jsx("div",{className:"seg seg_scroll",role:"group","aria-label":"Inbox views",children:r?e.jsxs(e.Fragment,{children:[e.jsx("button",{"aria-pressed":l==="messages",className:`seg_btn ${l==="messages"?"active":""}`,onClick:()=>c("messages"),children:"Messages"}),e.jsx("button",{"aria-pressed":l==="email",className:`seg_btn ${l==="email"?"active":""}`,onClick:()=>c("email"),children:"Email"}),e.jsx("button",{"aria-pressed":l==="bugs",className:`seg_btn ${l==="bugs"?"active":""}`,onClick:()=>c("bugs"),children:"Bugs"}),e.jsx("button",{"aria-pressed":l==="features",className:`seg_btn ${l==="features"?"active":""}`,onClick:()=>c("features"),children:"Features"})]}):e.jsx("button",{"aria-pressed":l==="email",className:`seg_btn ${l==="email"?"active":""}`,onClick:()=>c("email"),children:"Email"})}),r&&l!=="email"&&w?e.jsx("span",{className:"page_hint mono",children:w}):null,r&&l!=="email"&&L?e.jsx("span",{className:"page_error mono",children:L}):null,e.jsx("div",{className:"page_toolbar_spacer"}),r?e.jsxs(e.Fragment,{children:[l==="messages"?e.jsxs(e.Fragment,{children:[e.jsxs("select",{value:oe,onChange:J=>le(String(J.target.value)),title:"Filter triage decisions by status",children:[e.jsx("option",{value:"pending",children:"pending"}),e.jsx("option",{value:"approved",children:"approved"}),e.jsx("option",{value:"deferred",children:"deferred"}),e.jsx("option",{value:"rejected",children:"rejected"}),e.jsx("option",{value:"",children:"all"})]}),e.jsx("button",{className:"btn",onClick:()=>void Ye(),disabled:!Ie||x,children:x?"Refreshing…":"Refresh"}),e.jsx("button",{className:"btn primary",onClick:()=>void ke(),disabled:!Ie||ue,children:ue?"Running…":"Run triage"})]}):l==="email"?null:e.jsx("button",{className:"btn",onClick:()=>void Ye(),disabled:!Ie||x,children:x?"Refreshing…":"Refresh"}),e.jsx("button",{className:"btn",onClick:()=>ge("bug"),disabled:!Ie,children:"File bug"}),e.jsx("button",{className:"btn",onClick:()=>ge("feature"),disabled:!Ie,children:"File feature"})]}):null]}),l==="email"?e.jsx(Vv,{gateway:s,enabled:Ie}):e.jsxs("div",{className:"inbox_layout exec_layout",children:[e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:l==="messages"?"Triage decisions":l==="bugs"?"Bug reports":"Feature requests"}),e.jsx("span",{className:"pane_count",children:l==="messages"?y.length:se.length})]}),e.jsx("div",{className:"pane_body pane_body_list",children:l==="messages"?e.jsx(e.Fragment,{children:y.length?y.map(J=>{const T=(pe==null?void 0:pe.decision_id)===J.decision_id,Y=Array.isArray(J.missing_fields)?J.missing_fields.length:0;return e.jsxs("button",{className:`inbox_item ${T?"active":""}`,onClick:()=>void me(J),children:[e.jsxs("div",{className:"inbox_item_title",children:[e.jsx("span",{className:`pill ${String(J.status||"").toLowerCase()}`,children:String(J.status||"pending")}),e.jsx("span",{className:"mono",children:J.report_type}),e.jsx("span",{className:"mono muted",children:vi(J.decision_id,10)})]}),e.jsxs("div",{className:"inbox_item_meta mono muted",children:[Y?`${Y} missing`:"complete"," • ",Fo(J.updated_at||J.created_at)||"(time?)"]}),e.jsx("div",{className:"inbox_item_meta mono",children:vi(J.report_relpath||"",46)})]},J.decision_id)}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No decisions."})}):e.jsx(e.Fragment,{children:se.length?se.map(J=>{const T=(C==null?void 0:C.filename)===J.filename&&(C==null?void 0:C.report_type)===J.report_type,Y=String(J.triage_status||"").trim().toLowerCase();return e.jsxs("button",{className:`inbox_item ${T?"active":""}`,onClick:()=>void ie(J),children:[e.jsxs("div",{className:"inbox_item_title",children:[Y?e.jsx("span",{className:`pill ${Y}`,children:Y}):null,e.jsx("span",{className:"mono",children:vi(J.title||J.filename,46)})]}),e.jsxs("div",{className:"inbox_item_meta mono muted",children:[Fo(J.created_at)||"(time?)"," • ",J.session_id?vi(J.session_id,12):"session?"]}),e.jsx("div",{className:"inbox_item_meta mono",children:J.filename})]},J.relpath)}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No reports."})})})]}),e.jsx("div",{className:"pane",children:e.jsx("div",{className:"pane_body",children:l==="messages"?pe?e.jsxs("div",{className:"inbox_detail",children:[e.jsxs("div",{className:"inbox_detail_header",children:[e.jsxs("div",{className:"inbox_detail_title",children:[e.jsx("span",{className:"mono",style:{fontWeight:700},children:"Triage decision"}),e.jsx("span",{className:"chip mono muted",children:pe.report_type}),e.jsx("span",{className:"chip mono muted",children:pe.status}),e.jsx("span",{className:"chip mono muted",children:vi(pe.decision_id,16)})]}),e.jsxs("div",{className:"inbox_detail_actions",children:[e.jsx("button",{className:"btn",onClick:()=>{mn(pe.report_relpath||"")},children:"Copy report path"}),pe.draft_relpath?e.jsx("button",{className:"btn",onClick:()=>void be(pe),children:"Load draft"}):null,e.jsx("button",{className:"btn primary",onClick:()=>void G("approve"),disabled:X,children:"Approve"}),e.jsx("button",{className:"btn",onClick:()=>void G("defer",1),disabled:X,children:"Defer 1d"}),e.jsx("button",{className:"btn",onClick:()=>void G("defer",7),disabled:X,children:"Defer 7d"}),e.jsx("button",{className:"btn",onClick:()=>void G("reject"),disabled:X,children:"Reject"})]})]}),e.jsxs("div",{className:"inbox_detail_meta mono muted",style:{fontSize:"var(--font-size-sm)"},children:[pe.updated_at?`updated ${Fo(pe.updated_at)}`:null,pe.created_at?`${pe.updated_at?" • ":""}created ${Fo(pe.created_at)}`:null,pe.defer_until?` • defer until ${pe.defer_until}`:null]}),R?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:R}):null,e.jsxs("div",{className:"row",style:{gap:"12px"},children:[e.jsxs("div",{className:"col",style:{minWidth:240},children:[e.jsx("div",{className:"section_title",children:"Missing fields"}),pe.missing_fields&&pe.missing_fields.length?e.jsx("ul",{className:"inbox_list_ul mono",children:pe.missing_fields.map(J=>e.jsx("li",{children:J},J))}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"None."}),e.jsx("div",{className:"section_title",style:{marginTop:"10px"},children:"Possible duplicates"}),pe.duplicates&&pe.duplicates.length?e.jsx("ul",{className:"inbox_list_ul mono",children:pe.duplicates.slice(0,20).map((J,T)=>{const Y=String((J==null?void 0:J.title)||(J==null?void 0:J.ref)||(J==null?void 0:J.kind)||"duplicate").trim(),Se=typeof(J==null?void 0:J.score)=="number"&&Number.isFinite(J.score)?` (score ${J.score.toFixed(2)})`:"";return e.jsxs("li",{children:[Y,Se]},`${Y}_${T}`)})}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"None."})]}),e.jsxs("div",{className:"col",style:{minWidth:240},children:[e.jsx("div",{className:"section_title",children:"Draft"}),pe.draft_relpath?e.jsxs("div",{className:"mono",style:{fontSize:"var(--font-size-sm)"},children:[e.jsx("div",{className:"mono muted",children:"path"}),e.jsx("div",{className:"mono",children:pe.draft_relpath})]}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No draft yet. Approve to generate one (requires repo mounted on gateway host)."})]})]}),ce?e.jsxs("div",{className:"inbox_markdown",children:[e.jsx("div",{className:"section_title",children:"Draft content"}),e.jsx(ds,{className:"md_doc",text:String(ce.content||"")})]}):null,e.jsxs("div",{className:"inbox_markdown",children:[e.jsx("div",{className:"section_title",children:"Source report"}),Me?e.jsx(ds,{className:"md_doc",text:Me}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No report preview loaded."})]})]}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Select a decision."}):C?e.jsxs("div",{className:"inbox_detail",children:[e.jsxs("div",{className:"inbox_detail_header",children:[e.jsxs("div",{className:"inbox_detail_title",children:[e.jsx("span",{className:"mono",style:{fontWeight:700},children:C.report_type==="bug"?"Bug report":"Feature request"}),C.triage_status?e.jsx("span",{className:`pill ${C.triage_status}`,children:C.triage_status}):null,e.jsx("span",{className:"chip mono muted",children:C.filename}),C.session_id?e.jsx("span",{className:"chip mono muted",children:vi(C.session_id,16)}):null]}),e.jsx("div",{className:"inbox_detail_actions",children:e.jsx("button",{className:"btn",onClick:()=>{mn(C.relpath||"")},children:"Copy path"})})]}),E?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)",marginTop:"8px"},children:E}):null,q?e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Loading…"}):B?e.jsx(ds,{className:"md_doc",text:B}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"No content loaded."})]}):e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"Select a report."})})})]}),e.jsxs(Ua,{open:he,title:ee==="bug"?"File bug report":"File feature request",onClose:()=>ge(""),actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn",onClick:()=>ge(""),disabled:fe,children:"Cancel"}),e.jsx("button",{className:"btn primary",onClick:()=>void Xe(),disabled:fe,children:fe?"Submitting…":"Submit"})]}),children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Session ID"}),e.jsx("input",{value:O,onChange:J=>je(J.target.value),placeholder:"session id (required)"}),e.jsx("div",{className:"mono muted",style:{fontSize:"var(--font-size-sm)"},children:"This correlates runs + attachments (via the session memory run)."})]}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:ee==="bug"?"Bug description":"Feature description"}),e.jsx("textarea",{value:te,onChange:J=>Ce(J.target.value),placeholder:ee==="bug"?"What is broken? What did you expect?":"What do you want to be able to do?",rows:6})]}),Ae?e.jsx("div",{className:"mono",style:{color:"rgba(239, 68, 68, 0.9)",fontSize:"var(--font-size-sm)"},children:Ae}):null]})]})}const Kv="api/continuum/settings";async function Ph(a){const s=await fetch(Kv,{...a,signal:AbortSignal.timeout(1e4),headers:a!=null&&a.body?{"Content-Type":"application/json"}:void 0}),r=await s.text();let l=null;try{l=JSON.parse(r)}catch{}if(!s.ok||!l||typeof l!="object"||!l.settings){const c=l&&typeof l=="object"?l.detail||l.error:"",d=new Error(c||`settings unavailable (HTTP ${s.status})`);throw d.status=s.status,d}return l}function Qv(){return Ph()}function Jv(a,s){return Ph({method:"PUT",body:JSON.stringify({[a]:s})})}const Ih="abstractcontinuum_voice_override_v1",Mu={enabled:!1};function ed(){try{const a=localStorage.getItem(Ih);if(!a)return{...Mu};const s=JSON.parse(a);return!s||typeof s!="object"?{...Mu}:{enabled:!!s.enabled,provider:Ps(s.provider),model:Ps(s.model),profile:Ps(s.profile),voice:Ps(s.voice),quality_preset:Ps(s.quality_preset)}}catch{return{...Mu}}}const td="abstractcontinuum:voice_override_changed";function Yv(a){try{localStorage.setItem(Ih,JSON.stringify(a))}catch{}try{window.dispatchEvent(new CustomEvent(td))}catch{}}function Oh(a){if(!a)return{};const s={},r=Ps(a.quality_preset);if(r&&(s.quality_preset=r),!a.enabled)return s;for(const l of["provider","model","profile","voice"]){const c=Ps(a[l]);c&&(s[l]=c)}return s}function Ps(a){return String(a??"").trim()||void 0}function Dh(a){const s=a&&typeof a=="object"?a.routes:null;if(!Array.isArray(s))return{};const r=y=>s.find(b=>b&&typeof b=="object"&&String(b.key||"").trim()===y&&!!b.configured),l=r("output.voice.tts")||r("output.voice");if(!l)return{};const c={},d=Ps(l.provider),m=Ps(l.model),p=l.options,_=p&&typeof p=="object"?Ps(p.voice):void 0;return d&&(c.provider=d),m&&(c.model=m),_&&(c.voice=_),c}function Xv(a){let s=String(a||"");return s=s.replace(/```[\s\S]*?```/g," "),s=s.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),s=s.replace(/\[([^\]]+)\]\([^)]*\)/g,"$1"),s=s.replace(/`([^`]+)`/g,"$1"),s=s.replace(/^[ \t]*#{1,6}[ \t]+/gm,""),s=s.replace(/^[ \t]*>[ \t]?/gm,""),s=s.replace(/^[ \t]*[-*+][ \t]+/gm,""),s=s.replace(/^[ \t]*\d+[.)][ \t]+/gm,""),s=s.replace(/^[ \t]*\|/gm,"").replace(/\|[ \t]*$/gm,"").replace(/\|/g,", "),s=s.replace(/(\*\*|__|~~)(.*?)\1/g,"$2"),s=s.replace(/\*([^*\n]+)\*/g,"$1"),s=s.replace(/(^|[^\w])_([^_\n]+)_(?=[^\w]|$)/g,"$1$2"),s=s.replace(/^[ \t]*([-*_])(?:[ \t]*\1){2,}[ \t]*$/gm," "),s=s.replace(/\s+/g," ").trim(),s}const kl={loading:!1,error:"",providers:[],models_by_provider:{},profiles_by_provider:{},voices_by_provider:{},cloned_by_provider:{}};function Zv(a){const s={};if(!Array.isArray(a))return s;for(const r of a){if(!r||typeof r!="object")continue;const l=r.voice_kinds;if(!(Array.isArray(l)&&l.some(_=>String(_).toLowerCase().includes("clone"))))continue;const d=String(r.provider||"").trim(),m=String(r.id||r.voice||r.name||"").trim();if(!m)continue;const p=d||"*";(s[p]||(s[p]=[])).push(m)}for(const r of Object.keys(s))s[r]=[...new Set(s[r])];return s}function nd(a){if(!Array.isArray(a))return[];const s=[];for(const r of a)if(typeof r=="string"){const l=r.trim();l&&s.push(l)}else if(r&&typeof r=="object"){const l=String(r.id||r.name||r.voice||r.value||"").trim();l&&s.push(l)}return[...new Set(s)]}function zu(a){const s={};if(a&&typeof a=="object"&&!Array.isArray(a))for(const[r,l]of Object.entries(a)){const c=nd(l);c.length&&(s[String(r)]=c)}return s}function ey(a){const{gateway:s,gateway_connected:r}=a,[l,c]=h.useState(()=>ed()),[d,m]=h.useState(kl),[p,_]=h.useState(!1),[y,b]=h.useState(""),x=h.useRef(null),N=h.useCallback(q=>{c(Q=>{const E={...Q,...q};return Yv(E),E})},[]);h.useEffect(()=>{if(!r){m(kl);return}if(typeof(s==null?void 0:s.voice_voices)!="function"){m(kl);return}let q=!0;m(E=>({...E,loading:!0,error:""}));let Q;try{Q=s.voice_voices()}catch(E){m({...kl,error:String((E==null?void 0:E.message)||E||"voice catalog unavailable")});return}return Q.then(E=>{if(!q)return;const Z=[...new Set([...nd(E==null?void 0:E.providers),...nd(E==null?void 0:E.tts_providers)])];m({loading:!1,error:"",providers:Z,models_by_provider:zu(E==null?void 0:E.tts_models_by_provider),profiles_by_provider:zu(E==null?void 0:E.tts_profiles_by_provider),voices_by_provider:zu(E==null?void 0:E.tts_voices_by_provider),cloned_by_provider:Zv(E==null?void 0:E.items)})}).catch(E=>{q&&m({...kl,error:String((E==null?void 0:E.message)||E||"voice catalog unavailable")})}),()=>{q=!1}},[s,r]);const L=l.provider||"",I=L&&d.models_by_provider[L]?d.models_by_provider[L]:[],C=L&&d.voices_by_provider[L]?d.voices_by_provider[L]:[],z=L&&d.profiles_by_provider[L]?d.profiles_by_provider[L]:[],B=[...L&&d.cloned_by_provider[L]?d.cloned_by_provider[L]:[],...d.cloned_by_provider["*"]||[]];async function F(){if(!(p||!r)){_(!0),b("");try{const q=await od("abstractcontinuum_team_voice");let Q={};if(typeof s.capability_defaults=="function")try{Q=Dh(await s.capability_defaults())}catch{Q={}}const E=await s.voice_tts(q,{text:"This is the voice AbstractContinuum will use to read your messages.",...Q,...Oh(l),timeout_s:30}),Z=E==null?void 0:E.audio_artifact,oe=Z&&typeof Z=="object"?String(Z.$artifact||"").trim():"";if(!oe)throw new Error("no audio returned");const le=await s.download_run_artifact_content(q,oe),pe=URL.createObjectURL(le);if(x.current)try{x.current.pause()}catch{}const Te=x.current;if(Te){try{Te.pause()}catch{}const ve=Te.src;ve.startsWith("blob:")&&URL.revokeObjectURL(ve)}const Me=new Audio(pe);x.current=Me,Me.onended=()=>{URL.revokeObjectURL(pe),b("")};try{await Me.play(),b("Playing…")}catch(ve){b(String((ve==null?void 0:ve.name)||"").includes("NotAllowed")?"Synthesized OK — click Test again to play.":`Playback failed: ${String((ve==null?void 0:ve.message)||ve).slice(0,80)}`),URL.revokeObjectURL(pe)}}catch(q){b(`Test failed: ${String((q==null?void 0:q.message)||q||"synthesis error").slice(0,120)}`)}finally{_(!1)}}}return e.jsxs("div",{className:"pane",style:{marginTop:12},children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Voice"}),e.jsx("span",{className:"pane_subtitle",children:"message read-aloud — this browser"})]}),e.jsx("div",{className:"pane_body",children:r?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"muted team_note",style:{marginTop:0},children:"Each message can be read aloud (the speaker button on a message). By default the gateway's configured voice is used, streamed so playback starts immediately. Override it here for this browser."}),e.jsxs("label",{className:"settings_row",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{type:"checkbox",checked:l.enabled,onChange:q=>N({enabled:q.target.checked})}),"Override the gateway default voice"]}),d.error?e.jsxs("div",{className:"muted team_note",children:["Voice catalog unavailable (",d.error.slice(0,100),") — you can still type provider/model/voice values below; the gateway validates on Test."]}):null,d.loading?e.jsx("div",{className:"muted team_note",children:"Loading voices…"}):null,l.enabled&&!L&&(l.voice||l.profile)?e.jsx("div",{className:"muted team_note",style:{color:"var(--warning, #facc15)"},children:"A voice id is provider-specific — pick the provider it belongs to, or the gateway's default provider may reject it."}):null,l.enabled?e.jsxs("div",{style:{display:"grid",gap:8,marginTop:8},children:[e.jsxs("label",{className:"settings_field",children:[e.jsx("span",{className:"muted",children:"Provider"}),e.jsx(qo,{value:L,options:d.providers,placeholder:"gateway default",onChange:q=>N({provider:q,model:"",voice:"",profile:""})})]}),e.jsxs("label",{className:"settings_field",children:[e.jsx("span",{className:"muted",children:"Model"}),e.jsx(qo,{value:l.model||"",options:I,placeholder:"default",onChange:q=>N({model:q})})]}),e.jsxs("label",{className:"settings_field",children:[e.jsx("span",{className:"muted",children:"Base voice"}),e.jsx(qo,{value:l.profile||"",options:z,placeholder:"default",onChange:q=>N({profile:q})})]}),e.jsxs("label",{className:"settings_field",children:[e.jsx("span",{className:"muted",children:"Cloned voice"}),e.jsx(qo,{value:l.voice||"",options:[...B,...C],placeholder:"none",onChange:q=>N({voice:q})})]})]}):null,e.jsxs("label",{className:"settings_field",style:{marginTop:8},children:[e.jsx("span",{className:"muted",children:"Quality"}),e.jsxs("select",{className:"team_compose_control",value:l.quality_preset||"",onChange:q=>N({quality_preset:q.target.value}),children:[e.jsx("option",{value:"",children:"gateway default"}),e.jsx("option",{value:"low",children:"low (fastest)"}),e.jsx("option",{value:"standard",children:"standard"}),e.jsx("option",{value:"high",children:"high (best)"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:10},children:[e.jsx("button",{className:"btn primary",disabled:p,onClick:()=>void F(),children:p?"Synthesizing…":"Test voice"}),y?e.jsx("span",{className:"muted team_note",children:y}):null]})]}):e.jsx("div",{className:"muted team_note",children:"Connect to the gateway to configure and test message voice."})})]})}function qo(a){const s=Kt.useId();return e.jsxs(e.Fragment,{children:[e.jsx("input",{className:"team_compose_control mono",list:s,value:a.value,placeholder:a.placeholder||"",onChange:r=>a.onChange(r.target.value.trim())}),a.options.length?e.jsx("datalist",{id:s,children:a.options.map(r=>e.jsx("option",{value:r},r))}):null]})}const ty=["minimal","low","medium","high","xhigh"];function ny(a){const{gateway:s,connected:r,model:l,value:c,onChange:d}=a,[m,p]=h.useState({state:"unknown",levels:[]}),[_,y]=h.useState(!1);if(h.useEffect(()=>{y(!1);const N=String(l||"").trim();if(!N||!r){p({state:"unknown",levels:[]});return}let L=!1;return p({state:"loading",levels:[]}),s.discovery_model_capabilities(N).then(I=>{if(L)return;const C=I!=null&&I.capabilities&&typeof I.capabilities=="object"?I.capabilities:{},z=C.thinking_support,B=Array.isArray(C.reasoning_levels)?C.reasoning_levels.map(F=>String(F)):[];p(z===!0?{state:"supported",levels:B}:z===!1?{state:"unsupported",levels:[]}:{state:"unknown",levels:[]})}).catch(()=>{L||p({state:"unknown",levels:[]})}),()=>{L=!0}},[l,r]),!String(l||"").trim())return null;const b=m.state==="unsupported"||m.state==="unknown"&&!_||m.state==="loading",x=m.state==="supported"&&m.levels.length?m.levels:m.state==="unknown"&&_?[...ty]:[];return e.jsxs("div",{className:"field","data-testid":"reasoning_select",children:[e.jsxs("label",{children:["Reasoning (effort for ",l,")"]}),e.jsxs("select",{value:b?"":c,onChange:N=>d(String(N.target.value||"")),disabled:b,title:m.state==="supported"?"Efforts this model declares (gateway-served). Sent on the `thinking` wire key; blank = gateway default.":m.state==="unsupported"?"This model declares no reasoning support — effort is locked to none (contract v1: non-reasoning models naturally get none).":m.state==="loading"?"Checking the model's served capabilities…":"The gateway serves no reasoning facts for this model (unknown ≠ unsupported). Locked fail-safe; tick “set anyway” if you know the model reasons.",children:[e.jsx("option",{value:"",children:m.state==="unsupported"?"none — this model doesn't reason":m.state==="loading"?"checking…":m.state==="unknown"&&!_?"unknown — no served facts":"gateway default"}),x.map(N=>e.jsx("option",{value:N,children:N},N))]}),m.state==="unknown"&&!b?e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:"Override active: efforts unverified for this model — the provider may reject or ignore them."}):null,m.state==="unknown"?e.jsxs("label",{className:"muted",style:{fontSize:"var(--font-size-sm)",display:"inline-flex",gap:"6px",alignItems:"center"},children:[e.jsx("input",{type:"checkbox",checked:_,onChange:N=>{y(N.target.checked),N.target.checked||d("")}}),"set anyway (I know this model reasons)"]}):null]})}function sy(a){const[s,r]=h.useState(!1),[l,c]=h.useState("");return s?e.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{className:"mono",style:{minWidth:260},value:l,onChange:d=>c(d.target.value),placeholder:"/path/to/a/folder/with/docs/backlog",disabled:a.busy}),e.jsx("button",{className:"btn primary",disabled:a.busy||!l.trim(),onClick:()=>{a.on_apply(l.trim()),r(!1)},children:"Apply"}),e.jsx("button",{className:"btn",disabled:a.busy,onClick:()=>r(!1),children:"Cancel"})]}):e.jsx("button",{className:"btn",disabled:a.busy,onClick:()=>{c(a.current),r(!0)},children:a.current?"Change…":"Set…"})}function ay(a){const s=String(a||"").trim();if(!s)return null;const r={flag:["launch flag","info","Set by a launch flag of the running Continuum; a saved value applies once it restarts without the flag."],setting:["setting","info","Saved setting (here, or `abstractcontinuum config set`)."],env:["environment (legacy)","warn","Set by the environment Continuum was started with. Save a value here to replace it."],default:["default","muted","Nothing saved: Continuum's default."]},[l,c,d]=r[s]||[s,"muted",""];return e.jsx("span",{className:`chip mono ${c}`,title:d,"data-testid":"hub_seat_source",children:l})}function ry(){var I;const[a,s]=h.useState(null),[r,l]=h.useState(""),[c,d]=h.useState(""),[m,p]=h.useState(!1),[_,y]=h.useState("");h.useEffect(()=>{let C=!1;return Qv().then(z=>{var B;C||(s(z),d(String(((B=z.settings.hub_seat)==null?void 0:B.value)??"")))}).catch(z=>{C||l(String((z==null?void 0:z.message)||z))}),()=>{C=!0}},[]);async function b(C){var z;p(!0),y("");try{const B=await Jv("hub_seat",C);s(B),d(String(((z=B.settings.hub_seat)==null?void 0:z.value)??""))}catch(B){y(String((B==null?void 0:B.message)||B||"Save refused"))}finally{p(!1)}}const x=a==null?void 0:a.settings.hub_seat,N=String((x==null?void 0:x.value)??""),L=!!((I=a==null?void 0:a.writable)!=null&&I.includes("hub_seat"));return e.jsxs("div",{className:"pane","data-testid":"hub_seat_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Team (agora hub)"}),e.jsx("span",{className:"pane_subtitle",children:"server-side — this Continuum"})]}),e.jsx("div",{className:"pane_body",children:a?e.jsxs("div",{className:"admin_row","data-testid":"admin_row_hub_seat",children:[e.jsxs("div",{className:"admin_row_top",children:[e.jsx("span",{className:"admin_row_name",children:"Hub seat"}),e.jsx("span",{className:"chip mono ok","data-testid":"hub_seat_value",children:N}),ay(x==null?void 0:x.source),e.jsx("div",{className:"admin_row_action",children:L?e.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{className:"mono","aria-label":"Hub seat",value:c,onChange:C=>d(C.target.value),placeholder:"your seat",disabled:m}),e.jsx("button",{className:"btn primary",disabled:m||!c.trim()||c.trim()===N&&(x==null?void 0:x.source)==="setting",onClick:()=>void b(c.trim()),children:"Save"}),(x==null?void 0:x.source)==="setting"?e.jsx("button",{className:"btn",disabled:m,onClick:()=>void b(null),children:"Use default"}):null]}):null})]}),e.jsxs("div",{className:"admin_row_detail",children:["The seat the Team page reads and posts as — set it to your own seat. Saved in ",e.jsx("code",{children:a.settings_file}),"; the same setting: ",e.jsx("code",{children:"abstractcontinuum config set hub_seat <seat>"}),", or ",e.jsx("code",{children:"--hub-seat <seat>"})," for one run.",(x==null?void 0:x.source)==="flag"?" A launch flag sets the seat for this run; a saved value applies once Continuum restarts without it.":null]}),_?e.jsx("div",{className:"page_error mono",style:{marginTop:"6px"},children:_}):null]}):e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:r?`Continuum's server settings are not available here (${r}). Set the seat with \`abstractcontinuum config set hub_seat <seat>\` or start Continuum with --hub-seat <seat>.`:"Loading…"})})]})}function iy(a){var ve,ce;const{gateway:s,gateway_connected:r,settings:l,set_settings:c}=a,d=(ce=(ve=a.connection)==null?void 0:ve.gateway)==null?void 0:ce.principal,[m,p]=h.useState({loaded:!1,process_manager:null,backlog_root:null,exec_pipeline:null,exec_detail:"",executor:""}),[_,y]=h.useState(null),[b,x]=h.useState(null),[N,L]=h.useState(!1),[I,C]=h.useState(null),[z,B]=h.useState([]),[F,q]=h.useState(""),[Q,E]=h.useState(!1),[Z,oe]=h.useState(0);async function le(D){if(!Q){E(!0),q("");try{const R=await s.admin_runtime_config_update(D);y(R),oe(U=>U+1)}catch(R){q(String((R==null?void 0:R.message)||R||"Config update refused"))}finally{E(!1)}}}h.useEffect(()=>{if(!r)return;let D=!1;return(async()=>{var U;const R={loaded:!0,process_manager:null,backlog_root:null,exec_pipeline:null,exec_detail:"",executor:""};try{const X=await s.backlog_exec_config(),M=!!(X!=null&&X.runner_enabled),ue=!!(X!=null&&X.runner_alive),V=(X==null?void 0:X.can_execute)===!0;R.exec_pipeline=V?"on":M||ue?"degraded":"off",R.exec_detail=V?"":M?ue?"runner alive but cannot execute (executor missing?)":"runner enabled but not alive":"runner disabled",R.executor=String((X==null?void 0:X.executor)||"").trim()}catch{R.exec_pipeline=null}try{const X=await s.admin_runtime_config();if(X&&typeof X=="object"){D||(y(X),R.process_manager=gi(X.process_manager),R.backlog_root=((U=X.triage_repo_root)==null?void 0:U.available)!==void 0?!!X.triage_repo_root.available:gi(X.triage_repo_root),p(R));return}}catch{}try{const X=await s.list_processes();R.process_manager=!!(X!=null&&X.enabled)}catch{R.process_manager=null}try{await s.backlog_template(),R.backlog_root=!0}catch(X){R.backlog_root=bi(X)?!1:null}D||p(R)})(),(async()=>{try{const R=await s.admin_data_homes();D||(C(Array.isArray(R==null?void 0:R.homes)?R.homes:[]),B(Array.isArray(R==null?void 0:R.warnings)?R.warnings:[]))}catch{D||C(null)}})(),(async()=>{try{const R=await s.list_bundles(),U=Array.isArray(R==null?void 0:R.items)?R.items:Array.isArray(R==null?void 0:R.bundles)?R.bundles:Array.isArray(R)?R:[],X=[];for(const V of U){const w=String((V==null?void 0:V.bundle_id)||(V==null?void 0:V.id)||"").trim();if(!w)continue;const A=Array.isArray(V==null?void 0:V.entrypoints)?V.entrypoints:[];for(const ee of A){if((ee==null?void 0:ee.deprecated)===!0||!(Array.isArray(ee==null?void 0:ee.interfaces)?ee.interfaces:[]).some(O=>String(O||"").trim().length>0))continue;const he=String((ee==null?void 0:ee.name)||"").trim();X.push({id:w,name:he?`${w} · ${he}`:w,description:String((ee==null?void 0:ee.description)||"").trim()||void 0})}}const M=new Set,ue=X.filter(V=>M.has(V.id)?!1:(M.add(V.id),!0));ue.sort((V,w)=>V.name.localeCompare(w.name)),D||x(ue)}catch{D||x(null)}})(),()=>{D=!0}},[s,r,Z]);function pe(D){return typeof D!="number"||!Number.isFinite(D)||D<0?"":D>=1e12?`${(D/1e12).toFixed(1)} TB`:D>=1e9?`${(D/1e9).toFixed(1)} GB`:D>=1e6?`${(D/1e6).toFixed(1)} MB`:D>=1e3?`${(D/1e3).toFixed(1)} KB`:`${D} B`}function Te(D,R="on",U="off"){return D===null?e.jsx("span",{className:"chip mono muted",children:"unknown"}):e.jsx("span",{className:`chip mono ${D?"ok":"warn"}`,children:D?R:U})}function Me(D){const R=String(D||"").trim();if(!R)return null;const U={flag:["launch flag","info","Set by a launch flag of the running gateway; a saved value applies once it restarts without the flag."],stored:["setting","info","Saved setting (Settings here, the gateway console, or `abstractgateway config set`)."],env:["environment (legacy)","warn","Set by the environment the gateway was started with. Save a value here to replace it."],default:["default","muted","Nothing saved: the gateway's default."]},[X,M,ue]=U[R]||[R,"muted",""];return e.jsx("span",{className:`chip mono ${M}`,title:ue,"data-testid":"source_chip",children:X})}return e.jsx("div",{className:"page page_scroll",children:e.jsxs("div",{className:"page_inner page_pad constrained",children:[e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Execution defaults"}),e.jsx("span",{className:"pane_subtitle",children:"preference — this browser"})]}),e.jsxs("div",{className:"pane_body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Default execution mode (preselected in execute dialogs)"}),e.jsxs("select",{value:l.default_execution_mode,onChange:D=>c(R=>({...R,default_execution_mode:D.target.value==="inplace"?"inplace":"uat"})),children:[e.jsx("option",{value:"uat",children:"UAT (staged, safe) — recommended"}),e.jsx("option",{value:"inplace",children:"Inplace (dangerous, edits prod)"})]})]}),e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:"Every execute dialog still shows the mode selector — this only sets what it starts on."})]})]}),e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"AI assistance"}),e.jsx("span",{className:"pane_subtitle",children:"preference — this browser"})]}),e.jsxs("div",{className:"pane_body",children:[e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Maintenance AI (backlog assist — refine/dod/labels)"}),e.jsx(Vp,{disabled:!r,value:{provider:l.maintenance_ai_provider,model:l.maintenance_ai_model},onChange:D=>c(R=>({...R,maintenance_ai_provider:D.provider,maintenance_ai_model:D.model,maintenance_ai_reasoning:D.model===R.maintenance_ai_model?R.maintenance_ai_reasoning:""})),fetchProviders:async()=>{const D=await s.discovery_providers();return(Array.isArray(D==null?void 0:D.items)?D.items:[]).map(R=>({name:R.name,display_name:R.display_name}))},fetchModels:async D=>{const R=await s.discovery_provider_models(D);return Array.isArray(R==null?void 0:R.models)?R.models:[]},defaultHint:"Uses the gateway's configured default provider and model for maintenance calls."})]}),e.jsx(ny,{gateway:s,connected:r,model:l.maintenance_ai_model,value:l.maintenance_ai_reasoning,onChange:D=>c(R=>({...R,maintenance_ai_reasoning:D}))}),e.jsxs("div",{className:"field",children:[e.jsx("label",{children:"Advisor workflow (executable workflows served by this gateway)"}),b===null?e.jsx("input",{className:"mono",value:l.backlog_advisor_agent,onChange:D=>c(R=>({...R,backlog_advisor_agent:String(D.target.value||"")})),placeholder:"basic-agent",title:"This gateway does not serve the workflow catalog — enter a bundle id."}):(()=>{const D=String(l.backlog_advisor_agent||"").trim(),R=D===""||b.some(U=>U.id===D);return e.jsxs(e.Fragment,{children:[e.jsxs("select",{value:R&&!N?D:"__custom__",onChange:U=>{const X=U.target.value;X==="__custom__"?L(!0):(L(!1),c(M=>({...M,backlog_advisor_agent:X})))},title:"Workflows the gateway can run for advice; blank = the shipped basic-agent",children:[e.jsx("option",{value:"",children:"gateway default (basic-agent)"}),b.map(U=>e.jsx("option",{value:U.id,title:U.description||void 0,children:U.name||U.id},U.id)),e.jsx("option",{value:"__custom__",children:"custom bundle id…"})]}),!R||N?e.jsx("input",{className:"mono",style:{marginTop:6},value:l.backlog_advisor_agent,onChange:U=>c(X=>({...X,backlog_advisor_agent:String(U.target.value||"")})),placeholder:"bundle id (e.g. docs-qa@0.1.0)"}):null]})})()]})]})]}),e.jsx(ey,{gateway:s,gateway_connected:r}),e.jsx(ry,{}),e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Gateway administration"}),e.jsx("span",{className:"pane_subtitle",children:"server-side — the gateway is the gatekeeper"})]}),e.jsx("div",{className:"pane_body",children:r?e.jsxs(e.Fragment,{children:[d!=null&&d.user_id?e.jsxs("div",{style:{fontSize:"var(--font-size-sm)",marginBottom:"8px"},children:["Signed in as ",e.jsx("strong",{children:d.user_id}),d.admin===!0?e.jsx("span",{className:"chip mono ok",style:{marginLeft:6},children:"gateway admin"}):d.admin===!1?e.jsx("span",{className:"chip mono muted",style:{marginLeft:6},title:"This pane stays read-only for non-admin principals.",children:"not admin"}):null]}):null,(()=>{var U,X,M,ue,V,w,A,ee,ge;const D=(_==null?void 0:_.writable)===!0,R=Array.isArray(_==null?void 0:_.executors)?_.executors:[];return e.jsxs("div",{children:[e.jsxs("div",{className:"admin_row","data-testid":"admin_row_backlog_folder",children:[e.jsxs("div",{className:"admin_row_top",children:[e.jsx("span",{className:"admin_row_name",children:"Backlog folder"}),Te(m.backlog_root,"available","not available"),Me((U=_==null?void 0:_.triage_repo_root)==null?void 0:U.source),e.jsxs("div",{className:"admin_row_action",children:[D&&((X=_==null?void 0:_.triage_repo_root)!=null&&X.default_path)&&bl(_==null?void 0:_.triage_repo_root)!==_.triage_repo_root.default_path?e.jsx("button",{className:"btn",disabled:Q,onClick:()=>{var he;return void le({triage_repo_root:((he=_==null?void 0:_.triage_repo_root)==null?void 0:he.default_path)||null})},title:_.triage_repo_root.default_path,children:"Use the gateway's own folder"}):null,D?e.jsx(sy,{current:bl(_==null?void 0:_.triage_repo_root),busy:Q,on_apply:he=>void le({triage_repo_root:he})}):null]})]}),e.jsxs("div",{className:"admin_row_detail",children:[((M=_==null?void 0:_.triage_repo_root)==null?void 0:M.help)||"The folder whose docs/backlog holds the items the Board and Backlog pages show.",bl(_==null?void 0:_.triage_repo_root)?e.jsxs(e.Fragment,{children:[" ","In use: ",e.jsx("code",{children:bl(_==null?void 0:_.triage_repo_root)})]}):null,((ue=_==null?void 0:_.triage_repo_root)==null?void 0:ue.available)===!1&&_.triage_repo_root.reason?e.jsxs(e.Fragment,{children:[" — not available: ",_.triage_repo_root.reason]}):null]})]}),e.jsxs("div",{className:"admin_row",children:[e.jsxs("div",{className:"admin_row_top",children:[e.jsx("span",{className:"admin_row_name",children:"Exec runner"}),m.exec_pipeline===null?e.jsx("span",{className:"chip mono muted",children:"unknown"}):e.jsx("span",{className:`chip mono ${m.exec_pipeline==="on"?"ok":"warn"}`,children:m.exec_pipeline}),Me((V=_==null?void 0:_.backlog_exec_runner)==null?void 0:V.source),e.jsx("div",{className:"admin_row_action",children:D?e.jsx("button",{className:"btn",disabled:Q,onClick:()=>void le({backlog_exec_runner:gi(_==null?void 0:_.backlog_exec_runner)!==!0}),children:gi(_==null?void 0:_.backlog_exec_runner)===!0?"Disable":"Enable"}):null})]}),e.jsxs("div",{className:"admin_row_detail",children:[((w=_==null?void 0:_.backlog_exec_runner)==null?void 0:w.help)||"Runs the backlog items queued for execution on the gateway's computer.",m.exec_detail?e.jsxs(e.Fragment,{children:[" — ",m.exec_detail]}):null]})]}),e.jsxs("div",{className:"admin_row",children:[e.jsxs("div",{className:"admin_row_top",children:[e.jsx("span",{className:"admin_row_name",children:"Executor"}),m.executor&&m.executor!=="none"?e.jsx("span",{className:"chip mono ok",children:m.executor}):e.jsx("span",{className:"chip mono warn",children:"none"}),Me((A=_==null?void 0:_.executor)==null?void 0:A.source),e.jsx("div",{className:"admin_row_action",children:D&&R.length?e.jsx("select",{value:bl(_==null?void 0:_.executor),disabled:Q,onChange:he=>void le({executor:String(he.target.value||"")}),title:"Pick the execution agent (validated by the gateway registry)",children:R.map(he=>e.jsxs("option",{value:he.id,disabled:he.available===!1,children:[he.display||he.id,he.available===!1?" (unavailable)":""]},he.id))}):null})]}),e.jsx("div",{className:"admin_row_detail",children:"The agent that runs queued items (the gateway lists what is installed on its computer)."})]}),e.jsxs("div",{className:"admin_row",children:[e.jsxs("div",{className:"admin_row_top",children:[e.jsx("span",{className:"admin_row_name",children:"Process manager"}),Te(m.process_manager,"enabled","disabled"),Me((ee=_==null?void 0:_.process_manager)==null?void 0:ee.source),e.jsx("div",{className:"admin_row_action",children:D?e.jsx("button",{className:"btn",disabled:Q,onClick:()=>void le({process_manager:gi(_==null?void 0:_.process_manager)!==!0}),children:gi(_==null?void 0:_.process_manager)===!0?"Disable":"Enable"}):null})]}),e.jsx("div",{className:"admin_row_detail",children:((ge=_==null?void 0:_.process_manager)==null?void 0:ge.help)||"Powers the Services page. High trust: whoever reaches Services can redeploy."})]})]})})(),F?e.jsx("div",{className:"page_error mono",style:{marginTop:"6px"},children:F}):null,e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:_?_.writable===!0?"Changes are saved on the gateway and apply at once; a launch flag of the running gateway wins until it restarts without it. The same settings: gateway console (Apps → Backlog settings) or `abstractgateway config set <key> <value>` on the gateway's computer.":_.writable===!1?"This gateway serves the admin config surface, but your principal is not authorized to change it (admin only).":"This gateway serves the admin config surface (write authority unknown — it predates the writable flag).":"This gateway does not serve its settings to Continuum (older build): update the gateway to change these from here."})]}):e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:"Connect to a gateway to see its posture (top-right control)."})})]}),e.jsxs("div",{className:"pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Data and caches"}),e.jsx("span",{className:"pane_subtitle",children:I?`server-side — ${I.length} registered home${I.length===1?"":"s"}`:"server-side — read-only telemetry"})]}),e.jsx("div",{className:"pane_body",children:r?I===null?e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:"This gateway does not serve the data-homes registry yet (older build) — the table lights up on its next restart. Purge actions live on the gateway console either way; this card is read-only by design."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"table_scroll",children:e.jsxs("table",{className:"data_table mono",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"name"}),e.jsx("th",{children:"kind"}),e.jsx("th",{children:"owner"}),e.jsx("th",{children:"size"}),e.jsx("th",{children:"purge"})]})}),e.jsx("tbody",{children:[...I].sort((D,R)=>(R.size_bytes||0)-(D.size_bytes||0)).map(D=>e.jsxs("tr",{title:D.description||D.path,children:[e.jsx("td",{children:D.name}),e.jsx("td",{children:e.jsx("span",{className:"chip mono muted",children:D.kind})}),e.jsx("td",{className:"muted",children:D.owner}),e.jsx("td",{children:D.exists===!1?e.jsx("span",{className:"chip mono warn",children:"missing"}):pe(D.size_bytes)}),e.jsx("td",{children:D.safe_to_purge?e.jsx("span",{className:"chip mono ok",children:"purgeable"}):e.jsx("span",{className:"chip mono warn",title:D.description||"Protected — the owner's rule refuses purge",children:"protected"})})]},D.name))})]})}),z.map((D,R)=>e.jsx("div",{className:"page_error mono",style:{marginTop:"6px"},children:D},`dhw:${R}`)),e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)",marginTop:"8px"},children:"Read-only view over the framework data registry (hover a row for its path and purge rule). Purge verbs live on the gateway console — one management surface, per the cache-management split ruling."})]}):e.jsx("div",{className:"muted",style:{fontSize:"var(--font-size-sm)"},children:"Connect to a gateway to see its data footprint."})})]})]})})}const ly=/^(```+|~~~+)\s*mermaid\s*$/i;function oy(a){const s=String(a||"").split(`
|
|
89
|
-
`),r=[];let l=[],c=0;for(;c<s.length;){const d=s[c].match(ly);if(!d){l.push(s[c]),c+=1;continue}const m=d[1];let p=-1;for(let _=c+1;_<s.length;_++){const y=s[_].trimEnd();if(y.startsWith(m[0].repeat(3))&&/^(`{3,}|~{3,})\s*$/.test(y)&&y[0]===m[0]){p=_;break}}if(p===-1){l.push(s[c]),c+=1;continue}l.length&&(r.push({kind:"md",text:l.join(`
|
|
90
|
-
`)}),l=[]),r.push({kind:"mermaid",text:s.slice(c+1,p).join(`
|
|
91
|
-
`)}),c=p+1}return l.length&&r.push({kind:"md",text:l.join(`
|
|
92
|
-
`)}),r}const cy="modulepreload",uy=function(a,s){return new URL(a,s).href},Lf={},dy=function(s,r,l){let c=Promise.resolve();if(r&&r.length>0){let m=function(b){return Promise.all(b.map(x=>Promise.resolve(x).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};const p=document.getElementsByTagName("link"),_=document.querySelector("meta[property=csp-nonce]"),y=(_==null?void 0:_.nonce)||(_==null?void 0:_.getAttribute("nonce"));c=m(r.map(b=>{if(b=uy(b,l),b in Lf)return;Lf[b]=!0;const x=b.endsWith(".css"),N=x?'[rel="stylesheet"]':"";if(!!l)for(let C=p.length-1;C>=0;C--){const z=p[C];if(z.href===b&&(!x||z.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${b}"]${N}`))return;const I=document.createElement("link");if(I.rel=x?"stylesheet":cy,x||(I.as="script"),I.crossOrigin="",I.href=b,y&&I.setAttribute("nonce",y),document.head.appendChild(I),x)return new Promise((C,z)=>{I.addEventListener("load",C),I.addEventListener("error",()=>z(new Error(`Unable to preload CSS for ${b}`)))})}))}function d(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return c.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})};let Pu=null;function my(){return Pu||(Pu=dy(()=>import("./mermaid.core-rvwxvqSK.js").then(a=>a.bp),[],import.meta.url).then(a=>{const s=a.default||a;return s.initialize({startOnLoad:!1,securityLevel:"strict",theme:"dark"}),s})),Pu}let fy=0;function hy(a){const s=h.useRef(null),[r,l]=h.useState("");return h.useEffect(()=>{let c=!0;return l(""),my().then(async d=>{const m=`af_mermaid_${fy+=1}`,{svg:p}=await d.render(m,a.text);c&&s.current&&(s.current.innerHTML=p)}).catch(d=>{c&&l(String((d==null?void 0:d.message)||d||"mermaid render failed"))}),()=>{c=!1}},[a.text]),r?e.jsxs("div",{className:"team_mermaid_error",children:[e.jsxs("div",{className:"muted team_note",children:["#FALLBACK diagram did not render (",r.slice(0,120),") — source below:"]}),e.jsx("pre",{className:"team_mermaid_src",children:a.text})]}):e.jsx("div",{className:"team_mermaid",ref:s})}const Fh=5e4,py="abstractcontinuum history_window.estimate_tokens (~4 chars per token)";function _y(a){const s=String(a??"");return s?Math.max(1,Math.floor(s.length/4)):0}function gy(a,s,r=Fh){if(!Number.isInteger(r)||r<=0)throw new Error(`history window max_tokens must be a positive integer, got ${r}`);const l=a.map(_=>({item:_,tokens:s(_)}));let c=0,d=l.length,m=!1;for(let _=l.length-1;_>=0;_--){const y=l[_].tokens;if(c+y>r){d===l.length&&(m=!0,c+=y,d=_);break}c+=y,d=_}const p=l.slice(0,d);return{kept:l.slice(d).map(_=>_.item),report:{policy:"newest_whole_messages",max_tokens:r,token_estimator:py,total_messages:l.length,replayed_messages:l.length-d,replayed_tokens:c,dropped_messages:p.length,dropped_tokens:p.reduce((_,y)=>_+y.tokens,0),oversize_message_kept:m}}}const vy=400;function yy(a){const s=new Map;for(const c of a)s.set(c.id,c);const r=c=>{let d=c,m=!1;const p=new Set([d.id]);for(let _=0;_<vy;_++){const y=String(d.reply_to||"");if(!y)break;const b=s.get(y);if(!b){m=d.id===c.id||m;break}if(p.has(b.id))break;p.add(b.id),d=b}return{root:d,orphan:m&&d.id===c.id}},l=new Map;for(const c of[...a].sort((d,m)=>(d.seq||0)-(m.seq||0))){const{root:d,orphan:m}=r(c);let p=l.get(d.id);p||(p={root:d,replies:[],orphan:d.id===c.id?m:!1,last_seq:d.seq||0},l.set(d.id,p)),c.id!==d.id&&(p.replies.push(c),p.last_seq=Math.max(p.last_seq,c.seq||0))}return[...l.values()].sort((c,d)=>c.last_seq-d.last_seq||(c.root.seq||0)-(d.root.seq||0))}const Mf=[{id:"all",label:"All",title:"Every message in the window"},{id:"unread",label:"Unread",title:"Unread MESSAGES (same number as the blue channel badge); the list shows the threads containing them"},{id:"asks",label:"Asks",title:"Threads with open/blocked messages — something expects an answer"},{id:"vigilance",label:"Needs vigilance",title:"Threads with unanswered asks, critical messages, or messages addressed to your seat"},{id:"fyi",label:"FYI",title:"Threads of fyi/system traffic"},{id:"resolved",label:"Resolved",title:"Threads closed by a resolved reply (the ✓ Resolve act) or a resolved root"},{id:"to_me",label:"@me",title:"Threads with messages addressed to your seat"}];function qh(a,s,r){var c,d,m,p,_;if(a.retracted===!0)return s==="all"?!0:s==="unread"?!!((c=r.unread_seqs)!=null&&c.has(a.seq)||(d=r.unread_snapshot_seqs)!=null&&d.has(a.seq)):!1;const l=String(a.status||"").toLowerCase();switch(s){case"all":return!0;case"unread":return!!((m=r.unread_seqs)!=null&&m.has(a.seq)||(p=r.unread_snapshot_seqs)!=null&&p.has(a.seq));case"asks":return l==="open"||l==="blocked";case"fyi":return l==="fyi";case"resolved":return l==="resolved";case"to_me":return Array.isArray(a.to)&&a.to.includes(r.seat);case"vigilance":{const y=(l==="open"||l==="blocked")&&a.has_resolved_reply!==!0,b=a.critical===!0,x=Array.isArray(a.to)&&a.to.includes(r.seat),N=!!((_=r.escalated_seqs)!=null&&_.has(a.seq));return y||b||x||N}}}function zf(a,s,r){return s==="all"?a:a.filter(l=>[l.root,...l.replies].some(c=>qh(c,s,r)))}function xy(a,s,r){return qh(a,s,r)}function by(a){const s={},r={};for(const l of a){const c=String(l.channel||"");if(!c)continue;const d=Number(l.seq);if(Number.isFinite(d)){const m=s[c]||(s[c]=new Set);if(m.has(d))continue;m.add(d)}r[c]=(r[c]||0)+1}return r}function wy(a){const s={};for(const r of a){const l=String(r.channel||""),c=Number(r.seq);!l||!Number.isFinite(c)||(s[l]||(s[l]=new Set)).add(c)}return s}function jy(a,s){const r={};for(const l of a){const c=String(l.channel||""),d=Number(l.seq);if(!c||!Number.isFinite(d))continue;const m=String(l.status||"").toLowerCase(),p=Array.isArray(l.to)&&s?l.to.includes(s):!1;(m==="open"||m==="blocked"||(m==="reply"||m==="fyi")&&p)&&(r[c]||(r[c]=new Set)).add(d)}return r}function ky(a){const s={};for(const r of a){const l=String(r.channel||""),c=Number(r.seq);if(!l||!Number.isFinite(c))continue;const d=String(r.effective_urgency||"").toLowerCase();(r.escalated===!0||d==="interrupt")&&(s[l]||(s[l]=new Set)).add(c)}return s}function Sy(a,s){const r=s?s.replace(/\/+$/,"")+"/":"",l=new Map,c=[];for(const d of a){const m=String(d.path||"");if(!m.startsWith(r))continue;const p=m.slice(r.length);if(!p)continue;const _=p.indexOf("/");if(_===-1)c.push(d);else{const y=p.slice(0,_);l.set(y,(l.get(y)||0)+1)}}return{dirs:[...l.entries()].map(([d,m])=>({name:d,path:r+d,count:m})).sort((d,m)=>d.name.localeCompare(m.name)),leaves:c.sort((d,m)=>d.path.localeCompare(m.path))}}function Pf(a,s){const r=String(a||"");if(!r.startsWith("dm:")||!s)return"";const l=r.slice(3);return l.startsWith(`${s}--`)?l.slice(s.length+2):l.endsWith(`--${s}`)?l.slice(0,l.length-s.length-2):""}function Ny(a){return a.is_reply?"reply":a.in_dm||a.kind==="ask"?"open":"fyi"}function Cy(a){const s=new Map;for(const l of a)l.id&&s.set(l.id,String(l.sender||""));const r=new Set;for(const l of a){const c=l.reply_to?String(l.reply_to):"";if(!c)continue;const d=s.get(c);(d===void 0||d!==String(l.sender||""))&&r.add(c)}return r}const $y=/(?:^|[\s("'`])((?:[A-Za-z0-9_][A-Za-z0-9_.-]*\/)+[A-Za-z0-9_][A-Za-z0-9_.-]*\.(?:md|markdown|txt|json|yaml|yml|csv|log))\b/g,Ey=4;function Ty(a){const s=[];for(const r of String(a||"").matchAll($y)){const l=r[1],c=r.index===void 0?-1:r.index,d=c>=0?String(a).slice(Math.max(0,c-12),c+1):"";if(!(d.includes("://")||/\/api\//.test(d))&&(s.includes(l)||s.push(l),s.length>=Ey))break}return s}function Ay(a,s,r){var c,d;const l=a.split("/").pop()||a;if(s!=null&&s.has(a))return{kind:"fs",path:a,rewritten:!1};for(let m=0;m<r.length;m++)if(String(((c=r[m])==null?void 0:c.filename)||"")===a)return{kind:"attachment",attachment_index:m};if(s){const m=[];for(const p of s)(p===l||p.endsWith(`/${l}`))&&m.push(p);if(m.length===1)return{kind:"fs",path:m[0],rewritten:m[0]!==a}}for(let m=0;m<r.length;m++){const p=String(((d=r[m])==null?void 0:d.filename)||"");if(p&&(p===l||p.split("/").pop()===l))return{kind:"attachment",attachment_index:m}}return null}const If=/@([A-Za-z0-9][A-Za-z0-9_.-]*)/g;function Iu(a){const s=[];for(const l of a.matchAll(If)){const c=l[1].toLowerCase();s.includes(c)||s.push(c)}return{title:a.replace(If," ").split(/\s+/).join(" ").trim().replace(/^[\s,;:-]+|[\s,;:-]+$/g,""),members:s}}function Ou(a){const s=[];for(const r of String(a||"").split(/[\s,;]+/)){const l=r.replace(/^@/,"").toLowerCase();!l||!/^[a-z0-9][a-z0-9_.-]*$/.test(l)||s.includes(l)||s.push(l)}return s}function Du(a,s){let r=a.toLowerCase().replace(/[^a-z0-9_.-]+/g,"-").replace(/^[-.]+|[-.]+$/g,"");r||(r="group"),r=r.slice(0,40).replace(/[-.]+$/g,"");let l=r,c=1;for(;s.has(l);)c+=1,l=`${r}-${c}`;return l}const Of=400,Df=/([.;:!?…]["')\]]*) +(\((?:\d{1,2}|[a-z])\)|\[\d{1,2}\]) (?=["'([{]?[A-Za-z0-9])/g,Ff=/([.;:!?…]["')\]]*) +(?=[A-Z][A-Z'-]+(?: [A-Z][A-Z'-]*)+)/g;function Ry(a){if(!a||a.length<Of)return a;const s=a.split(/(```[\s\S]*?(?:```|$))/),r=[];for(const l of s){if(l.startsWith("```")){r.push(l);continue}const c=l.split(/(\n{2,})/);for(const d of c){if(/\n/.test(d)||d.length<Of){r.push(d);continue}const m=d.split(/(`[^`\n]*`)/);let p=0;for(const _ of m)_.startsWith("`")||(p+=(_.match(Df)||[]).length+(_.match(Ff)||[]).length);if(p<2){r.push(d);continue}r.push(m.map(_=>_.startsWith("`")?_:_.replace(Df,`$1
|
|
93
|
-
|
|
94
|
-
$2 `).replace(Ff,`$1
|
|
95
|
-
|
|
96
|
-
`)).join(""))}}return r.join("")}const Ly=/https?:\/\/[^\s<>()[\]{}"'`]+/g,My=/\.(png|jpe?g|gif|webp)$/i;function zy(a,s){if(!s)return a;const r=s.replace(/\/+$/,"");if(!a.startsWith(r+"/"))return a;const c=a.slice(r.length).match(/^\/channels\/([^/]+)\/attachments\/([A-Za-z0-9_.-]+)$/);return c?`api/hub/channels/${c[1]}/attachments/${c[2]}`:a}function Py(a,s){if(!a||!/https?:\/\//.test(a))return a;const r=(s==null?void 0:s.hub_base)||"",l=(s==null?void 0:s.app_origin)||"",c=a.split(/(```[\s\S]*?(?:```|$))/),d=[];for(let m=0;m<c.length;m++){const p=c[m];if(p.startsWith("```")){d.push(p);continue}const _=p.split(/(`[^`\n]*`)/);for(let y=0;y<_.length;y++){const b=_[y];if(b.startsWith("`")){d.push(b);continue}d.push(b.replace(Ly,(x,N)=>{const L=b.slice(Math.max(0,N-2),N);if(L.endsWith("](")||L.endsWith("("))return x;const I=x.replace(/[.,;:!?]+$/,""),C=x.slice(I.length);let z="";try{z=new URL(I).pathname}catch{return x}const B=zy(I,r),F=My.test(z),q=B!==I||l!==""&&B.startsWith(l+"/");return F&&q?`${C}`:`[${I}](${B})${C}`}))}}return d.join("")}const Iy=/^api\/hub\/channels\/[^/]+\/attachments\/[A-Za-z0-9_-]+$/;function Oy(a){const s=a.trim(),r=s.replace(/^\.\//,"").replace(/^\//,"");return r.startsWith("api/")?s.startsWith("/")||/\s/.test(r)||r.includes("..")?!0:!Iy.test(r):!1}function Tl(a){if(!a||!a.includes("api/"))return a;const s=/(!?)\[([^\]]*)\]\(([^)]+)\)/g;return a.replace(s,(r,l,c,d)=>Oy(String(d))?"`"+(String(c||"").trim()||String(d)).replace(/`/g,"")+" (blocked link)`":r)}function _d(a){let s=0;for(let r=0;r<a.length;r++)s=s*31+a.charCodeAt(r)>>>0;return s%360}function Dy(a){var d,m,p,_;const s=Array.isArray(a.to)&&a.to.length?` to=[${a.to.join(",")}]`:"",r=(m=(d=a.data)==null?void 0:d.asks)!=null&&m.length?` asks=${a.data.asks.map(y=>`${y.id}:"${y.text}"`).join("; ")}`:"",l=(_=(p=a.data)==null?void 0:p.answers)!=null&&_.length?` answers=[${a.data.answers.join(",")}]`:"",c=a.reply_to?` reply_to=${a.reply_to}`:"";return`#${a.seq} [${a.sender}] (${a.status})${s}${c}${r}${l}
|
|
97
|
-
${a.title?`title: ${a.title}
|
|
98
|
-
`:""}${String(a.body||"").trim()}`}function qf(a,s){const r=Fh,c=[...a].sort((_,y)=>(_.seq||0)-(y.seq||0)).map(Dy),{kept:d,report:m}=gy(c,_y,r),p=[`TRANSCRIPT WINDOW: ${m.replayed_messages} of ${m.total_messages} message(s), ~${m.replayed_tokens} tokens (the newest whole messages up to ${r} tokens).`];return m.dropped_messages>0&&p.push(`#TRUNCATION: the ${m.dropped_messages} oldest message(s) (~${m.dropped_tokens} tokens) were dropped by the history window (the newest whole messages up to ${r} tokens; abstractcontinuum team_model); this transcript starts mid-conversation.`),{text:`${p.join(`
|
|
99
|
-
`)}
|
|
100
|
-
|
|
101
|
-
${d.join(`
|
|
102
|
-
|
|
103
|
-
`)}`,report:m}}function Bf(a){const s=r=>`message${r===1?"":"s"}`;return a.dropped_messages<=0?`${a.replayed_messages} ${s(a.replayed_messages)}`:`${a.replayed_messages} of ${a.total_messages} ${s(a.total_messages)} (${a.dropped_messages} oldest dropped by the ${a.max_tokens.toLocaleString("en-US")}-token history window)`}function Fy(a,s){let r=Number(a.up||0),l=Number(a.down||0),c=Number(a.mine||0);return s===void 0?{up:r,down:l,mine:c,caught_up:!1}:s===c?{up:r,down:l,mine:c,caught_up:!0}:(c>0?r-=1:c<0&&(l-=1),s>0?r+=1:s<0&&(l+=1),{up:Math.max(0,r),down:Math.max(0,l),mine:s,caught_up:!1})}function qy(a,s){const r=Array.from(String(a??"")),l=(s??[]).filter(m=>Array.isArray(m)&&m.length>=2&&Number.isFinite(m[0])&&Number.isFinite(m[1])&&m[0]>=0&&m[1]>0).sort((m,p)=>m[0]-p[0]),c=[];let d=0;for(const[m,p]of l){if(m>=r.length)break;const _=Math.max(m,d),y=Math.min(m+p,r.length);y<=_||(_>d&&c.push({text:r.slice(d,_).join(""),hit:!1}),c.push({text:r.slice(_,y).join(""),hit:!0}),d=y)}return d<r.length&&c.push({text:r.slice(d).join(""),hit:!1}),!c.length&&r.length&&c.push({text:r.join(""),hit:!1}),c}const Bo=[{id:"decisions",label:"Decisions",kind:"decision"},{id:"open_threads",label:"Open threads",kind:null},{id:"work",label:"Work",kind:"work"},{id:"people",label:"People",kind:"agent"},{id:"files",label:"Files",kind:"file"},{id:"messages",label:"Messages",kind:"message"}],By=new Set(["image/png","image/jpeg","image/gif","image/webp"]);function Cr(a,s){const r=a.toLowerCase().split(".").pop()||"",l=String(s||"").toLowerCase();if(r==="md"||r==="markdown"||l==="text/markdown")return"md";if(By.has(l))return"image";const c=new Set(["txt","json","yaml","yml","csv","log","ts","tsx","js","py","sh","toml","ini","env"]);return!(l.includes("html")||l.includes("xml")||l.includes("svg"))&&(l.startsWith("text/")||c.has(r))?"text":"download"}function Uy({url:a,name:s}){const[r,l]=Kt.useState(!1);return r?e.jsxs("div",{className:"team_fileview_dl",children:[e.jsx("p",{className:"muted team_note",children:"The image failed to decode in the browser — the bytes may be corrupt or mistyped."}),e.jsxs("a",{className:"btn primary",href:a,target:"_blank",rel:"noreferrer",download:!0,children:["Download ",s]})]}):e.jsx("img",{className:"team_fileview_img",src:a,alt:s,onError:()=>l(!0)})}function Wy({view:a,onClose:s}){if(!a)return null;const r=a.url?e.jsxs("a",{className:"btn primary",href:a.url,target:"_blank",rel:"noreferrer",download:!0,children:["Download ",a.name]}):null;return e.jsxs(Ua,{open:!0,title:a.name,onClose:s,variant:"default",children:[a.meta?e.jsx("div",{className:"muted team_note",style:{marginBottom:8},children:a.meta}):null,a.loading?e.jsx("div",{className:"muted team_note",children:"Loading…"}):a.error?e.jsxs("div",{className:"team_fileview_dl",children:[e.jsx("div",{className:"page_error mono",children:a.error}),r]}):a.mode==="md"?e.jsx("div",{className:"team_fileview_md",children:oy(a.text||"").map((l,c)=>l.kind==="mermaid"?e.jsx(hy,{text:l.text},c):e.jsx(ds,{className:"md_doc",text:Tl(l.text)},c))}):a.mode==="text"?e.jsx("pre",{className:"team_fileview_text",children:a.text||""}):a.mode==="image"&&a.url?e.jsx(Uy,{url:a.url,name:a.name},a.url):e.jsxs("div",{className:"team_fileview_dl",children:[e.jsxs("p",{className:"muted team_note",children:["Inline preview isn't available for this file type",a.content_type?` (${a.content_type})`:"","."]}),r]})]})}const Hy=Kt.memo(ds),Vy=["id","channel","seq","sender","kind","status","urgency","critical","downgraded","to","title","body","data","reply_to","created_at"];function Uf(a){let s='"';for(let r=0;r<a.length;r++){const l=a.charCodeAt(r),c=a[r];c==='"'?s+='\\"':c==="\\"?s+="\\\\":l===8?s+="\\b":l===9?s+="\\t":l===10?s+="\\n":l===12?s+="\\f":l===13?s+="\\r":l<32||l>126?s+="\\u"+l.toString(16).padStart(4,"0"):s+=c}return s+'"'}class Bh{constructor(s){this.value=s}}function Wf(a){if(!Number.isFinite(a))throw new Error("py_float_repr: non-finite");if(Object.is(a,-0))return"-0.0";if(a===0)return"0.0";const s=a<0,r=Math.abs(a),c=r.toExponential().match(/^(\d)(?:\.(\d+))?e([+-]\d+)$/);if(!c)return(s?"-":"")+String(r);const d=c[1]+(c[2]||""),p=parseInt(c[3],10)+1;let _;if(p<=-4||p>16){const y=d.length>1?`${d[0]}.${d.slice(1)}`:d[0],b=p-1,x=(b<0?"-":"+")+String(Math.abs(b)).padStart(2,"0");_=`${y}e${x}`}else p<=0?_="0."+"0".repeat(-p)+d:p>=d.length?_=d+"0".repeat(p-d.length)+".0":_=d.slice(0,p)+"."+d.slice(p);return(s?"-":"")+_}function sd(a){if(a==null)return"null";if(typeof a=="boolean")return a?"true":"false";if(a instanceof Bh){if(!Number.isFinite(a.value))throw new Error("canonical_json: non-finite number");return Wf(a.value)}if(typeof a=="number"){if(!Number.isFinite(a))throw new Error("canonical_json: non-finite number");return Number.isInteger(a)&&!Object.is(a,-0)?String(a):Wf(a)}if(typeof a=="string")return Uf(a);if(Array.isArray(a))return"["+a.map(sd).join(",")+"]";if(typeof a=="object")return"{"+Object.keys(a).sort().map(r=>Uf(r)+":"+sd(a[r])).join(",")+"}";throw new Error(`canonical_json: unsupported type ${typeof a}`)}async function Gy(a){const s=new TextEncoder().encode(a),r=await crypto.subtle.digest("SHA-256",s);return[...new Uint8Array(r)].map(l=>l.toString(16).padStart(2,"0")).join("")}async function Ky(a,s,r){const l={};for(const c of Vy)c!=="channel"&&(l[c]=s[c]??null);return l.channel=r,typeof l.created_at=="number"&&(l.created_at=new Bh(l.created_at)),await Gy(a+`
|
|
104
|
-
`+sd(l))}async function Qy(a){const s=a.channel;let r="",l=0,c=0,d=null,m="";for(const _ of a.turns){if(_.hash===null||_.hash===void 0){l>0&&d===null&&(d=_.seq),c+=1,r="";continue}const y=await Ky(r,_,s);y!==_.hash&&d===null&&(d=_.seq),r=_.hash,m=y,l+=1}const p=d===null&&String(a.head||"")!==m;return{ok:d===null&&!p,broken_at:d,head_mismatch:p,computed_head:m,hashed:l,legacy:c}}const Jy=5e3,Yy=6,ua=200,Xy=50,Uo=380,Hf=240,Vf=2,Zy=12,Sl=8,Gf=16*1024*1024,ex=new Set(["image/png","image/jpeg","image/gif","image/webp"]),Rl=256*1024;function tx(){return e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round","aria-hidden":!0,children:e.jsx("path",{d:"M1.8 4a1 1 0 0 1 1-1h3.4l1.6 1.8h6.4a1 1 0 0 1 1 1V12a1 1 0 0 1-1 1H2.8a1 1 0 0 1-1-1z"})})}function Kf(){return e.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round","aria-hidden":!0,children:[e.jsx("path",{d:"M4.2 1.8h5.2l2.8 2.8v9a.9.9 0 0 1-.9.9H4.2a.9.9 0 0 1-.9-.9V2.7a.9.9 0 0 1 .9-.9z"}),e.jsx("path",{d:"M9.2 1.8v3h3"})]})}function Wo(a){return a.length<=Rl?a:a.slice(0,Rl)+`
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
#TRUNCATION: preview clamped at ${On(Rl)} of ${On(a.length)} — download the file for the full content.`}function Fu(a,s){try{return JSON.stringify(a)===JSON.stringify(s)}catch{return!1}}function qu(a,s){const r=Object.keys(a);if(r.length!==Object.keys(s).length)return!1;for(const l of r){const c=a[l],d=s[l];if(!d||c.size!==d.size)return!1;for(const m of c)if(!d.has(m))return!1}return!0}function On(a){if(!Number.isFinite(a)||a<0)return"—";if(a<1024)return`${a} B`;const s=a/1024;return s<1024?`${Math.round(s)} KiB`:`${(a/(1024*1024)).toFixed(1)} MiB`}const Uh="abstractcontinuum_team_drafts_v1";function nx(){try{const a=window.localStorage.getItem(Uh),s=a?JSON.parse(a):{};return s&&typeof s=="object"?s:{}}catch{return{}}}function Nl(a){try{window.localStorage.setItem(Uh,JSON.stringify(a))}catch{}}const Ho="agora/0.4";function Cl(a){if(!a)return"";const s=Math.max(0,Math.floor(Date.now()/1e3-a));return s<60?`${s}s`:s<3600?`${Math.floor(s/60)}m`:s<86400?`${Math.floor(s/3600)}h`:`${Math.floor(s/86400)}d`}function $l(a){if(!a)return"";try{return new Date(a*1e3).toLocaleString()}catch{return""}}function Qf(a){return{color:`hsl(${_d(a)}, 60%, 55%)`}}function Da(a){const s=_d(a),r=s>=40&&s<=190?36:45;return{background:`hsl(${s}, 55%, ${r}%)`,color:"#fff"}}const xi=[{id:"trust",label:"Trust",help:"Claim ↔ action: does it say what it does, and do what it says?"},{id:"wisdom",label:"Wisdom",help:"Often right — takes the right decisions and leads by example."},{id:"thorough",label:"Thorough",help:"Takes a task end-to-end and doesn't stop until it is fully resolved and functional, with proofs."},{id:"helper",label:"Helper",help:"Contributes to OTHERS' work — detects issues, contributes positively."}],sx=[{id:"ruling",help:"May decide in the operator's name — seats treat its rulings as operator rulings while the grant stands."},{id:"operational",help:"Day-to-day operational writes (queues, coordination surfaces) in the operator's name."},{id:"reporting",help:"Receives and reads operator-grade reports and status surfaces."},{id:"moderation",help:"Moderation acts (pause, kick, retire) in the operator's name."}],Jf={general:"Message thumbs — every standing ±1 on this agent's messages counts (operator ruling dm#161: a vote is a vote; a flip revises its own message, never stacks).",...Object.fromEntries(xi.map(a=>[a.id,`${a.help} Every standing vote counts.`]))};function El(a){const s=xi.find(r=>r.id===a);return s?s.label:a==="general"?"General":a.charAt(0).toUpperCase()+a.slice(1)}function ax(a){if(!a)return"";try{return new Date(a*1e3).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}catch{return""}}function rx(a){var ri,aa,vs,$t,Nt,ys;const s=a.gateway,r=!!a.gateway_connected,l=h.useMemo(()=>new pd,[]),c=h.useMemo(()=>{if(a.advisor)return a.advisor;if(!r||!s)return;const u=a.advisor_agent;return async(v,S)=>{const k=[...S.map(ne=>({role:ne.role,content:ne.content})),{role:"user",content:v}],$=await s.backlog_advisor({messages:k,agent:u||null});return String(($==null?void 0:$.reply)||"").trim()||"(the model returned an empty reply)"}},[a.advisor,s,r,a.advisor_agent]),d=!!c,[m,p]=h.useState(""),[_,y]=h.useState(()=>ed()),[b,x]=h.useState(""),N=h.useRef(_);N.current=_;const L=h.useRef({});h.useEffect(()=>{if(!r||!s){p("");return}let u=!0;return(async()=>{try{const v=await od("abstractcontinuum_team_voice");u&&p(v)}catch{u&&p("")}})(),typeof s.capability_defaults=="function"&&Promise.resolve().then(()=>s.capability_defaults()).then(v=>{u&&(L.current=Dh(v))}).catch(()=>{u&&(L.current={})}),()=>{u=!1}},[s,r]),h.useEffect(()=>{const u=()=>y(ed());return window.addEventListener(td,u),window.addEventListener("storage",u),()=>{window.removeEventListener(td,u),window.removeEventListener("storage",u)}},[]);const I=h.useMemo(()=>{const u=String(m||"").trim();if(!(!r||!s||!u))return v=>{const S=s.voice_stream_transport(u,{text:v,...L.current,...Oh(N.current)});return D_({path:S.path,body:S.body,headers:S.headers})}},[s,r,m]),C=sh({tts_stream:I,on_error:x});h.useEffect(()=>{if(!b)return;_e(b);const u=setTimeout(()=>x(""),6e3);return()=>clearTimeout(u)},[b]);const[z,B]=h.useState(null),F=h.useRef(null);h.useEffect(()=>{F.current=z},[z]);const[q,Q]=h.useState(""),[E,Z]=h.useState(null),[oe,le]=h.useState([]),[pe,Te]=h.useState({}),[Me,ve]=h.useState({}),[ce,D]=h.useState({}),[R,U]=h.useState({}),[X,M]=h.useState(null),[ue,V]=h.useState(""),w=h.useRef(0),A=h.useRef(!1),ee=h.useRef(!1);async function ge(){if(!A.current&&!(Date.now()-w.current<3e4)){w.current=Date.now();try{const u=await l.desk();M(v=>v==="loading"?v:u),u.rows.length&&!ee.current&&sn(v=>v!==""?v:(ee.current=!0,"desk"))}catch(u){((u==null?void 0:u.status)===403||(u==null?void 0:u.status)===404)&&(A.current=!0)}}}async function he(){M("loading"),V("");try{const u=await l.desk();M(u),w.current=Date.now(),A.current=!1}catch(u){M(null),V((u==null?void 0:u.status)===403?"The desk serves operators and reporting delegates only — this console's seat is neither.":(u==null?void 0:u.status)===404?'The hub does not answer GET /desk (older hub build) — the amber "needs reply" pills on messages still mark what waits on you.':`The desk read failed (${String((u==null?void 0:u.message)||u||"network error").slice(0,120)}) — transient; Refresh retries.`)}}const[O,je]=h.useState(""),[te,Ce]=h.useState([]),[Ae,Ge]=h.useState("all"),fe=h.useRef(null),[Re,Ie]=h.useState(null),se=h.useRef(""),[ye,_e]=h.useState(""),[qe,Ye]=h.useState(!1),[ie,me]=h.useState({}),[be,G]=h.useState({}),[ke,Xe]=h.useState({}),J=h.useRef(new Set),T=h.useRef(0),[Y,Se]=h.useState(""),[ze,Ke]=h.useState(""),[nt,dt]=h.useState([]),[yt,ht]=h.useState(!1),Et=h.useRef(null),[Ut,De]=h.useState(!1),it=h.useRef(null);h.useEffect(()=>{const u=it.current;u&&(u.style.height="auto",u.style.height=`${Math.min(u.scrollHeight+2,160)}px`)},[Y,O]);const[tt,jt]=h.useState("fyi"),[ft,Zt]=h.useState(""),[we,$e]=h.useState(""),[Oe,mt]=h.useState(null),[pt,_t]=h.useState({}),[nn,fn]=h.useState(""),Wt=h.useRef(nx()),Wa=h.useRef(""),[Qn,Fn]=h.useState(!1),[ma,Rr]=h.useState(!1),[ki,ot]=h.useState(""),[Qt,Jn]=h.useState(null),[Mt,Ha]=h.useState(null),[Pl,Si]=h.useState({});function Lr(u,v){v.length&&Si(S=>{const k={...S},$=new Set(k[u]||[]);for(const ne of v)$.add(ne);return k[u]=$,k})}function Ni(u,v){const S=new Set(v.map(k=>String(k.agent_id||"")).filter(Boolean));S.size&&Si(k=>{const $=k[u];if(!$||![...$].some(xe=>S.has(xe)))return k;const ne=new Set([...$].filter(xe=>!S.has(xe))),W={...k};return ne.size?W[u]=ne:delete W[u],W})}const Va=h.useRef(0),[Il,Mr]=h.useState(""),[zt,Ol]=h.useState(null),[Ga,Ds]=h.useState(""),[ms,zr]=h.useState(!1),[fa,Ka]=h.useState(""),[hn,Dl]=h.useState([]);function kn(){l.delegations().then(u=>{Ol(u),Ds("")}).catch(u=>{Ol([]);const v=String((u==null?void 0:u.message)||u);Ds((u==null?void 0:u.status)===404||/allowlist/i.test(v)?"Delegation needs the updated console/hub — restart the stack to pick it up.":v)})}async function Xo(){if(!(!fa||!hn.length||ms)){zr(!0),Ds("");try{await l.set_delegation(fa,hn),Ka(""),Dl([]),kn()}catch(u){Ds(String((u==null?void 0:u.message)||u||"delegation failed"))}finally{zr(!1)}}}async function Zo(u){if(!ms){zr(!0),Ds("");try{await l.revoke_delegation(u),kn()}catch(v){Ds(String((v==null?void 0:v.message)||v||"resign failed"))}finally{zr(!1)}}}const[qn,Yn]=h.useState(null),[Fs,Xn]=h.useState(null),[Ft,on]=h.useState(""),[Pr,Ss]=h.useState(null),[qs,Ir]=h.useState([]),[Ot,Ns]=h.useState(""),[Or,ct]=h.useState(""),[Dr,Ci]=h.useState(""),[Qa,$i]=h.useState(!1),[Ei,Ja]=h.useState(""),[Cs,Bs]=h.useState({open:!1,name:"",is_private:!1}),[Jt,pn]=h.useState(!1),[$s,fs]=h.useState({}),[kt,sn]=h.useState(""),[Bn,Fr]=h.useState(null),[Us,Fl]=h.useState(""),[Un,Ya]=h.useState("channel"),[Xa,ql]=h.useState(""),[Ws,hs]=h.useState(null),[Hs,Za]=h.useState(""),[Ti,Bl]=h.useState(""),[Vs,Zn]=h.useState(""),[ha,qr]=h.useState(null),[es,er]=h.useState(""),[ps,pa]=h.useState(""),[Br,Ht]=h.useState(null),[tr,_n]=h.useState([]),[Gs,nr]=h.useState(""),[Ks,Ai]=h.useState(!1),[Ur,sr]=h.useState(""),[_a,ar]=h.useState(""),Ri=h.useRef(null),Ul=h.useRef(0),Li=h.useRef(!1),Wl=h.useRef(0),[rr,Mi]=h.useState(!1),Hl=h.useRef(""),Tn=h.useRef([]),Es=h.useRef([]),Ts=h.useRef(null),Wr=h.useRef(!1),zi=h.useRef(null);Hl.current=O,Tn.current=oe,Es.current=te,h.useEffect(()=>{for(const u of te){const v=ba.current[u.id];v!==void 0&&u.ratings&&Number(u.ratings.mine||0)===v&&delete ba.current[u.id]}},[te]);const Pi=h.useRef(!1);async function ec(u){var v;try{const S=await l.inbox(),k=by(S),$=wy(S);ve(Be=>qu(Be,$)?Be:$);const ne=jy(S,((v=F.current)==null?void 0:v.seat)||"");D(Be=>qu(Be,ne)?Be:ne);const W=ky(S);U(Be=>qu(Be,W)?Be:W),ge();const xe=u.slice(0,Zy),Pe=await Promise.allSettled(xe.map(Be=>l.digest(Be.name))),Ue={};for(const Be of u)Ue[Be.name]={unread:k[Be.name]||0,open_questions:0};Pe.forEach((Be,Tt)=>{var rs;const Vt=xe[Tt].name;if(Be.status==="fulfilled"){const bt=(rs=Be.value)==null?void 0:rs.counts;Ue[Vt]={...Ue[Vt],open_questions:Number((bt==null?void 0:bt.open_questions)||0)}}}),Te(Be=>Fu(Be,Ue)?Be:Ue)}catch{}}async function ga(u){if(Wr.current){zi.current=u;return}Wr.current=!0;let v=u;try{for(;v;)zi.current=null,await ec(v),v=zi.current}finally{Wr.current=!1}}async function Qs(){const v=[...await l.channels()];return v.sort((S,k)=>(k.last_at||0)-(S.last_at||0)),le(S=>Fu(S,v)?S:v),Tn.current=v,v}async function _s(){try{const[u,v]=await Promise.all([l.meta(),l.channels()]);B({seat:u.seat,seat_key_present:u.seat_key_present}),Q(String(u.hub_url||"")),l.healthz().then($=>Z($)).catch(()=>Z(null)),l.presence().then($=>{const ne=[...new Set($.map(W=>String(W.agent_id||"")).filter(W=>W&&W!==u.seat))].sort();Ir(ne)}).catch(()=>Ir([]));const S=[...v];S.sort(($,ne)=>(ne.last_at||0)-($.last_at||0)),le(S);const k=S.filter($=>!$.name.startsWith("dm:"));!O&&k.length&&je(k[0].name),_e(""),ga(S)}catch(u){_e(String((u==null?void 0:u.message)||u||"Hub unreachable"))}}async function Js(u,v){var k,$,ne;if(!u)return;const S=T.current;v!=null&&v.background||Ye(!0);try{const W=Es.current.length&&Es.current[Es.current.length-1].seq||0,xe=((k=Tn.current.find(et=>et.name===u))==null?void 0:k.last_seq)||0;let Pe=xe,Ue=null;if(!(v!=null&&v.background))if(xe>0)Ue=Qs().catch(()=>null);else try{const et=await Qs();if(S!==T.current)return;Pe=(($=et.find(Yt=>Yt.name===u))==null?void 0:$.last_seq)||0}catch{}const Be=Math.max(0,Pe-ua),Tt=v!=null&&v.background&&W>0?Math.max(0,W-Xy):Be,Vt=await l.messages(u,{since:Tt,limit:ua});if(S!==T.current)return;const rs=new Set(Es.current.map(et=>et.id)),bt=Vt.some(et=>!rs.has(et.id));if(v!=null&&v.background&&!bt&&W>0){const et=Date.now();if(et-Wl.current>1e4){Wl.current=et;try{const Yt=await Qs();if(S!==T.current)return;const wt=((ne=Yt.find(He=>He.name===u))==null?void 0:ne.last_seq)||0;if(wt>0&&wt<W){const He=Math.max(0,wt-ua),At=await l.messages(u,{since:He,limit:ua});if(S!==T.current)return;At.sort((Pt,Rt)=>(Pt.seq||0)-(Rt.seq||0)),Ce(At),_e("");return}}catch{}}}Vt.sort((et,Yt)=>(et.seq||0)-(Yt.seq||0)),Ce(et=>{if(v!=null&&v.background&&et.length){if(!Vt.length)return et;const Yt=new Set(et.map(It=>It.id)),wt=Vt.filter(It=>!Yt.has(It.id)),He=new Map(Vt.map(It=>[It.id,It]));let At=0;const Pt=et.map(It=>{const gt=He.get(It.id);if(!gt)return It;const Lt=JSON.stringify(gt.ratings??null)!==JSON.stringify(It.ratings??null)||(gt.has_resolved_reply??null)!==(It.has_resolved_reply??null)||JSON.stringify(gt.pending_asks??null)!==JSON.stringify(It.pending_asks??null)||!!gt.retracted!=!!It.retracted;return Lt&&At++,Lt?gt:It});if(!wt.length&&!At)return et;const Rt=[...At?Pt:et,...wt];return Rt.length>ua*2?Rt.slice(Rt.length-ua*2):Rt}return Vt}),_e(""),!(v!=null&&v.background)&&Ue&&(async()=>{var et;try{const Yt=await Ue;if(S!==T.current||!Yt)return;const wt=((et=Yt.find(He=>He.name===u))==null?void 0:et.last_seq)||0;if(wt>0&&wt!==xe){const He=Math.max(0,wt-ua),At=await l.messages(u,{since:He,limit:ua});if(S!==T.current)return;At.sort((Pt,Rt)=>(Pt.seq||0)-(Rt.seq||0)),Ce(Pt=>Fu(Pt,At)?Pt:At)}}catch{}})()}catch(W){if(S!==T.current)return;_e(String((W==null?void 0:W.message)||W||"Failed to load messages"))}finally{!(v!=null&&v.background)&&S===T.current&&Ye(!1)}}h.useEffect(()=>{_s()},[]),h.useEffect(()=>{let u=null,v=!1,S=0,k=0;const $=()=>{if(!v){try{u=new WebSocket(l.ws_url())}catch{Mi(!1),S+=1,setTimeout($,Math.min(15e3,1e3*Math.max(1,S)));return}u.onopen=()=>{Mi(!0),k=Date.now(),(!Tn.current.length||!F.current)&&_s()},u.onmessage=ne=>{var W;try{const xe=JSON.parse(String(ne.data||"{}"));if((xe==null?void 0:xe.type)!=="envelope")return;const Pe=String(((W=xe.envelope)==null?void 0:W.channel)||"");Pe&&Pe===Hl.current&&Js(Pe,{background:!0}),Pe&&!Tn.current.some(Ue=>Ue.name===Pe)&&Qs(),Ts.current&&clearTimeout(Ts.current),Ts.current=setTimeout(()=>void ga(Tn.current),800)}catch{}},u.onclose=()=>{Mi(!1),v||(k&&Date.now()-k>=15e3?S=0:S+=1,k=0,setTimeout($,Math.min(15e3,1e3*Math.max(1,S))))},u.onerror=()=>{try{u==null||u.close()}catch{}}}};return $(),()=>{v=!0,Ts.current&&clearTimeout(Ts.current);try{u==null||u.close()}catch{}}},[]),h.useEffect(()=>{T.current+=1,me({}),G({}),Xe({}),J.current=new Set,Jn(null),Ha(null);try{C.stop_tts()}catch{}Va.current=0,ba.current={},gs("recency"),Jr(null),hr(""),qr(null),er(""),pa(""),Ht(null),Yn(null),Xn(null),Ss(null),on(""),ct(""),fs({}),_n([]),sr(""),ar(""),Ai(!1),nr(""),Ce([]),Ge(fe.current||"all"),fe.current=null,mt(null),_t({}),fn(""),dt([]),Wa.current&&Wa.current!==O&&(Y||ze?Wt.current[Wa.current]={text:Y,title:ze,kind:tt}:delete Wt.current[Wa.current],Nl(Wt.current));const u=Wt.current[O];if(Se((u==null?void 0:u.text)||""),Ke((u==null?void 0:u.title)||""),jt((u==null?void 0:u.kind)||"fyi"),Wa.current=O,Pi.current=!0,Js(O),!O)return;kt==="files"&&Jl(),kt==="members"&&Oi();const v=setInterval(()=>{Ul.current+=1,Li.current||(Li.current=!0,Js(O,{background:!0}).finally(()=>{Li.current=!1})),Ul.current%Yy===0&&(Qs().then(S=>ga(S)).catch(()=>ga(Tn.current)),l.healthz().then(Z).catch(()=>{}),l.meta().then(S=>B(S)).catch(()=>{}))},Jy);return()=>clearInterval(v)},[O]);const Vl=h.useRef({text:"",title:"",kind:"fyi",selected:""});Vl.current={text:Y,title:ze,kind:tt,selected:O},h.useEffect(()=>{if(!O)return;const u=setTimeout(()=>{Y||ze?Wt.current[O]={text:Y,title:ze,kind:tt}:delete Wt.current[O],Nl(Wt.current)},300);return()=>clearTimeout(u)},[Y,ze,tt,O]),h.useEffect(()=>{const u=()=>{const v=Vl.current;v.selected&&(v.text||v.title?Wt.current[v.selected]={text:v.text,title:v.title,kind:v.kind}:delete Wt.current[v.selected],Nl(Wt.current))};return window.addEventListener("pagehide",u),window.addEventListener("beforeunload",u),()=>{window.removeEventListener("pagehide",u),window.removeEventListener("beforeunload",u),u()}},[]),h.useEffect(()=>{const u=Ri.current;if(!u||!te.length)return;if(Pi.current){Pi.current=!1,u.scrollTop=u.scrollHeight;return}u.scrollHeight-u.scrollTop-u.clientHeight<240&&(u.scrollTop=u.scrollHeight)},[te]),h.useEffect(()=>{if(Ae!=="unread"||!O){Ie(null);return}const u=Me[O];Ie(new Set(u||[])),se.current=""},[Ae,O]),h.useEffect(()=>{if(Ae!=="unread"||!O||!Re||!Re.size)return;const u=Math.min(...Re),v=te.length&&te[0].seq||0;if(!u||!v||v<=u)return;const S=`${O}:${u}`;if(se.current===S)return;se.current=S;const k=T.current;l.messages(O,{since:Math.max(0,u-1),limit:ua}).then($=>{k!==T.current||!$.length||Ce(ne=>{const W=new Set(ne.map(Pe=>Pe.id)),xe=$.filter(Pe=>!W.has(Pe.id));return xe.length?[...ne,...xe].sort((Pe,Ue)=>(Pe.seq||0)-(Ue.seq||0)):ne})}).catch(()=>{k===T.current&&(ot("Couldn't load the older unread messages — the Unread list may be incomplete. Re-select Unread to retry."),setTimeout(()=>ot(""),6e3))})},[Ae,O,Re,te]);function Ii(u){J.current.has(u.id)||(J.current.add(u.id),l.read_message(u.channel,u.id).catch(()=>{}),l.ack(u.channel,u.seq).catch(()=>{}),ve(v=>{const S=v[u.channel];if(!S||!S.has(u.seq))return v;const k=new Set(S);return k.delete(u.seq),{...v,[u.channel]:k}}),Ts.current&&clearTimeout(Ts.current),Ts.current=setTimeout(()=>void ga(Tn.current),500),u.critical&&(ot(`Read recorded for critical #${u.seq}.`),setTimeout(()=>ot(""),2500)))}function Gl(u){const v=!ie[u.id];me(S=>({...S,[u.id]:v})),v&&Ii(u)}function tc(u){const v=window.getSelection();if(v&&!v.isCollapsed)return;const S=String(u.body||""),k=u.status==="reply"?Hf:Uo;S.length>k?Gl(u):Ii(u)}async function nc(){if(!O||Qt==="running")return;const u=T.current;Jn("running");try{const v=await l.ledger(O),S=await Qy(v);if(u!==T.current)return;Jn(S)}catch(v){if(u!==T.current)return;Jn({error:String((v==null?void 0:v.message)||v||"verification failed")})}}function Oi(){{const u=T.current;Ha("loading"),Yn(null),Mr(""),Xn(null),l.channel_info(O).then(v=>{u===T.current&&Ha(v)}).catch(v=>{u===T.current&&Ha({error:String((v==null?void 0:v.message)||v||"info failed")})}),l.members(O).then(v=>{u===T.current&&(Yn(v),Mr(""),Ni(O,v))}).catch(v=>{u===T.current&&(Yn([]),Mr(String((v==null?void 0:v.message)||v||"members unavailable")))}),l.list_blocks().then(v=>{u===T.current&&Xn(v)}).catch(()=>{u===T.current&&Xn([])}),l.retired_agents().then(v=>{u===T.current&&Ss(v)}).catch(()=>{u===T.current&&Ss([])})}}function va(u){const v=kt===u?"":u;if(sn(v),v==="files"&&Jl(),v==="members"){let S=0;for(const k of Es.current)String(k.sender||"")==="hub"&&(k.seq||0)>S&&(S=k.seq||0);Va.current=S,Oi(),kn()}v==="leaderboard"&&Di(Un),v==="desk"&&he()}function Di(u){const v=T.current;Fr(null),Fl(""),ql(""),hs(null),Zn(""),(u==="hub"?l.reputation_hub():l.reputation(O)).then(k=>{v===T.current&&Fr(k)}).catch(k=>{if(v!==T.current)return;const $=Number((k==null?void 0:k.status)||0);Fl($===404||$===403?"Reputation ships with the next hub update — relaunch the hub (agora ≥ 0.12.7) and reopen this drawer.":String((k==null?void 0:k.message)||k||"failed to load leaderboard"))})}function Kl(u){const v=Xa===u?"":u;if(ql(v),hs(null),Zn(""),!v||Un==="hub")return;const S=T.current;l.reputation_votes(O,v).then(k=>{S===T.current&&hs(k)}).catch(k=>{S===T.current&&(hs(null),Zn(`votes list failed: ${String((k==null?void 0:k.message)||k||"fetch failed")}`))})}const[ir,ya]=h.useState(""),[xa,Hr]=h.useState("");h.useEffect(()=>{if(!xa)return;const u=setTimeout(()=>Hr(""),6e3);return()=>clearTimeout(u)},[xa]);async function Ql(u){if(xa!==u.id){Hr(u.id);return}Hr("");try{const v=Array.isArray(u.pending_asks)?u.pending_asks.filter(Boolean):[];await l.post_message(u.channel,{body:`Declined on the record by ${(z==null?void 0:z.seat)||"operator"} — closing without a substantive answer.`,status:"reply",reply_to:u.id,to:u.sender?[u.sender]:void 0,...v.length?{answers:v}:{}}),D(S=>{const k=S[u.channel];if(!(k!=null&&k.has(u.seq)))return S;const $=new Set(k);return $.delete(u.seq),{...S,[u.channel]:$}})}catch(v){_e(String((v==null?void 0:v.message)||v||"decline failed"))}}const ba=h.useRef({});function Vr(u){const v=u.ratings;return v?Fy(v,ba.current[u.id]):null}async function Fi(u,v){var $,ne;const S=(z==null?void 0:z.seat)||"";if(!u||!S||ir)return;const k=Es.current.find(W=>W.id===u)||(($=Zi.current)==null?void 0:$.find(W=>W.id===u));if(k){ya(`${u}:${v}`),Zn("");try{const W=((ne=Vr(k))==null?void 0:ne.mine)??0;W===v?await l.unrate_message(O,u):await l.rate_message(O,u,v),ba.current[u]=W===v?0:v}catch(W){Zn(String((W==null?void 0:W.message)||W||"rating failed"))}finally{ya("")}}}async function Ys(u,v,S){if(!Ti){Bl(`${u}:${v}:${S}`),Zn("");try{await l.rate(O,u,v,S,Hs.trim()),Za("");const k=T.current,[$,ne]=await Promise.all([l.reputation(O),l.reputation_votes(O,u)]);k===T.current&&(Fr($),hs(ne))}catch(k){Zn(String((k==null?void 0:k.message)||k||"vote failed"))}finally{Bl("")}}}function Jl(){const u=T.current;qr(null),er(""),pa(""),l.fs_list(O).then(v=>{u===T.current&&qr(v)}).catch(v=>{u===T.current&&er(String((v==null?void 0:v.message)||v||"failed to list files"))})}async function sc(u){const v=T.current,S=Cr(u.path,"text/markdown"),k=`${u.updated_by||"?"} · ${$l(u.updated_at)} · v${u.version}`;Ht({name:u.path,mode:S==="image"?"text":S,meta:k,loading:!0});try{const $=await l.fs_read(O,u.path);if(v!==T.current)return;const ne=Cr(u.path,$.mime);Ht({name:u.path,mode:ne==="image"?"text":ne,text:Wo($.content),content_type:$.mime,meta:k,loading:!1})}catch($){if(v!==T.current)return;Ht({name:u.path,mode:"text",meta:k,error:String(($==null?void 0:$.message)||$||"failed to read file")})}}const Xs=h.useRef(null);function wa(){const u=Xs.current,v=Es.current;if(!u||!v.length)return;if(u.message_id?v.some(k=>k.id===u.message_id):!1){Xs.current=null,requestAnimationFrame(()=>{const k=document.getElementById(`hubmsg-${u.message_id}`);k==null||k.scrollIntoView({block:"center"}),k==null||k.classList.add("hit"),setTimeout(()=>k==null?void 0:k.classList.remove("hit"),2500)});return}if(u.seq&&Number.isFinite(u.seq)){const k=T.current,$=u.seq;Xs.current={...u,seq:void 0},l.messages(O,{since:Math.max(0,$-3),limit:10}).then(ne=>{k!==T.current||!ne.length||Ce(W=>{const xe=new Set(W.map(Ue=>Ue.id)),Pe=ne.filter(Ue=>!xe.has(Ue.id));return Pe.length?[...W,...Pe].sort((Ue,Be)=>(Ue.seq||0)-(Be.seq||0)):W})}).catch(()=>{})}}h.useEffect(()=>{var k;if(!a.focus)return;const{channel:u,message_id:v,seq:S}=a.focus;(k=a.on_focus_consumed)==null||k.call(a),u&&(Xs.current={message_id:v,seq:S},u===O?wa():je(u))},[a.focus]),h.useEffect(()=>{wa()},[te]),h.useEffect(()=>{if(kt!=="members"||!O)return;let u=0,v="";for(const k of te){if(k.channel&&k.channel!==O||String(k.sender||"")!=="hub")continue;const $=`${String(k.title||"")} ${String(k.body||"")}`;/\b(joined|left|kicked|banned|archived|reopened)\b/i.test($)&&(k.seq||0)>u&&(u=k.seq||0,v=$)}if(!u||u<=Va.current)return;const S=T.current;l.members(O).then(k=>{S===T.current&&(Va.current=u,Yn(k),Mr(""),Ni(O,k))}).catch(()=>{}),/\b(kicked|banned)\b/i.test(v)&&l.list_blocks(O).then(k=>{S===T.current&&Xn(k)}).catch(()=>{})},[te,kt,O]);const[Yl,As]=h.useState(null),Zs=h.useRef(0);h.useEffect(()=>{if(As(null),Zs.current=0,!O)return;const u=T.current;l.fs_list(O).then(v=>{u===T.current&&As(new Set(v.map(S=>String(S.path||"")).filter(Boolean)))}).catch(()=>{u===T.current&&As(null)})},[O]),h.useEffect(()=>{const u=te.reduce((S,k)=>{if(k.channel&&k.channel!==O)return S;const $=String(k.title||"");return($.startsWith("fs:put")||$.startsWith("fs:delete"))&&(k.seq||0)>S?k.seq||0:S},0);if(!u||u<=Zs.current)return;const v=T.current;l.fs_list(O).then(S=>{v===T.current&&(Zs.current=u,As(new Set(S.map(k=>String(k.path||"")).filter(Boolean))))}).catch(()=>{})},[te,O]);async function ac(u){const v=T.current,S=Cr(u,"text/markdown");Ht({name:u,mode:S==="image"?"text":S,loading:!0});try{const k=await l.fs_read(O,u);if(v!==T.current)return;const $=Cr(u,k.mime),ne=k.updated_by?`${k.updated_by} · ${$l(k.updated_at)} · v${k.version??"?"}`:void 0;Ht({name:u,mode:$==="image"?"text":$,text:Wo(k.content),content_type:k.mime,meta:ne,loading:!1})}catch(k){if(v!==T.current)return;Ht({name:u,mode:"text",error:String((k==null?void 0:k.message)||k||"failed to read file")+" — the file may have been rewritten under another path; check the Files drawer"})}}async function ea(u,v){const S=T.current,k=l.attachment_url(u,v.id),$=Cr(v.filename,v.content_type);if($==="image"){Ht({name:v.filename,mode:"image",url:k,content_type:v.content_type,size:v.size});return}if($==="md"||$==="text"){if(v.size>Rl){Ht({name:v.filename,mode:"download",url:k,content_type:v.content_type,size:v.size,error:`too large to preview inline (${On(v.size)} > ${On(Rl)}) — download to view`});return}Ht({name:v.filename,mode:$,url:k,content_type:v.content_type,size:v.size,loading:!0});try{const ne=await fetch(k);if(!ne.ok)throw new Error(`fetch failed (${ne.status})`);const W=await ne.text();if(S!==T.current)return;Ht({name:v.filename,mode:$,url:k,content_type:v.content_type,size:v.size,text:Wo(W)})}catch(ne){if(S!==T.current)return;Ht({name:v.filename,mode:"download",url:k,content_type:v.content_type,size:v.size,error:String((ne==null?void 0:ne.message)||ne||"failed to load")})}return}Ht({name:v.filename,mode:"download",url:k,content_type:v.content_type,size:v.size})}async function Gr(u,v,S="channel"){if(!Ot){Ns(`${S}:${v}:${u}`),ct("");try{S==="hub"?v==="unblock"?await l.hub_unblock(u):await l.hub_block(u,v==="kick"?{seconds:3600,reason:"hub kick (Continuum Team page)"}:{reason:"hub ban (Continuum Team page)"}):v==="unblock"?await l.unblock(O,u):await l.block(O,u,v==="kick"?{seconds:3600,reason:"kicked by the operator (Continuum Team page)"}:{reason:"banned by the operator (Continuum Team page)"}),ot(`${S==="hub"?"hub ":""}${v} → ${u} applied.`),setTimeout(()=>ot(""),3e3);const k=T.current,$=await l.members(O).catch(()=>null);$&&k===T.current&&Yn($);const ne=await l.list_blocks().catch(()=>null);ne&&k===T.current&&Xn(ne)}catch(k){ct(String((k==null?void 0:k.message)||k||"moderation refused"))}finally{Ns("")}}}async function Xl(u){if(!Ot){Ns(`retire:${u}`),ct("");try{await l.retire_agent(u,"decommissioned via Continuum Team page"),on(""),ot(`${u} retired (decommissioned — not banned).`),setTimeout(()=>ot(""),3500);const v=T.current,S=await l.members(O).catch(()=>null);S&&v===T.current&&Yn(S);const k=await l.retired_agents().catch(()=>null);k&&v===T.current&&Ss(k)}catch(v){const S=v==null?void 0:v.status,k=String((v==null?void 0:v.message)||v||"");S===404||/not found|hub_route_not_allowed/i.test(k)?(ot("Agent retire ships with the next hub update — this control is wired and ready for it."),setTimeout(()=>ot(""),6e3)):ct(k||"retire refused")}finally{Ns("")}}}async function qi(u){if(!Ot){Ns(`unretire:${u}`),ct("");try{await l.unretire_agent(u),on(""),ot(`${u} un-retired — it can rejoin channels explicitly.`),setTimeout(()=>ot(""),3500);const v=await l.retired_agents().catch(()=>null);v&&Ss(v)}catch(v){ct(String((v==null?void 0:v.message)||v||"un-retire refused"))}finally{Ns("")}}}async function Bi(u){if(!Ot){Ns(`delete:${u}`),ct("");try{await l.delete_agent(u),on(""),ot(`${u} deleted from the hub — off every roster and board; its id stays reserved.`),setTimeout(()=>ot(""),3500);const v=await l.retired_agents().catch(()=>null);v&&Ss(v)}catch(v){const S=String((v==null?void 0:v.message)||v);ct((v==null?void 0:v.status)===404||/not found|allowlist/i.test(S)?"Delete needs the updated hub/console (0.12.41+) — restart the stack to pick it up.":/409|active/i.test(S)?`${u} is still active — retire it first, then delete.`:S||"delete refused")}finally{Ns("")}}}async function Ui(u){if(!Jt){pn(!0),ct("");try{let v={state:u},S;try{const k=await l.channel_meta(O);k&&typeof k.value=="object"&&k.value&&(v={...k.value,state:u}),typeof(k==null?void 0:k.version)=="number"&&(S=k.version)}catch{}await l.put_channel_meta(O,v,S),ot(u==="closed"?"Channel closed (member posts refused until reopened).":"Channel reopened."),setTimeout(()=>ot(""),3500),Oi(),_s()}catch(v){ct(String((v==null?void 0:v.message)||v||"channel state change refused"))}finally{pn(!1)}}}const[Zl,Wi]=h.useState("");async function rc(u){if(!Jt){pn(!0),_e("");try{await l.leave(u),Wi(""),O===u&&je(""),await _s(),ot("Direct message removed from your list."),setTimeout(()=>ot(""),3e3)}catch(v){_e(String((v==null?void 0:v.message)||v||"leave refused"))}finally{pn(!1)}}}const[ic,Hi]=h.useState("");async function lc(u){if(!Jt){pn(!0),_e("");try{await l.archive(u),Hi(""),O===u&&je(""),await _s(),ot(`Channel #${u} archived (history preserved).`),setTimeout(()=>ot(""),3500)}catch(v){const S=String((v==null?void 0:v.message)||v||"");(v==null?void 0:v.status)===404||/not found|hub_route_not_allowed/i.test(S)?(Hi(""),ot("Channel archive ships with the next hub update — this control is wired and ready for it."),setTimeout(()=>ot(""),6e3)):_e(S||"archive refused")}finally{pn(!1)}}}async function eo(){const u=Cs.name.trim();if(!(!u||Jt)){pn(!0),_e("");try{await l.create_channel(u,Cs.is_private),Bs({open:!1,name:"",is_private:!1}),await _s(),je(u),ot(`Channel #${u} created.`),setTimeout(()=>ot(""),3e3)}catch(v){_e(String((v==null?void 0:v.message)||v||"channel create refused"))}finally{pn(!1)}}}async function An(u,v){if(!c)throw new Error("AI advisor is not available");return c(u,v)}async function lr(u){if(!d)return;const v=u.root.id,S=T.current,k=u.replies.length+1;fs($=>{var ne;return{...$,[v]:{busy:!0,text:((ne=$[v])==null?void 0:ne.text)||"",error:"",count:k}}});try{const $=qf([u.root,...u.replies]),ne=`Summarize this hub discussion thread in at most 5 short bullet points: the question or claim, the positions taken, decisions reached, and anything still open. Be concrete — name senders and receipts.
|
|
108
|
-
|
|
109
|
-
THREAD TRANSCRIPT:
|
|
110
|
-
${$.text}`,W=await An(ne,[]);if(S!==T.current)return;const xe=Bf($.report);fs(Pe=>({...Pe,[v]:{busy:!1,text:W,error:"",count:k,window:xe}}))}catch($){if(S!==T.current)return;fs(ne=>({...ne,[v]:{busy:!1,text:"",error:String(($==null?void 0:$.message)||$||"summary failed"),count:k}}))}}async function Vi(u){const v=u.trim();if(!v||Ks||!d)return;const S=T.current;sn("assistant"),Ai(!0),sr(""),_n(k=>[...k,{role:"user",content:v}]);try{const k=qf(te);ar(Bf(k.report));const $=`You are the operator's analyst for the agora hub channel #${O}. Answer from the transcript below — strategies used, deviations, who owes what, timeline of decisions. Cite message seqs like #123. If the transcript does not contain the answer, say so plainly.
|
|
111
|
-
|
|
112
|
-
CHANNEL TRANSCRIPT (window):
|
|
113
|
-
${k.text}
|
|
114
|
-
|
|
115
|
-
QUESTION: ${v}`,ne=await An($,tr);if(S!==T.current)return;_n(W=>[...W,{role:"assistant",content:ne}])}catch(k){if(S!==T.current)return;sr(String((k==null?void 0:k.message)||k||"assistant failed"))}finally{S===T.current&&Ai(!1)}}const[or,Gi]=h.useState(""),[cr,Kr]=h.useState("");async function oc(u){if(!Qn){Fn(!0),_e("");try{await l.retract_message(O,u.id),Kr(""),ot(`#${u.seq} retracted — readers see a tombstone, the words are gone from every agent-facing read.`),setTimeout(()=>ot(""),4e3),await Js(O,{background:!0})}catch(v){const S=String((v==null?void 0:v.message)||v||"retract failed");_e(/404|not found/i.test(S)?"Retraction ships with the hub's next bounce (0.12.16) — the running hub predates the verb. Nothing was changed.":S)}finally{Fn(!1)}}}async function cc(u){if(!Qn){Fn(!0),_e("");try{const v=Pf(O,St);await l.post_message(O,{body:"Resolved.",status:"resolved",to:v?[v]:void 0,reply_to:u.id}),Gi(""),ot(`Marked #${u.seq} resolved.`),setTimeout(()=>ot(""),3e3),await Js(O,{background:!0})}catch(v){_e(String((v==null?void 0:v.message)||v||"Resolve failed"))}finally{Fn(!1)}}}async function ta(u){if(!u||!u.length||yt)return;const v=Array.from(u);if(nt.length+v.length>Sl){_e(`At most ${Sl} attachments per message.`);return}const S=v.find(W=>W.size>Gf);if(S){_e(`"${S.name}" is ${On(S.size)} — the limit is ${On(Gf)}.`);return}const k=T.current,$=O;ht(!0),_e("");let ne=0;try{for(const W of v){const xe=await l.upload_attachment($,W);if(k!==T.current||O!==$)return;dt(Pe=>[...Pe,xe]),ne+=1}}catch(W){const xe=W==null?void 0:W.status,Pe=String((W==null?void 0:W.message)||W||"");if(xe===404||/not found|hub_route_not_allowed/i.test(Pe))ot("Attachments ship with the next hub update — the composer control is wired and ready for it."),setTimeout(()=>ot(""),6e3);else{const Ue=v.length>1?` (${ne} of ${v.length} attached before this)`:"";_e(`${Pe||"attachment upload failed"}${Ue}`)}}finally{ht(!1),Et.current&&(Et.current.value="")}}function Ki(u){var S;mt(u);const v=((S=u.data)==null?void 0:S.asks)||[];_t(v.length===1?{[v[0].id]:!0}:{}),fn(""),jt("fyi")}function ja(){mt(null),_t({}),fn("")}async function Qi(u){const{title:v,members:S}=Iu(u);if(!S.length){_e("/group: no @mentions found — usage: /group fix the voice outage @gateway @core");return}const k=v||`focused work with ${S.join(", ")}`;await Xi({title:k,members:S})}async function Ji(u,v,S){const k=[],$=[];for(const ne of S)try{const W=await fetch(l.attachment_url(u,ne.id));if(!W.ok)throw new Error(`fetch ${W.status}`);const xe=await W.blob(),Pe=new File([xe],ne.filename||"attachment",{type:ne.content_type||xe.type||"application/octet-stream"}),Ue=await l.upload_attachment(v,Pe);k.push({id:Ue.id,filename:Ue.filename||ne.filename})}catch(W){$.push(`${ne.filename||ne.id.slice(0,8)} (${String((W==null?void 0:W.message)||W)})`)}return{migrated:k,att_failed:$}}async function ur(u,v,S){try{const k=await l.create_invite(u,v);return await l.send_dm(v,{title:`invite to ${u}${S?`: ${S}`:""}`.slice(0,120),body:`You are invited to '${u}'${S?` — ${S}`:""}. Join with join_channel(channel='${u}', invite_token='${k}'), read the recent messages, and work the topic THERE.`}),null}catch(k){return String((k==null?void 0:k.message)||k)}}async function ka(u){var v,S;if(!(!O||!u)){$i(!0),Ja("");try{const k=Mt&&typeof Mt=="object"&&"meta"in Mt?String(((v=Mt.meta)==null?void 0:v.purpose)||""):"",$=!!((S=Tn.current.find(W=>W.name===O))!=null&&S.private);let ne=null;if($)ne=await ur(O,u,k||void 0);else try{await l.send_dm(u,{title:`join ${O}${k?`: ${k}`:""}`.slice(0,120),body:`You are invited to '${O}' (public)${k?` — ${k}`:""}. Join with join_channel(channel='${O}'), read the recent messages, and work the topic THERE.`})}catch(W){ne=String((W==null?void 0:W.message)||W)}ne?Ja(ne.includes("outside the Team page allowlist")?"Invites need the updated console server — one stack restart activates them; nothing was sent.":`Invite failed: ${ne}`):(Ja(`Invited @${u} — join pointer DM'd.`),Ci(""),Lr(O,[u]))}finally{$i(!1),setTimeout(()=>Ja(""),8e3)}}}async function Yi(u,v){var S;try{const k=Iu(v).members;if(!k.length)return;const $=await l.members(u),ne=new Set($.map(Be=>String(Be.agent_id||""))),W=k.filter(Be=>!ne.has(Be)&&qs.includes(Be)&&Be!==St);if(!W.length)return;const xe=!!((S=Tn.current.find(Be=>Be.name===u))!=null&&S.private),Pe=[],Ue=[];for(const Be of W)if(xe){const Tt=await ur(u,Be);Tt?Ue.push(`${Be} (${Tt})`):Pe.push(Be)}else try{await l.send_dm(Be,{title:`you were mentioned in #${u}`.slice(0,120),body:`You were mentioned in #${u} (public). Join with join_channel(channel='${u}') and read the recent messages.`}),Pe.push(Be)}catch(Tt){Ue.push(`${Be} (${String((Tt==null?void 0:Tt.message)||Tt)})`)}Pe.length&&(Lr(u,Pe),ot(`Posted — @${Pe.join(", @")} ${xe?"invited":"nudged"} (mentioned, not yet member${Pe.length===1?"":"s"}).`)),Ue.length&&_e(Ue.some(Be=>Be.includes("outside the Team page allowlist"))?"Posted; inviting mentioned non-members needs the updated console server (one stack restart).":`Posted; invite failed for ${Ue.join("; ")}.`)}catch{}}async function Xi(u){var ne,W;const{title:v,members:S}=u,k=[...nt],$=O;Fn(!0),_e("");try{const xe=new Set(Tn.current.map(bt=>bt.name)),Pe=Du(v,xe);let Ue=[],Be=[],Tt=!1;try{const bt=await l.create_group({name:Pe,members:S,purpose:v,opening_post:((ne=u.opening_body)==null?void 0:ne.trim())||v,private:!0});Tt=!0,Ue=Array.isArray(bt==null?void 0:bt.invited)?bt.invited.map(String):S,Be=Array.isArray(bt==null?void 0:bt.failed)?bt.failed.map(et=>typeof et=="string"?et:`${(et==null?void 0:et.agent)||(et==null?void 0:et.member)||(et==null?void 0:et.peer)||"?"} (${String((et==null?void 0:et.error)||(et==null?void 0:et.detail)||"failed")})`):[]}catch(bt){const et=String((bt==null?void 0:bt.message)||bt||"");if(!((bt==null?void 0:bt.status)===404||et.includes("outside the Team page allowlist")||et.includes("Not Found")))throw bt;try{await l.create_invite("__group-preflight__",S[0])}catch(wt){if(String((wt==null?void 0:wt.message)||wt).includes("outside the Team page allowlist")){_e("/group needs the updated console server — this process predates the invite route. Restart the console (next stack restart picks it up) and retry; nothing was created.");return}}await l.create_channel(Pe,!0),await l.put_channel_meta(Pe,{purpose:v},0);for(const wt of S)try{const He=await l.create_invite(Pe,wt);await l.send_dm(wt,{title:`invite to ${Pe}: ${v}`.slice(0,120),body:`You are invited to '${Pe}' — focused room: ${v}. Join with join_channel(channel='${Pe}', invite_token='${He}'), read the opening post, and work the topic THERE (not in commons).`}),Ue.push(wt)}catch(He){Be.push(`${wt} (${String((He==null?void 0:He.message)||He)})`)}}const{migrated:Vt,att_failed:rs}=await Ji($,Pe,k);Tt?Vt.length&&await l.post_message(Pe,{body:"Attachments carried over from the create request.",status:"fyi",attachments:Vt}):await l.post_message(Pe,{body:((W=u.opening_body)==null?void 0:W.trim())||v,title:v.slice(0,120),status:"open",attachments:Vt.length?Vt:void 0}),Lr(Pe,Ue),ot(`Room '${Pe}' created — private, ${Ue.length} invited${Ue.length?`: ${Ue.join(", ")}`:""}.`+(Vt.length?` ${Vt.length} attachment(s) carried over.`:"")+(Be.length?` Invite FAILED for ${Be.join("; ")}.`:"")),Be.length&&_e(`Some invites failed — ${Be.join("; ")}. Mint them again from the room's Members drawer or re-run /group.`),rs.length&&_e(`Attachment carry-over failed for ${rs.join("; ")} — the room and post were created; re-attach in the new room.`),Se(""),Ke(""),$e(""),jt("fyi"),dt([]),delete Wt.current[O],Nl(Wt.current),await _s(),je(Pe),setTimeout(()=>ot(""),6e3)}catch(xe){_e(`group creation failed: ${String((xe==null?void 0:xe.message)||xe)}`)}finally{Fn(!1)}}async function dr(){var ne;const u=Y.trim(),v=nt.length>0,S=!Oe&&!O.startsWith("dm:")&&tt==="group";if(!u&&!v&&!S||Qn||!O)return;if(S){const W=Ou(we);if(!W.length){_e("Group needs at least one member — write their names like: @entity @assistant");return}const xe=ze.trim()||(u?u.split(`
|
|
116
|
-
`)[0].slice(0,80):`focused work with ${W.join(", ")}`);await Xi({title:xe,members:W,opening_body:u});return}if(/^\/assistant(?=\s|$)/i.test(u)){if(!d){_e("AI advisor is not configured — connect a gateway or inject an advisor.");return}const W=u.replace(/^\/assistant/i,"").trim();Se(""),W?Vi(W):sn("assistant");return}if(/^\/group(?=\s|$)/i.test(u)){await Qi(u.replace(/^\/group/i,"").trim());return}if(/^\//.test(u)){_e(`Unknown command "${u.split(/\s/)[0]}" — only /assistant and /group are supported. Remove the leading "/" to post this as a message.`);return}const k=Object.entries(pt).filter(([,W])=>W).map(([W])=>W),$=O.startsWith("dm:");if(Oe&&(((ne=Oe.data)==null?void 0:ne.asks)||[]).length&&!k.length&&nn!=="void_reply"){fn("void_reply");return}if(!Oe&&!$&&tt==="ask"&&!ze.trim()&&nn!=="untitled_open"){fn("untitled_open");return}if(!Oe&&!$&&tt==="dm"&&!ft.trim()){_e("Pick a recipient for the direct message.");return}Fn(!0),_e("");try{if(!Oe&&!$&&tt==="dm"){const W=ft.trim(),xe=[...nt],Pe=O;await l.send_dm(W,{body:u||(xe.length?`(${xe.length} attachment${xe.length===1?"":"s"})`:u),title:ze.trim()||void 0});const Ue=`dm:${[St,W].sort().join("--")}`;if(xe.length){const{migrated:Be,att_failed:Tt}=await Ji(Pe,Ue,xe);Be.length&&await l.post_message(Ue,{body:"",to:[W],attachments:Be}),ot(`DM sent to ${W}${Be.length?` with ${Be.length} attachment(s)`:""}.`),Tt.length&&_e(`Attachment carry-over failed for ${Tt.join("; ")} — the DM text was sent; re-attach inside the conversation.`)}else ot(`DM sent to ${W}.`);await _s(),je(Ue)}else{const W=nt.map(Ue=>({id:Ue.id,filename:Ue.filename})),xe=$?Pf(O,St):"";$&&!xe&&_e(`#FALLBACK this dm's pair does not include seat '${St}' — sent unaddressed (no to-me wake; check the hub seat in Settings).`);const Pe={body:u,title:ze.trim()||void 0,status:Ny({is_reply:!!Oe,in_dm:$,kind:tt}),to:xe?[xe]:void 0,reply_to:Oe==null?void 0:Oe.id,answers:Oe&&k.length?k:void 0,attachments:W.length?W:void 0};try{await l.post_message(O,Pe)}catch(Ue){if(xe&&/address non-members/i.test(String((Ue==null?void 0:Ue.message)||Ue)))await l.post_message(O,{...Pe,to:void 0}),_e(`#FALLBACK '${xe}' is no longer a member of this dm — message delivered unaddressed (their listener will not get a to-me wake).`);else throw Ue}ot($?"Sent.":"Posted."),await Js(O,{background:!0}),!$&&u&&Yi(O,u)}Se(""),Ke(""),dt([]),mt(null),_t({}),jt("fyi"),Zt(""),fn(""),delete Wt.current[O],Nl(Wt.current),setTimeout(()=>ot(""),3e3)}catch(W){_e(String((W==null?void 0:W.message)||W||"Post failed"))}finally{Fn(!1)}}async function to(u){if(!(!O||!u||ma||qe)){Rr(!0);try{await l.ack(O,u),ot(`Marked read to #${u}.`),setTimeout(()=>ot(""),3e3),ga(Tn.current)}catch(v){_e(String((v==null?void 0:v.message)||v||"Ack failed"))}finally{Rr(!1)}}}const Sn=!!(z!=null&&z.seat_key_present)&&!(E!=null&&E.paused),St=(z==null?void 0:z.seat)||"",en=O.startsWith("dm:"),Qr=(()=>{if(!en)return"";const u=O.slice(3);return St&&u.startsWith(`${St}--`)?u.slice(St.length+2):St&&u.endsWith(`--${St}`)?u.slice(0,u.length-St.length-2):u||O})(),no=h.useMemo(()=>Cy(te),[te]),gn=h.useMemo(()=>({seat:St,unread_seqs:Me[O],unread_snapshot_seqs:Ae==="unread"&&Re||void 0,escalated_seqs:R[O]}),[St,Me,O,Ae,Re,R]),ts=h.useMemo(()=>{if(Oe)return null;const u=new Set(oe.map(S=>S.name)),v=Y.trimStart();if(/^\/group(\s|$)/i.test(v)){const{title:S,members:k}=Iu(v.replace(/^\/group/i,"").trim()),$=S||(k.length?`focused work with ${k.join(", ")}`:"");return{name:$?Du($,u):"group",members:k,source:"slash"}}if(tt==="group"&&!O.startsWith("dm:")){const S=Ou(we),k=ze.trim()||(S.length?`focused work with ${S.join(", ")}`:"");return{name:k?Du(k,u):"group",members:S,source:"kind"}}return null},[Y,Oe,oe,tt,we,ze,O]),Wn=h.useMemo(()=>yy(te),[te]),Sa=h.useMemo(()=>zf(Wn,Ae,gn),[Wn,Ae,gn]),[mr,gs]=h.useState("recency"),[fr,Jr]=h.useState(null),Zi=h.useRef(null);h.useEffect(()=>{Zi.current=fr},[fr]);const[Ct,hr]=h.useState("");function Yr(){const u=T.current;Jr(null),hr(""),l.messages(O,{sort:"votes",limit:50}).then(v=>{u===T.current&&Jr(v)}).catch(v=>{if(u!==T.current)return;const S=String((v==null?void 0:v.message)||v);hr((v==null?void 0:v.status)===400||(v==null?void 0:v.status)===404||/allowlist/i.test(S)?"Top-voted needs the next hub update (this hub predates sort=votes) — Recency still works.":S)})}function pr(u){Xs.current={message_id:u.id,seq:u.seq},gs("recency"),requestAnimationFrame(()=>wa())}const[el,Xr]=h.useState(""),[ns,Zr]=h.useState("all"),[an,ei]=h.useState(""),[ss,ti]=h.useState(null),[ni,Rn]=h.useState(null),Nn=h.useRef(0);function Na(u,v,S){if(!u&&!S)return;const k=++Nn.current;Rn(null),ti({q:u,report:null,error:"",busy:!0}),l.search({q:u,channel:v==="channel"&&O?[O]:void 0,rated:S||void 0,sort:!u&&S?"votes":void 0}).then($=>{k===Nn.current&&ti({q:u,report:$,error:"",busy:!1})}).catch($=>{if(k!==Nn.current)return;const ne=String(($==null?void 0:$.message)||$);ti({q:u,report:null,busy:!1,error:($==null?void 0:$.status)===404||/allowlist/i.test(ne)?"Search needs the next hub update (this hub predates search-grouped) — everything else still works.":ne})})}function tl(u){Na(u.trim(),ns,an)}function _r(){Nn.current+=1,ti(null),Rn(null),ei("")}function nl(u,v){const S=(ss==null?void 0:ss.q)||"";if(!S&&!an)return;const k=++Nn.current;Rn({label:u,kind:v,hits:[],total:0,cursor:null,busy:!0,error:""}),l.search({q:S,kind:v,sort:"recent",limit:50,rated:an||void 0,channel:ns==="channel"&&O?[O]:void 0}).then($=>{if(k!==Nn.current)return;const ne=sl($,v);Rn({label:u,kind:v,hits:ne.hits,total:ne.total,cursor:$.next_cursor??null,busy:!1,error:""})}).catch($=>{k===Nn.current&&Rn({label:u,kind:v,hits:[],total:0,cursor:null,busy:!1,error:String(($==null?void 0:$.message)||$)})})}function uc(){const u=ni,v=(ss==null?void 0:ss.q)||"";if(!u||!u.cursor||u.busy||!v&&!an)return;const S=Nn.current;Rn({...u,busy:!0}),l.search({q:v,kind:u.kind,sort:"recent",limit:50,cursor:u.cursor,rated:an||void 0,channel:ns==="channel"&&O?[O]:void 0}).then(k=>{if(S!==Nn.current)return;const $=sl(k,u.kind);Rn(ne=>ne&&ne.kind===u.kind?{...ne,hits:[...ne.hits,...$.hits],cursor:k.next_cursor??null,busy:!1}:ne)}).catch(k=>{S===Nn.current&&Rn($=>$&&$.kind===u.kind?{...$,busy:!1,error:String((k==null?void 0:k.message)||k)}:$)})}function sl(u,v){const S=Bo.find($=>$.kind===v),k=S?u[S.id]:void 0;return k?{hits:k.hits||[],total:k.total||0}:{hits:[],total:0}}function dc(u){const v=String(u.channel||"");v&&(Xs.current={message_id:u.kind==="message"?u.ref:void 0,seq:u.seq??void 0},_r(),gs("recency"),v===O?wa():je(v))}async function mc(u){const v=String(u.channel||""),S=String(u.ref||"");if(!v||!S)return;const k=Cr(S,"text/markdown");Ht({name:S,mode:k==="image"?"text":k,meta:`#${v}`,loading:!0});try{const $=await l.fs_read(v,S),ne=Cr(S,$.mime);Ht({name:S,mode:ne==="image"?"text":ne,text:Wo($.content),content_type:$.mime,meta:`#${v} · ${$.updated_by||"?"} · v${$.version??"?"}`,loading:!1})}catch($){Ht({name:S,mode:"text",meta:`#${v}`,error:String(($==null?void 0:$.message)||$||"failed to read file")})}}function si(u){const v=u.kind==="message"&&!!u.channel,S=u.kind==="file"&&!!u.channel,k=v||S,$=qy(String(u.snippet||""),u.highlights),ne=u.ratings,W=String(u.channel||""),xe=W?W.startsWith("dm:")?W:`#${W}`:"";return e.jsxs("div",{className:`team_search_hit${k?" clickable":""}`,onClick:k?()=>S?void mc(u):dc(u):void 0,role:k?"button":void 0,title:v?"Open this message in its thread":S?"Open this file":void 0,children:[e.jsxs("div",{className:"team_search_hit_head",children:[u.kind!=="message"?e.jsx("span",{className:"team_search_kind mono",children:u.kind}):null,xe?e.jsx("span",{className:"team_search_chan mono",children:xe}):null,u.sender?e.jsx("span",{className:"team_search_sender",style:{color:`hsl(${_d(String(u.sender))}, 60%, 55%)`},children:u.sender}):null,typeof u.seq=="number"&&u.seq>0?e.jsxs("span",{className:"muted mono",children:["#",u.seq]}):null,u.status==="open"||u.status==="blocked"?e.jsx("span",{className:"team_search_status mono",title:"This thread still carries an unresolved obligation",children:u.status}):null,typeof u.thread_hits=="number"&&u.thread_hits>1?e.jsxs("span",{className:"muted",title:"More matches in the same thread",children:[u.thread_hits," in thread"]}):null,ne&&(ne.up||ne.down)?e.jsxs("span",{className:"team_search_tally mono",title:"Standing ±1 ratings on this message (read-only here — vote from the thread)",children:["▲",ne.up," ▽",ne.down]}):null,u.created_at?e.jsx("span",{className:"muted team_search_time",children:$l(u.created_at)}):null]}),String(u.title||"").trim()?e.jsx("div",{className:"team_search_title",children:u.title}):null,$.length?e.jsx("div",{className:"team_search_snippet",children:$.map((Pe,Ue)=>Pe.hit?e.jsx("mark",{children:Pe.text},Ue):e.jsx(Kt.Fragment,{children:Pe.text},Ue))}):null,!v&&!S&&u.kind!=="agent"?e.jsx("div",{className:"team_search_ref mono muted",children:u.ref}):null]},`${u.kind}:${W}:${u.ref}`)}const Rs=h.useMemo(()=>{let u=0;for(const v of Sa)for(const S of[v.root,...v.replies])u=Math.max(u,S.seq||0);return u},[Sa]),so=h.useMemo(()=>{const u={};for(const v of["asks","vigilance","fyi","resolved","to_me"])u[v]=zf(Wn,v,gn).length;return u.unread=te.filter(v=>{var S,k;return((S=gn.unread_seqs)==null?void 0:S.has(v.seq))||((k=gn.unread_snapshot_seqs)==null?void 0:k.has(v.seq))}).length,u},[Wn,te,gn]);function Ca(){var u,v;return Mt==="loading"?e.jsx("span",{className:"muted team_note",children:"Loading channel info…"}):Mt&&typeof Mt=="object"&&"error"in Mt?e.jsx("span",{className:"page_error mono",children:Mt.error}):Mt?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"team_info_row",children:[Mt.state?e.jsx(In,{tone:Mt.state==="open"?"success":"warning",size:"sm",children:Mt.state}):null,(u=Mt.channel)!=null&&u.private?e.jsx(In,{tone:"muted",size:"sm",children:"private"}):e.jsx(In,{tone:"muted",size:"sm",children:"public"}),Mt.response_sla_minutes?e.jsxs(In,{tone:"muted",size:"sm",title:"Expected response SLA",children:["SLA ",Math.round(Number(Mt.response_sla_minutes)/60),"h"]}):null,e.jsxs("span",{className:"muted team_note",children:[(qn??Mt.members??[]).length," members"]})]}),(v=Mt.meta)!=null&&v.purpose?e.jsx("div",{className:"team_info_purpose",children:Mt.meta.purpose}):null,Mt.charter?e.jsxs("div",{className:"team_info_charter",children:[e.jsx("div",{className:"muted team_note",style:{marginBottom:4},children:"Charter"}),e.jsx(ds,{className:"md_doc",text:Tl(String(Mt.charter))})]}):e.jsx("div",{className:"muted team_note",children:"No charter set for this channel."}),e.jsxs("div",{className:"team_members",children:[e.jsxs("div",{className:"muted team_note",style:{marginBottom:4},children:["Members ",qn?`(${qn.length})`:""]}),!en&&qn!==null?e.jsxs("div",{className:"team_invite_row",children:[e.jsxs("select",{className:"team_compose_control team_invite_select",value:Dr,onChange:S=>Ci(S.target.value),disabled:!!Qa,title:"Agents on the hub not yet in this channel",children:[e.jsx("option",{value:"",children:"invite: agent…"}),qs.filter(S=>!(qn||[]).some(k=>String(k.agent_id||"")===S)).filter(S=>!(Pl[O]||new Set).has(S)).map(S=>e.jsx("option",{value:S,children:S},S))]}),e.jsx("button",{className:"btn",disabled:!Dr||!!Qa,title:"Mint a single-use invite token and DM it with the join pointer",onClick:()=>void ka(Dr),children:Qa?"Inviting…":"Invite"})]}):null,Ei?e.jsx("div",{className:"muted team_note",children:Ei}):null,(()=>{const S=[...Pl[O]||[]].filter(k=>!(qn||[]).some($=>String($.agent_id||"")===k));return!S.length||qn===null?null:S.map(k=>e.jsxs("div",{className:"team_member_row team_member_invited",children:[e.jsx("span",{className:"team_avatar",style:Da(k),"aria-hidden":"true",children:(k[0]||"?").toUpperCase()}),e.jsx("span",{className:"team_member_id",children:k}),e.jsx("span",{className:"chip mono warn",title:"The invite DM is in their inbox (status=open, owed) — agents join on their next wake; this row clears itself when they do.",children:"invited — awaiting join"})]},`inv:${k}`))})(),Il?e.jsxs("div",{className:"muted team_note",children:["Members list unavailable (",Il.slice(0,100),") — an empty list below means the FETCH failed, not an empty channel. Reopen the drawer to retry."]}):null,qn===null?e.jsx("span",{className:"muted team_note",children:"Loading members…"}):qn.map(S=>{const k=String(S.agent_id||"");return k?e.jsxs("div",{className:"team_member_row",children:[e.jsx("span",{className:"team_avatar",style:Da(k),"aria-hidden":"true",children:(k[0]||"?").toUpperCase()}),e.jsx("span",{className:"team_member_id",title:String(S.about||""),children:k}),k!==St&&!en?e.jsxs("span",{className:"team_member_actions",children:[e.jsx("button",{className:"team_row_expand",disabled:!!Ot,title:"Kick: 1-hour block from THIS channel (hub authorizes — owner/operator only)",onClick:()=>void Gr(k,"kick"),children:Ot===`channel:kick:${k}`?"kicking…":"kick"}),e.jsx("button",{className:`team_row_expand ${Ft===`channel:ban:${k}`?"team_danger":""}`,disabled:!!Ot,title:"Ban: INDEFINITE block from this channel (two clicks — the first arms, the second confirms)",onClick:()=>{Ft===`channel:ban:${k}`?(on(""),Gr(k,"ban")):on(`channel:ban:${k}`)},children:Ot===`channel:ban:${k}`?"banning…":Ft===`channel:ban:${k}`?"confirm ban":"ban"}),e.jsx("button",{className:`team_row_expand ${Ft===`hub:ban:${k}`?"team_danger":""}`,disabled:!!Ot,title:"Hub ban: INDEFINITE lockout from the ENTIRE hub — every channel, re-registration refused, live connection severed (operator-only). Two clicks to confirm.",onClick:()=>{Ft===`hub:ban:${k}`?(on(""),Gr(k,"ban","hub")):on(`hub:ban:${k}`)},children:Ot===`hub:ban:${k}`?"hub-banning…":Ft===`hub:ban:${k}`?"confirm hub ban":"hub ban"}),e.jsx("button",{className:`team_row_expand ${Ft===`retire:${k}`?"team_danger":""}`,disabled:!!Ot,title:"Retire: decommission this agent WITHOUT blame — removed from all channels/rosters, the id is reserved (never reused), never shown as blocked (operator-only). Two clicks to confirm.",onClick:()=>{Ft===`retire:${k}`?(on(""),Xl(k)):on(`retire:${k}`)},children:Ot===`retire:${k}`?"retiring…":Ft===`retire:${k}`?"confirm retire":"retire"})]}):k===St?e.jsx("span",{className:"chip mono ok",style:{marginLeft:"auto"},children:"you"}):null]},k):null})]}),!en&&Fs&&Fs.length?e.jsxs("div",{className:"team_members",children:[e.jsxs("div",{className:"muted team_note",style:{marginBottom:4},children:["Blocked (",Fs.length,")"]}),Fs.map(S=>{const k=String(S.agent_id||S.agent||"");if(!k)return null;const $=String(S.scope||""),ne=$==="hub",W=ne?"hub":"channel",xe=S.expires_at?` · until ${new Date(Number(S.expires_at)*1e3).toLocaleString()}`:" · indefinite",Pe=ne?"hub-wide":`#${$}`;return e.jsxs("div",{className:"team_member_row",children:[e.jsx("span",{className:"team_avatar",style:Da(k),"aria-hidden":"true",children:(k[0]||"?").toUpperCase()}),e.jsxs("span",{className:"team_member_id",title:String(S.reason||""),children:[k,e.jsxs("span",{className:"muted team_note",children:[Pe,xe]})]}),e.jsx("span",{className:"team_member_actions",children:e.jsx("button",{className:"team_row_expand",disabled:!!Ot,title:ne?"Lift this HUB-WIDE block (the agent can re-register and rejoin)":"Lift this channel block (the agent can rejoin/post again)",onClick:()=>void Gr(k,"unblock",W),children:Ot===`${W}:unblock:${k}`?"unblocking…":"unblock"})})]},`blocked:${$}:${k}`)})]}):null,!en&&Pr&&Pr.length?e.jsxs("div",{className:"team_members",children:[e.jsxs("div",{className:"muted team_note",style:{marginBottom:4},children:["Retired agents (",Pr.length,")"]}),Pr.map(S=>{const k=String(S.id||"");if(!k)return null;const $=S.retired_at?` · ${new Date(Number(S.retired_at)*1e3).toLocaleDateString()}`:"";return e.jsxs("div",{className:"team_member_row",children:[e.jsx("span",{className:"team_avatar",style:Da(k),"aria-hidden":"true",children:(k[0]||"?").toUpperCase()}),e.jsxs("span",{className:"team_member_id",title:String(S.reason||""),children:[k,e.jsxs("span",{className:"muted team_note",children:["decommissioned",$]})]}),e.jsxs("span",{className:"team_member_actions",children:[e.jsx("button",{className:`team_row_expand ${Ft===`unretire:${k}`?"team_danger":""}`,disabled:!!Ot,title:"Un-retire: restore this agent's access (it rejoins channels explicitly). Two clicks to confirm.",onClick:()=>{Ft===`unretire:${k}`?(on(""),qi(k)):on(`unretire:${k}`)},children:Ot===`unretire:${k}`?"un-retiring…":Ft===`unretire:${k}`?"confirm un-retire":"un-retire"}),e.jsx("button",{className:`team_row_expand ${Ft===`delete:${k}`?"team_danger":""}`,disabled:!!Ot,title:"Delete from the hub: irreversible cleanup — removes this agent from every roster and board (its votes/ratings purged), id stays reserved. History keeps its old messages. Two clicks to confirm.",onClick:()=>{Ft===`delete:${k}`?(on(""),Bi(k)):on(`delete:${k}`)},children:Ot===`delete:${k}`?"deleting…":Ft===`delete:${k}`?"confirm delete":"delete"})]})]},`retired:${k}`)})]}):null,e.jsxs("div",{className:"team_delegation",children:[e.jsxs("div",{className:"muted team_note team_delegation_head",children:["Hub delegation ",e.jsx("span",{title:"Hub-wide, not per-channel: a delegate holds named powers in the operator's name until the grant expires or is resigned. Every seat can verify who holds what (the list is public).",children:"ⓘ"})]}),zt===null?e.jsx("span",{className:"muted team_note",children:Ga||"Loading delegations…"}):e.jsxs(e.Fragment,{children:[zt.length===0?e.jsx("span",{className:"muted team_note",children:"No active delegate."}):null,zt.map(S=>{const k=String(S.agent_id||""),$=Array.isArray(S.powers)?S.powers.map(String):[],ne=Number(S.expires_at||S.expires||0);return e.jsxs("div",{className:"team_delegation_row",children:[e.jsx("span",{className:"team_avatar",style:Da(k),"aria-hidden":"true",children:(k[0]||"?").toUpperCase()}),e.jsx("span",{className:"team_member_id",children:k}),e.jsxs("span",{className:"team_delegation_powers mono",title:String(S.note||""),children:[$.join(" + ")||"(no powers?)",ne?` · until ${new Date(ne*1e3).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""]}),e.jsx("button",{className:`team_row_expand ${Ft===`resign:${k}`?"team_danger":""}`,disabled:ms,title:"Resign this delegate: the grant is revoked hub-wide, on the record (two clicks)",onClick:()=>{Ft===`resign:${k}`?(on(""),Zo(k)):on(`resign:${k}`)},children:ms?"resigning…":Ft===`resign:${k}`?"confirm resign":"resign"})]},k)}),e.jsxs("div",{className:"team_delegation_assign",children:[e.jsxs("select",{className:"team_compose_control team_invite_select",value:fa,onChange:S=>Ka(S.target.value),title:"Assign a delegate: any registered agent except operators and current delegates",children:[e.jsx("option",{value:"",children:"assign a delegate…"}),(qn??Mt.members??[]).map(S=>String(typeof S=="string"?S:(S==null?void 0:S.agent_id)||(S==null?void 0:S.id)||"")).filter(S=>S&&S!==St&&!zt.some(k=>String(k.agent_id)===S)).map(S=>e.jsx("option",{value:S,children:S},S))]}),fa?e.jsxs("div",{className:"team_delegation_powers_pick",children:[sx.map(S=>e.jsxs("label",{className:"team_delegation_power",title:S.help,children:[e.jsx("input",{type:"checkbox",checked:hn.includes(S.id),onChange:k=>Dl($=>k.target.checked?[...$,S.id]:$.filter(ne=>ne!==S.id))}),S.id]},S.id)),e.jsx("button",{className:"btn",disabled:ms||!hn.length,title:hn.length?`Grant ${fa} the powers: ${hn.join(", ")} (7-day TTL, renewable; on the record)`:"Pick at least one power",onClick:()=>void Xo(),children:ms?"Assigning…":"Assign"})]}):null]}),Ga?e.jsx("div",{className:"page_error mono",children:Ga}):null]})]}),en?null:e.jsx("div",{className:"team_chan_admin",children:ai?String(Mt.state||"open")==="open"?e.jsx("button",{className:"btn",disabled:Jt,title:"Close this channel — member posts refuse until reopened (owner-only; the hub authorizes)",onClick:()=>void Ui("closed"),children:Jt?"Closing…":"Close channel"}):e.jsx("button",{className:"btn",disabled:Jt,title:"Reopen this channel for member posts",onClick:()=>void Ui("open"),children:Jt?"Reopening…":"Reopen channel"}):e.jsxs("span",{className:"muted team_note",children:["Close/reopen is owner-only on the hub (this channel's owner: ",sa||"unknown",")."]})}),Or?e.jsx("div",{className:"page_error mono",children:Or}):null]}):e.jsx("span",{className:"muted team_note",children:"Open a channel to see its members."})}function as(u){var S;const v=((S=u.data)==null?void 0:S.attachments)||u.attachments||[];return v.length?e.jsx("div",{className:"team_attachments",children:v.map((k,$)=>{const ne=`${k.id}:${$}`,W=l.attachment_url(u.channel,k.id);return ex.has(String(k.content_type||"").toLowerCase())?e.jsxs("button",{className:"team_attach_img_link",title:`${k.filename} · ${On(k.size)} — click to preview`,onClick:()=>void ea(u.channel,k),children:[e.jsx("img",{className:"team_attach_img",src:W,alt:k.filename,loading:"lazy",onError:Pe=>{var Tt;const Ue=Pe.currentTarget;Ue.style.display="none";const Be=(Tt=Ue.parentElement)==null?void 0:Tt.querySelector(".team_attach_fallback");Be&&(Be.style.display="inline-flex")}}),e.jsxs("span",{className:"team_attach_chip team_attach_fallback",style:{display:"none"},children:[e.jsx(rt,{name:"paperclip",size:11}),e.jsx("span",{className:"team_attach_name",children:k.filename}),e.jsx("span",{className:"muted",children:On(k.size)})]})]},ne):e.jsxs("button",{className:"team_attach_chip team_attach_dl",title:`${k.content_type} · ${On(k.size)} — click to preview`,onClick:()=>void ea(u.channel,k),children:[e.jsx(rt,{name:"paperclip",size:11}),e.jsx("span",{className:"team_attach_name",children:k.filename}),e.jsx("span",{className:"muted",children:On(k.size)})]},ne)})}):null}function gr(u,v){var xe;const S=[],k=String(u.status||"").toLowerCase();(k==="open"||k==="blocked")&&(u.has_resolved_reply===!0||(u.id?no.has(u.id):!1))?S.push(e.jsx(In,{tone:"success",size:"sm",title:"This ask already has a reply from another seat.",children:"answered"},"st")):k==="open"||k==="blocked"?S.push(e.jsx(In,{tone:k==="blocked"?"error":"warning",size:"sm",children:k},"st")):k==="resolved"&&v&&S.push(e.jsx(In,{tone:"success",size:"sm",children:"resolved"},"st")),u.critical&&S.push(e.jsx(In,{tone:"error",size:"sm",title:"Critical: unpins only on explicit read — click the row to record the read",children:"critical"},"crit"));const ne=((xe=u.data)==null?void 0:xe.answers)||[];k==="reply"&&ne.length&&S.push(e.jsxs(In,{tone:"success",size:"sm",title:`This reply discharges ask(s) ${ne.join(", ")} of its parent.`,children:["✓ answers ",ne.join(",")]},"dis"));const W=u.to||[];for(const Pe of W.slice(0,2))S.push(e.jsxs(In,{tone:"muted",size:"sm",children:["@",Pe]},`to:${Pe}`));return W.length>2&&S.push(e.jsxs(In,{tone:"muted",size:"sm",title:W.map(Pe=>`@${Pe}`).join(" "),children:["+",W.length-2]},"to+")),S}function Hn(u,v){return e.jsx(Mh,{resetKey:`${u.retracted?1:0}:${(u.body||"").length}:${(u.title||"").length}`,fallback:e.jsx("div",{className:"team_row team_row_broken",id:`hubmsg-${u.id}`,children:e.jsxs("div",{className:"team_row_main",children:[e.jsxs("div",{className:"team_row_head",children:[e.jsx("span",{className:"team_row_sender",style:Qf(u.sender),children:u.sender}),e.jsxs("span",{className:"team_row_meta mono",children:["#",u.seq," · ",Cl(u.created_at)]}),e.jsx("span",{className:"chip mono warn",title:"This message failed to render; showing its raw text so nothing is hidden.",children:"render failed"})]}),e.jsx("pre",{className:"team_row_raw",children:(u.title?u.title+`
|
|
117
|
-
`:"")+String(u.body||"(no text)")})]})}),children:al(u,v)},u.id)}function al(u,v){var bt,et,Yt,wt;const S=!!ie[u.id],k=String(u.body||""),$=v.is_root?Uo:Hf,ne=k.length>$,W=ne&&!S,xe=((bt=u.data)==null?void 0:bt.asks)||[],Pe=!!((et=gn.unread_seqs)!=null&&et.has(u.seq)),Ue=Ae!=="all"&&xy(u,Ae,gn),Be=String(u.title||"").trim(),Tt=((Yt=k.trim().split(`
|
|
118
|
-
`)[0])==null?void 0:Yt.trim())||"",Vt=Be&&(Be===k.trim()||Be===Tt),rs=(Oe==null?void 0:Oe.id)===u.id;return e.jsxs("div",{className:`team_row ${u.sender===St?"own":""} ${Ue?"hit":""} ${rs?"replying":""} ${Pe?"unread":""} ${u.retracted?"retracted":""}`,id:`hubmsg-${u.id}`,onClick:()=>tc(u),title:ne?void 0:u.critical?"Click to record the read (critical unpins on it)":void 0,children:[e.jsx("span",{className:"team_avatar",style:Da(u.sender),"aria-hidden":"true",children:(u.sender[0]||"?").toUpperCase()}),e.jsxs("div",{className:"team_row_main",children:[e.jsxs("div",{className:"team_row_head",children:[(wt=ce[u.channel])!=null&&wt.has(u.seq)?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_chip_debt",title:"Pinned by the hub until answered: this is an open ask or a directive addressed to you — reading is not answering; reply, Decline, or Resolve the thread to clear it",children:"needs reply"}),e.jsx("button",{className:`team_chip_decline ${xa===u.id?"armed":""}`,title:xa===u.id?"Click again to decline on the record (posts a closing reply)":"Decline: close this ask without answering — posts an on-the-record reply so it stops showing everywhere",onClick:He=>{He.stopPropagation(),Ql(u)},children:xa===u.id?"sure? declines on the record":"decline"})]}):Pe?e.jsx("span",{className:"team_chip_new",title:"Unread — your seat has not read past this message yet; clicking the row records the read",children:"new"}):u.read===!1&&v.is_root?e.jsx("span",{className:"team_chip_seen",title:"Swept read by the cursor but never opened — you caught the tail of a burst and this one was marked read without being seen. Click to actually read it.",children:"missed?"}):null,e.jsx("span",{className:"team_row_sender",style:Qf(u.sender),children:u.sender}),gr(u,v.is_root),(()=>{const He=Vr(u);return!He||!He.up&&!He.down?null:e.jsxs("span",{className:`team_reaction_tally mono ${He.mine>0?"pos":He.mine<0?"neg":""}`,title:"±1 ratings feed the sender's reputation (one system). Green/red tint = YOUR standing vote on this message; counts refresh with the poll.",children:[He.up?`▲${He.up}`:"",He.up&&He.down?" ":"",He.down?`▼${He.down}`:""]})})(),e.jsxs("span",{className:"team_row_meta mono",title:$l(u.created_at),children:["#",u.seq," · ",Cl(u.created_at)]})]}),Be&&!Vt?e.jsx("div",{className:"team_row_title",children:Be}):null,e.jsx("div",{className:`team_row_body ${W?v.is_root?"clamp_root":"clamp_reply":""}`,children:e.jsx(Hy,{className:"md_doc",text:Tl(Py(Ry(k),{hub_base:q}))})}),as(u),(()=>{var It;const He=Ty(`${String(u.title||"")}
|
|
119
|
-
${k}`),At=((It=u.data)==null?void 0:It.attachments)||u.attachments||[],Pt=He.map(gt=>({mention:gt,res:Ay(gt,Yl,At)})).filter(gt=>gt.res!==null).filter(gt=>{var Lt;return!(gt.res.kind==="attachment"&&String(((Lt=At[gt.res.attachment_index])==null?void 0:Lt.filename)||"")===gt.mention)}),Rt=a.on_open_board?Kg(`${String(u.title||"")}
|
|
120
|
-
${k}`):[];return!Pt.length&&!Rt.length?null:e.jsxs("div",{className:"team_fs_chips",children:[Pt.map(({mention:gt,res:Lt})=>e.jsxs("button",{className:"team_attach_chip team_fs_chip",title:Lt.kind==="fs"?Lt.rewritten?`Opens ${Lt.path} (the mention's path moved — matched by name in #${O}'s files)`:`Open ${Lt.path} from #${O}'s virtual filesystem`:"Opens the file attached to this message (the path in the text belongs to the sender's workspace)",onClick:is=>{is.stopPropagation(),Lt.kind==="fs"?ac(Lt.path):ea(u.channel,At[Lt.attachment_index])},children:[e.jsx(Kf,{}),e.jsx("span",{className:"team_attach_name",children:gt}),Lt.kind==="attachment"?e.jsx("span",{className:"team_fs_chip_note",children:"attached"}):Lt.rewritten?e.jsx("span",{className:"team_fs_chip_note",children:"moved"}):null]},gt)),Rt.map(gt=>e.jsxs("button",{className:"team_attach_chip team_fs_chip team_work_chip",title:`Work item ${gt} — open the Board filtered to it`,onClick:Lt=>{var is;Lt.stopPropagation(),(is=a.on_open_board)==null||is.call(a,gt)},children:[e.jsx("span",{className:"team_work_glyph","aria-hidden":!0,children:"⛭"}),e.jsx("span",{className:"team_attach_name mono",children:gt})]},`w:${gt}`))]})})(),xe.length?e.jsx("div",{className:"team_row_asks",children:xe.map(He=>e.jsxs("span",{className:"team_ask",title:He.text,children:["ask ",He.id,": ",He.text.length>90?He.text.slice(0,90)+"…":He.text]},He.id))}):null,ne?e.jsx("button",{className:"team_row_expand",onClick:He=>{He.stopPropagation(),Gl(u)},children:S?"collapse":"show more"}):null]}),Sn?e.jsxs("div",{className:"team_row_rail",children:[u.id&&u.sender!==St&&u.sender!=="hub"&&!u.retracted?(()=>{const He=Vr(u);return He?e.jsxs("span",{className:"team_vote_thumbs",children:[e.jsxs("button",{className:`btn btn_icon team_thumb ${He.mine>0?"up_on":""}`,title:He.mine>0?"Withdraw your +1 on this message":"+1 this message",disabled:!!ir,onClick:At=>{At.stopPropagation(),Fi(u.id,1)},children:[e.jsx(rt,{name:He.mine>0?"thumbsUpFilled":"thumbsUp",size:13}),He.up?e.jsx("span",{className:"team_thumb_count",children:He.up}):null]}),e.jsxs("button",{className:`btn btn_icon team_thumb ${He.mine<0?"down_on":""}`,title:He.mine<0?"Withdraw your −1 on this message":"−1 this message",disabled:!!ir,onClick:At=>{At.stopPropagation(),Fi(u.id,-1)},children:[e.jsx(rt,{name:He.mine<0?"thumbsDownFilled":"thumbsDown",size:13}),He.down?e.jsx("span",{className:"team_thumb_count",children:He.down}):null]})]}):null})():null,C.tts_supported&&u.id?(()=>{const He=C.tts_playback.key===u.id&&C.tts_playback.status==="playing",At=C.tts_playback.key===u.id&&C.tts_playback.status==="loading";return e.jsx("button",{className:`btn btn_icon ${He||At?"team_speak_on":""}`,title:He?"Pause":At?"Synthesizing…":_.enabled?"Read aloud (your voice override)":"Read aloud (gateway voice)","aria-label":He?"Pause reading":"Read this message aloud",onClick:Pt=>{Pt.stopPropagation();const Rt=Xv(u.body||u.title||"");Rt?C.toggle_tts(u.id,Rt):_e("Nothing readable to speak in this message (code/markup only).")},children:e.jsx(rt,{name:He?"pause":At?"refresh":"speaker",size:13})})})():null,e.jsx("button",{className:"btn btn_icon",title:xe.length?"Reply and discharge this message's asks":"Reply in this trail (status=reply, linked to this message)",onClick:He=>{He.stopPropagation(),Ki(u)},children:"↩ Reply"}),u.sender===St&&!u.retracted?e.jsx("button",{className:`btn btn_icon ${cr===u.id?"team_danger":""}`,title:cr===u.id?"Click again to retract: the words are redacted for every reader and the message stops demanding anything":"Retract this message (agents and entities will never read the words; two clicks)",onClick:He=>{He.stopPropagation(),cr===u.id?oc(u):Kr(u.id)},children:cr===u.id?"⌫ confirm retract":"⌫ Retract"}):null,v.is_root&&(String(u.status||"").toLowerCase()==="open"||String(u.status||"").toLowerCase()==="blocked")?e.jsx("button",{className:`btn btn_icon ${or===u.id?"team_danger":""}`,title:or===u.id?"Click again to close this topic (posts a resolved reply)":"Mark this topic resolved — closes the thread on the hub (two clicks)",onClick:He=>{He.stopPropagation(),or===u.id?cc(u):Gi(u.id)},children:or===u.id?"✓ confirm resolve":"✓ Resolve"}):null]}):null]},u.id)}function fc(u){const v=u.replies.length,S=!!ke[u.root.id],k=!!be[u.root.id],$=S?[]:k||Ae!=="all"||v<=Vf+1?u.replies:u.replies.slice(v-Vf),ne=S?v:v-$.length,W=$s[u.root.id];return e.jsxs("div",{className:`team_thread_group ${v?"has_replies":""}`,children:[u.orphan?e.jsx("div",{className:"team_orphan mono",title:"The parent message is older than the fetched window — the trail starts mid-flight.",children:"↩ reply to an earlier message (outside the window)"}):null,Hn(u.root,{is_root:!0}),ne>0||v>0||String(u.root.body||"").length>Uo?e.jsxs("div",{className:"team_trail_bar",children:[v>0?e.jsx("button",{className:"team_replies_more",onClick:()=>Xe(xe=>({...xe,[u.root.id]:!xe[u.root.id]})),children:S?`show ${v} repl${v===1?"y":"ies"}`:"fold thread"}):null,!S&&ne>0?e.jsxs("button",{className:"team_replies_more",onClick:()=>G(xe=>({...xe,[u.root.id]:!0})),children:["↓ ",ne," earlier repl",ne===1?"y":"ies"]}):null,!S&&d&&(v>0||String(u.root.body||"").length>Uo)?e.jsx("button",{className:"team_replies_more team_summarize",disabled:!!(W!=null&&W.busy),title:"LLM summary of this trail (root + replies) — read-only, never posts",onClick:()=>void lr(u),children:W!=null&&W.busy?"✦ summarizing…":`✦ Summarize (${v+1})`}):null]}):null,!S&&v>0?e.jsx("div",{className:"team_replies",children:$.map(xe=>Hn(xe,{is_root:!1}))}):null,!S&&(W!=null&&W.text)?e.jsxs("div",{className:"team_summary",children:[e.jsxs("div",{className:"team_summary_head",children:[e.jsxs("span",{children:["AI summary — ",W.window||`${W.count} message${W.count===1?"":"s"}`]}),e.jsx("button",{className:"team_row_expand",onClick:()=>fs(xe=>({...xe,[u.root.id]:{busy:!1,text:"",error:"",count:0}})),children:"dismiss"})]}),e.jsx(ds,{className:"md_doc",text:Tl(W.text)})]}):null,W!=null&&W.error?e.jsx("div",{className:"page_error mono",children:W.error}):null]},u.root.id)}const hc=te.length?te[te.length-1].seq:0,na=Math.max(hc,((ri=oe.find(u=>u.name===O))==null?void 0:ri.last_seq)||0),$a=((aa=oe.find(u=>u.name===O))==null?void 0:aa.member_count)||0,sa=((vs=(qn||[]).find(u=>String(u.role||"")==="owner"))==null?void 0:vs.agent_id)||"",ai=!!St&&sa===St;return e.jsxs("div",{className:"page page_pad team_page",onDragOver:u=>{var v;Array.from(((v=u.dataTransfer)==null?void 0:v.types)||[]).includes("Files")&&(u.preventDefault(),Sn&&!yt&&De(!0))},onDragLeave:u=>{u.currentTarget.contains(u.relatedTarget)||De(!1)},onDrop:u=>{var v,S;(S=(v=u.dataTransfer)==null?void 0:v.files)!=null&&S.length&&(u.preventDefault(),De(!1),!(!Sn||yt)&&ta(u.dataTransfer.files))},children:[Ut?e.jsx("div",{className:"team_drop_overlay",children:e.jsxs("div",{className:"team_drop_overlay_card",children:["Drop to attach to ",en?Qr:`#${O}`]})}):null,E!=null&&E.protocol&&E.protocol!==Ho||E!=null&&E.paused||ye||Vs||ki||z&&!z.seat_key_present?e.jsxs("div",{className:"team_statusstrip",children:[z&&!z.seat_key_present?e.jsx("span",{className:"chip mono warn",title:"No hub key for this seat — read-only until Continuum can read one (the seat's entry in ~/.agora/keys.json, or --hub-token-file at launch). The seat itself is set in Settings.",children:"read-only (no seat key)"}):null,E!=null&&E.protocol&&E.protocol!==Ho?e.jsxs("span",{className:"chip mono warn",title:`The hub advertises ${E.protocol}; this page was written against ${Ho}. Meaning may have shifted — rendering continues (protocol.md: warn, never refuse).`,children:["protocol ",E.protocol," ≠ ",Ho]}):null,E!=null&&E.paused?e.jsx("span",{className:"chip mono warn",title:"The operator paused the hub — posting resumes when it does.",children:"hub paused"}):null,ye?e.jsx("span",{className:"page_error mono",children:ye}):null,Vs?e.jsxs("span",{className:"page_error mono",children:["±1 failed: ",Vs]}):null,ki?e.jsx("span",{className:"chip mono ok",children:ki}):null]}):null,e.jsxs("div",{className:`team_layout ${kt?"with_drawer":""} ${kt==="leaderboard"?"drawer_wide":""}`,children:[e.jsxs("div",{className:"pane team_channels_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Channels"}),e.jsx("span",{className:"pane_count",children:oe.filter(u=>!u.name.startsWith("dm:")).length}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",title:"Create a channel (you become its owner)","aria-label":"New channel",onClick:()=>Bs(u=>({...u,open:!u.open})),children:e.jsx(rt,{name:"plus",size:14})})})]}),Cs.open?e.jsxs("div",{className:"team_new_channel",children:[e.jsx("input",{value:Cs.name,onChange:u=>Bs(v=>({...v,name:u.target.value})),placeholder:"channel-name (simple slug)",onKeyDown:u=>{u.key==="Enter"&&eo()}}),e.jsxs("label",{title:"Private channels need invites; public ones are joinable by any registered agent.",children:[e.jsx("input",{type:"checkbox",checked:Cs.is_private,onChange:u=>Bs(v=>({...v,is_private:u.target.checked}))}),"private"]}),e.jsx("button",{className:"btn primary",disabled:!Cs.name.trim()||Jt,onClick:()=>void eo(),children:Jt?"Creating…":"Create"})]}):null,e.jsxs("div",{className:"pane_body pane_body_list",children:[oe.length?null:e.jsx("div",{className:"muted team_note team_rail_degraded",children:ye?"Channels unavailable — the hub is unreachable. Retrying automatically; check that the hub is running if this persists.":"Loading channels…"}),oe.filter(u=>!u.name.startsWith("dm:")).map(u=>{const v=pe[u.name],S=ic===u.name;return e.jsxs("div",{className:`team_channel team_dm_row ${O===u.name?"selected":""}`,role:"button",tabIndex:0,onClick:()=>je(u.name),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&je(u.name)},children:[e.jsxs("span",{className:"team_channel_line",children:[e.jsxs("span",{className:`team_channel_name ${v!=null&&v.unread?"has_unread":""}`,children:["#",u.name]}),e.jsxs("span",{className:"team_channel_badges",children:[v!=null&&v.unread?e.jsx("span",{className:"team_badge unread",role:"button",tabIndex:0,title:`${v.unread>=100?"100 or more":v.unread} unread message(s) for your seat — the Unread tab shows the same number. Click to open with the Unread filter.`,onClick:k=>{k.stopPropagation(),u.name!==O&&(fe.current="unread"),je(u.name),Ge("unread")},onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.stopPropagation(),u.name!==O&&(fe.current="unread"),je(u.name),Ge("unread"))},children:v.unread>=100?"99+":v.unread}):null,v!=null&&v.open_questions?e.jsx("span",{className:"team_badge asks",role:"button",tabIndex:0,title:`${v.open_questions} open question(s) in this room still awaiting answers (channel digest) — click to open with the Asks filter`,onClick:k=>{k.stopPropagation(),u.name!==O&&(fe.current="asks"),je(u.name),Ge("asks")},onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.stopPropagation(),u.name!==O&&(fe.current="asks"),je(u.name),Ge("asks"))},children:v.open_questions}):null,e.jsx("button",{className:`team_dm_trash ${S?"arming":""}`,title:S?"Click again to archive this channel (evicts members; history preserved)":"Archive this channel — evicts everyone and drops it off rails; messages are preserved (owner/operator)","aria-label":S?"Confirm archive channel":"Archive channel",disabled:Jt,onClick:k=>{k.stopPropagation(),S?lc(u.name):Hi(u.name)},children:e.jsx(rt,{name:S?"x":"trash",size:12})})]})]}),e.jsx("span",{className:"team_channel_meta mono",children:S?"archive? click ✕":`${u.member_count} seats · ${Cl(u.last_at)}`})]},u.name)}),(()=>{const u=oe.filter(v=>v.name.startsWith("dm:"));return u.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"team_rail_section",children:"Direct messages"}),u.map(v=>{const S=pe[v.name],k=v.name.replace(/^dm:/,"").split("--").filter(ne=>ne!==St).join("")||v.name,$=Zl===v.name;return e.jsxs("div",{className:`team_channel team_dm_row ${O===v.name?"selected":""}`,role:"button",tabIndex:0,onClick:()=>je(v.name),onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&je(v.name)},children:[e.jsxs("span",{className:"team_channel_line",children:[e.jsxs("span",{className:`team_channel_name ${S!=null&&S.unread?"has_unread":""}`,children:["@",k]}),e.jsxs("span",{className:"team_channel_badges",children:[S!=null&&S.unread?e.jsx("span",{className:"team_badge unread",title:`${S.unread>=100?"100 or more":S.unread} unread message(s)`,children:S.unread>=100?"99+":S.unread}):null,e.jsx("button",{className:`team_dm_trash ${$?"arming":""}`,title:$?"Click again to remove this DM from your list":"Remove this DM from your list (history is kept; it reopens if they message you)","aria-label":$?"Confirm remove direct message":"Remove direct message",disabled:Jt,onClick:ne=>{ne.stopPropagation(),$?rc(v.name):Wi(v.name)},children:e.jsx(rt,{name:$?"x":"trash",size:12})})]})]}),e.jsx("span",{className:"team_channel_meta mono",children:$?"remove? click ✕":Cl(v.last_at)})]},v.name)})]}):null})()]})]}),e.jsxs("div",{className:"pane team_thread_pane",children:[e.jsxs("div",{className:"pane_header team_thread_header",children:[e.jsx("span",{className:"pane_title team_pane_title",children:O?en?`@${Qr} — direct`:`#${O}`:"Select a channel"}),O&&$a?e.jsxs("button",{className:"chip team_members_chip",onClick:()=>{kt!=="members"&&va("members")},title:"View the channel members (opens the Members drawer, roster + moderation)",children:[$a," members"]}):null,qe?e.jsx("span",{className:"muted team_note",children:"loading…"}):null,e.jsxs("span",{className:"pane_header_actions",children:[C.tts_playback.status!=="idle"?e.jsx("button",{className:"btn team_speak_stop",title:"Stop reading aloud",onClick:()=>C.stop_tts(),children:"◼ Stop reading"}):null,(()=>{const u=Ae==="all"?na:Rs;return e.jsx("button",{className:"btn",onClick:()=>void to(u),disabled:!O||!te.length||!u||ma||qe,title:Ae==="all"?"Moves your inbox cursor for this channel to the latest message in the window. The ONE explicit 'I have seen this' act (nothing acks on render).":"Moves your inbox cursor to the last message VISIBLE under this filter — messages newer than it stay unread. (The cursor is a single high-water mark: hidden rows BELOW it are cleared too.)",children:ma?"Marking…":`Mark read → #${u||"…"}`})})(),e.jsx("button",{className:"btn btn_icon",onClick:()=>{_s(),Js(O)},title:"Refresh channels, badges, and the thread window (the page also polls every 5s)","aria-label":"Refresh",children:e.jsx(rt,{name:"refresh",size:14})}),Qt&&Qt!=="running"&&typeof Qt=="object"&&"ok"in Qt?Qt.ok?e.jsxs(In,{tone:"success",size:"sm",title:`Hash chain recomputed client-side over ${Qt.hashed} hashed turns (${Qt.legacy} pre-ledger); served head matches.`,children:["transcript intact (",Qt.hashed,")"]}):e.jsxs(In,{tone:"error",size:"sm",title:Qt.broken_at!==null?`Recomputed chain diverges at seq ${Qt.broken_at} — a hashed turn was edited, inserted, or reordered.`:"Chain internally consistent but the served head does not match the last turn — the hub is presenting a different commitment.",children:["TAMPERED",Qt.broken_at!==null?` at #${Qt.broken_at}`:" (head mismatch)"]}):null,Qt&&typeof Qt=="object"&&"error"in Qt?e.jsx(In,{tone:"warning",size:"sm",title:Qt.error,children:"verify failed"}):null,e.jsx("button",{className:"btn btn_icon",onClick:()=>void nc(),disabled:!O||Qt==="running",title:"Fetch the channel's verbatim ledger and recompute the sha256 hash chain in this browser — independent of the hub's own verified flag.",children:Qt==="running"?"Verifying…":"Verify transcript"})]})]}),e.jsxs("div",{className:"team_filterbar",children:[e.jsx("div",{className:"seg seg_scroll",role:"group","aria-label":"Message filters",children:Mf.map(u=>{const v=Ae===u.id,S=so[u.id];return e.jsxs("button",{className:`seg_btn ${v?"active":""}`,"aria-pressed":v,title:u.title,onClick:()=>Ge(u.id),children:[u.label,typeof S=="number"&&S>0?e.jsx("span",{className:"team_filter_count",children:S}):null]},u.id)})}),e.jsxs("form",{className:"team_search_bar",onSubmit:u=>{u.preventDefault();const v=el.trim();if(!v&&!an){ei("down"),Na("",ns,"down");return}tl(v)},children:[e.jsx("input",{className:"team_search_input",type:"search",placeholder:"Search the hub…",value:el,onChange:u=>Xr(u.target.value),onKeyDown:u=>{u.key==="Escape"&&(ss&&_r(),Xr(""))},title:"Search everything your seat can read (Enter). Served as a grouped report: decisions, open threads, work, people, files, messages. Enter on an empty box browses rated messages (most-downvoted first).","aria-label":"Search the hub"}),ss?e.jsx("button",{type:"button",className:"btn btn_icon team_search_close",onClick:_r,title:"Close search results (Esc)","aria-label":"Close search results",children:"✕"}):null]}),e.jsxs("div",{className:"seg",role:"group","aria-label":"Sort order",children:[e.jsx("button",{className:`seg_btn ${mr==="recency"?"active":""}`,"aria-pressed":mr==="recency",title:"Threads by last activity (default)",onClick:()=>gs("recency"),children:"Recency"}),e.jsx("button",{className:`seg_btn ${mr==="votes"?"active":""}`,"aria-pressed":mr==="votes",title:"The channel's most-voted messages — whole channel, ranked by net standing ±1 (hub-served order)",onClick:()=>{gs("votes"),Yr()},children:"Top voted"})]}),e.jsxs("span",{className:"team_filterbar_meta",children:[e.jsx("span",{className:`team_live_dot ${rr?"on":""}`,title:rr?"Live: agents' posts push instantly over a websocket. Your own posts from OTHER windows arrive with the 5s poll (the hub skips echoing your seat's frames back).":"Polling every 5s — the live socket is down (it reconnects automatically).",children:rr?"● live":"◌ polling"})," · ",Sa.length!==Wn.length?`${Sa.length} of ${Wn.length} threads`:Wn.length?`${Wn.length} threads`:"",z!=null&&z.seat_key_present?e.jsxs("span",{title:"Posts are authored under this hub seat — your own identity, key held server-side.",children:[" · as ",z.seat]}):null]})]}),e.jsx("div",{className:"pane_body team_thread",ref:Ri,children:ss?(()=>{const u=ss;if(u.error)return e.jsx("div",{className:"muted team_note",children:u.error});if(u.busy||!u.report)return e.jsx("div",{className:"muted team_note",children:u.q?`Searching “${u.q}”…`:"Browsing rated messages…"});const v=u.report;if(ni){const $=ni;return e.jsxs("div",{className:"team_search_results",children:[e.jsxs("div",{className:"team_search_meta",children:[e.jsx("button",{className:"team_replies_more",onClick:()=>Rn(null),children:"← All results"}),e.jsxs("span",{className:"muted",children:[$.label," matching “",u.q,"” — newest first",$.total?` · ${$.hits.length} of ${$.total}`:""]})]}),$.error?e.jsx("div",{className:"muted team_note",children:$.error}):null,$.hits.map(ne=>si(ne)),$.busy?e.jsx("div",{className:"muted team_note",children:"Loading…"}):null,!$.busy&&$.cursor?e.jsx("button",{className:"team_replies_more team_search_more",onClick:uc,children:"Load more"}):null,!$.busy&&!$.hits.length&&!$.error?e.jsxs("div",{className:"muted team_note",children:["Nothing in ",$.label.toLowerCase()," matches “",u.q,"”."]}):null]})}const S=Bo.filter($=>{var ne;return!((((ne=v[$.id])==null?void 0:ne.total)??0)>0)}),k=S.length<Bo.length;return e.jsxs("div",{className:"team_search_results",children:[v.relaxed&&(!v.mode_used||v.mode_used==="lexical")?e.jsx("div",{className:"team_search_relaxed",title:"The strict query (all terms) found nothing, so the hub re-ran it as ANY-term (OR). Matches below are looser than what you typed.",children:"No exact matches — showing loosened (any-term) matches instead."}):null,v.notice?e.jsx("div",{className:"team_search_notice",title:"Served by the hub while search is degraded — quote this text in anything you conclude from these results.",children:v.notice}):null,e.jsxs("div",{className:"team_search_meta",children:[e.jsxs("span",{className:"muted",children:[u.q?`“${u.q}”`:`rated messages${an?` (${an==="down"?"↓ downvoted":"↑ upvoted"}, net-vote order)`:""}`," · ",v.channels_searched??0," channel",(v.channels_searched??0)===1?"":"s"," searched",v.mode_used?e.jsxs("span",{className:"team_search_mode mono",title:"Which search engine answered: fused = word + meaning matches blended; lexical = words only; semantic = meaning only. Served verbatim by the hub.",children:[" ","· ",v.mode_used,typeof v.semantic_coverage=="number"?` (${Math.round(v.semantic_coverage*100)}% embedded)`:""]}):null]}),e.jsx("span",{className:"seg team_search_rated",role:"group","aria-label":"Rated filter",children:["up","down"].map($=>e.jsx("button",{className:`seg_btn ${an===$?"active":""}`,"aria-pressed":an===$,title:$==="up"?"Only messages with net-positive standing ratings (toggle re-runs)":"Only messages with net-negative standing ratings — where displeasure lives (toggle re-runs)",onClick:()=>{const ne=an===$?"":$;ei(ne),Na(u.q,ns,ne)},children:$==="up"?"▲ rated":"▼ rated"},$))}),e.jsxs("label",{className:"team_search_scope",title:"Limit the search to the channel currently open in the rail (re-runs the query)",children:[e.jsx("input",{type:"checkbox",checked:ns==="channel",onChange:$=>{const ne=$.target.checked?"channel":"all";Zr(ne),Na(u.q,ne,an)}}),"this channel only"]})]}),Bo.map($=>{const ne=v[$.id],W=(ne==null?void 0:ne.shown)??0,xe=(ne==null?void 0:ne.total)??0,Pe=(ne==null?void 0:ne.hits)??[];return!ne||!xe&&!Pe.length?null:e.jsxs("div",{className:"team_search_section",children:[e.jsxs("div",{className:"team_search_section_head",children:[e.jsx("span",{className:"team_search_section_label",children:$.label}),e.jsx("span",{className:"muted mono",children:W<xe?`showing ${W} of ${xe}`:`${xe}`}),W<xe&&$.kind?e.jsx("button",{className:"team_replies_more",onClick:()=>nl($.label,$.kind),title:`All ${xe} ${$.label.toLowerCase()} matches, newest first (paged)`,children:"view all →"}):null]}),Pe.map(Ue=>si(Ue))]},$.id)}),k?S.length?e.jsxs("div",{className:"muted team_search_empties",children:["nothing in ",S.map($=>$.label.toLowerCase()).join(", ")]}):null:e.jsx("div",{className:"muted team_note",children:u.q?`Nothing matches “${u.q}” in the channels this seat can read.`:"No rated messages match this lens."})]})})():mr==="votes"?Ct?e.jsx("div",{className:"muted team_note",children:Ct}):fr===null?e.jsx("div",{className:"muted team_note",children:"Loading the channel's top-voted messages…"}):fr.length?fr.map((u,v)=>e.jsxs("div",{className:"team_top_row",children:[e.jsxs("div",{className:"team_top_rank_line",children:[e.jsxs("span",{className:"team_top_rank mono",title:"Rank by net standing rating (hub-served order)",children:["#",v+1]}),e.jsx("button",{className:"team_replies_more",onClick:()=>pr(u),title:"Switch back to recency and scroll to this message in its thread",children:"view in thread"})]}),Hn(u,{is_root:!0})]},u.id)):e.jsx("div",{className:"muted team_note",children:"No rated messages in this channel yet — cast the first ±1 from any message's thumbs."}):e.jsxs(e.Fragment,{children:[(()=>{const u=[];let v="";for(const S of Sa){const k=S.replies.length?S.replies[S.replies.length-1]:S.root,$=ax(k.created_at);$&&$!==v&&(v=$,u.push(e.jsx("div",{className:"team_day_divider",children:e.jsx("span",{children:$})},`day:${$}:${S.root.id}`))),u.push(fc(S))}return u})(),!Sa.length&&O&&!qe?e.jsx("div",{className:"muted team_note",children:Wn.length?e.jsxs(e.Fragment,{children:["Nothing matches the ",e.jsx("strong",{children:(($t=Mf.find(u=>u.id===Ae))==null?void 0:$t.label)||Ae})," filter in this channel — the messages exist under All."," ",e.jsx("button",{className:"team_replies_more",onClick:()=>Ge("all"),children:"Show all"})]}):"No messages in the window."}):null]})}),e.jsxs("div",{className:"team_composer",onKeyDown:u=>{u.key==="Escape"&&Oe&&ja()},children:[Oe?e.jsxs("div",{className:"team_reply_banner",children:[e.jsxs("button",{className:"team_reply_target",title:"Jump to the message you are replying to",onClick:()=>{var u;(u=document.getElementById(`hubmsg-${Oe.id}`))==null||u.scrollIntoView({block:"center"})},children:["↩ #",Oe.seq," (",Oe.sender,") —"," ",(String(Oe.title||"").trim()||String(Oe.body||"").trim()).slice(0,80)||"(no text)"]}),(((Nt=Oe.data)==null?void 0:Nt.asks)||[]).length?e.jsx("span",{className:"team_reply_asks",children:(((ys=Oe.data)==null?void 0:ys.asks)||[]).map(u=>e.jsxs("label",{title:u.text,children:[e.jsx("input",{type:"checkbox",checked:!!pt[u.id],onChange:v=>_t(S=>({...S,[u.id]:v.target.checked}))}),e.jsxs("span",{className:"team_reply_ask_text",children:["ask ",u.id,": ",u.text.length>70?u.text.slice(0,70)+"…":u.text]})]},u.id))}):null,e.jsx("button",{className:"team_row_expand",onClick:ja,children:"cancel (Esc)"})]}):null,nn==="void_reply"?e.jsxs("div",{className:"team_nudge",children:["This reply discharges NO asks — the parent stays formally open on the hub. Check an ask above, or press ",Oe?"Reply":"Post"," again to send as-is."]}):null,nn==="untitled_open"?e.jsxs("div",{className:"team_nudge",children:["An ",e.jsx("code",{children:"open"})," post without a title — receivers triage by headline (hub etiquette). Add one, or press Ask again to send untitled."]}):null,ts?e.jsx("div",{className:"team_group_preview",title:"Creates a private room, DMs invites to the mentioned seats, posts the topic as the opening open message, and switches you in",children:ts.members.length?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_group_label",children:"group room"}),e.jsxs("span",{className:"mono team_group_name",children:["#",ts.name]}),e.jsxs("span",{className:"team_group_invites",children:["invites: ",ts.members.map(u=>`@${u}`).join(" ")]})]}):e.jsx("span",{className:"muted",children:ts.source==="kind"?"Add members below — write their names like @entity @assistant":"/group needs @mentions — e.g. /group fix the voice outage @gateway @core"})}):null,!Oe&&!en&&(tt==="ask"||tt==="group")?e.jsx("input",{className:"team_ask_title",value:ze,onChange:u=>Ke(u.target.value),placeholder:tt==="group"?"Group topic — names the room (e.g. fix the voice outage)":"Title — receivers triage asks by headline",disabled:!Sn}):null,!Oe&&!en&&tt==="group"?e.jsx("input",{className:"team_ask_title team_group_members",value:we,onChange:u=>$e(u.target.value),placeholder:"Members — write their names: @entity @assistant @gateway",disabled:!Sn,list:"team_roster_options"}):null,!Oe&&!en&&tt==="group"&&qs.length?e.jsx("datalist",{id:"team_roster_options",children:qs.map(u=>e.jsx("option",{value:`@${u}`},u))}):null,nt.length?e.jsx("div",{className:"team_attach_pending",children:nt.map(u=>e.jsxs("span",{className:"team_attach_chip",title:`${u.content_type} · ${On(u.size)} — click to preview`,children:[e.jsxs("button",{className:"team_attach_open",onClick:()=>void ea(O,u),"aria-label":`Preview ${u.filename}`,children:[e.jsx(rt,{name:"paperclip",size:11}),e.jsx("span",{className:"team_attach_name",children:u.filename}),e.jsx("span",{className:"muted",children:On(u.size)})]}),e.jsx("button",{className:"team_attach_x","aria-label":`Remove ${u.filename}`,title:"Remove this attachment",onClick:()=>dt(v=>v.filter(S=>S.id!==u.id)),children:e.jsx(rt,{name:"x",size:10})})]},u.id))}):null,e.jsxs("div",{className:"team_compose_row",children:[!Oe&&!en?e.jsxs("select",{className:"team_compose_control team_kind_select",value:tt,onChange:u=>{const v=u.target.value,S=v==="ask"?"ask":v==="dm"?"dm":v==="group"?"group":"fyi";jt(S),S!=="ask"&&S!=="group"&&Ke(""),S!=="group"&&$e("")},disabled:!Sn,title:"fyi = informational · ask = expects replies (posts as status=open) · dm = private direct message · group = focused private room with invited members",children:[e.jsx("option",{value:"fyi",children:"fyi"}),e.jsx("option",{value:"ask",children:"ask"}),e.jsx("option",{value:"dm",children:"dm"}),e.jsx("option",{value:"group",children:"group"})]}):null,!Oe&&!en&&tt==="dm"?qs.length?e.jsxs("select",{className:"team_compose_control team_dm_peer",value:ft,onChange:u=>Zt(u.target.value),disabled:!Sn,title:"Recipient — every agent on the hub you share a channel with, connected or not",children:[e.jsx("option",{value:"",children:"to: member…"}),qs.map(u=>e.jsx("option",{value:u,children:u},u))]}):e.jsx("input",{className:"team_compose_control team_dm_peer",value:ft,onChange:u=>Zt(u.target.value),placeholder:"to: agent id",disabled:!Sn,title:"Recipient agent id (roster unavailable — type it; #FALLBACK)"}):null,e.jsx("textarea",{ref:it,className:"team_compose_text",rows:2,value:Y,onChange:u=>Se(u.target.value),placeholder:Sn?Oe?`Reply to #${Oe.seq} in #${O}…`:en?`Message ${Qr}…`:tt==="dm"?`Direct message${ft.trim()?` to ${ft.trim()}`:""}…`:d?`Message #${O||"…"} as ${(z==null?void 0:z.seat)||"operator"} — or /assistant <question>`:`Message #${O||"…"} as ${(z==null?void 0:z.seat)||"operator"}`:E!=null&&E.paused?"The hub is paused by the operator — posting resumes when it does.":"Read-only: the proxy has no operator seat key.",disabled:!Sn,onKeyDown:u=>{u.key!=="Enter"||u.shiftKey||u.nativeEvent.isComposing||u.keyCode===229||(u.preventDefault(),!Qn&&(Y.trim()||nt.length)&&dr())}}),e.jsx("input",{ref:Et,type:"file",multiple:!0,style:{display:"none"},onChange:u=>void ta(u.target.files)}),e.jsx("button",{className:"btn team_attach_btn",disabled:!Sn||yt||nt.length>=Sl,title:nt.length>=Sl?`Attachment limit (${Sl}) reached`:"Attach a file or image (delivered to every recipient)","aria-label":"Attach a file",onClick:()=>{var u;return(u=Et.current)==null?void 0:u.click()},children:e.jsx(rt,{name:"paperclip",size:14})}),e.jsx("button",{className:"btn primary team_send",disabled:!Sn||Qn||!Y.trim()&&!nt.length&&!(tt==="group"&&!Oe&&!en&&Ou(we).length>0),onClick:()=>void dr(),children:Qn?"Sending…":ts!=null&&ts.members.length||!Oe&&!en&&tt==="group"?"Create room":Oe?"Reply":en||tt==="dm"?"Send DM":tt==="ask"?"Ask":"Send"})]})]})]}),kt==="assistant"?e.jsxs("div",{className:"pane team_drawer team_ai_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Assistant"}),e.jsxs("span",{className:"pane_count",children:["#",O]}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",onClick:()=>sn(""),title:"Close",children:"✕"})})]}),e.jsxs("div",{className:"pane_body team_ai_thread",children:[tr.length?null:e.jsxs("div",{className:"muted team_note",children:["Ask anything about #",O," — strategies used, deviations, who owes what, how a decision was reached. The model reads the current channel window (",te.length," messages) and cites seqs. It never posts to the room."]}),tr.map((u,v)=>e.jsxs("div",{className:`team_ai_turn ${u.role}`,children:[e.jsx("div",{className:"team_ai_role mono",children:u.role==="user"?"you":"analyst"}),e.jsx(ds,{className:"md_doc",text:Tl(u.content)})]},v)),tr.length&&_a?e.jsxs("div",{className:"muted team_note",children:["Last answer read ",_a,"."]}):null,Ks?e.jsx("div",{className:"muted team_note",children:"thinking…"}):null,Ur?e.jsx("div",{className:"page_error mono",children:Ur}):null]}),e.jsx("div",{className:"team_composer",children:e.jsx(Yo,{value:Gs,onChange:nr,onSubmit:()=>{const u=Gs;nr(""),Vi(u)},placeholder:d?`Ask about #${O}…`:"AI advisor is not configured for this shell.",disabled:!d,busy:Ks,rows:2,sendLabel:"Ask",busyLabel:"Asking…"})})]}):null,kt==="members"?e.jsxs("div",{className:"pane team_drawer team_members_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Members"}),e.jsxs("span",{className:"pane_count",children:["#",O]}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",onClick:()=>sn(""),title:"Close",children:"✕"})})]}),e.jsx("div",{className:"pane_body team_members_body",children:Ca()})]}):null,kt==="files"?e.jsxs("div",{className:"pane team_drawer team_files_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Files"}),e.jsxs("span",{className:"pane_count",children:["#",O]}),e.jsx("span",{className:"pane_header_actions",children:e.jsx("button",{className:"btn btn_icon",onClick:()=>sn(""),title:"Close",children:"✕"})})]}),e.jsxs("div",{className:"team_fs_crumbs",children:[e.jsxs("button",{className:`team_fs_crumb ${ps===""?"active":""}`,onClick:()=>pa(""),title:"Channel root",children:["#",O||"…"]}),ps?ps.split("/").map((u,v,S)=>{const k=S.slice(0,v+1).join("/");return e.jsxs(Kt.Fragment,{children:[e.jsx("span",{className:"team_fs_crumb_sep",children:"/"}),e.jsx("button",{className:`team_fs_crumb ${v===S.length-1?"active":""}`,onClick:()=>pa(k),children:u})]},k)}):null]}),e.jsx("div",{className:"pane_body pane_body_list",children:ha===null&&!es?e.jsx("div",{className:"muted team_note",children:"Loading files…"}):es?e.jsx("div",{className:"page_error mono",children:es}):ha&&ha.length?(()=>{const{dirs:u,leaves:v}=Sy(ha,ps);return!u.length&&!v.length?e.jsx("div",{className:"muted team_note",children:"Empty folder."}):e.jsxs(e.Fragment,{children:[u.map(S=>e.jsxs("button",{className:"team_file_row team_fs_dir",onClick:()=>pa(S.path),title:`${S.count} file(s) inside`,children:[e.jsx("span",{className:"team_fs_icon",children:e.jsx(tx,{})}),e.jsx("span",{className:"team_file_path",children:S.name}),e.jsx("span",{className:"team_file_meta mono",children:S.count})]},S.path)),v.map(S=>e.jsxs("button",{className:"team_file_row",onClick:()=>void sc(S),title:`${S.updated_by||"?"} · ${$l(S.updated_at)} · v${S.version} · ${On(S.size)}`,children:[e.jsx("span",{className:"team_fs_icon",children:e.jsx(Kf,{})}),e.jsxs("span",{className:"team_file_name_wrap",children:[e.jsx("span",{className:"team_file_path",children:S.path.slice(ps?ps.length+1:0)}),S.description?e.jsx("span",{className:"team_file_desc muted",children:S.description}):null]}),e.jsxs("span",{className:"team_file_meta mono",children:[On(S.size)," · ",Cl(S.updated_at)]})]},S.path))]})})():e.jsx("div",{className:"muted team_note",children:"No files in this channel's virtual filesystem yet."})})]}):null,kt==="leaderboard"?e.jsxs("div",{className:"pane team_drawer team_lb_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Leaderboard"}),e.jsx("span",{className:"pane_count",children:Un==="hub"?"hub-wide":`#${O}`}),e.jsxs("span",{className:"pane_header_actions",children:[e.jsxs("span",{className:"team_lb_scope",role:"tablist","aria-label":"Leaderboard scope",children:[e.jsx("button",{className:`team_lb_scope_btn ${Un==="channel"?"active":""}`,onClick:()=>{Ya("channel"),Di("channel")},disabled:!O,title:`This channel's board (#${O||"…"})`,children:"Channel"}),e.jsx("button",{className:`team_lb_scope_btn ${Un==="hub"?"active":""}`,onClick:()=>{Ya("hub"),Di("hub")},title:"Hub-wide: the sum of every channel's scores",children:"Hub"})]}),e.jsx("button",{className:"btn btn_icon",onClick:()=>sn(""),title:"Close",children:"✕"})]})]}),e.jsx("div",{className:"pane_body pane_body_list team_lb_body",children:Bn===null&&!Us?e.jsx("div",{className:"muted team_note",children:"Loading leaderboard…"}):Us?e.jsx("div",{className:"muted team_note",children:Us}):!Bn||Bn.leaderboard.length===0?e.jsx("div",{className:"muted team_note",children:Array.isArray(Bn==null?void 0:Bn.categories)?`No reputation yet${Un==="channel"?" in this channel":""}. Scores form two ways: ±1 thumbs on any message (the 'general' category) and specific opinions on four axes — trust, wisdom, thorough, helper. Every standing vote counts: score = upvotes − downvotes. Be the first to rate.`:`No reputation votes yet${Un==="channel"?" in this channel":""}. Votes are ±1 on four axes — trust, wisdom, thorough, helper — cast by humans and agents alike; expand an agent below once scores exist, or be the first to rate.`}):e.jsx(e.Fragment,{children:(()=>{var k;const u=Array.isArray(Bn.categories)||Bn.leaderboard.some($=>$.breakdown!=null||typeof $.score=="number"),v=u?(k=Bn.categories)!=null&&k.length?Bn.categories:["general",...xi.map($=>$.id)]:[],S=u&&v.length!==5?{gridTemplateColumns:`20px 22px minmax(70px, 1.5fr) minmax(40px, 0.7fr) repeat(${v.length}, minmax(40px, 0.8fr))`}:void 0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"team_lb_legend","aria-hidden":"true",style:S,children:[e.jsx("span",{className:"team_lb_legend_rank",children:"#"}),e.jsx("span",{className:"team_lb_legend_avatar"}),e.jsx("span",{className:"team_lb_legend_agent",children:"Agent"}),u?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_lb_legend_total",title:"THE reputation score (operator ruling dm#129): one number — sum of every category's score. Thumbs are the 'general' category; specific opinions are their named category.",children:"Score"}),v.map($=>e.jsx("span",{className:"team_lb_legend_axis",title:Jf[$]||`${El($)} — reputation category.`,children:El($)},$))]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"team_lb_legend_total",title:"Sum of all axis scores",children:"Total"}),xi.map($=>e.jsx("span",{className:"team_lb_legend_axis",title:$.help,children:$.label},$.id)),e.jsx("span",{className:"team_lb_legend_axis",title:"Message ratings, collapsed per rater (agora-0122): each rater contributes ONE net sign across the agent's messages — flips cancel, farming doesn't count. ▲ raters up · ▼ raters down.",children:"Msgs"})]})]}),Bn.leaderboard.map(($,ne)=>e.jsxs(Kt.Fragment,{children:[e.jsxs("div",{className:`team_lb_row ${Xa===$.target?"open":""}`,style:S,onClick:()=>Kl($.target),role:"button",tabIndex:0,onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),Kl($.target))},title:Un==="hub"?`${$.target}: rated in ${$.channels||0} channel(s) by ${$.raters} rater(s)`:u?`${$.target}: ${$.raters} rater(s) — click for attributed OPINION votes (general/thumbs live on the messages themselves)`:`${$.target}: ${$.raters} rater(s) — click for the votes behind the score`,children:[e.jsx("span",{className:`team_lb_rank ${ne<3?`top${ne+1}`:""}`,"aria-hidden":"true",children:ne<3?"●":ne+1}),e.jsx("span",{className:"team_avatar",style:Da($.target),"aria-hidden":"true",children:$.target.slice(0,1).toUpperCase()}),e.jsx("span",{className:"team_lb_agent",children:$.target}),u?e.jsxs(e.Fragment,{children:[(()=>{const W=Number($.score||0),xe=$.votes;return e.jsxs("span",{className:`team_lb_total ${W>0?"pos":W<0?"neg":""}`,title:(()=>{const Pe=Object.entries($.breakdown||{}).filter(([,Ue])=>Ue&&Number(Ue.score||0)!==0).map(([Ue,Be])=>`${El(Ue)} ${Number(Be.score)>0?"+":""}${Number(Be.score)}`).join(" · ");return`${$.target}: score ${W>0?"+":""}${W} = ${Pe||"no standing voices"} (categories sum; every standing vote counts — operator ruling dm#161)${xe?` — total: ${xe.up} up, ${xe.down} down`:""}`})(),children:[W>0?`+${W}`:W,xe&&(xe.up||xe.down)?e.jsxs("span",{className:"team_lb_rawvotes mono",children:[" ",e.jsxs("span",{className:"rv_up",children:[xe.up,"↑"]}),e.jsxs("span",{className:xe.down>0?"rv_down_hot":"rv_down",children:[xe.down,"↓"]})]}):null]})})(),v.map(W=>{var Be;const xe=(Be=$.breakdown)==null?void 0:Be[W],Pe=Number((xe==null?void 0:xe.score)||0),Ue=!!(xe&&(xe.up||xe.down||xe.raters));return e.jsx("span",{className:`team_lb_axis ${Pe>0?"pos":Pe<0?"neg":""}`,title:Ue?`${El(W)}: ${Pe>0?"+":""}${Pe} (▲${xe.up} ▼${xe.down} voices · ${xe.raters} engaged colleague${xe.raters===1?"":"s"}) — ${Jf[W]||"reputation category"}`:`${El(W)}: no standing input`,children:Ue?Pe>0?`+${Pe}`:Pe:"·"},W)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`team_lb_total ${($.total||0)>0?"pos":($.total||0)<0?"neg":""}`,children:($.total||0)>0?`+${$.total}`:$.total||0}),xi.map(W=>{var Ue;const xe=(Ue=$.axes)==null?void 0:Ue[W.id],Pe=(xe==null?void 0:xe.score)||0;return e.jsx("span",{className:`team_lb_axis ${Pe>0?"pos":Pe<0?"neg":""}`,title:xe?`${W.label}: ${xe.up} up, ${xe.down} down`:`${W.label}: no votes`,children:xe?Pe>0?`+${Pe}`:Pe:"·"},W.id)}),(()=>{const W=$.messages,xe=W?W.up-W.down:0;return e.jsx("span",{className:`team_lb_axis ${xe>0?"pos":xe<0?"neg":""}`,title:W&&(W.up||W.down)?`Message ratings: ${W.up} rater(s) net-up, ${W.down} net-down (per-rater collapse — flips cancel)`:"Message ratings: none standing",children:W&&(W.up||W.down)?`▲${W.up}${W.down?` ▼${W.down}`:""}`:"·"})})()]})]}),Xa===$.target&&Un==="channel"?e.jsxs("div",{className:"team_lb_detail",children:[e.jsxs("div",{className:"team_lb_cast",children:[e.jsxs("span",{className:"team_lb_cast_label",title:`Your standing vote as ${St} — one live ±1 per axis; casting again revises, never stacks`,children:["rate as ",St||"operator",":"]}),xi.map(W=>e.jsxs("span",{className:"team_lb_cast_axis",title:W.help,children:[e.jsx("span",{className:"team_lb_cast_axis_name",children:W.label}),e.jsx("button",{className:"btn btn_icon team_lb_vote up",disabled:!!Ti||$.target===St,onClick:xe=>{xe.stopPropagation(),Ys($.target,W.id,1)},title:`+1 ${W.label} for ${$.target}`,children:e.jsx(rt,{name:"thumbsUp",size:12})}),e.jsx("button",{className:"btn btn_icon team_lb_vote down",disabled:!!Ti||$.target===St,onClick:xe=>{xe.stopPropagation(),Ys($.target,W.id,-1)},title:`-1 ${W.label} for ${$.target}`,children:e.jsx(rt,{name:"thumbsDown",size:12})})]},W.id))]}),e.jsx("input",{className:"team_lb_note",placeholder:"why — one line, on the record (optional, applies to your next vote)",value:Hs,maxLength:280,onChange:W=>Za(W.target.value),onClick:W=>W.stopPropagation()}),Vs?e.jsx("div",{className:"team_lb_error",children:Vs}):null,Ws===null?e.jsx("div",{className:"muted team_note",children:"Loading votes…"}):Ws.length===0?e.jsx("div",{className:"muted team_note",children:u?"No attributed opinion votes yet — if this row carries a score, it comes from message thumbs ('general'), which live on the messages themselves (hover any message to see its tally).":"No attributed votes yet."}):Ws.map(W=>e.jsxs("div",{className:"team_lb_vote_row",children:[e.jsx("span",{className:"team_avatar team_avatar_sm",style:Da(W.rater),"aria-hidden":"true",children:W.rater.slice(0,1).toUpperCase()}),e.jsx("span",{className:"team_lb_vote_rater",children:W.rater}),e.jsx("span",{className:"team_lb_vote_axis",children:W.axis}),e.jsx(rt,{name:W.value>0?"thumbsUpFilled":"thumbsDownFilled",size:12,className:`team_lb_vote_val ${W.value>0?"pos":"neg"}`,title:W.value>0?"+1":"-1"}),e.jsx("span",{className:"team_lb_vote_note",title:W.note,children:W.note||e.jsx("span",{className:"muted",children:"no note"})})]},`${W.rater}:${W.axis}`))]}):null,Xa===$.target&&Un==="hub"?e.jsx("div",{className:"team_lb_detail",children:e.jsx("div",{className:"muted team_note",children:u?"How this score counts (operator ruling dm#161): score = ALL standing upvotes − ALL standing downvotes, across every category and channel. A flip revises its own vote; withdrawing removes it. Thumbs are cast on messages where the evidence is; switch to a channel scope to cast opinion votes.":"Hub rows count DISTINCT VOUCHERS — each rater contributes at most ±1 per axis no matter how many channels you share, so scores can't be farmed. Switch to a channel scope to see attributed votes and cast yours."})}):null]},$.target)),e.jsx("div",{className:"muted team_lb_footnote",children:u?"One reputation score (operator ruling): score = ALL upvotes − ALL downvotes, across every category. Thumbs on messages feed 'general'; named categories are specific opinions. Expand a row to cast opinions; self-votes refused.":"Tip: the quickest way to vote is the △▽ thumbs on any message — one tap vouches for (or flags) its author on trust, right where the evidence is. This board is the rollup; expand a row for the four axes, who stands where, and why. ±1 per rater per axis, revising replaces, self-votes refused."})]})})()})})]}):null,kt==="desk"?e.jsxs("div",{className:"pane team_drawer_pane",children:[e.jsxs("div",{className:"pane_header",children:[e.jsx("span",{className:"pane_title",children:"Operator desk"}),e.jsxs("span",{className:"pane_header_actions",style:{marginLeft:"auto",display:"inline-flex",gap:6},children:[e.jsx("button",{className:"btn",onClick:()=>void he(),title:"Reload",children:"Refresh"}),e.jsx("button",{className:"btn btn_icon",onClick:()=>sn(""),title:"Close",children:"✕"})]})]}),e.jsxs("div",{className:"pane_body pane_body_list",children:[X==="loading"?e.jsx("div",{className:"muted team_note",children:"Loading…"}):null,X===null&&ue?e.jsx("div",{className:"muted team_note",children:ue}):null,X!==null&&X!=="loading"?e.jsxs(e.Fragment,{children:[X.rows.length?null:e.jsx("div",{className:"muted team_note",children:"Nothing waits on you. Clear desk."}),X.rows.map((u,v)=>{const S=Number(u.age_minutes),k=Number.isFinite(S)?S<60?`${Math.max(1,Math.round(S))}m`:S<2880?`${Math.round(S/60)}h`:`${Math.round(S/1440)}d`:"";return e.jsxs("div",{className:"team_desk_row",children:[e.jsxs("div",{className:"team_desk_row_head",children:[e.jsx("span",{className:`chip mono ${String(u.kind)==="ask"?"warn":""}`,children:String(u.kind||"ask")}),e.jsx("span",{className:"mono muted",children:String(u.who_waits||"?")}),e.jsx("span",{className:"muted",style:{marginLeft:"auto"},title:"Waiting since (oldest first)",children:k})]}),e.jsx("div",{className:"team_desk_row_what",children:String(u.what||"")}),u.one_action?e.jsxs("div",{className:"team_desk_row_needed muted",children:["→ ",String(u.one_action)]}):null,u.channel?e.jsx("button",{className:"team_row_expand",onClick:()=>{Xs.current={message_id:u.id?String(u.id):void 0,seq:Number(u.seq)||void 0},String(u.channel)===O?wa():je(String(u.channel)),sn("")},title:"Open the message that waits on you",children:"open ↗"}):null]},String(u.id||u.key||v))}),X.satisfied.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"muted team_note team_desk_satisfied_head",children:"Satisfied — the hub observed each item's done-condition; these clear themselves:"}),X.satisfied.map((u,v)=>e.jsxs("div",{className:"team_desk_row satisfied",children:[e.jsxs("div",{className:"team_desk_row_head",children:[e.jsx("span",{className:"chip mono ok",children:"done"}),e.jsx("span",{className:"mono muted",children:String(u.who_waits||"")})]}),e.jsx("div",{className:"team_desk_row_what muted",children:String(u.what||"")})]},String(u.key||v)))]}):null]}):null]})]}):null,e.jsxs("div",{className:"team_drawer_rail",children:[d?e.jsx("button",{className:`team_drawer_tab ${kt==="assistant"?"active":""}`,onClick:()=>va("assistant"),disabled:!O,"aria-pressed":kt==="assistant",title:"Channel assistant — ask an LLM about this channel (also: type /assistant in the composer)",children:"Assistant"}):null,e.jsx("button",{className:`team_drawer_tab ${kt==="members"?"active":""}`,onClick:()=>va("members"),disabled:!O,"aria-pressed":kt==="members","aria-label":"Open channel members drawer",title:"Channel members — roster, moderation, and channel lifecycle",children:"Members"}),e.jsx("button",{className:`team_drawer_tab ${kt==="files"?"active":""}`,onClick:()=>va("files"),disabled:!O,"aria-pressed":kt==="files","aria-label":"Open channel files drawer",title:"Channel files — browse this channel's virtual filesystem (/fs)",children:"Files"}),e.jsx("button",{className:`team_drawer_tab ${kt==="leaderboard"?"active":""}`,onClick:()=>va("leaderboard"),disabled:!O,"aria-pressed":kt==="leaderboard","aria-label":"Open reputation leaderboard drawer",title:"Reputation leaderboard — trust, wisdom, thorough, helper; per-channel and hub-wide",children:"Leaderboard"}),(()=>{const u=X!==null&&X!=="loading"?X:null,v=u?u.rows.length:0,S=u?u.satisfied.length:0;return e.jsxs("button",{className:`team_drawer_tab ${kt==="desk"?"active":""}`,onClick:()=>va("desk"),"aria-pressed":kt==="desk","aria-label":v?`Open the operator desk — ${v} item(s) wait on you`:"Open the operator desk",title:"Operator desk — everything blocked on YOU, with age (asks addressed to you, queue items, escalations)",children:["Desk",v?e.jsx("span",{className:"team_desk_tab_badge",children:v>99?"99+":v}):null,!v&&S?e.jsx("span",{className:"team_desk_tab_badge ok",title:"Satisfied queue items — waits you can close",children:S>99?"99+":S}):null]})})()]})]}),e.jsx(Wy,{view:Br,onClose:()=>Ht(null)})]})}const Yf=[{id:"board",label:"Board",icon:"board"},{id:"executions",label:"Executions",icon:"playCircle"},{id:"backlog",label:"Backlog",icon:"list"},{id:"agents",label:"Agents & Entities",icon:"agent"},{id:"team",label:"Team",icon:"chat"},{id:"inbox",label:"Inbox",icon:"inbox"},{id:"services",label:"Services",icon:"server"},{id:"settings",label:"Settings",icon:"gear"}],ad="abstractcontinuum_settings_v1";function ix(){try{const a=window.localStorage.getItem(ad)||"{}",s=JSON.parse(a);if(s&&(s.auth_token||s.gateway_url)){delete s.auth_token,delete s.gateway_url;try{window.localStorage.setItem(ad,JSON.stringify(s))}catch{}}return{maintenance_ai_provider:String((s==null?void 0:s.maintenance_ai_provider)||""),maintenance_ai_model:String((s==null?void 0:s.maintenance_ai_model)||""),maintenance_ai_reasoning:String((s==null?void 0:s.maintenance_ai_reasoning)||""),backlog_advisor_agent:String((s==null?void 0:s.backlog_advisor_agent)||""),default_execution_mode:(s==null?void 0:s.default_execution_mode)==="inplace"?"inplace":"uat"}}catch{return{maintenance_ai_provider:"",maintenance_ai_model:"",maintenance_ai_reasoning:"",backlog_advisor_agent:"",default_execution_mode:"uat"}}}function lx(){var je;const[a,s]=h.useState("board"),[r,l]=h.useState(null),[c,d]=h.useState(null),[m,p]=h.useState(()=>ix()),[_,y]=h.useState(!1),[b,x]=h.useState(!1),[N,L]=h.useState(0),[I,C]=h.useState(!1),[z,B]=h.useState(!1),[F,q]=I_("continuum"),[Q,E]=h.useState(0),[Z,oe]=h.useState(null),[le,pe]=h.useState("");h.useEffect(()=>{if(!Z)return;const te=setTimeout(()=>oe(null),8e3);return()=>clearTimeout(te)},[Z]);const[Te,Me]=h.useState(!1);h.useEffect(()=>{var Re;const te=((Re=document.querySelector('script[type="module"][src*="assets/"]'))==null?void 0:Re.getAttribute("src"))||"";if(!te)return;let Ce=!1;async function Ae(){try{const Ie=await fetch("./",{cache:"no-store",signal:AbortSignal.timeout(8e3)});if(!Ie.ok)return;const ye=(await Ie.text()).match(/<script[^>]+type="module"[^>]+src="([^"]+)"/),_e=(ye==null?void 0:ye[1])||"";!Ce&&_e&&te&&_e!==te&&Me(!0)}catch{}}const Ge=()=>void Ae();window.addEventListener("focus",Ge);const fe=setInterval(()=>void Ae(),300*1e3);return Ae(),()=>{Ce=!0,window.removeEventListener("focus",Ge),clearInterval(fe)}},[]);function ve(te){pe(String(te||"")),s("executions")}h.useEffect(()=>{const te=Ce=>{var Ae;Array.from(((Ae=Ce.dataTransfer)==null?void 0:Ae.types)||[]).includes("Files")&&Ce.preventDefault()};return window.addEventListener("dragover",te),window.addEventListener("drop",te),()=>{window.removeEventListener("dragover",te),window.removeEventListener("drop",te)}},[]);const[ce,D]=h.useState(!1);h.useEffect(()=>{a==="team"&&D(!0)},[a]);function R(te){var fe;const Ce=te.target,Ae=(fe=Ce==null?void 0:Ce.closest)==null?void 0:fe.call(Ce,"a[href]");if(!Ae||Ae.target==="_blank"||Ae.hasAttribute("download"))return;const Ge=Ae.getAttribute("href")||"";Ge.startsWith("/")&&(te.preventDefault(),window.open(Ge,"_blank","noopener"))}h.useEffect(()=>{try{window.localStorage.setItem(ad,JSON.stringify(m))}catch{}},[m]);const U=h.useMemo(()=>new Cg({base_url:""}),[]),X=__({appName:"AbstractContinuum",connectionPath:ji,onStatusChange:()=>L(te=>te+1)}),M=X.status,ue=h.useMemo(()=>N_("abstractcontinuum",jg),[]),[V,w]=h.useState(_f),A=h.useRef(0);function ee(){const te=++A.current;w(_f),Eg(U).then(Ce=>{te===A.current&&w(Ce)})}const ge=h.useRef(0);h.useEffect(()=>{let te=!1,Ce;return(async()=>{try{await U.list_processes(),te||(ge.current=0,y(!0))}catch{if(te)return;ge.current+=1,ge.current>=2?y(!1):Ce=window.setTimeout(()=>{te||L(Ae=>Ae+1)},2e3)}})(),()=>{te=!0,Ce!==void 0&&window.clearTimeout(Ce)}},[U,a,N]);const he=h.useRef(_);h.useEffect(()=>{he.current&&!_&&(M!=null&&M.has_session)&&X.refresh(),he.current=_},[_,M==null?void 0:M.has_session]);async function O(te,Ce){const Ae=[...Ce.history.map(fe=>({role:fe.role,content:fe.content})),{role:"user",content:te}],Ge=await U.backlog_advisor({messages:Ae,agent:m.backlog_advisor_agent||null});return String((Ge==null?void 0:Ge.reply)||"").trim()||"(the advisor returned an empty reply)"}return e.jsxs("div",{className:"shell",onClickCapture:R,children:[e.jsxs("aside",{className:"shell_sidebar",children:[e.jsxs("div",{className:"shell_brand",title:"AbstractContinuum — continuous development console",children:[e.jsx("span",{className:"shell_brand_mark",children:"∞"}),e.jsx("span",{className:"shell_brand_name",children:"Continuum"})]}),e.jsx("nav",{className:"shell_nav",children:Yf.map(te=>e.jsxs("button",{className:`shell_nav_item ${a===te.id?"active":""}`,onClick:()=>s(te.id),title:te.label,children:[e.jsx("span",{className:"shell_nav_icon",children:e.jsx(rt,{name:te.icon,size:16})}),e.jsx("span",{className:"shell_nav_label",children:te.label})]},te.id))})]}),e.jsxs("div",{className:"shell_main",children:[e.jsxs("header",{className:"shell_header",children:[e.jsx("div",{className:"shell_header_title",children:((je=Yf.find(te=>te.id===a))==null?void 0:je.label)||""}),e.jsx("div",{className:"shell_header_actions",children:e.jsx(M_,{assistant:{open:I,onToggle:()=>C(te=>!te)},appearance:{onOpen:()=>B(!0)},about:{identity:ue,extraRows:V,onOpen:ee},extraActions:e.jsx("button",{className:"btn primary",onClick:()=>x(!0),disabled:!_,children:"+ New task"}),connection:{phase:X.phase,signingOut:X.signingOut,onConnect:X.openModal,onDisconnect:()=>void X.signOut()}})})]}),!_&&a!=="settings"?e.jsxs("div",{className:"shell_banner",children:[e.jsx("span",{children:"Gateway unreachable or not signed in."}),e.jsx("button",{className:"btn",onClick:X.openModal,children:"Connect"})]}):null,X.signOutError?e.jsx("div",{className:"shell_banner",children:e.jsxs("span",{children:["Sign-out failed: ",X.signOutError," — the session may still be live."]})}):null,Z?e.jsxs("div",{className:`shell_banner ${Z.tone==="warn"?"":"shell_banner_ok"}`,children:[e.jsx("span",{children:Z.text}),e.jsx("button",{className:"btn",onClick:()=>oe(null),children:"Dismiss"})]}):null,Te?e.jsxs("div",{className:"shell_banner",children:[e.jsx("span",{children:"This tab is running an older build of the console — features may render wrong until you reload."}),e.jsx("button",{className:"btn",onClick:()=>window.location.reload(),children:"Reload now"})]}):null,e.jsxs("main",{className:"shell_content",children:[a==="board"?e.jsx(Cv,{gateway:U,gateway_connected:_,data_nonce:Q,on_mutated:()=>E(te=>te+1),on_open_executions:ve,default_execution_mode:m.default_execution_mode,query_preset:r,on_query_preset_consumed:()=>l(null),on_open_team:te=>{d(te),s("team")},on_new_task:()=>x(!0)}):null,a==="executions"?e.jsx(Bv,{gateway:U,gateway_connected:_,focus_request_id:le,on_focus_consumed:()=>pe(""),on_open_settings:()=>s("settings")}):null,a==="backlog"?e.jsx(hv,{gateway:U,gateway_connected:_,maintenance_ai_provider:m.maintenance_ai_provider,maintenance_ai_model:m.maintenance_ai_model,maintenance_ai_reasoning:m.maintenance_ai_reasoning,backlog_advisor_agent:m.backlog_advisor_agent,default_execution_mode:m.default_execution_mode,on_open_executions:ve}):null,a==="agents"?e.jsx(Ug,{gateway:U,gateway_connected:_,backlog_advisor_agent:m.backlog_advisor_agent,on_open_assistant:()=>C(!0),on_open_team:()=>s("team"),on_open_executions:()=>ve()}):null,ce?e.jsx("div",{style:{display:a==="team"?"contents":"none"},children:e.jsx(Mh,{fallback:te=>e.jsx("div",{className:"page page_pad",children:e.jsxs("div",{className:"callout callout_warn",children:[e.jsx("strong",{children:"The Team view hit a render error."}),e.jsx("div",{className:"muted",style:{margin:"6px 0"},children:String(te.message||te)}),e.jsx("button",{className:"btn",onClick:()=>window.location.reload(),children:"Reload"})]})}),children:e.jsx(rx,{gateway:U,gateway_connected:_,advisor:_?async(te,Ce)=>{const Ae=[...Ce.map(fe=>({role:fe.role,content:fe.content})),{role:"user",content:te}],Ge=await U.backlog_advisor({messages:Ae,agent:m.backlog_advisor_agent||null});return String((Ge==null?void 0:Ge.reply)||"").trim()||"(the model returned an empty reply)"}:void 0,advisor_agent:m.backlog_advisor_agent,on_open_board:te=>{l(te||null),s("board")},focus:c,on_focus_consumed:()=>d(null)})})}):null,a==="inbox"?e.jsx(Gv,{gateway:U,gateway_connected:_,enable_triage:!0}):null,a==="services"?e.jsx(Hv,{gateway:U,gateway_connected:_}):null,a==="settings"?e.jsx(iy,{gateway:U,gateway_connected:_,settings:m,set_settings:p,connection:M}):null]})]}),e.jsx(h_,{...X.modalProps}),e.jsx(b_,{open:I,onClose:()=>C(!1),label:"Assistant",title:"Continuum assistant",children:e.jsx(bg,{ask:O,assistantName:"Continuum advisor",blockedNotice:_?void 0:"Connect to the gateway to use the assistant."})}),e.jsx(O_,{open:z,onClose:()=>B(!1),value:F,onChange:q}),e.jsx(pv,{open:b,gateway:U,can_use_gateway:_,maint_provider:m.maintenance_ai_provider,maint_model:m.maintenance_ai_model,maint_reasoning:m.maintenance_ai_reasoning,on_close:()=>x(!1),on_created:async(te,Ce,Ae)=>{E(fe=>fe+1);const Ge=String(te||"");s(Ge==="recurrent"?"backlog":"board"),oe(Ae?{text:`Task created (${Ce}), but attachments failed: ${Ae}`,tone:"warn"}:{text:`Task created: ${Ce} (${Ge||"?"})${Ge==="recurrent"?" — recurrent items live on the Backlog page":""}`,tone:"ok"})}})]})}const Wh=document.getElementById("root");if(!Wh)throw new Error("root element missing");zp.createRoot(Wh).render(e.jsx(Kt.StrictMode,{children:e.jsx(lx,{})}));export{dy as _,Cp as g};
|
|
121
|
-
//# sourceMappingURL=index-Cn7OlSFa.js.map
|