clinkx 1.1.0 → 1.1.2
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/CHANGELOG.md +39 -1
- package/README.md +210 -177
- package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +5 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.js +50 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +995 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.js +149 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +29 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.js +387 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -0
- package/clinkx-workflows/dist/contained-file.js +1 -1
- package/clinkx-workflows/dist/contained-file.js.map +1 -1
- package/clinkx-workflows/dist/council-execution-policy.d.ts +4 -2
- package/clinkx-workflows/dist/council-execution-policy.js +5 -1
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +72 -72
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +1564 -122
- package/clinkx-workflows/dist/dashboard/contracts.js +4 -0
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +12 -12
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +8 -8
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +3 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +27 -0
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +48 -48
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +2 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +4 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.d.ts +191 -0
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.js +28 -0
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +115 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/engine.d.ts +6 -0
- package/clinkx-workflows/dist/engine.js +78 -7
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/index.d.ts +3 -0
- package/clinkx-workflows/dist/index.js +3 -2
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
- package/clinkx-workflows/dist/reducers/index.js +22 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/state.js +17 -7
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/validators/architecture-comparison.d.ts +2 -0
- package/clinkx-workflows/dist/validators/architecture-comparison.js +12 -0
- package/clinkx-workflows/dist/validators/architecture-comparison.js.map +1 -0
- package/clinkx-workflows/dist/validators/index.js +4 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/verified-repair.d.ts +2 -0
- package/clinkx-workflows/dist/validators/verified-repair.js +12 -0
- package/clinkx-workflows/dist/validators/verified-repair.js.map +1 -0
- package/clinkx-workflows/dist/verification-proof.d.ts +254 -0
- package/clinkx-workflows/dist/verification-proof.js +195 -0
- package/clinkx-workflows/dist/verification-proof.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/admission.d.ts +72 -0
- package/clinkx-workflows/dist/verified-repair/admission.js +63 -0
- package/clinkx-workflows/dist/verified-repair/admission.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/contract.d.ts +1910 -0
- package/clinkx-workflows/dist/verified-repair/contract.js +127 -0
- package/clinkx-workflows/dist/verified-repair/contract.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/host.d.ts +32 -0
- package/clinkx-workflows/dist/verified-repair/host.js +2 -0
- package/clinkx-workflows/dist/verified-repair/host.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/prompts.d.ts +12 -0
- package/clinkx-workflows/dist/verified-repair/prompts.js +58 -0
- package/clinkx-workflows/dist/verified-repair/prompts.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/result.d.ts +16 -0
- package/clinkx-workflows/dist/verified-repair/result.js +102 -0
- package/clinkx-workflows/dist/verified-repair/result.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/runtime.d.ts +28 -0
- package/clinkx-workflows/dist/verified-repair/runtime.js +186 -0
- package/clinkx-workflows/dist/verified-repair/runtime.js.map +1 -0
- package/clinkx-workflows/dist/workflow-tools.d.ts +3 -0
- package/clinkx-workflows/dist/workflow-tools.js +148 -14
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workflow-verification-contract.d.ts +539 -0
- package/clinkx-workflows/dist/workflow-verification-contract.js +52 -0
- package/clinkx-workflows/dist/workflow-verification-contract.js.map +1 -0
- package/clinkx-workflows/dist/workflow-verification.d.ts +15 -0
- package/clinkx-workflows/dist/workflow-verification.js +218 -0
- package/clinkx-workflows/dist/workflow-verification.js.map +1 -0
- package/clinkx-workflows/templates/architecture-comparison/candidate.txt +29 -0
- package/clinkx-workflows/templates/architecture-comparison/judge.txt +31 -0
- package/clinkx-workflows/templates/verified-repair/investigate.txt +20 -0
- package/clinkx-workflows/templates/verified-repair/repair.txt +11 -0
- package/clinkx-workflows/templates/verified-repair/review.txt +18 -0
- package/clinkx-workflows/workflows/architecture-comparison.yaml +133 -0
- package/clinkx-workflows/workflows/verified-repair.yaml +104 -0
- package/dist/allowed-roots.js +4 -1
- package/dist/allowed-roots.js.map +1 -1
- package/dist/codex/app-server-client.d.ts +1 -0
- package/dist/codex/app-server-client.js +3 -2
- package/dist/codex/app-server-client.js.map +1 -1
- package/dist/context-builder/diagnostics.d.ts +1 -0
- package/dist/context-builder/diagnostics.js +1 -1
- package/dist/context-builder/diagnostics.js.map +1 -1
- package/dist/context-builder/discovery.d.ts +18 -1
- package/dist/context-builder/discovery.js +69 -1
- package/dist/context-builder/discovery.js.map +1 -1
- package/dist/context-builder/handler.js +8 -1
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/lifecycle-contract.d.ts +24 -24
- package/dist/context-builder/refine-handler.js +16 -1
- package/dist/context-builder/refine-handler.js.map +1 -1
- package/dist/context-builder/secrets.d.ts +11 -0
- package/dist/context-builder/secrets.js +81 -1
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/versions.d.ts +5 -2
- package/dist/context-builder/versions.js +5 -2
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/dashboard-cli.js +10 -3
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-gateway/main.js +8 -3
- package/dist/dashboard-gateway/main.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/project-verification/contract.d.ts +537 -0
- package/dist/project-verification/contract.js +40 -0
- package/dist/project-verification/contract.js.map +1 -0
- package/dist/project-verification/files.d.ts +23 -0
- package/dist/project-verification/files.js +80 -0
- package/dist/project-verification/files.js.map +1 -0
- package/dist/project-verification/process.d.ts +7 -0
- package/dist/project-verification/process.js +115 -0
- package/dist/project-verification/process.js.map +1 -0
- package/dist/project-verification/runner.d.ts +35 -0
- package/dist/project-verification/runner.js +185 -0
- package/dist/project-verification/runner.js.map +1 -0
- package/dist/project-verification/service.d.ts +37 -0
- package/dist/project-verification/service.js +151 -0
- package/dist/project-verification/service.js.map +1 -0
- package/dist/provider-doctor.d.ts +22 -0
- package/dist/provider-doctor.js +22 -0
- package/dist/provider-doctor.js.map +1 -0
- package/dist/server.js +29 -1
- package/dist/server.js.map +1 -1
- package/dist/verification-tools.d.ts +90 -0
- package/dist/verification-tools.js +120 -0
- package/dist/verification-tools.js.map +1 -0
- package/dist/verified-repair/files.d.ts +22 -0
- package/dist/verified-repair/files.js +114 -0
- package/dist/verified-repair/files.js.map +1 -0
- package/dist/verified-repair/host.d.ts +14 -0
- package/dist/verified-repair/host.js +612 -0
- package/dist/verified-repair/host.js.map +1 -0
- package/docs/configuration.md +493 -0
- package/docs/engineering-recipes.md +415 -0
- package/docs/security.md +293 -0
- package/docs/verification/README.md +59 -0
- package/docs/verification/dashboard-real-disk.md +436 -0
- package/docs/verification/project-checks.example.json +14 -0
- package/docs/verification/project-checks.md +444 -0
- package/docs/verification/workflow-handoff.md +113 -0
- package/package.json +13 -6
- package/scripts/provider-doctor-core.mjs +364 -0
- package/scripts/provider-doctor-probe.mjs +34 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-JPHQVtn9.js +0 -106
- package/clinkx-workflows/dist/dashboard-ui/assets/style-DOMHk-j6.css +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
var Dp={exports:{}},Ro={};var Uv;function Mw(){if(Uv)return Ro;Uv=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(r,c,f){var p=null;if(f!==void 0&&(p=""+f),c.key!==void 0&&(p=""+c.key),"key"in c){f={};for(var h in c)h!=="key"&&(f[h]=c[h])}else f=c;return c=f.ref,{$$typeof:t,type:r,key:p,ref:c!==void 0?c:null,props:f}}return Ro.Fragment=a,Ro.jsx=i,Ro.jsxs=i,Ro}var Bv;function Iw(){return Bv||(Bv=1,Dp.exports=Mw()),Dp.exports}var s=Iw(),zp={exports:{}},Fe={};var Gv;function Lw(){if(Gv)return Fe;Gv=1;var t=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),A=Symbol.iterator;function w(S){return S===null||typeof S!="object"?null:(S=A&&S[A]||S["@@iterator"],typeof S=="function"?S:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,N={};function I(S,L,B){this.props=S,this.context=L,this.refs=N,this.updater=B||C}I.prototype.isReactComponent={},I.prototype.setState=function(S,L){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,L,"setState")},I.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function k(){}k.prototype=I.prototype;function q(S,L,B){this.props=S,this.context=L,this.refs=N,this.updater=B||C}var E=q.prototype=new k;E.constructor=q,T(E,I.prototype),E.isPureReactComponent=!0;var M=Array.isArray;function D(){}var F={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function oe(S,L,B){var Q=B.ref;return{$$typeof:t,type:S,key:L,ref:Q!==void 0?Q:null,props:B}}function P(S,L){return oe(S.type,L,S.props)}function ue(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function _e(S){var L={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(B){return L[B]})}var ge=/\/+/g;function be(S,L){return typeof S=="object"&&S!==null&&S.key!=null?_e(""+S.key):L.toString(36)}function ve(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(D,D):(S.status="pending",S.then(function(L){S.status==="pending"&&(S.status="fulfilled",S.value=L)},function(L){S.status==="pending"&&(S.status="rejected",S.reason=L)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function $(S,L,B,Q,me){var H=typeof S;(H==="undefined"||H==="boolean")&&(S=null);var pe=!1;if(S===null)pe=!0;else switch(H){case"bigint":case"string":case"number":pe=!0;break;case"object":switch(S.$$typeof){case t:case a:pe=!0;break;case x:return pe=S._init,$(pe(S._payload),L,B,Q,me)}}if(pe)return me=me(S),pe=Q===""?"."+be(S,0):Q,M(me)?(B="",pe!=null&&(B=pe.replace(ge,"$&/")+"/"),$(me,L,B,"",function(Re){return Re})):me!=null&&(ue(me)&&(me=P(me,B+(me.key==null||S&&S.key===me.key?"":(""+me.key).replace(ge,"$&/")+"/")+pe)),L.push(me)),1;pe=0;var Be=Q===""?".":Q+":";if(M(S))for(var Se=0;Se<S.length;Se++)Q=S[Se],H=Be+be(Q,Se),pe+=$(Q,L,B,H,me);else if(Se=w(S),typeof Se=="function")for(S=Se.call(S),Se=0;!(Q=S.next()).done;)Q=Q.value,H=Be+be(Q,Se++),pe+=$(Q,L,B,H,me);else if(H==="object"){if(typeof S.then=="function")return $(ve(S),L,B,Q,me);throw L=String(S),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(S).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return pe}function ae(S,L,B){if(S==null)return S;var Q=[],me=0;return $(S,Q,"","",function(H){return L.call(B,H,me++)}),Q}function ce(S){if(S._status===-1){var L=S._result;L=L(),L.then(function(B){(S._status===0||S._status===-1)&&(S._status=1,S._result=B)},function(B){(S._status===0||S._status===-1)&&(S._status=2,S._result=B)}),S._status===-1&&(S._status=0,S._result=L)}if(S._status===1)return S._result.default;throw S._result}var de=typeof reportError=="function"?reportError:function(S){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof S=="object"&&S!==null&&typeof S.message=="string"?String(S.message):String(S),error:S});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",S);return}console.error(S)},ye={map:ae,forEach:function(S,L,B){ae(S,function(){L.apply(this,arguments)},B)},count:function(S){var L=0;return ae(S,function(){L++}),L},toArray:function(S){return ae(S,function(L){return L})||[]},only:function(S){if(!ue(S))throw Error("React.Children.only expected to receive a single React element child.");return S}};return Fe.Activity=y,Fe.Children=ye,Fe.Component=I,Fe.Fragment=i,Fe.Profiler=c,Fe.PureComponent=q,Fe.StrictMode=r,Fe.Suspense=v,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(S){return F.H.useMemoCache(S)}},Fe.cache=function(S){return function(){return S.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(S,L,B){if(S==null)throw Error("The argument must be a React element, but you passed "+S+".");var Q=T({},S.props),me=S.key;if(L!=null)for(H in L.key!==void 0&&(me=""+L.key),L)!te.call(L,H)||H==="key"||H==="__self"||H==="__source"||H==="ref"&&L.ref===void 0||(Q[H]=L[H]);var H=arguments.length-2;if(H===1)Q.children=B;else if(1<H){for(var pe=Array(H),Be=0;Be<H;Be++)pe[Be]=arguments[Be+2];Q.children=pe}return oe(S.type,me,Q)},Fe.createContext=function(S){return S={$$typeof:p,_currentValue:S,_currentValue2:S,_threadCount:0,Provider:null,Consumer:null},S.Provider=S,S.Consumer={$$typeof:f,_context:S},S},Fe.createElement=function(S,L,B){var Q,me={},H=null;if(L!=null)for(Q in L.key!==void 0&&(H=""+L.key),L)te.call(L,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(me[Q]=L[Q]);var pe=arguments.length-2;if(pe===1)me.children=B;else if(1<pe){for(var Be=Array(pe),Se=0;Se<pe;Se++)Be[Se]=arguments[Se+2];me.children=Be}if(S&&S.defaultProps)for(Q in pe=S.defaultProps,pe)me[Q]===void 0&&(me[Q]=pe[Q]);return oe(S,H,me)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(S){return{$$typeof:h,render:S}},Fe.isValidElement=ue,Fe.lazy=function(S){return{$$typeof:x,_payload:{_status:-1,_result:S},_init:ce}},Fe.memo=function(S,L){return{$$typeof:m,type:S,compare:L===void 0?null:L}},Fe.startTransition=function(S){var L=F.T,B={};F.T=B;try{var Q=S(),me=F.S;me!==null&&me(B,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(D,de)}catch(H){de(H)}finally{L!==null&&B.types!==null&&(L.types=B.types),F.T=L}},Fe.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Fe.use=function(S){return F.H.use(S)},Fe.useActionState=function(S,L,B){return F.H.useActionState(S,L,B)},Fe.useCallback=function(S,L){return F.H.useCallback(S,L)},Fe.useContext=function(S){return F.H.useContext(S)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(S,L){return F.H.useDeferredValue(S,L)},Fe.useEffect=function(S,L){return F.H.useEffect(S,L)},Fe.useEffectEvent=function(S){return F.H.useEffectEvent(S)},Fe.useId=function(){return F.H.useId()},Fe.useImperativeHandle=function(S,L,B){return F.H.useImperativeHandle(S,L,B)},Fe.useInsertionEffect=function(S,L){return F.H.useInsertionEffect(S,L)},Fe.useLayoutEffect=function(S,L){return F.H.useLayoutEffect(S,L)},Fe.useMemo=function(S,L){return F.H.useMemo(S,L)},Fe.useOptimistic=function(S,L){return F.H.useOptimistic(S,L)},Fe.useReducer=function(S,L,B){return F.H.useReducer(S,L,B)},Fe.useRef=function(S){return F.H.useRef(S)},Fe.useState=function(S){return F.H.useState(S)},Fe.useSyncExternalStore=function(S,L,B){return F.H.useSyncExternalStore(S,L,B)},Fe.useTransition=function(){return F.H.useTransition()},Fe.version="19.2.7",Fe}var Hv;function Gh(){return Hv||(Hv=1,zp.exports=Lw()),zp.exports}var b=Gh(),qp={exports:{}},Eo={},Up={exports:{}},Bp={};var Vv;function Dw(){return Vv||(Vv=1,(function(t){function a($,ae){var ce=$.length;$.push(ae);e:for(;0<ce;){var de=ce-1>>>1,ye=$[de];if(0<c(ye,ae))$[de]=ae,$[ce]=ye,ce=de;else break e}}function i($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var ae=$[0],ce=$.pop();if(ce!==ae){$[0]=ce;e:for(var de=0,ye=$.length,S=ye>>>1;de<S;){var L=2*(de+1)-1,B=$[L],Q=L+1,me=$[Q];if(0>c(B,ce))Q<ye&&0>c(me,B)?($[de]=me,$[Q]=ce,de=Q):($[de]=B,$[L]=ce,de=L);else if(Q<ye&&0>c(me,ce))$[de]=me,$[Q]=ce,de=Q;else break e}}return ae}function c($,ae){var ce=$.sortIndex-ae.sortIndex;return ce!==0?ce:$.id-ae.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;t.unstable_now=function(){return f.now()}}else{var p=Date,h=p.now();t.unstable_now=function(){return p.now()-h}}var v=[],m=[],x=1,y=null,A=3,w=!1,C=!1,T=!1,N=!1,I=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function E($){for(var ae=i(m);ae!==null;){if(ae.callback===null)r(m);else if(ae.startTime<=$)r(m),ae.sortIndex=ae.expirationTime,a(v,ae);else break;ae=i(m)}}function M($){if(T=!1,E($),!C)if(i(v)!==null)C=!0,D||(D=!0,_e());else{var ae=i(m);ae!==null&&ve(M,ae.startTime-$)}}var D=!1,F=-1,te=5,oe=-1;function P(){return N?!0:!(t.unstable_now()-oe<te)}function ue(){if(N=!1,D){var $=t.unstable_now();oe=$;var ae=!0;try{e:{C=!1,T&&(T=!1,k(F),F=-1),w=!0;var ce=A;try{t:{for(E($),y=i(v);y!==null&&!(y.expirationTime>$&&P());){var de=y.callback;if(typeof de=="function"){y.callback=null,A=y.priorityLevel;var ye=de(y.expirationTime<=$);if($=t.unstable_now(),typeof ye=="function"){y.callback=ye,E($),ae=!0;break t}y===i(v)&&r(v),E($)}else r(v);y=i(v)}if(y!==null)ae=!0;else{var S=i(m);S!==null&&ve(M,S.startTime-$),ae=!1}}break e}finally{y=null,A=ce,w=!1}ae=void 0}}finally{ae?_e():D=!1}}}var _e;if(typeof q=="function")_e=function(){q(ue)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,be=ge.port2;ge.port1.onmessage=ue,_e=function(){be.postMessage(null)}}else _e=function(){I(ue,0)};function ve($,ae){F=I(function(){$(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return A},t.unstable_next=function($){switch(A){case 1:case 2:case 3:var ae=3;break;default:ae=A}var ce=A;A=ae;try{return $()}finally{A=ce}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function($,ae){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var ce=A;A=$;try{return ae()}finally{A=ce}},t.unstable_scheduleCallback=function($,ae,ce){var de=t.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?de+ce:de):ce=de,$){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=ce+ye,$={id:x++,callback:ae,priorityLevel:$,startTime:ce,expirationTime:ye,sortIndex:-1},ce>de?($.sortIndex=ce,a(m,$),i(v)===null&&$===i(m)&&(T?(k(F),F=-1):T=!0,ve(M,ce-de))):($.sortIndex=ye,a(v,$),C||w||(C=!0,D||(D=!0,_e()))),$},t.unstable_shouldYield=P,t.unstable_wrapCallback=function($){var ae=A;return function(){var ce=A;A=ae;try{return $.apply(this,arguments)}finally{A=ce}}}})(Bp)),Bp}var Fv;function zw(){return Fv||(Fv=1,Up.exports=Dw()),Up.exports}var Gp={exports:{}},zn={};var Kv;function qw(){if(Kv)return zn;Kv=1;var t=Gh();function a(v){var m="https://react.dev/errors/"+v;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)m+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+v+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(a(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(v,m,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:v,containerInfo:m,implementation:x}}var p=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(v,m){if(v==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return zn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,zn.createPortal=function(v,m){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(a(299));return f(v,m,null,x)},zn.flushSync=function(v){var m=p.T,x=r.p;try{if(p.T=null,r.p=2,v)return v()}finally{p.T=m,r.p=x,r.d.f()}},zn.preconnect=function(v,m){typeof v=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(v,m))},zn.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},zn.preinit=function(v,m){if(typeof v=="string"&&m&&typeof m.as=="string"){var x=m.as,y=h(x,m.crossOrigin),A=typeof m.integrity=="string"?m.integrity:void 0,w=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;x==="style"?r.d.S(v,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:y,integrity:A,fetchPriority:w}):x==="script"&&r.d.X(v,{crossOrigin:y,integrity:A,fetchPriority:w,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},zn.preinitModule=function(v,m){if(typeof v=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var x=h(m.as,m.crossOrigin);r.d.M(v,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(v)},zn.preload=function(v,m){if(typeof v=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var x=m.as,y=h(x,m.crossOrigin);r.d.L(v,x,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},zn.preloadModule=function(v,m){if(typeof v=="string")if(m){var x=h(m.as,m.crossOrigin);r.d.m(v,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(v)},zn.requestFormReset=function(v){r.d.r(v)},zn.unstable_batchedUpdates=function(v,m){return v(m)},zn.useFormState=function(v,m,x){return p.H.useFormState(v,m,x)},zn.useFormStatus=function(){return p.H.useHostTransitionStatus()},zn.version="19.2.7",zn}var Zv;function Jy(){if(Zv)return Gp.exports;Zv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),Gp.exports=qw(),Gp.exports}var Yv;function Uw(){if(Yv)return Eo;Yv=1;var t=zw(),a=Gh(),i=Jy();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var n=e,l=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(l=n.return),e=n.return;while(e)}return n.tag===3?l:null}function p(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function h(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function v(e){if(f(e)!==e)throw Error(r(188))}function m(e){var n=e.alternate;if(!n){if(n=f(e),n===null)throw Error(r(188));return n!==e?null:e}for(var l=e,o=n;;){var u=l.return;if(u===null)break;var d=u.alternate;if(d===null){if(o=u.return,o!==null){l=o;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===l)return v(u),e;if(d===o)return v(u),n;d=d.sibling}throw Error(r(188))}if(l.return!==o.return)l=u,o=d;else{for(var _=!1,j=u.child;j;){if(j===l){_=!0,l=u,o=d;break}if(j===o){_=!0,o=u,l=d;break}j=j.sibling}if(!_){for(j=d.child;j;){if(j===l){_=!0,l=d,o=u;break}if(j===o){_=!0,o=d,l=u;break}j=j.sibling}if(!_)throw Error(r(189))}}if(l.alternate!==o)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?e:n}function x(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=x(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,A=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),q=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function _e(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function be(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case I:return"Profiler";case N:return"StrictMode";case M:return"Suspense";case D:return"SuspenseList";case oe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case q:return e.displayName||"Context";case k:return(e._context.displayName||"Context")+".Consumer";case E:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case F:return n=e.displayName||null,n!==null?n:be(e.type)||"Memo";case te:n=e._payload,e=e._init;try{return be(e(n))}catch{}}return null}var ve=Array.isArray,$=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},de=[],ye=-1;function S(e){return{current:e}}function L(e){0>ye||(e.current=de[ye],de[ye]=null,ye--)}function B(e,n){ye++,de[ye]=e.current,e.current=n}var Q=S(null),me=S(null),H=S(null),pe=S(null);function Be(e,n){switch(B(H,n),B(me,e),B(Q,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?cv(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=cv(n),e=uv(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(Q),B(Q,e)}function Se(){L(Q),L(me),L(H)}function Re(e){e.memoizedState!==null&&B(pe,e);var n=Q.current,l=uv(n,e.type);n!==l&&(B(me,e),B(Q,l))}function Qe(e){me.current===e&&(L(Q),L(me)),pe.current===e&&(L(pe),So._currentValue=ce)}var Vt,Kt;function Tt(e){if(Vt===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);Vt=n&&n[1]||"",Kt=-1<l.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Vt+e+Kt}var Qt=!1;function Dt(e,n){if(!e||Qt)return"";Qt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(X){var Y=X}Reflect.construct(e,[],re)}else{try{re.call()}catch(X){Y=X}e.call(re.prototype)}}else{try{throw Error()}catch(X){Y=X}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(X){if(X&&Y&&typeof X.stack=="string")return[X.stack,Y.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=o.DetermineComponentFrameRoot(),_=d[0],j=d[1];if(_&&j){var O=_.split(`
|
|
4
|
+
`),Z=j.split(`
|
|
5
|
+
`);for(u=o=0;o<O.length&&!O[o].includes("DetermineComponentFrameRoot");)o++;for(;u<Z.length&&!Z[u].includes("DetermineComponentFrameRoot");)u++;if(o===O.length||u===Z.length)for(o=O.length-1,u=Z.length-1;1<=o&&0<=u&&O[o]!==Z[u];)u--;for(;1<=o&&0<=u;o--,u--)if(O[o]!==Z[u]){if(o!==1||u!==1)do if(o--,u--,0>u||O[o]!==Z[u]){var J=`
|
|
6
|
+
`+O[o].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=o&&0<=u);break}}}finally{Qt=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?Tt(l):""}function Jt(e,n){switch(e.tag){case 26:case 27:case 5:return Tt(e.type);case 16:return Tt("Lazy");case 13:return e.child!==n&&n!==null?Tt("Suspense Fallback"):Tt("Suspense");case 19:return Tt("SuspenseList");case 0:case 15:return Dt(e.type,!1);case 11:return Dt(e.type.render,!1);case 1:return Dt(e.type,!0);case 31:return Tt("Activity");default:return""}}function Wt(e){try{var n="",l=null;do n+=Jt(e,l),l=e,e=e.return;while(e);return n}catch(o){return`
|
|
7
|
+
Error generating stack: `+o.message+`
|
|
8
|
+
`+o.stack}}var Zt=Object.prototype.hasOwnProperty,rn=t.unstable_scheduleCallback,Ln=t.unstable_cancelCallback,on=t.unstable_shouldYield,en=t.unstable_requestPaint,rt=t.unstable_now,Ue=t.unstable_getCurrentPriorityLevel,le=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,Ie=t.unstable_NormalPriority,qe=t.unstable_LowPriority,ot=t.unstable_IdlePriority,$t=t.log,pt=t.unstable_setDisableYieldValue,Je=null,ht=null;function kt(e){if(typeof $t=="function"&&pt(e),ht&&typeof ht.setStrictMode=="function")try{ht.setStrictMode(Je,e)}catch{}}var Mt=Math.clz32?Math.clz32:gn,mn=Math.log,Rn=Math.LN2;function gn(e){return e>>>=0,e===0?32:31-(mn(e)/Rn|0)|0}var tn=256,_t=262144,nn=4194304;function Ct(e){var n=e&42;if(n!==0)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Dn(e,n,l){var o=e.pendingLanes;if(o===0)return 0;var u=0,d=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var j=o&134217727;return j!==0?(o=j&~d,o!==0?u=Ct(o):(_&=j,_!==0?u=Ct(_):l||(l=j&~e,l!==0&&(u=Ct(l))))):(j=o&~d,j!==0?u=Ct(j):_!==0?u=Ct(_):l||(l=o&~e,l!==0&&(u=Ct(l)))),u===0?0:n!==0&&n!==u&&(n&d)===0&&(d=u&-u,l=n&-n,d>=l||d===32&&(l&4194048)!==0)?n:u}function Ut(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function ct(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bt(){var e=nn;return nn<<=1,(nn&62914560)===0&&(nn=4194304),e}function Hn(e){for(var n=[],l=0;31>l;l++)n.push(e);return n}function ia(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xn(e,n,l,o,u,d){var _=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var j=e.entanglements,O=e.expirationTimes,Z=e.hiddenUpdates;for(l=_&~l;0<l;){var J=31-Mt(l),re=1<<J;j[J]=0,O[J]=-1;var Y=Z[J];if(Y!==null)for(Z[J]=null,J=0;J<Y.length;J++){var X=Y[J];X!==null&&(X.lane&=-536870913)}l&=~re}o!==0&&za(e,o,0),d!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=d&~(_&~n))}function za(e,n,l){e.pendingLanes|=n,e.suspendedLanes&=~n;var o=31-Mt(n);e.entangledLanes|=n,e.entanglements[o]=e.entanglements[o]|1073741824|l&261930}function qa(e,n){var l=e.entangledLanes|=n;for(e=e.entanglements;l;){var o=31-Mt(l),u=1<<o;u&n|e[o]&n&&(e[o]|=n),l&=~u}}function Ua(e,n){var l=n&-n;return l=(l&42)!==0?1:Ja(l),(l&(e.suspendedLanes|n))!==0?0:l}function Ja(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ra(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function z(){var e=ae.p;return e!==0?e:(e=window.event,e===void 0?32:$v(e.type))}function xe(e,n){var l=ae.p;try{return ae.p=e,n()}finally{ae.p=l}}var we=Math.random().toString(36).slice(2),ke="__reactFiber$"+we,$e="__reactProps$"+we,Ye="__reactContainer$"+we,We="__reactEvents$"+we,It="__reactListeners$"+we,yn="__reactHandles$"+we,Xe="__reactResources$"+we,Gt="__reactMarker$"+we;function En(e){delete e[ke],delete e[$e],delete e[We],delete e[It],delete e[yn]}function _n(e){var n=e[ke];if(n)return n;for(var l=e.parentNode;l;){if(n=l[Ye]||l[ke]){if(l=n.alternate,n.child!==null||l!==null&&l.child!==null)for(e=_v(e);e!==null;){if(l=e[ke])return l;e=_v(e)}return n}e=l,l=e.parentNode}return null}function Lt(e){if(e=e[ke]||e[Ye]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function cn(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function xn(e){var n=e[Xe];return n||(n=e[Xe]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function mt(e){e[Gt]=!0}var _s=new Set,Wa={};function ya(e,n){jn(e,n),jn(e+"Capture",n)}function jn(e,n){for(Wa[e]=n,e=0;e<n.length;e++)_s.add(n[e])}var Si=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),el={},tl={};function vs(e){return Zt.call(tl,e)?!0:Zt.call(el,e)?!1:Si.test(e)?tl[e]=!0:(el[e]=!0,!1)}function bs(e,n,l){if(vs(n))if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var o=n.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+l)}}function es(e,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+l)}}function ie(e,n,l,o){if(o===null)e.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(n,l,""+o)}}function Ee(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function he(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function nl(e,n,l){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var u=o.get,d=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return u.call(this)},set:function(_){l=""+_,d.call(this,_)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(_){l=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function ys(e){if(!e._valueTracker){var n=he(e)?"checked":"value";e._valueTracker=nl(e,n,""+e[n])}}function xa(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var l=n.getValue(),o="";return e&&(o=he(e)?e.checked?"true":"false":e.value),e=o,e!==l?(n.setValue(e),!0):!1}function ts(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ni=/[\n"\\]/g;function Vn(e){return e.replace(Ni,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function ki(e,n,l,o,u,d,_,j){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Ee(n)):e.value!==""+Ee(n)&&(e.value=""+Ee(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?al(e,_,Ee(n)):l!=null?al(e,_,Ee(l)):o!=null&&e.removeAttribute("value"),u==null&&d!=null&&(e.defaultChecked=!!d),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+Ee(j):e.removeAttribute("name")}function nc(e,n,l,o,u,d,_,j){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),n!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||n!=null)){ys(e);return}l=l!=null?""+Ee(l):"",n=n!=null?""+Ee(n):l,j||n===e.value||(e.value=n),e.defaultValue=n}o=o??u,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=j?e.checked:!!o,e.defaultChecked=!!o,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),ys(e)}function al(e,n,l){n==="number"&&ts(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function xs(e,n,l,o){if(e=e.options,n){n={};for(var u=0;u<l.length;u++)n["$"+l[u]]=!0;for(l=0;l<e.length;l++)u=n.hasOwnProperty("$"+e[l].value),e[l].selected!==u&&(e[l].selected=u),u&&o&&(e[l].defaultSelected=!0)}else{for(l=""+Ee(l),n=null,u=0;u<e.length;u++){if(e[u].value===l){e[u].selected=!0,o&&(e[u].defaultSelected=!0);return}n!==null||e[u].disabled||(n=e[u])}n!==null&&(n.selected=!0)}}function Lr(e,n,l){if(n!=null&&(n=""+Ee(n),n!==e.value&&(e.value=n),l==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=l!=null?""+Ee(l):""}function ac(e,n,l,o){if(n==null){if(o!=null){if(l!=null)throw Error(r(92));if(ve(o)){if(1<o.length)throw Error(r(93));o=o[0]}l=o}l==null&&(l=""),n=l}l=Ee(n),e.defaultValue=l,o=e.textContent,o===l&&o!==""&&o!==null&&(e.value=o),ys(e)}function sl(e,n){if(n){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=n;return}}e.textContent=n}var Dr=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ai(e,n,l){var o=n.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?o?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":o?e.setProperty(n,l):typeof l!="number"||l===0||Dr.has(n)?n==="float"?e.cssFloat=l:e[n]=(""+l).trim():e[n]=l+"px"}function sc(e,n,l){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,l!=null){for(var o in l)!l.hasOwnProperty(o)||n!=null&&n.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var u in n)o=n[u],n.hasOwnProperty(u)&&l[u]!==o&&Ai(e,u,o)}else for(var d in n)n.hasOwnProperty(d)&&Ai(e,d,n[d])}function zr(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Id=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ld=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ri(e){return Ld.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ja(){}var Ei=null;function Ti(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wn=null,ns=null;function lc(e){var n=Lt(e);if(n&&(e=n.stateNode)){var l=e[$e]||null;e:switch(e=n.stateNode,n.type){case"input":if(ki(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),n=l.name,l.type==="radio"&&n!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Vn(""+n)+'"][type="radio"]'),n=0;n<l.length;n++){var o=l[n];if(o!==e&&o.form===e.form){var u=o[$e]||null;if(!u)throw Error(r(90));ki(o,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(n=0;n<l.length;n++)o=l[n],o.form===e.form&&xa(o)}break e;case"textarea":Lr(e,l.value,l.defaultValue);break e;case"select":n=l.value,n!=null&&xs(e,!!l.multiple,n,!1)}}}var ll=!1;function Ci(e,n,l){if(ll)return e(n,l);ll=!0;try{var o=e(n);return o}finally{if(ll=!1,(wn!==null||ns!==null)&&(Pc(),wn&&(n=wn,e=ns,ns=wn=null,lc(n),e)))for(n=0;n<e.length;n++)lc(e[n])}}function il(e,n){var l=e.stateNode;if(l===null)return null;var o=l[$e]||null;if(o===null)return null;l=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)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(r(231,n,typeof l));return l}var oa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oi=!1;if(oa)try{var js={};Object.defineProperty(js,"passive",{get:function(){Oi=!0}}),window.addEventListener("test",js,js),window.removeEventListener("test",js,js)}catch{Oi=!1}var Ba=null,qr=null,Ga=null;function $i(){if(Ga)return Ga;var e,n=qr,l=n.length,o,u="value"in Ba?Ba.value:Ba.textContent,d=u.length;for(e=0;e<l&&n[e]===u[e];e++);var _=l-e;for(o=1;o<=_&&n[l-o]===u[d-o];o++);return Ga=u.slice(e,1<o?1-o:void 0)}function Mi(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ii(){return!0}function ic(){return!1}function Sn(e){function n(l,o,u,d,_){this._reactName=l,this._targetInst=u,this.type=o,this.nativeEvent=d,this.target=_,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(l=e[j],this[j]=l?l(d):d[j]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Ii:ic,this.isPropagationStopped=ic,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ii)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ii)},persist:function(){},isPersistent:Ii}),n}var Ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gl=Sn(Ha),ws=y({},Ha,{view:0,detail:0}),rc=Sn(ws),Li,Di,an,wa=y({},ws,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zi,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==an&&(an&&e.type==="mousemove"?(Li=e.screenX-an.screenX,Di=e.screenY-an.screenY):Di=Li=0,an=e),Li)},movementY:function(e){return"movementY"in e?e.movementY:Di}}),Hl=Sn(wa),Dd=y({},wa,{dataTransfer:0}),zd=Sn(Dd),oc=y({},ws,{relatedTarget:0}),as=Sn(oc),Tn=y({},Ha,{animationName:0,elapsedTime:0,pseudoElement:0}),cc=Sn(Tn),Pn=y({},Ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),uc=Sn(Pn),Ur=y({},Ha,{data:0}),dc=Sn(Ur),Ss={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Br={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"},qd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vl(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=qd[e])?!!n[e]:!1}function zi(){return Vl}var Gr=y({},ws,{key:function(e){if(e.key){var n=Ss[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Mi(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Br[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zi,charCode:function(e){return e.type==="keypress"?Mi(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Mi(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fc=Sn(Gr),pc=y({},wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hr=Sn(pc),hc=y({},ws,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zi}),Ud=Sn(hc),Bd=y({},Ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),Gd=Sn(Bd),g=y({},wa,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),R=Sn(g),V=y({},Ha,{newState:0,oldState:0}),W=Sn(V),fe=[9,13,27,32],ne=oa&&"CompositionEvent"in window,Oe=null;oa&&"documentMode"in document&&(Oe=document.documentMode);var Ge=oa&&"TextEvent"in window&&!Oe,tt=oa&&(!ne||Oe&&8<Oe&&11>=Oe),Ns=" ",qi=!1;function Vr(e,n){switch(e){case"keyup":return fe.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ui=!1;function sj(e,n){switch(e){case"compositionend":return bm(n);case"keypress":return n.which!==32?null:(qi=!0,Ns);case"textInput":return e=n.data,e===Ns&&qi?null:e;default:return null}}function lj(e,n){if(Ui)return e==="compositionend"||!ne&&Vr(e,n)?(e=$i(),Ga=qr=Ba=null,Ui=!1,e):null;switch(e){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 tt&&n.locale!=="ko"?null:n.data;default:return null}}var ij={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 ym(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ij[e.type]:n==="textarea"}function xm(e,n,l,o){wn?ns?ns.push(o):ns=[o]:wn=o,n=au(n,"onChange"),0<n.length&&(l=new Gl("onChange","change",null,l,o),e.push({event:l,listeners:n}))}var Fr=null,Kr=null;function rj(e){av(e,0)}function mc(e){var n=cn(e);if(xa(n))return e}function jm(e,n){if(e==="change")return n}var wm=!1;if(oa){var Hd;if(oa){var Vd="oninput"in document;if(!Vd){var Sm=document.createElement("div");Sm.setAttribute("oninput","return;"),Vd=typeof Sm.oninput=="function"}Hd=Vd}else Hd=!1;wm=Hd&&(!document.documentMode||9<document.documentMode)}function Nm(){Fr&&(Fr.detachEvent("onpropertychange",km),Kr=Fr=null)}function km(e){if(e.propertyName==="value"&&mc(Kr)){var n=[];xm(n,Kr,e,Ti(e)),Ci(rj,n)}}function oj(e,n,l){e==="focusin"?(Nm(),Fr=n,Kr=l,Fr.attachEvent("onpropertychange",km)):e==="focusout"&&Nm()}function cj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return mc(Kr)}function uj(e,n){if(e==="click")return mc(n)}function dj(e,n){if(e==="input"||e==="change")return mc(n)}function fj(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var ca=typeof Object.is=="function"?Object.is:fj;function Zr(e,n){if(ca(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var l=Object.keys(e),o=Object.keys(n);if(l.length!==o.length)return!1;for(o=0;o<l.length;o++){var u=l[o];if(!Zt.call(n,u)||!ca(e[u],n[u]))return!1}return!0}function Am(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rm(e,n){var l=Am(e);e=0;for(var o;l;){if(l.nodeType===3){if(o=e+l.textContent.length,e<=n&&o>=n)return{node:l,offset:n-e};e=o}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Am(l)}}function Em(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Em(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Tm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ts(e.document);n instanceof e.HTMLIFrameElement;){try{var l=typeof n.contentWindow.location.href=="string"}catch{l=!1}if(l)e=n.contentWindow;else break;n=ts(e.document)}return n}function Fd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var pj=oa&&"documentMode"in document&&11>=document.documentMode,Bi=null,Kd=null,Yr=null,Zd=!1;function Cm(e,n,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Zd||Bi==null||Bi!==ts(o)||(o=Bi,"selectionStart"in o&&Fd(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}),Yr&&Zr(Yr,o)||(Yr=o,o=au(Kd,"onSelect"),0<o.length&&(n=new Gl("onSelect","select",null,n,l),e.push({event:n,listeners:o}),n.target=Bi)))}function Fl(e,n){var l={};return l[e.toLowerCase()]=n.toLowerCase(),l["Webkit"+e]="webkit"+n,l["Moz"+e]="moz"+n,l}var Gi={animationend:Fl("Animation","AnimationEnd"),animationiteration:Fl("Animation","AnimationIteration"),animationstart:Fl("Animation","AnimationStart"),transitionrun:Fl("Transition","TransitionRun"),transitionstart:Fl("Transition","TransitionStart"),transitioncancel:Fl("Transition","TransitionCancel"),transitionend:Fl("Transition","TransitionEnd")},Yd={},Om={};oa&&(Om=document.createElement("div").style,"AnimationEvent"in window||(delete Gi.animationend.animation,delete Gi.animationiteration.animation,delete Gi.animationstart.animation),"TransitionEvent"in window||delete Gi.transitionend.transition);function Kl(e){if(Yd[e])return Yd[e];if(!Gi[e])return e;var n=Gi[e],l;for(l in n)if(n.hasOwnProperty(l)&&l in Om)return Yd[e]=n[l];return e}var $m=Kl("animationend"),Mm=Kl("animationiteration"),Im=Kl("animationstart"),hj=Kl("transitionrun"),mj=Kl("transitionstart"),gj=Kl("transitioncancel"),Lm=Kl("transitionend"),Dm=new Map,Xd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Xd.push("scrollEnd");function Va(e,n){Dm.set(e,n),ya(n,[e])}var gc=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Sa=[],Hi=0,Pd=0;function _c(){for(var e=Hi,n=Pd=Hi=0;n<e;){var l=Sa[n];Sa[n++]=null;var o=Sa[n];Sa[n++]=null;var u=Sa[n];Sa[n++]=null;var d=Sa[n];if(Sa[n++]=null,o!==null&&u!==null){var _=o.pending;_===null?u.next=u:(u.next=_.next,_.next=u),o.pending=u}d!==0&&zm(l,u,d)}}function vc(e,n,l,o){Sa[Hi++]=e,Sa[Hi++]=n,Sa[Hi++]=l,Sa[Hi++]=o,Pd|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function Qd(e,n,l,o){return vc(e,n,l,o),bc(e)}function Zl(e,n){return vc(e,null,null,n),bc(e)}function zm(e,n,l){e.lanes|=l;var o=e.alternate;o!==null&&(o.lanes|=l);for(var u=!1,d=e.return;d!==null;)d.childLanes|=l,o=d.alternate,o!==null&&(o.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(u=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,u&&n!==null&&(u=31-Mt(l),e=d.hiddenUpdates,o=e[u],o===null?e[u]=[n]:o.push(n),n.lane=l|536870912),d):null}function bc(e){if(50<_o)throw _o=0,rp=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Vi={};function _j(e,n,l,o){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=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 ua(e,n,l,o){return new _j(e,n,l,o)}function Jd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ks(e,n){var l=e.alternate;return l===null?(l=ua(e.tag,n,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=n,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,n=e.dependencies,l.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function qm(e,n){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,n=l.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function yc(e,n,l,o,u,d){var _=0;if(o=e,typeof e=="function")Jd(e)&&(_=1);else if(typeof e=="string")_=jw(e,l,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case oe:return e=ua(31,l,n,u),e.elementType=oe,e.lanes=d,e;case T:return Yl(l.children,u,d,n);case N:_=8,u|=24;break;case I:return e=ua(12,l,n,u|2),e.elementType=I,e.lanes=d,e;case M:return e=ua(13,l,n,u),e.elementType=M,e.lanes=d,e;case D:return e=ua(19,l,n,u),e.elementType=D,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:_=10;break e;case k:_=9;break e;case E:_=11;break e;case F:_=14;break e;case te:_=16,o=null;break e}_=29,l=Error(r(130,e===null?"null":typeof e,"")),o=null}return n=ua(_,l,n,u),n.elementType=e,n.type=o,n.lanes=d,n}function Yl(e,n,l,o){return e=ua(7,e,o,n),e.lanes=l,e}function Wd(e,n,l){return e=ua(6,e,null,n),e.lanes=l,e}function Um(e){var n=ua(18,null,null,0);return n.stateNode=e,n}function ef(e,n,l){return n=ua(4,e.children!==null?e.children:[],e.key,n),n.lanes=l,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Bm=new WeakMap;function Na(e,n){if(typeof e=="object"&&e!==null){var l=Bm.get(e);return l!==void 0?l:(n={value:e,source:n,stack:Wt(n)},Bm.set(e,n),n)}return{value:e,source:n,stack:Wt(n)}}var Fi=[],Ki=0,xc=null,Xr=0,ka=[],Aa=0,rl=null,ss=1,ls="";function As(e,n){Fi[Ki++]=Xr,Fi[Ki++]=xc,xc=e,Xr=n}function Gm(e,n,l){ka[Aa++]=ss,ka[Aa++]=ls,ka[Aa++]=rl,rl=e;var o=ss;e=ls;var u=32-Mt(o)-1;o&=~(1<<u),l+=1;var d=32-Mt(n)+u;if(30<d){var _=u-u%5;d=(o&(1<<_)-1).toString(32),o>>=_,u-=_,ss=1<<32-Mt(n)+u|l<<u|o,ls=d+e}else ss=1<<d|l<<u|o,ls=e}function tf(e){e.return!==null&&(As(e,1),Gm(e,1,0))}function nf(e){for(;e===xc;)xc=Fi[--Ki],Fi[Ki]=null,Xr=Fi[--Ki],Fi[Ki]=null;for(;e===rl;)rl=ka[--Aa],ka[Aa]=null,ls=ka[--Aa],ka[Aa]=null,ss=ka[--Aa],ka[Aa]=null}function Hm(e,n){ka[Aa++]=ss,ka[Aa++]=ls,ka[Aa++]=rl,ss=n.id,ls=n.overflow,rl=e}var Cn=null,zt=null,ut=!1,ol=null,Ra=!1,af=Error(r(519));function cl(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Pr(Na(n,e)),af}function Vm(e){var n=e.stateNode,l=e.type,o=e.memoizedProps;switch(n[ke]=e,n[$e]=o,l){case"dialog":at("cancel",n),at("close",n);break;case"iframe":case"object":case"embed":at("load",n);break;case"video":case"audio":for(l=0;l<bo.length;l++)at(bo[l],n);break;case"source":at("error",n);break;case"img":case"image":case"link":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"input":at("invalid",n),nc(n,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":at("invalid",n);break;case"textarea":at("invalid",n),ac(n,o.value,o.defaultValue,o.children)}l=o.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||n.textContent===""+l||o.suppressHydrationWarning===!0||rv(n.textContent,l)?(o.popover!=null&&(at("beforetoggle",n),at("toggle",n)),o.onScroll!=null&&at("scroll",n),o.onScrollEnd!=null&&at("scrollend",n),o.onClick!=null&&(n.onclick=ja),n=!0):n=!1,n||cl(e,!0)}function Fm(e){for(Cn=e.return;Cn;)switch(Cn.tag){case 5:case 31:case 13:Ra=!1;return;case 27:case 3:Ra=!0;return;default:Cn=Cn.return}}function Zi(e){if(e!==Cn)return!1;if(!ut)return Fm(e),ut=!0,!1;var n=e.tag,l;if((l=n!==3&&n!==27)&&((l=n===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||jp(e.type,e.memoizedProps)),l=!l),l&&zt&&cl(e),Fm(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));zt=gv(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));zt=gv(e)}else n===27?(n=zt,wl(e.type)?(e=Ap,Ap=null,zt=e):zt=n):zt=Cn?Ta(e.stateNode.nextSibling):null;return!0}function Xl(){zt=Cn=null,ut=!1}function sf(){var e=ol;return e!==null&&(ea===null?ea=e:ea.push.apply(ea,e),ol=null),e}function Pr(e){ol===null?ol=[e]:ol.push(e)}var lf=S(null),Pl=null,Rs=null;function ul(e,n,l){B(lf,n._currentValue),n._currentValue=l}function Es(e){e._currentValue=lf.current,L(lf)}function rf(e,n,l){for(;e!==null;){var o=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,o!==null&&(o.childLanes|=n)):o!==null&&(o.childLanes&n)!==n&&(o.childLanes|=n),e===l)break;e=e.return}}function of(e,n,l,o){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var d=u.dependencies;if(d!==null){var _=u.child;d=d.firstContext;e:for(;d!==null;){var j=d;d=u;for(var O=0;O<n.length;O++)if(j.context===n[O]){d.lanes|=l,j=d.alternate,j!==null&&(j.lanes|=l),rf(d.return,l,e),o||(_=null);break e}d=j.next}}else if(u.tag===18){if(_=u.return,_===null)throw Error(r(341));_.lanes|=l,d=_.alternate,d!==null&&(d.lanes|=l),rf(_,l,e),_=null}else _=u.child;if(_!==null)_.return=u;else for(_=u;_!==null;){if(_===e){_=null;break}if(u=_.sibling,u!==null){u.return=_.return,_=u;break}_=_.return}u=_}}function Yi(e,n,l,o){e=null;for(var u=n,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var _=u.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var j=u.type;ca(u.pendingProps.value,_.value)||(e!==null?e.push(j):e=[j])}}else if(u===pe.current){if(_=u.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(So):e=[So])}u=u.return}e!==null&&of(n,e,l,o),n.flags|=262144}function jc(e){for(e=e.firstContext;e!==null;){if(!ca(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ql(e){Pl=e,Rs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function On(e){return Km(Pl,e)}function wc(e,n){return Pl===null&&Ql(e),Km(e,n)}function Km(e,n){var l=n._currentValue;if(n={context:n,memoizedValue:l,next:null},Rs===null){if(e===null)throw Error(r(308));Rs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Rs=Rs.next=n;return l}var vj=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(l,o){e.push(o)}};this.abort=function(){n.aborted=!0,e.forEach(function(l){return l()})}},bj=t.unstable_scheduleCallback,yj=t.unstable_NormalPriority,un={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cf(){return{controller:new vj,data:new Map,refCount:0}}function Qr(e){e.refCount--,e.refCount===0&&bj(yj,function(){e.controller.abort()})}var Jr=null,uf=0,Xi=0,Pi=null;function xj(e,n){if(Jr===null){var l=Jr=[];uf=0,Xi=pp(),Pi={status:"pending",value:void 0,then:function(o){l.push(o)}}}return uf++,n.then(Zm,Zm),n}function Zm(){if(--uf===0&&Jr!==null){Pi!==null&&(Pi.status="fulfilled");var e=Jr;Jr=null,Xi=0,Pi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function jj(e,n){var l=[],o={status:"pending",value:null,reason:null,then:function(u){l.push(u)}};return e.then(function(){o.status="fulfilled",o.value=n;for(var u=0;u<l.length;u++)(0,l[u])(n)},function(u){for(o.status="rejected",o.reason=u,u=0;u<l.length;u++)(0,l[u])(void 0)}),o}var Ym=$.S;$.S=function(e,n){C_=rt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&xj(e,n),Ym!==null&&Ym(e,n)};var Jl=S(null);function df(){var e=Jl.current;return e!==null?e:Ot.pooledCache}function Sc(e,n){n===null?B(Jl,Jl.current):B(Jl,n.pool)}function Xm(){var e=df();return e===null?null:{parent:un._currentValue,pool:e}}var Qi=Error(r(460)),ff=Error(r(474)),Nc=Error(r(542)),kc={then:function(){}};function Pm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Qm(e,n,l){switch(l=e[l],l===void 0?e.push(n):l!==n&&(n.then(ja,ja),n=l),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Wm(e),e;default:if(typeof n.status=="string")n.then(ja,ja);else{if(e=Ot,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(o){if(n.status==="pending"){var u=n;u.status="fulfilled",u.value=o}},function(o){if(n.status==="pending"){var u=n;u.status="rejected",u.reason=o}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Wm(e),e}throw ei=n,Qi}}function Wl(e){try{var n=e._init;return n(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ei=l,Qi):l}}var ei=null;function Jm(){if(ei===null)throw Error(r(459));var e=ei;return ei=null,e}function Wm(e){if(e===Qi||e===Nc)throw Error(r(483))}var Ji=null,Wr=0;function Ac(e){var n=Wr;return Wr+=1,Ji===null&&(Ji=[]),Qm(Ji,e,n)}function eo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Rc(e,n){throw n.$$typeof===A?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function eg(e){function n(G,U){if(e){var K=G.deletions;K===null?(G.deletions=[U],G.flags|=16):K.push(U)}}function l(G,U){if(!e)return null;for(;U!==null;)n(G,U),U=U.sibling;return null}function o(G){for(var U=new Map;G!==null;)G.key!==null?U.set(G.key,G):U.set(G.index,G),G=G.sibling;return U}function u(G,U){return G=ks(G,U),G.index=0,G.sibling=null,G}function d(G,U,K){return G.index=K,e?(K=G.alternate,K!==null?(K=K.index,K<U?(G.flags|=67108866,U):K):(G.flags|=67108866,U)):(G.flags|=1048576,U)}function _(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function j(G,U,K,se){return U===null||U.tag!==6?(U=Wd(K,G.mode,se),U.return=G,U):(U=u(U,K),U.return=G,U)}function O(G,U,K,se){var De=K.type;return De===T?J(G,U,K.props.children,se,K.key):U!==null&&(U.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===te&&Wl(De)===U.type)?(U=u(U,K.props),eo(U,K),U.return=G,U):(U=yc(K.type,K.key,K.props,null,G.mode,se),eo(U,K),U.return=G,U)}function Z(G,U,K,se){return U===null||U.tag!==4||U.stateNode.containerInfo!==K.containerInfo||U.stateNode.implementation!==K.implementation?(U=ef(K,G.mode,se),U.return=G,U):(U=u(U,K.children||[]),U.return=G,U)}function J(G,U,K,se,De){return U===null||U.tag!==7?(U=Yl(K,G.mode,se,De),U.return=G,U):(U=u(U,K),U.return=G,U)}function re(G,U,K){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=Wd(""+U,G.mode,K),U.return=G,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case w:return K=yc(U.type,U.key,U.props,null,G.mode,K),eo(K,U),K.return=G,K;case C:return U=ef(U,G.mode,K),U.return=G,U;case te:return U=Wl(U),re(G,U,K)}if(ve(U)||_e(U))return U=Yl(U,G.mode,K,null),U.return=G,U;if(typeof U.then=="function")return re(G,Ac(U),K);if(U.$$typeof===q)return re(G,wc(G,U),K);Rc(G,U)}return null}function Y(G,U,K,se){var De=U!==null?U.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return De!==null?null:j(G,U,""+K,se);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case w:return K.key===De?O(G,U,K,se):null;case C:return K.key===De?Z(G,U,K,se):null;case te:return K=Wl(K),Y(G,U,K,se)}if(ve(K)||_e(K))return De!==null?null:J(G,U,K,se,null);if(typeof K.then=="function")return Y(G,U,Ac(K),se);if(K.$$typeof===q)return Y(G,U,wc(G,K),se);Rc(G,K)}return null}function X(G,U,K,se,De){if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return G=G.get(K)||null,j(U,G,""+se,De);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case w:return G=G.get(se.key===null?K:se.key)||null,O(U,G,se,De);case C:return G=G.get(se.key===null?K:se.key)||null,Z(U,G,se,De);case te:return se=Wl(se),X(G,U,K,se,De)}if(ve(se)||_e(se))return G=G.get(K)||null,J(U,G,se,De,null);if(typeof se.then=="function")return X(G,U,K,Ac(se),De);if(se.$$typeof===q)return X(G,U,K,wc(U,se),De);Rc(U,se)}return null}function Te(G,U,K,se){for(var De=null,vt=null,Me=U,Pe=U=0,lt=null;Me!==null&&Pe<K.length;Pe++){Me.index>Pe?(lt=Me,Me=null):lt=Me.sibling;var bt=Y(G,Me,K[Pe],se);if(bt===null){Me===null&&(Me=lt);break}e&&Me&&bt.alternate===null&&n(G,Me),U=d(bt,U,Pe),vt===null?De=bt:vt.sibling=bt,vt=bt,Me=lt}if(Pe===K.length)return l(G,Me),ut&&As(G,Pe),De;if(Me===null){for(;Pe<K.length;Pe++)Me=re(G,K[Pe],se),Me!==null&&(U=d(Me,U,Pe),vt===null?De=Me:vt.sibling=Me,vt=Me);return ut&&As(G,Pe),De}for(Me=o(Me);Pe<K.length;Pe++)lt=X(Me,G,Pe,K[Pe],se),lt!==null&&(e&<.alternate!==null&&Me.delete(lt.key===null?Pe:lt.key),U=d(lt,U,Pe),vt===null?De=lt:vt.sibling=lt,vt=lt);return e&&Me.forEach(function(Rl){return n(G,Rl)}),ut&&As(G,Pe),De}function ze(G,U,K,se){if(K==null)throw Error(r(151));for(var De=null,vt=null,Me=U,Pe=U=0,lt=null,bt=K.next();Me!==null&&!bt.done;Pe++,bt=K.next()){Me.index>Pe?(lt=Me,Me=null):lt=Me.sibling;var Rl=Y(G,Me,bt.value,se);if(Rl===null){Me===null&&(Me=lt);break}e&&Me&&Rl.alternate===null&&n(G,Me),U=d(Rl,U,Pe),vt===null?De=Rl:vt.sibling=Rl,vt=Rl,Me=lt}if(bt.done)return l(G,Me),ut&&As(G,Pe),De;if(Me===null){for(;!bt.done;Pe++,bt=K.next())bt=re(G,bt.value,se),bt!==null&&(U=d(bt,U,Pe),vt===null?De=bt:vt.sibling=bt,vt=bt);return ut&&As(G,Pe),De}for(Me=o(Me);!bt.done;Pe++,bt=K.next())bt=X(Me,G,Pe,bt.value,se),bt!==null&&(e&&bt.alternate!==null&&Me.delete(bt.key===null?Pe:bt.key),U=d(bt,U,Pe),vt===null?De=bt:vt.sibling=bt,vt=bt);return e&&Me.forEach(function($w){return n(G,$w)}),ut&&As(G,Pe),De}function Et(G,U,K,se){if(typeof K=="object"&&K!==null&&K.type===T&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case w:e:{for(var De=K.key;U!==null;){if(U.key===De){if(De=K.type,De===T){if(U.tag===7){l(G,U.sibling),se=u(U,K.props.children),se.return=G,G=se;break e}}else if(U.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===te&&Wl(De)===U.type){l(G,U.sibling),se=u(U,K.props),eo(se,K),se.return=G,G=se;break e}l(G,U);break}else n(G,U);U=U.sibling}K.type===T?(se=Yl(K.props.children,G.mode,se,K.key),se.return=G,G=se):(se=yc(K.type,K.key,K.props,null,G.mode,se),eo(se,K),se.return=G,G=se)}return _(G);case C:e:{for(De=K.key;U!==null;){if(U.key===De)if(U.tag===4&&U.stateNode.containerInfo===K.containerInfo&&U.stateNode.implementation===K.implementation){l(G,U.sibling),se=u(U,K.children||[]),se.return=G,G=se;break e}else{l(G,U);break}else n(G,U);U=U.sibling}se=ef(K,G.mode,se),se.return=G,G=se}return _(G);case te:return K=Wl(K),Et(G,U,K,se)}if(ve(K))return Te(G,U,K,se);if(_e(K)){if(De=_e(K),typeof De!="function")throw Error(r(150));return K=De.call(K),ze(G,U,K,se)}if(typeof K.then=="function")return Et(G,U,Ac(K),se);if(K.$$typeof===q)return Et(G,U,wc(G,K),se);Rc(G,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,U!==null&&U.tag===6?(l(G,U.sibling),se=u(U,K),se.return=G,G=se):(l(G,U),se=Wd(K,G.mode,se),se.return=G,G=se),_(G)):l(G,U)}return function(G,U,K,se){try{Wr=0;var De=Et(G,U,K,se);return Ji=null,De}catch(Me){if(Me===Qi||Me===Nc)throw Me;var vt=ua(29,Me,null,G.mode);return vt.lanes=se,vt.return=G,vt}}}var ti=eg(!0),tg=eg(!1),dl=!1;function pf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function hf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function fl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function pl(e,n,l){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(yt&2)!==0){var u=o.pending;return u===null?n.next=n:(n.next=u.next,u.next=n),o.pending=n,n=bc(e),zm(e,null,l),n}return vc(e,o,n,l),bc(e)}function to(e,n,l){if(n=n.updateQueue,n!==null&&(n=n.shared,(l&4194048)!==0)){var o=n.lanes;o&=e.pendingLanes,l|=o,n.lanes=l,qa(e,l)}}function mf(e,n){var l=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,l===o)){var u=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var _={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?u=d=_:d=d.next=_,l=l.next}while(l!==null);d===null?u=d=n:d=d.next=n}else u=d=n;l={baseState:o.baseState,firstBaseUpdate:u,lastBaseUpdate:d,shared:o.shared,callbacks:o.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=n:e.next=n,l.lastBaseUpdate=n}var gf=!1;function no(){if(gf){var e=Pi;if(e!==null)throw e}}function ao(e,n,l,o){gf=!1;var u=e.updateQueue;dl=!1;var d=u.firstBaseUpdate,_=u.lastBaseUpdate,j=u.shared.pending;if(j!==null){u.shared.pending=null;var O=j,Z=O.next;O.next=null,_===null?d=Z:_.next=Z,_=O;var J=e.alternate;J!==null&&(J=J.updateQueue,j=J.lastBaseUpdate,j!==_&&(j===null?J.firstBaseUpdate=Z:j.next=Z,J.lastBaseUpdate=O))}if(d!==null){var re=u.baseState;_=0,J=Z=O=null,j=d;do{var Y=j.lane&-536870913,X=Y!==j.lane;if(X?(st&Y)===Y:(o&Y)===Y){Y!==0&&Y===Xi&&(gf=!0),J!==null&&(J=J.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var Te=e,ze=j;Y=n;var Et=l;switch(ze.tag){case 1:if(Te=ze.payload,typeof Te=="function"){re=Te.call(Et,re,Y);break e}re=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=ze.payload,Y=typeof Te=="function"?Te.call(Et,re,Y):Te,Y==null)break e;re=y({},re,Y);break e;case 2:dl=!0}}Y=j.callback,Y!==null&&(e.flags|=64,X&&(e.flags|=8192),X=u.callbacks,X===null?u.callbacks=[Y]:X.push(Y))}else X={lane:Y,tag:j.tag,payload:j.payload,callback:j.callback,next:null},J===null?(Z=J=X,O=re):J=J.next=X,_|=Y;if(j=j.next,j===null){if(j=u.shared.pending,j===null)break;X=j,j=X.next,X.next=null,u.lastBaseUpdate=X,u.shared.pending=null}}while(!0);J===null&&(O=re),u.baseState=O,u.firstBaseUpdate=Z,u.lastBaseUpdate=J,d===null&&(u.shared.lanes=0),vl|=_,e.lanes=_,e.memoizedState=re}}function ng(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function ag(e,n){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)ng(l[e],n)}var Wi=S(null),Ec=S(0);function sg(e,n){e=zs,B(Ec,e),B(Wi,n),zs=e|n.baseLanes}function _f(){B(Ec,zs),B(Wi,Wi.current)}function vf(){zs=Ec.current,L(Wi),L(Ec)}var da=S(null),Ea=null;function hl(e){var n=e.alternate;B(sn,sn.current&1),B(da,e),Ea===null&&(n===null||Wi.current!==null||n.memoizedState!==null)&&(Ea=e)}function bf(e){B(sn,sn.current),B(da,e),Ea===null&&(Ea=e)}function lg(e){e.tag===22?(B(sn,sn.current),B(da,e),Ea===null&&(Ea=e)):ml()}function ml(){B(sn,sn.current),B(da,da.current)}function fa(e){L(da),Ea===e&&(Ea=null),L(sn)}var sn=S(0);function Tc(e){for(var n=e;n!==null;){if(n.tag===13){var l=n.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Np(l)||kp(l)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Ts=0,Ze=null,At=null,dn=null,Cc=!1,er=!1,ni=!1,Oc=0,so=0,tr=null,wj=0;function Yt(){throw Error(r(321))}function yf(e,n){if(n===null)return!1;for(var l=0;l<n.length&&l<e.length;l++)if(!ca(e[l],n[l]))return!1;return!0}function xf(e,n,l,o,u,d){return Ts=d,Ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,$.H=e===null||e.memoizedState===null?Gg:Lf,ni=!1,d=l(o,u),ni=!1,er&&(d=rg(n,l,o,u)),ig(e),d}function ig(e){$.H=ro;var n=At!==null&&At.next!==null;if(Ts=0,dn=At=Ze=null,Cc=!1,so=0,tr=null,n)throw Error(r(300));e===null||fn||(e=e.dependencies,e!==null&&jc(e)&&(fn=!0))}function rg(e,n,l,o){Ze=e;var u=0;do{if(er&&(tr=null),so=0,er=!1,25<=u)throw Error(r(301));if(u+=1,dn=At=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}$.H=Hg,d=n(l,o)}while(er);return d}function Sj(){var e=$.H,n=e.useState()[0];return n=typeof n.then=="function"?lo(n):n,e=e.useState()[0],(At!==null?At.memoizedState:null)!==e&&(Ze.flags|=1024),n}function jf(){var e=Oc!==0;return Oc=0,e}function wf(e,n,l){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~l}function Sf(e){if(Cc){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Cc=!1}Ts=0,dn=At=Ze=null,er=!1,so=Oc=0,tr=null}function Fn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dn===null?Ze.memoizedState=dn=e:dn=dn.next=e,dn}function ln(){if(At===null){var e=Ze.alternate;e=e!==null?e.memoizedState:null}else e=At.next;var n=dn===null?Ze.memoizedState:dn.next;if(n!==null)dn=n,At=e;else{if(e===null)throw Ze.alternate===null?Error(r(467)):Error(r(310));At=e,e={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},dn===null?Ze.memoizedState=dn=e:dn=dn.next=e}return dn}function $c(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lo(e){var n=so;return so+=1,tr===null&&(tr=[]),e=Qm(tr,e,n),n=Ze,(dn===null?n.memoizedState:dn.next)===null&&(n=n.alternate,$.H=n===null||n.memoizedState===null?Gg:Lf),e}function Mc(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return lo(e);if(e.$$typeof===q)return On(e)}throw Error(r(438,String(e)))}function Nf(e){var n=null,l=Ze.updateQueue;if(l!==null&&(n=l.memoCache),n==null){var o=Ze.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(n={data:o.data.map(function(u){return u.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),l===null&&(l=$c(),Ze.updateQueue=l),l.memoCache=n,l=n.data[n.index],l===void 0)for(l=n.data[n.index]=Array(e),o=0;o<e;o++)l[o]=P;return n.index++,l}function Cs(e,n){return typeof n=="function"?n(e):n}function Ic(e){var n=ln();return kf(n,At,e)}function kf(e,n,l){var o=e.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=l;var u=e.baseQueue,d=o.pending;if(d!==null){if(u!==null){var _=u.next;u.next=d.next,d.next=_}n.baseQueue=u=d,o.pending=null}if(d=e.baseState,u===null)e.memoizedState=d;else{n=u.next;var j=_=null,O=null,Z=n,J=!1;do{var re=Z.lane&-536870913;if(re!==Z.lane?(st&re)===re:(Ts&re)===re){var Y=Z.revertLane;if(Y===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),re===Xi&&(J=!0);else if((Ts&Y)===Y){Z=Z.next,Y===Xi&&(J=!0);continue}else re={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},O===null?(j=O=re,_=d):O=O.next=re,Ze.lanes|=Y,vl|=Y;re=Z.action,ni&&l(d,re),d=Z.hasEagerState?Z.eagerState:l(d,re)}else Y={lane:re,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},O===null?(j=O=Y,_=d):O=O.next=Y,Ze.lanes|=re,vl|=re;Z=Z.next}while(Z!==null&&Z!==n);if(O===null?_=d:O.next=j,!ca(d,e.memoizedState)&&(fn=!0,J&&(l=Pi,l!==null)))throw l;e.memoizedState=d,e.baseState=_,e.baseQueue=O,o.lastRenderedState=d}return u===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Af(e){var n=ln(),l=n.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=e;var o=l.dispatch,u=l.pending,d=n.memoizedState;if(u!==null){l.pending=null;var _=u=u.next;do d=e(d,_.action),_=_.next;while(_!==u);ca(d,n.memoizedState)||(fn=!0),n.memoizedState=d,n.baseQueue===null&&(n.baseState=d),l.lastRenderedState=d}return[d,o]}function og(e,n,l){var o=Ze,u=ln(),d=ut;if(d){if(l===void 0)throw Error(r(407));l=l()}else l=n();var _=!ca((At||u).memoizedState,l);if(_&&(u.memoizedState=l,fn=!0),u=u.queue,Tf(dg.bind(null,o,u,e),[e]),u.getSnapshot!==n||_||dn!==null&&dn.memoizedState.tag&1){if(o.flags|=2048,nr(9,{destroy:void 0},ug.bind(null,o,u,l,n),null),Ot===null)throw Error(r(349));d||(Ts&127)!==0||cg(o,n,l)}return l}function cg(e,n,l){e.flags|=16384,e={getSnapshot:n,value:l},n=Ze.updateQueue,n===null?(n=$c(),Ze.updateQueue=n,n.stores=[e]):(l=n.stores,l===null?n.stores=[e]:l.push(e))}function ug(e,n,l,o){n.value=l,n.getSnapshot=o,fg(n)&&pg(e)}function dg(e,n,l){return l(function(){fg(n)&&pg(e)})}function fg(e){var n=e.getSnapshot;e=e.value;try{var l=n();return!ca(e,l)}catch{return!0}}function pg(e){var n=Zl(e,2);n!==null&&ta(n,e,2)}function Rf(e){var n=Fn();if(typeof e=="function"){var l=e;if(e=l(),ni){kt(!0);try{l()}finally{kt(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:e},n}function hg(e,n,l,o){return e.baseState=l,kf(e,At,typeof o=="function"?o:Cs)}function Nj(e,n,l,o,u){if(zc(e))throw Error(r(485));if(e=n.action,e!==null){var d={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){d.listeners.push(_)}};$.T!==null?l(!0):d.isTransition=!1,o(d),l=n.pending,l===null?(d.next=n.pending=d,mg(n,d)):(d.next=l.next,n.pending=l.next=d)}}function mg(e,n){var l=n.action,o=n.payload,u=e.state;if(n.isTransition){var d=$.T,_={};$.T=_;try{var j=l(u,o),O=$.S;O!==null&&O(_,j),gg(e,n,j)}catch(Z){Ef(e,n,Z)}finally{d!==null&&_.types!==null&&(d.types=_.types),$.T=d}}else try{d=l(u,o),gg(e,n,d)}catch(Z){Ef(e,n,Z)}}function gg(e,n,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){_g(e,n,o)},function(o){return Ef(e,n,o)}):_g(e,n,l)}function _g(e,n,l){n.status="fulfilled",n.value=l,vg(n),e.state=l,n=e.pending,n!==null&&(l=n.next,l===n?e.pending=null:(l=l.next,n.next=l,mg(e,l)))}function Ef(e,n,l){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do n.status="rejected",n.reason=l,vg(n),n=n.next;while(n!==o)}e.action=null}function vg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function bg(e,n){return n}function yg(e,n){if(ut){var l=Ot.formState;if(l!==null){e:{var o=Ze;if(ut){if(zt){t:{for(var u=zt,d=Ra;u.nodeType!==8;){if(!d){u=null;break t}if(u=Ta(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){zt=Ta(u.nextSibling),o=u.data==="F!";break e}}cl(o)}o=!1}o&&(n=l[0])}}return l=Fn(),l.memoizedState=l.baseState=n,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bg,lastRenderedState:n},l.queue=o,l=qg.bind(null,Ze,o),o.dispatch=l,o=Rf(!1),d=If.bind(null,Ze,!1,o.queue),o=Fn(),u={state:n,dispatch:null,action:e,pending:null},o.queue=u,l=Nj.bind(null,Ze,u,d,l),u.dispatch=l,o.memoizedState=e,[n,l,!1]}function xg(e){var n=ln();return jg(n,At,e)}function jg(e,n,l){if(n=kf(e,n,bg)[0],e=Ic(Cs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var o=lo(n)}catch(_){throw _===Qi?Nc:_}else o=n;n=ln();var u=n.queue,d=u.dispatch;return l!==n.memoizedState&&(Ze.flags|=2048,nr(9,{destroy:void 0},kj.bind(null,u,l),null)),[o,d,e]}function kj(e,n){e.action=n}function wg(e){var n=ln(),l=At;if(l!==null)return jg(n,l,e);ln(),n=n.memoizedState,l=ln();var o=l.queue.dispatch;return l.memoizedState=e,[n,o,!1]}function nr(e,n,l,o){return e={tag:e,create:l,deps:o,inst:n,next:null},n=Ze.updateQueue,n===null&&(n=$c(),Ze.updateQueue=n),l=n.lastEffect,l===null?n.lastEffect=e.next=e:(o=l.next,l.next=e,e.next=o,n.lastEffect=e),e}function Sg(){return ln().memoizedState}function Lc(e,n,l,o){var u=Fn();Ze.flags|=e,u.memoizedState=nr(1|n,{destroy:void 0},l,o===void 0?null:o)}function Dc(e,n,l,o){var u=ln();o=o===void 0?null:o;var d=u.memoizedState.inst;At!==null&&o!==null&&yf(o,At.memoizedState.deps)?u.memoizedState=nr(n,d,l,o):(Ze.flags|=e,u.memoizedState=nr(1|n,d,l,o))}function Ng(e,n){Lc(8390656,8,e,n)}function Tf(e,n){Dc(2048,8,e,n)}function Aj(e){Ze.flags|=4;var n=Ze.updateQueue;if(n===null)n=$c(),Ze.updateQueue=n,n.events=[e];else{var l=n.events;l===null?n.events=[e]:l.push(e)}}function kg(e){var n=ln().memoizedState;return Aj({ref:n,nextImpl:e}),function(){if((yt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Ag(e,n){return Dc(4,2,e,n)}function Rg(e,n){return Dc(4,4,e,n)}function Eg(e,n){if(typeof n=="function"){e=e();var l=n(e);return function(){typeof l=="function"?l():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Tg(e,n,l){l=l!=null?l.concat([e]):null,Dc(4,4,Eg.bind(null,n,e),l)}function Cf(){}function Cg(e,n){var l=ln();n=n===void 0?null:n;var o=l.memoizedState;return n!==null&&yf(n,o[1])?o[0]:(l.memoizedState=[e,n],e)}function Og(e,n){var l=ln();n=n===void 0?null:n;var o=l.memoizedState;if(n!==null&&yf(n,o[1]))return o[0];if(o=e(),ni){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[o,n],o}function Of(e,n,l){return l===void 0||(Ts&1073741824)!==0&&(st&261930)===0?e.memoizedState=n:(e.memoizedState=l,e=$_(),Ze.lanes|=e,vl|=e,l)}function $g(e,n,l,o){return ca(l,n)?l:Wi.current!==null?(e=Of(e,l,o),ca(e,n)||(fn=!0),e):(Ts&42)===0||(Ts&1073741824)!==0&&(st&261930)===0?(fn=!0,e.memoizedState=l):(e=$_(),Ze.lanes|=e,vl|=e,n)}function Mg(e,n,l,o,u){var d=ae.p;ae.p=d!==0&&8>d?d:8;var _=$.T,j={};$.T=j,If(e,!1,n,l);try{var O=u(),Z=$.S;if(Z!==null&&Z(j,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var J=jj(O,o);io(e,n,J,ma(e))}else io(e,n,o,ma(e))}catch(re){io(e,n,{then:function(){},status:"rejected",reason:re},ma())}finally{ae.p=d,_!==null&&j.types!==null&&(_.types=j.types),$.T=_}}function Rj(){}function $f(e,n,l,o){if(e.tag!==5)throw Error(r(476));var u=Ig(e).queue;Mg(e,u,n,ce,l===null?Rj:function(){return Lg(e),l(o)})}function Ig(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:ce},next:null};var l={};return n.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Cs,lastRenderedState:l},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Lg(e){var n=Ig(e);n.next===null&&(n=e.alternate.memoizedState),io(e,n.next.queue,{},ma())}function Mf(){return On(So)}function Dg(){return ln().memoizedState}function zg(){return ln().memoizedState}function Ej(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var l=ma();e=fl(l);var o=pl(n,e,l);o!==null&&(ta(o,n,l),to(o,n,l)),n={cache:cf()},e.payload=n;return}n=n.return}}function Tj(e,n,l){var o=ma();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},zc(e)?Ug(n,l):(l=Qd(e,n,l,o),l!==null&&(ta(l,e,o),Bg(l,n,o)))}function qg(e,n,l){var o=ma();io(e,n,l,o)}function io(e,n,l,o){var u={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(zc(e))Ug(n,u);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=n.lastRenderedReducer,d!==null))try{var _=n.lastRenderedState,j=d(_,l);if(u.hasEagerState=!0,u.eagerState=j,ca(j,_))return vc(e,n,u,0),Ot===null&&_c(),!1}catch{}if(l=Qd(e,n,u,o),l!==null)return ta(l,e,o),Bg(l,n,o),!0}return!1}function If(e,n,l,o){if(o={lane:2,revertLane:pp(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},zc(e)){if(n)throw Error(r(479))}else n=Qd(e,l,o,2),n!==null&&ta(n,e,2)}function zc(e){var n=e.alternate;return e===Ze||n!==null&&n===Ze}function Ug(e,n){er=Cc=!0;var l=e.pending;l===null?n.next=n:(n.next=l.next,l.next=n),e.pending=n}function Bg(e,n,l){if((l&4194048)!==0){var o=n.lanes;o&=e.pendingLanes,l|=o,n.lanes=l,qa(e,l)}}var ro={readContext:On,use:Mc,useCallback:Yt,useContext:Yt,useEffect:Yt,useImperativeHandle:Yt,useLayoutEffect:Yt,useInsertionEffect:Yt,useMemo:Yt,useReducer:Yt,useRef:Yt,useState:Yt,useDebugValue:Yt,useDeferredValue:Yt,useTransition:Yt,useSyncExternalStore:Yt,useId:Yt,useHostTransitionStatus:Yt,useFormState:Yt,useActionState:Yt,useOptimistic:Yt,useMemoCache:Yt,useCacheRefresh:Yt};ro.useEffectEvent=Yt;var Gg={readContext:On,use:Mc,useCallback:function(e,n){return Fn().memoizedState=[e,n===void 0?null:n],e},useContext:On,useEffect:Ng,useImperativeHandle:function(e,n,l){l=l!=null?l.concat([e]):null,Lc(4194308,4,Eg.bind(null,n,e),l)},useLayoutEffect:function(e,n){return Lc(4194308,4,e,n)},useInsertionEffect:function(e,n){Lc(4,2,e,n)},useMemo:function(e,n){var l=Fn();n=n===void 0?null:n;var o=e();if(ni){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[o,n],o},useReducer:function(e,n,l){var o=Fn();if(l!==void 0){var u=l(n);if(ni){kt(!0);try{l(n)}finally{kt(!1)}}}else u=n;return o.memoizedState=o.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},o.queue=e,e=e.dispatch=Tj.bind(null,Ze,e),[o.memoizedState,e]},useRef:function(e){var n=Fn();return e={current:e},n.memoizedState=e},useState:function(e){e=Rf(e);var n=e.queue,l=qg.bind(null,Ze,n);return n.dispatch=l,[e.memoizedState,l]},useDebugValue:Cf,useDeferredValue:function(e,n){var l=Fn();return Of(l,e,n)},useTransition:function(){var e=Rf(!1);return e=Mg.bind(null,Ze,e.queue,!0,!1),Fn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,l){var o=Ze,u=Fn();if(ut){if(l===void 0)throw Error(r(407));l=l()}else{if(l=n(),Ot===null)throw Error(r(349));(st&127)!==0||cg(o,n,l)}u.memoizedState=l;var d={value:l,getSnapshot:n};return u.queue=d,Ng(dg.bind(null,o,d,e),[e]),o.flags|=2048,nr(9,{destroy:void 0},ug.bind(null,o,d,l,n),null),l},useId:function(){var e=Fn(),n=Ot.identifierPrefix;if(ut){var l=ls,o=ss;l=(o&~(1<<32-Mt(o)-1)).toString(32)+l,n="_"+n+"R_"+l,l=Oc++,0<l&&(n+="H"+l.toString(32)),n+="_"}else l=wj++,n="_"+n+"r_"+l.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Mf,useFormState:yg,useActionState:yg,useOptimistic:function(e){var n=Fn();n.memoizedState=n.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=l,n=If.bind(null,Ze,!0,l),l.dispatch=n,[e,n]},useMemoCache:Nf,useCacheRefresh:function(){return Fn().memoizedState=Ej.bind(null,Ze)},useEffectEvent:function(e){var n=Fn(),l={impl:e};return n.memoizedState=l,function(){if((yt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},Lf={readContext:On,use:Mc,useCallback:Cg,useContext:On,useEffect:Tf,useImperativeHandle:Tg,useInsertionEffect:Ag,useLayoutEffect:Rg,useMemo:Og,useReducer:Ic,useRef:Sg,useState:function(){return Ic(Cs)},useDebugValue:Cf,useDeferredValue:function(e,n){var l=ln();return $g(l,At.memoizedState,e,n)},useTransition:function(){var e=Ic(Cs)[0],n=ln().memoizedState;return[typeof e=="boolean"?e:lo(e),n]},useSyncExternalStore:og,useId:Dg,useHostTransitionStatus:Mf,useFormState:xg,useActionState:xg,useOptimistic:function(e,n){var l=ln();return hg(l,At,e,n)},useMemoCache:Nf,useCacheRefresh:zg};Lf.useEffectEvent=kg;var Hg={readContext:On,use:Mc,useCallback:Cg,useContext:On,useEffect:Tf,useImperativeHandle:Tg,useInsertionEffect:Ag,useLayoutEffect:Rg,useMemo:Og,useReducer:Af,useRef:Sg,useState:function(){return Af(Cs)},useDebugValue:Cf,useDeferredValue:function(e,n){var l=ln();return At===null?Of(l,e,n):$g(l,At.memoizedState,e,n)},useTransition:function(){var e=Af(Cs)[0],n=ln().memoizedState;return[typeof e=="boolean"?e:lo(e),n]},useSyncExternalStore:og,useId:Dg,useHostTransitionStatus:Mf,useFormState:wg,useActionState:wg,useOptimistic:function(e,n){var l=ln();return At!==null?hg(l,At,e,n):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Nf,useCacheRefresh:zg};Hg.useEffectEvent=kg;function Df(e,n,l,o){n=e.memoizedState,l=l(o,n),l=l==null?n:y({},n,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var zf={enqueueSetState:function(e,n,l){e=e._reactInternals;var o=ma(),u=fl(o);u.payload=n,l!=null&&(u.callback=l),n=pl(e,u,o),n!==null&&(ta(n,e,o),to(n,e,o))},enqueueReplaceState:function(e,n,l){e=e._reactInternals;var o=ma(),u=fl(o);u.tag=1,u.payload=n,l!=null&&(u.callback=l),n=pl(e,u,o),n!==null&&(ta(n,e,o),to(n,e,o))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var l=ma(),o=fl(l);o.tag=2,n!=null&&(o.callback=n),n=pl(e,o,l),n!==null&&(ta(n,e,l),to(n,e,l))}};function Vg(e,n,l,o,u,d,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,d,_):n.prototype&&n.prototype.isPureReactComponent?!Zr(l,o)||!Zr(u,d):!0}function Fg(e,n,l,o){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(l,o),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(l,o),n.state!==e&&zf.enqueueReplaceState(n,n.state,null)}function ai(e,n){var l=n;if("ref"in n){l={};for(var o in n)o!=="ref"&&(l[o]=n[o])}if(e=e.defaultProps){l===n&&(l=y({},l));for(var u in e)l[u]===void 0&&(l[u]=e[u])}return l}function Kg(e){gc(e)}function Zg(e){console.error(e)}function Yg(e){gc(e)}function qc(e,n){try{var l=e.onUncaughtError;l(n.value,{componentStack:n.stack})}catch(o){setTimeout(function(){throw o})}}function Xg(e,n,l){try{var o=e.onCaughtError;o(l.value,{componentStack:l.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function qf(e,n,l){return l=fl(l),l.tag=3,l.payload={element:null},l.callback=function(){qc(e,n)},l}function Pg(e){return e=fl(e),e.tag=3,e}function Qg(e,n,l,o){var u=l.type.getDerivedStateFromError;if(typeof u=="function"){var d=o.value;e.payload=function(){return u(d)},e.callback=function(){Xg(n,l,o)}}var _=l.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){Xg(n,l,o),typeof u!="function"&&(bl===null?bl=new Set([this]):bl.add(this));var j=o.stack;this.componentDidCatch(o.value,{componentStack:j!==null?j:""})})}function Cj(e,n,l,o,u){if(l.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(n=l.alternate,n!==null&&Yi(n,l,u,!0),l=da.current,l!==null){switch(l.tag){case 31:case 13:return Ea===null?Qc():l.alternate===null&&Xt===0&&(Xt=3),l.flags&=-257,l.flags|=65536,l.lanes=u,o===kc?l.flags|=16384:(n=l.updateQueue,n===null?l.updateQueue=new Set([o]):n.add(o),up(e,o,u)),!1;case 22:return l.flags|=65536,o===kc?l.flags|=16384:(n=l.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([o])},l.updateQueue=n):(l=n.retryQueue,l===null?n.retryQueue=new Set([o]):l.add(o)),up(e,o,u)),!1}throw Error(r(435,l.tag))}return up(e,o,u),Qc(),!1}if(ut)return n=da.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=u,o!==af&&(e=Error(r(422),{cause:o}),Pr(Na(e,l)))):(o!==af&&(n=Error(r(423),{cause:o}),Pr(Na(n,l))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,o=Na(o,l),u=qf(e.stateNode,o,u),mf(e,u),Xt!==4&&(Xt=2)),!1;var d=Error(r(520),{cause:o});if(d=Na(d,l),go===null?go=[d]:go.push(d),Xt!==4&&(Xt=2),n===null)return!0;o=Na(o,l),l=n;do{switch(l.tag){case 3:return l.flags|=65536,e=u&-u,l.lanes|=e,e=qf(l.stateNode,o,e),mf(l,e),!1;case 1:if(n=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(bl===null||!bl.has(d))))return l.flags|=65536,u&=-u,l.lanes|=u,u=Pg(u),Qg(u,e,l,o),mf(l,u),!1}l=l.return}while(l!==null);return!1}var Uf=Error(r(461)),fn=!1;function $n(e,n,l,o){n.child=e===null?tg(n,null,l,o):ti(n,e.child,l,o)}function Jg(e,n,l,o,u){l=l.render;var d=n.ref;if("ref"in o){var _={};for(var j in o)j!=="ref"&&(_[j]=o[j])}else _=o;return Ql(n),o=xf(e,n,l,_,d,u),j=jf(),e!==null&&!fn?(wf(e,n,u),Os(e,n,u)):(ut&&j&&tf(n),n.flags|=1,$n(e,n,o,u),n.child)}function Wg(e,n,l,o,u){if(e===null){var d=l.type;return typeof d=="function"&&!Jd(d)&&d.defaultProps===void 0&&l.compare===null?(n.tag=15,n.type=d,e_(e,n,d,o,u)):(e=yc(l.type,null,o,n,n.mode,u),e.ref=n.ref,e.return=n,n.child=e)}if(d=e.child,!Yf(e,u)){var _=d.memoizedProps;if(l=l.compare,l=l!==null?l:Zr,l(_,o)&&e.ref===n.ref)return Os(e,n,u)}return n.flags|=1,e=ks(d,o),e.ref=n.ref,e.return=n,n.child=e}function e_(e,n,l,o,u){if(e!==null){var d=e.memoizedProps;if(Zr(d,o)&&e.ref===n.ref)if(fn=!1,n.pendingProps=o=d,Yf(e,u))(e.flags&131072)!==0&&(fn=!0);else return n.lanes=e.lanes,Os(e,n,u)}return Bf(e,n,l,o,u)}function t_(e,n,l,o){var u=o.children,d=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((n.flags&128)!==0){if(d=d!==null?d.baseLanes|l:l,e!==null){for(o=n.child=e.child,u=0;o!==null;)u=u|o.lanes|o.childLanes,o=o.sibling;o=u&~d}else o=0,n.child=null;return n_(e,n,d,l,o)}if((l&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Sc(n,d!==null?d.cachePool:null),d!==null?sg(n,d):_f(),lg(n);else return o=n.lanes=536870912,n_(e,n,d!==null?d.baseLanes|l:l,l,o)}else d!==null?(Sc(n,d.cachePool),sg(n,d),ml(),n.memoizedState=null):(e!==null&&Sc(n,null),_f(),ml());return $n(e,n,u,l),n.child}function oo(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function n_(e,n,l,o,u){var d=df();return d=d===null?null:{parent:un._currentValue,pool:d},n.memoizedState={baseLanes:l,cachePool:d},e!==null&&Sc(n,null),_f(),lg(n),e!==null&&Yi(e,n,o,!0),n.childLanes=u,null}function Uc(e,n){return n=Gc({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function a_(e,n,l){return ti(n,e.child,null,l),e=Uc(n,n.pendingProps),e.flags|=2,fa(n),n.memoizedState=null,e}function Oj(e,n,l){var o=n.pendingProps,u=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(ut){if(o.mode==="hidden")return e=Uc(n,o),n.lanes=536870912,oo(null,e);if(bf(n),(e=zt)?(e=mv(e,Ra),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:rl!==null?{id:ss,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},l=Um(e),l.return=n,n.child=l,Cn=n,zt=null)):e=null,e===null)throw cl(n);return n.lanes=536870912,null}return Uc(n,o)}var d=e.memoizedState;if(d!==null){var _=d.dehydrated;if(bf(n),u)if(n.flags&256)n.flags&=-257,n=a_(e,n,l);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(fn||Yi(e,n,l,!1),u=(l&e.childLanes)!==0,fn||u){if(o=Ot,o!==null&&(_=Ua(o,l),_!==0&&_!==d.retryLane))throw d.retryLane=_,Zl(e,_),ta(o,e,_),Uf;Qc(),n=a_(e,n,l)}else e=d.treeContext,zt=Ta(_.nextSibling),Cn=n,ut=!0,ol=null,Ra=!1,e!==null&&Hm(n,e),n=Uc(n,o),n.flags|=4096;return n}return e=ks(e.child,{mode:o.mode,children:o.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Bc(e,n){var l=n.ref;if(l===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(e===null||e.ref!==l)&&(n.flags|=4194816)}}function Bf(e,n,l,o,u){return Ql(n),l=xf(e,n,l,o,void 0,u),o=jf(),e!==null&&!fn?(wf(e,n,u),Os(e,n,u)):(ut&&o&&tf(n),n.flags|=1,$n(e,n,l,u),n.child)}function s_(e,n,l,o,u,d){return Ql(n),n.updateQueue=null,l=rg(n,o,l,u),ig(e),o=jf(),e!==null&&!fn?(wf(e,n,d),Os(e,n,d)):(ut&&o&&tf(n),n.flags|=1,$n(e,n,l,d),n.child)}function l_(e,n,l,o,u){if(Ql(n),n.stateNode===null){var d=Vi,_=l.contextType;typeof _=="object"&&_!==null&&(d=On(_)),d=new l(o,d),n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=zf,n.stateNode=d,d._reactInternals=n,d=n.stateNode,d.props=o,d.state=n.memoizedState,d.refs={},pf(n),_=l.contextType,d.context=typeof _=="object"&&_!==null?On(_):Vi,d.state=n.memoizedState,_=l.getDerivedStateFromProps,typeof _=="function"&&(Df(n,l,_,o),d.state=n.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(_=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),_!==d.state&&zf.enqueueReplaceState(d,d.state,null),ao(n,o,d,u),no(),d.state=n.memoizedState),typeof d.componentDidMount=="function"&&(n.flags|=4194308),o=!0}else if(e===null){d=n.stateNode;var j=n.memoizedProps,O=ai(l,j);d.props=O;var Z=d.context,J=l.contextType;_=Vi,typeof J=="object"&&J!==null&&(_=On(J));var re=l.getDerivedStateFromProps;J=typeof re=="function"||typeof d.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,J||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(j||Z!==_)&&Fg(n,d,o,_),dl=!1;var Y=n.memoizedState;d.state=Y,ao(n,o,d,u),no(),Z=n.memoizedState,j||Y!==Z||dl?(typeof re=="function"&&(Df(n,l,re,o),Z=n.memoizedState),(O=dl||Vg(n,l,O,o,Y,Z,_))?(J||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(n.flags|=4194308)):(typeof d.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=o,n.memoizedState=Z),d.props=o,d.state=Z,d.context=_,o=O):(typeof d.componentDidMount=="function"&&(n.flags|=4194308),o=!1)}else{d=n.stateNode,hf(e,n),_=n.memoizedProps,J=ai(l,_),d.props=J,re=n.pendingProps,Y=d.context,Z=l.contextType,O=Vi,typeof Z=="object"&&Z!==null&&(O=On(Z)),j=l.getDerivedStateFromProps,(Z=typeof j=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(_!==re||Y!==O)&&Fg(n,d,o,O),dl=!1,Y=n.memoizedState,d.state=Y,ao(n,o,d,u),no();var X=n.memoizedState;_!==re||Y!==X||dl||e!==null&&e.dependencies!==null&&jc(e.dependencies)?(typeof j=="function"&&(Df(n,l,j,o),X=n.memoizedState),(J=dl||Vg(n,l,J,o,Y,X,O)||e!==null&&e.dependencies!==null&&jc(e.dependencies))?(Z||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(o,X,O),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(o,X,O)),typeof d.componentDidUpdate=="function"&&(n.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof d.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=1024),n.memoizedProps=o,n.memoizedState=X),d.props=o,d.state=X,d.context=O,o=J):(typeof d.componentDidUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&Y===e.memoizedState||(n.flags|=1024),o=!1)}return d=o,Bc(e,n),o=(n.flags&128)!==0,d||o?(d=n.stateNode,l=o&&typeof l.getDerivedStateFromError!="function"?null:d.render(),n.flags|=1,e!==null&&o?(n.child=ti(n,e.child,null,u),n.child=ti(n,null,l,u)):$n(e,n,l,u),n.memoizedState=d.state,e=n.child):e=Os(e,n,u),e}function i_(e,n,l,o){return Xl(),n.flags|=256,$n(e,n,l,o),n.child}var Gf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hf(e){return{baseLanes:e,cachePool:Xm()}}function Vf(e,n,l){return e=e!==null?e.childLanes&~l:0,n&&(e|=ha),e}function r_(e,n,l){var o=n.pendingProps,u=!1,d=(n.flags&128)!==0,_;if((_=d)||(_=e!==null&&e.memoizedState===null?!1:(sn.current&2)!==0),_&&(u=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(ut){if(u?hl(n):ml(),(e=zt)?(e=mv(e,Ra),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:rl!==null?{id:ss,overflow:ls}:null,retryLane:536870912,hydrationErrors:null},l=Um(e),l.return=n,n.child=l,Cn=n,zt=null)):e=null,e===null)throw cl(n);return kp(e)?n.lanes=32:n.lanes=536870912,null}var j=o.children;return o=o.fallback,u?(ml(),u=n.mode,j=Gc({mode:"hidden",children:j},u),o=Yl(o,u,l,null),j.return=n,o.return=n,j.sibling=o,n.child=j,o=n.child,o.memoizedState=Hf(l),o.childLanes=Vf(e,_,l),n.memoizedState=Gf,oo(null,o)):(hl(n),Ff(n,j))}var O=e.memoizedState;if(O!==null&&(j=O.dehydrated,j!==null)){if(d)n.flags&256?(hl(n),n.flags&=-257,n=Kf(e,n,l)):n.memoizedState!==null?(ml(),n.child=e.child,n.flags|=128,n=null):(ml(),j=o.fallback,u=n.mode,o=Gc({mode:"visible",children:o.children},u),j=Yl(j,u,l,null),j.flags|=2,o.return=n,j.return=n,o.sibling=j,n.child=o,ti(n,e.child,null,l),o=n.child,o.memoizedState=Hf(l),o.childLanes=Vf(e,_,l),n.memoizedState=Gf,n=oo(null,o));else if(hl(n),kp(j)){if(_=j.nextSibling&&j.nextSibling.dataset,_)var Z=_.dgst;_=Z,o=Error(r(419)),o.stack="",o.digest=_,Pr({value:o,source:null,stack:null}),n=Kf(e,n,l)}else if(fn||Yi(e,n,l,!1),_=(l&e.childLanes)!==0,fn||_){if(_=Ot,_!==null&&(o=Ua(_,l),o!==0&&o!==O.retryLane))throw O.retryLane=o,Zl(e,o),ta(_,e,o),Uf;Np(j)||Qc(),n=Kf(e,n,l)}else Np(j)?(n.flags|=192,n.child=e.child,n=null):(e=O.treeContext,zt=Ta(j.nextSibling),Cn=n,ut=!0,ol=null,Ra=!1,e!==null&&Hm(n,e),n=Ff(n,o.children),n.flags|=4096);return n}return u?(ml(),j=o.fallback,u=n.mode,O=e.child,Z=O.sibling,o=ks(O,{mode:"hidden",children:o.children}),o.subtreeFlags=O.subtreeFlags&65011712,Z!==null?j=ks(Z,j):(j=Yl(j,u,l,null),j.flags|=2),j.return=n,o.return=n,o.sibling=j,n.child=o,oo(null,o),o=n.child,j=e.child.memoizedState,j===null?j=Hf(l):(u=j.cachePool,u!==null?(O=un._currentValue,u=u.parent!==O?{parent:O,pool:O}:u):u=Xm(),j={baseLanes:j.baseLanes|l,cachePool:u}),o.memoizedState=j,o.childLanes=Vf(e,_,l),n.memoizedState=Gf,oo(e.child,o)):(hl(n),l=e.child,e=l.sibling,l=ks(l,{mode:"visible",children:o.children}),l.return=n,l.sibling=null,e!==null&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=l,n.memoizedState=null,l)}function Ff(e,n){return n=Gc({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Gc(e,n){return e=ua(22,e,null,n),e.lanes=0,e}function Kf(e,n,l){return ti(n,e.child,null,l),e=Ff(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function o_(e,n,l){e.lanes|=n;var o=e.alternate;o!==null&&(o.lanes|=n),rf(e.return,n,l)}function Zf(e,n,l,o,u,d){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:u,treeForkCount:d}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=o,_.tail=l,_.tailMode=u,_.treeForkCount=d)}function c_(e,n,l){var o=n.pendingProps,u=o.revealOrder,d=o.tail;o=o.children;var _=sn.current,j=(_&2)!==0;if(j?(_=_&1|2,n.flags|=128):_&=1,B(sn,_),$n(e,n,o,l),o=ut?Xr:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&o_(e,l,n);else if(e.tag===19)o_(e,l,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(l=n.child,u=null;l!==null;)e=l.alternate,e!==null&&Tc(e)===null&&(u=l),l=l.sibling;l=u,l===null?(u=n.child,n.child=null):(u=l.sibling,l.sibling=null),Zf(n,!1,u,l,d,o);break;case"backwards":case"unstable_legacy-backwards":for(l=null,u=n.child,n.child=null;u!==null;){if(e=u.alternate,e!==null&&Tc(e)===null){n.child=u;break}e=u.sibling,u.sibling=l,l=u,u=e}Zf(n,!0,l,null,d,o);break;case"together":Zf(n,!1,null,null,void 0,o);break;default:n.memoizedState=null}return n.child}function Os(e,n,l){if(e!==null&&(n.dependencies=e.dependencies),vl|=n.lanes,(l&n.childLanes)===0)if(e!==null){if(Yi(e,n,l,!1),(l&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,l=ks(e,e.pendingProps),n.child=l,l.return=n;e.sibling!==null;)e=e.sibling,l=l.sibling=ks(e,e.pendingProps),l.return=n;l.sibling=null}return n.child}function Yf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&jc(e)))}function $j(e,n,l){switch(n.tag){case 3:Be(n,n.stateNode.containerInfo),ul(n,un,e.memoizedState.cache),Xl();break;case 27:case 5:Re(n);break;case 4:Be(n,n.stateNode.containerInfo);break;case 10:ul(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,bf(n),null;break;case 13:var o=n.memoizedState;if(o!==null)return o.dehydrated!==null?(hl(n),n.flags|=128,null):(l&n.child.childLanes)!==0?r_(e,n,l):(hl(n),e=Os(e,n,l),e!==null?e.sibling:null);hl(n);break;case 19:var u=(e.flags&128)!==0;if(o=(l&n.childLanes)!==0,o||(Yi(e,n,l,!1),o=(l&n.childLanes)!==0),u){if(o)return c_(e,n,l);n.flags|=128}if(u=n.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),B(sn,sn.current),o)break;return null;case 22:return n.lanes=0,t_(e,n,l,n.pendingProps);case 24:ul(n,un,e.memoizedState.cache)}return Os(e,n,l)}function u_(e,n,l){if(e!==null)if(e.memoizedProps!==n.pendingProps)fn=!0;else{if(!Yf(e,l)&&(n.flags&128)===0)return fn=!1,$j(e,n,l);fn=(e.flags&131072)!==0}else fn=!1,ut&&(n.flags&1048576)!==0&&Gm(n,Xr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var o=n.pendingProps;if(e=Wl(n.elementType),n.type=e,typeof e=="function")Jd(e)?(o=ai(e,o),n.tag=1,n=l_(null,n,e,o,l)):(n.tag=0,n=Bf(null,n,e,o,l));else{if(e!=null){var u=e.$$typeof;if(u===E){n.tag=11,n=Jg(null,n,e,o,l);break e}else if(u===F){n.tag=14,n=Wg(null,n,e,o,l);break e}}throw n=be(e)||e,Error(r(306,n,""))}}return n;case 0:return Bf(e,n,n.type,n.pendingProps,l);case 1:return o=n.type,u=ai(o,n.pendingProps),l_(e,n,o,u,l);case 3:e:{if(Be(n,n.stateNode.containerInfo),e===null)throw Error(r(387));o=n.pendingProps;var d=n.memoizedState;u=d.element,hf(e,n),ao(n,o,null,l);var _=n.memoizedState;if(o=_.cache,ul(n,un,o),o!==d.cache&&of(n,[un],l,!0),no(),o=_.element,d.isDehydrated)if(d={element:o,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=d,n.memoizedState=d,n.flags&256){n=i_(e,n,o,l);break e}else if(o!==u){u=Na(Error(r(424)),n),Pr(u),n=i_(e,n,o,l);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,zt=Ta(e.firstChild),Cn=n,ut=!0,ol=null,Ra=!0,l=tg(n,null,o,l),n.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Xl(),o===u){n=Os(e,n,l);break e}$n(e,n,o,l)}n=n.child}return n;case 26:return Bc(e,n),e===null?(l=xv(n.type,null,n.pendingProps,null))?n.memoizedState=l:ut||(l=n.type,e=n.pendingProps,o=su(H.current).createElement(l),o[ke]=n,o[$e]=e,Mn(o,l,e),mt(o),n.stateNode=o):n.memoizedState=xv(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return Re(n),e===null&&ut&&(o=n.stateNode=vv(n.type,n.pendingProps,H.current),Cn=n,Ra=!0,u=zt,wl(n.type)?(Ap=u,zt=Ta(o.firstChild)):zt=u),$n(e,n,n.pendingProps.children,l),Bc(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&ut&&((u=o=zt)&&(o=cw(o,n.type,n.pendingProps,Ra),o!==null?(n.stateNode=o,Cn=n,zt=Ta(o.firstChild),Ra=!1,u=!0):u=!1),u||cl(n)),Re(n),u=n.type,d=n.pendingProps,_=e!==null?e.memoizedProps:null,o=d.children,jp(u,d)?o=null:_!==null&&jp(u,_)&&(n.flags|=32),n.memoizedState!==null&&(u=xf(e,n,Sj,null,null,l),So._currentValue=u),Bc(e,n),$n(e,n,o,l),n.child;case 6:return e===null&&ut&&((e=l=zt)&&(l=uw(l,n.pendingProps,Ra),l!==null?(n.stateNode=l,Cn=n,zt=null,e=!0):e=!1),e||cl(n)),null;case 13:return r_(e,n,l);case 4:return Be(n,n.stateNode.containerInfo),o=n.pendingProps,e===null?n.child=ti(n,null,o,l):$n(e,n,o,l),n.child;case 11:return Jg(e,n,n.type,n.pendingProps,l);case 7:return $n(e,n,n.pendingProps,l),n.child;case 8:return $n(e,n,n.pendingProps.children,l),n.child;case 12:return $n(e,n,n.pendingProps.children,l),n.child;case 10:return o=n.pendingProps,ul(n,n.type,o.value),$n(e,n,o.children,l),n.child;case 9:return u=n.type._context,o=n.pendingProps.children,Ql(n),u=On(u),o=o(u),n.flags|=1,$n(e,n,o,l),n.child;case 14:return Wg(e,n,n.type,n.pendingProps,l);case 15:return e_(e,n,n.type,n.pendingProps,l);case 19:return c_(e,n,l);case 31:return Oj(e,n,l);case 22:return t_(e,n,l,n.pendingProps);case 24:return Ql(n),o=On(un),e===null?(u=df(),u===null&&(u=Ot,d=cf(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=l),u=d),n.memoizedState={parent:o,cache:u},pf(n),ul(n,un,u)):((e.lanes&l)!==0&&(hf(e,n),ao(n,null,null,l),no()),u=e.memoizedState,d=n.memoizedState,u.parent!==o?(u={parent:o,cache:o},n.memoizedState=u,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=u),ul(n,un,o)):(o=d.cache,ul(n,un,o),o!==u.cache&&of(n,[un],l,!0))),$n(e,n,n.pendingProps.children,l),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function $s(e){e.flags|=4}function Xf(e,n,l,o,u){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(D_())e.flags|=8192;else throw ei=kc,ff}else e.flags&=-16777217}function d_(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!kv(n))if(D_())e.flags|=8192;else throw ei=kc,ff}function Hc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Bt():536870912,e.lanes|=n,ir|=n)}function co(e,n){if(!ut)switch(e.tailMode){case"hidden":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function qt(e){var n=e.alternate!==null&&e.alternate.child===e.child,l=0,o=0;if(n)for(var u=e.child;u!==null;)l|=u.lanes|u.childLanes,o|=u.subtreeFlags&65011712,o|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)l|=u.lanes|u.childLanes,o|=u.subtreeFlags,o|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=o,e.childLanes=l,n}function Mj(e,n,l){var o=n.pendingProps;switch(nf(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qt(n),null;case 1:return qt(n),null;case 3:return l=n.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),n.memoizedState.cache!==o&&(n.flags|=2048),Es(un),Se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Zi(n)?$s(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,sf())),qt(n),null;case 26:var u=n.type,d=n.memoizedState;return e===null?($s(n),d!==null?(qt(n),d_(n,d)):(qt(n),Xf(n,u,null,o,l))):d?d!==e.memoizedState?($s(n),qt(n),d_(n,d)):(qt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==o&&$s(n),qt(n),Xf(n,u,e,o,l)),null;case 27:if(Qe(n),l=H.current,u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&$s(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return qt(n),null}e=Q.current,Zi(n)?Vm(n):(e=vv(u,o,l),n.stateNode=e,$s(n))}return qt(n),null;case 5:if(Qe(n),u=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==o&&$s(n);else{if(!o){if(n.stateNode===null)throw Error(r(166));return qt(n),null}if(d=Q.current,Zi(n))Vm(n);else{var _=su(H.current);switch(d){case 1:d=_.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=_.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=_.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=_.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof o.is=="string"?_.createElement("select",{is:o.is}):_.createElement("select"),o.multiple?d.multiple=!0:o.size&&(d.size=o.size);break;default:d=typeof o.is=="string"?_.createElement(u,{is:o.is}):_.createElement(u)}}d[ke]=n,d[$e]=o;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)d.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=d;e:switch(Mn(d,u,o),u){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&$s(n)}}return qt(n),Xf(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,l),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==o&&$s(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(r(166));if(e=H.current,Zi(n)){if(e=n.stateNode,l=n.memoizedProps,o=null,u=Cn,u!==null)switch(u.tag){case 27:case 5:o=u.memoizedProps}e[ke]=n,e=!!(e.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||rv(e.nodeValue,l)),e||cl(n,!0)}else e=su(e).createTextNode(o),e[ke]=n,n.stateNode=e}return qt(n),null;case 31:if(l=n.memoizedState,e===null||e.memoizedState!==null){if(o=Zi(n),l!==null){if(e===null){if(!o)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ke]=n}else Xl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;qt(n),e=!1}else l=sf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return n.flags&256?(fa(n),n):(fa(n),null);if((n.flags&128)!==0)throw Error(r(558))}return qt(n),null;case 13:if(o=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Zi(n),o!==null&&o.dehydrated!==null){if(e===null){if(!u)throw Error(r(318));if(u=n.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[ke]=n}else Xl(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;qt(n),u=!1}else u=sf(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return n.flags&256?(fa(n),n):(fa(n),null)}return fa(n),(n.flags&128)!==0?(n.lanes=l,n):(l=o!==null,e=e!==null&&e.memoizedState!==null,l&&(o=n.child,u=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(u=o.alternate.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==u&&(o.flags|=2048)),l!==e&&l&&(n.child.flags|=8192),Hc(n,n.updateQueue),qt(n),null);case 4:return Se(),e===null&&_p(n.stateNode.containerInfo),qt(n),null;case 10:return Es(n.type),qt(n),null;case 19:if(L(sn),o=n.memoizedState,o===null)return qt(n),null;if(u=(n.flags&128)!==0,d=o.rendering,d===null)if(u)co(o,!1);else{if(Xt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(d=Tc(e),d!==null){for(n.flags|=128,co(o,!1),e=d.updateQueue,n.updateQueue=e,Hc(n,e),n.subtreeFlags=0,e=l,l=n.child;l!==null;)qm(l,e),l=l.sibling;return B(sn,sn.current&1|2),ut&&As(n,o.treeForkCount),n.child}e=e.sibling}o.tail!==null&&rt()>Yc&&(n.flags|=128,u=!0,co(o,!1),n.lanes=4194304)}else{if(!u)if(e=Tc(d),e!==null){if(n.flags|=128,u=!0,e=e.updateQueue,n.updateQueue=e,Hc(n,e),co(o,!0),o.tail===null&&o.tailMode==="hidden"&&!d.alternate&&!ut)return qt(n),null}else 2*rt()-o.renderingStartTime>Yc&&l!==536870912&&(n.flags|=128,u=!0,co(o,!1),n.lanes=4194304);o.isBackwards?(d.sibling=n.child,n.child=d):(e=o.last,e!==null?e.sibling=d:n.child=d,o.last=d)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rt(),e.sibling=null,l=sn.current,B(sn,u?l&1|2:l&1),ut&&As(n,o.treeForkCount),e):(qt(n),null);case 22:case 23:return fa(n),vf(),o=n.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(l&536870912)!==0&&(n.flags&128)===0&&(qt(n),n.subtreeFlags&6&&(n.flags|=8192)):qt(n),l=n.updateQueue,l!==null&&Hc(n,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==l&&(n.flags|=2048),e!==null&&L(Jl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Es(un),qt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function Ij(e,n){switch(nf(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Es(un),Se(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Qe(n),null;case 31:if(n.memoizedState!==null){if(fa(n),n.alternate===null)throw Error(r(340));Xl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(fa(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Xl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return L(sn),null;case 4:return Se(),null;case 10:return Es(n.type),null;case 22:case 23:return fa(n),vf(),e!==null&&L(Jl),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Es(un),null;case 25:return null;default:return null}}function f_(e,n){switch(nf(n),n.tag){case 3:Es(un),Se();break;case 26:case 27:case 5:Qe(n);break;case 4:Se();break;case 31:n.memoizedState!==null&&fa(n);break;case 13:fa(n);break;case 19:L(sn);break;case 10:Es(n.type);break;case 22:case 23:fa(n),vf(),e!==null&&L(Jl);break;case 24:Es(un)}}function uo(e,n){try{var l=n.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var u=o.next;l=u;do{if((l.tag&e)===e){o=void 0;var d=l.create,_=l.inst;o=d(),_.destroy=o}l=l.next}while(l!==u)}}catch(j){Nt(n,n.return,j)}}function gl(e,n,l){try{var o=n.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var d=u.next;o=d;do{if((o.tag&e)===e){var _=o.inst,j=_.destroy;if(j!==void 0){_.destroy=void 0,u=n;var O=l,Z=j;try{Z()}catch(J){Nt(u,O,J)}}}o=o.next}while(o!==d)}}catch(J){Nt(n,n.return,J)}}function p_(e){var n=e.updateQueue;if(n!==null){var l=e.stateNode;try{ag(n,l)}catch(o){Nt(e,e.return,o)}}}function h_(e,n,l){l.props=ai(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(o){Nt(e,n,o)}}function fo(e,n){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof l=="function"?e.refCleanup=l(o):l.current=o}}catch(u){Nt(e,n,u)}}function is(e,n){var l=e.ref,o=e.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(u){Nt(e,n,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){Nt(e,n,u)}else l.current=null}function m_(e){var n=e.type,l=e.memoizedProps,o=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":l.autoFocus&&o.focus();break e;case"img":l.src?o.src=l.src:l.srcSet&&(o.srcset=l.srcSet)}}catch(u){Nt(e,e.return,u)}}function Pf(e,n,l){try{var o=e.stateNode;aw(o,e.type,l,n),o[$e]=n}catch(u){Nt(e,e.return,u)}}function g_(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&wl(e.type)||e.tag===4}function Qf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||g_(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&wl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jf(e,n,l){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,n):(n=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,n.appendChild(e),l=l._reactRootContainer,l!=null||n.onclick!==null||(n.onclick=ja));else if(o!==4&&(o===27&&wl(e.type)&&(l=e.stateNode,n=null),e=e.child,e!==null))for(Jf(e,n,l),e=e.sibling;e!==null;)Jf(e,n,l),e=e.sibling}function Vc(e,n,l){var o=e.tag;if(o===5||o===6)e=e.stateNode,n?l.insertBefore(e,n):l.appendChild(e);else if(o!==4&&(o===27&&wl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Vc(e,n,l),e=e.sibling;e!==null;)Vc(e,n,l),e=e.sibling}function __(e){var n=e.stateNode,l=e.memoizedProps;try{for(var o=e.type,u=n.attributes;u.length;)n.removeAttributeNode(u[0]);Mn(n,o,l),n[ke]=e,n[$e]=l}catch(d){Nt(e,e.return,d)}}var Ms=!1,pn=!1,Wf=!1,v_=typeof WeakSet=="function"?WeakSet:Set,Nn=null;function Lj(e,n){if(e=e.containerInfo,yp=du,e=Tm(e),Fd(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var o=l.getSelection&&l.getSelection();if(o&&o.rangeCount!==0){l=o.anchorNode;var u=o.anchorOffset,d=o.focusNode;o=o.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var _=0,j=-1,O=-1,Z=0,J=0,re=e,Y=null;t:for(;;){for(var X;re!==l||u!==0&&re.nodeType!==3||(j=_+u),re!==d||o!==0&&re.nodeType!==3||(O=_+o),re.nodeType===3&&(_+=re.nodeValue.length),(X=re.firstChild)!==null;)Y=re,re=X;for(;;){if(re===e)break t;if(Y===l&&++Z===u&&(j=_),Y===d&&++J===o&&(O=_),(X=re.nextSibling)!==null)break;re=Y,Y=re.parentNode}re=X}l=j===-1||O===-1?null:{start:j,end:O}}else l=null}l=l||{start:0,end:0}}else l=null;for(xp={focusedElem:e,selectionRange:l},du=!1,Nn=n;Nn!==null;)if(n=Nn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Nn=e;else for(;Nn!==null;){switch(n=Nn,d=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)u=e[l],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,l=n,u=d.memoizedProps,d=d.memoizedState,o=l.stateNode;try{var Te=ai(l.type,u);e=o.getSnapshotBeforeUpdate(Te,d),o.__reactInternalSnapshotBeforeUpdate=e}catch(ze){Nt(l,l.return,ze)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,l=e.nodeType,l===9)Sp(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Sp(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(r(163))}if(e=n.sibling,e!==null){e.return=n.return,Nn=e;break}Nn=n.return}}function b_(e,n,l){var o=l.flags;switch(l.tag){case 0:case 11:case 15:Ls(e,l),o&4&&uo(5,l);break;case 1:if(Ls(e,l),o&4)if(e=l.stateNode,n===null)try{e.componentDidMount()}catch(_){Nt(l,l.return,_)}else{var u=ai(l.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(u,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){Nt(l,l.return,_)}}o&64&&p_(l),o&512&&fo(l,l.return);break;case 3:if(Ls(e,l),o&64&&(e=l.updateQueue,e!==null)){if(n=null,l.child!==null)switch(l.child.tag){case 27:case 5:n=l.child.stateNode;break;case 1:n=l.child.stateNode}try{ag(e,n)}catch(_){Nt(l,l.return,_)}}break;case 27:n===null&&o&4&&__(l);case 26:case 5:Ls(e,l),n===null&&o&4&&m_(l),o&512&&fo(l,l.return);break;case 12:Ls(e,l);break;case 31:Ls(e,l),o&4&&j_(e,l);break;case 13:Ls(e,l),o&4&&w_(e,l),o&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Fj.bind(null,l),dw(e,l))));break;case 22:if(o=l.memoizedState!==null||Ms,!o){n=n!==null&&n.memoizedState!==null||pn,u=Ms;var d=pn;Ms=o,(pn=n)&&!d?Ds(e,l,(l.subtreeFlags&8772)!==0):Ls(e,l),Ms=u,pn=d}break;case 30:break;default:Ls(e,l)}}function y_(e){var n=e.alternate;n!==null&&(e.alternate=null,y_(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&En(n)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Ht=null,Qn=!1;function Is(e,n,l){for(l=l.child;l!==null;)x_(e,n,l),l=l.sibling}function x_(e,n,l){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(Je,l)}catch{}switch(l.tag){case 26:pn||is(l,n),Is(e,n,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:pn||is(l,n);var o=Ht,u=Qn;wl(l.type)&&(Ht=l.stateNode,Qn=!1),Is(e,n,l),xo(l.stateNode),Ht=o,Qn=u;break;case 5:pn||is(l,n);case 6:if(o=Ht,u=Qn,Ht=null,Is(e,n,l),Ht=o,Qn=u,Ht!==null)if(Qn)try{(Ht.nodeType===9?Ht.body:Ht.nodeName==="HTML"?Ht.ownerDocument.body:Ht).removeChild(l.stateNode)}catch(d){Nt(l,n,d)}else try{Ht.removeChild(l.stateNode)}catch(d){Nt(l,n,d)}break;case 18:Ht!==null&&(Qn?(e=Ht,pv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),hr(e)):pv(Ht,l.stateNode));break;case 4:o=Ht,u=Qn,Ht=l.stateNode.containerInfo,Qn=!0,Is(e,n,l),Ht=o,Qn=u;break;case 0:case 11:case 14:case 15:gl(2,l,n),pn||gl(4,l,n),Is(e,n,l);break;case 1:pn||(is(l,n),o=l.stateNode,typeof o.componentWillUnmount=="function"&&h_(l,n,o)),Is(e,n,l);break;case 21:Is(e,n,l);break;case 22:pn=(o=pn)||l.memoizedState!==null,Is(e,n,l),pn=o;break;default:Is(e,n,l)}}function j_(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hr(e)}catch(l){Nt(n,n.return,l)}}}function w_(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hr(e)}catch(l){Nt(n,n.return,l)}}function Dj(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new v_),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new v_),n;default:throw Error(r(435,e.tag))}}function Fc(e,n){var l=Dj(e);n.forEach(function(o){if(!l.has(o)){l.add(o);var u=Kj.bind(null,e,o);o.then(u,u)}})}function Jn(e,n){var l=n.deletions;if(l!==null)for(var o=0;o<l.length;o++){var u=l[o],d=e,_=n,j=_;e:for(;j!==null;){switch(j.tag){case 27:if(wl(j.type)){Ht=j.stateNode,Qn=!1;break e}break;case 5:Ht=j.stateNode,Qn=!1;break e;case 3:case 4:Ht=j.stateNode.containerInfo,Qn=!0;break e}j=j.return}if(Ht===null)throw Error(r(160));x_(d,_,u),Ht=null,Qn=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)S_(n,e),n=n.sibling}var Fa=null;function S_(e,n){var l=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Jn(n,e),Wn(e),o&4&&(gl(3,e,e.return),uo(3,e),gl(5,e,e.return));break;case 1:Jn(n,e),Wn(e),o&512&&(pn||l===null||is(l,l.return)),o&64&&Ms&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?o:l.concat(o))));break;case 26:var u=Fa;if(Jn(n,e),Wn(e),o&512&&(pn||l===null||is(l,l.return)),o&4){var d=l!==null?l.memoizedState:null;if(o=e.memoizedState,l===null)if(o===null)if(e.stateNode===null){e:{o=e.type,l=e.memoizedProps,u=u.ownerDocument||u;t:switch(o){case"title":d=u.getElementsByTagName("title")[0],(!d||d[Gt]||d[ke]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(o),u.head.insertBefore(d,u.querySelector("head > title"))),Mn(d,o,l),d[ke]=e,mt(d),o=d;break e;case"link":var _=Sv("link","href",u).get(o+(l.href||""));if(_){for(var j=0;j<_.length;j++)if(d=_[j],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){_.splice(j,1);break t}}d=u.createElement(o),Mn(d,o,l),u.head.appendChild(d);break;case"meta":if(_=Sv("meta","content",u).get(o+(l.content||""))){for(j=0;j<_.length;j++)if(d=_[j],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){_.splice(j,1);break t}}d=u.createElement(o),Mn(d,o,l),u.head.appendChild(d);break;default:throw Error(r(468,o))}d[ke]=e,mt(d),o=d}e.stateNode=o}else Nv(u,e.type,e.stateNode);else e.stateNode=wv(u,o,e.memoizedProps);else d!==o?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,o===null?Nv(u,e.type,e.stateNode):wv(u,o,e.memoizedProps)):o===null&&e.stateNode!==null&&Pf(e,e.memoizedProps,l.memoizedProps)}break;case 27:Jn(n,e),Wn(e),o&512&&(pn||l===null||is(l,l.return)),l!==null&&o&4&&Pf(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Jn(n,e),Wn(e),o&512&&(pn||l===null||is(l,l.return)),e.flags&32){u=e.stateNode;try{sl(u,"")}catch(Te){Nt(e,e.return,Te)}}o&4&&e.stateNode!=null&&(u=e.memoizedProps,Pf(e,u,l!==null?l.memoizedProps:u)),o&1024&&(Wf=!0);break;case 6:if(Jn(n,e),Wn(e),o&4){if(e.stateNode===null)throw Error(r(162));o=e.memoizedProps,l=e.stateNode;try{l.nodeValue=o}catch(Te){Nt(e,e.return,Te)}}break;case 3:if(ru=null,u=Fa,Fa=lu(n.containerInfo),Jn(n,e),Fa=u,Wn(e),o&4&&l!==null&&l.memoizedState.isDehydrated)try{hr(n.containerInfo)}catch(Te){Nt(e,e.return,Te)}Wf&&(Wf=!1,N_(e));break;case 4:o=Fa,Fa=lu(e.stateNode.containerInfo),Jn(n,e),Wn(e),Fa=o;break;case 12:Jn(n,e),Wn(e);break;case 31:Jn(n,e),Wn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Fc(e,o)));break;case 13:Jn(n,e),Wn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Zc=rt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Fc(e,o)));break;case 22:u=e.memoizedState!==null;var O=l!==null&&l.memoizedState!==null,Z=Ms,J=pn;if(Ms=Z||u,pn=J||O,Jn(n,e),pn=J,Ms=Z,Wn(e),o&8192)e:for(n=e.stateNode,n._visibility=u?n._visibility&-2:n._visibility|1,u&&(l===null||O||Ms||pn||si(e)),l=null,n=e;;){if(n.tag===5||n.tag===26){if(l===null){O=l=n;try{if(d=O.stateNode,u)_=d.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{j=O.stateNode;var re=O.memoizedProps.style,Y=re!=null&&re.hasOwnProperty("display")?re.display:null;j.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(Te){Nt(O,O.return,Te)}}}else if(n.tag===6){if(l===null){O=n;try{O.stateNode.nodeValue=u?"":O.memoizedProps}catch(Te){Nt(O,O.return,Te)}}}else if(n.tag===18){if(l===null){O=n;try{var X=O.stateNode;u?hv(X,!0):hv(O.stateNode,!1)}catch(Te){Nt(O,O.return,Te)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;l===n&&(l=null),n=n.return}l===n&&(l=null),n.sibling.return=n.return,n=n.sibling}o&4&&(o=e.updateQueue,o!==null&&(l=o.retryQueue,l!==null&&(o.retryQueue=null,Fc(e,l))));break;case 19:Jn(n,e),Wn(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,Fc(e,o)));break;case 30:break;case 21:break;default:Jn(n,e),Wn(e)}}function Wn(e){var n=e.flags;if(n&2){try{for(var l,o=e.return;o!==null;){if(g_(o)){l=o;break}o=o.return}if(l==null)throw Error(r(160));switch(l.tag){case 27:var u=l.stateNode,d=Qf(e);Vc(e,d,u);break;case 5:var _=l.stateNode;l.flags&32&&(sl(_,""),l.flags&=-33);var j=Qf(e);Vc(e,j,_);break;case 3:case 4:var O=l.stateNode.containerInfo,Z=Qf(e);Jf(e,Z,O);break;default:throw Error(r(161))}}catch(J){Nt(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function N_(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;N_(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ls(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)b_(e,n.alternate,n),n=n.sibling}function si(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:gl(4,n,n.return),si(n);break;case 1:is(n,n.return);var l=n.stateNode;typeof l.componentWillUnmount=="function"&&h_(n,n.return,l),si(n);break;case 27:xo(n.stateNode);case 26:case 5:is(n,n.return),si(n);break;case 22:n.memoizedState===null&&si(n);break;case 30:si(n);break;default:si(n)}e=e.sibling}}function Ds(e,n,l){for(l=l&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var o=n.alternate,u=e,d=n,_=d.flags;switch(d.tag){case 0:case 11:case 15:Ds(u,d,l),uo(4,d);break;case 1:if(Ds(u,d,l),o=d,u=o.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(Z){Nt(o,o.return,Z)}if(o=d,u=o.updateQueue,u!==null){var j=o.stateNode;try{var O=u.shared.hiddenCallbacks;if(O!==null)for(u.shared.hiddenCallbacks=null,u=0;u<O.length;u++)ng(O[u],j)}catch(Z){Nt(o,o.return,Z)}}l&&_&64&&p_(d),fo(d,d.return);break;case 27:__(d);case 26:case 5:Ds(u,d,l),l&&o===null&&_&4&&m_(d),fo(d,d.return);break;case 12:Ds(u,d,l);break;case 31:Ds(u,d,l),l&&_&4&&j_(u,d);break;case 13:Ds(u,d,l),l&&_&4&&w_(u,d);break;case 22:d.memoizedState===null&&Ds(u,d,l),fo(d,d.return);break;case 30:break;default:Ds(u,d,l)}n=n.sibling}}function ep(e,n){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Qr(l))}function tp(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Qr(e))}function Ka(e,n,l,o){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)k_(e,n,l,o),n=n.sibling}function k_(e,n,l,o){var u=n.flags;switch(n.tag){case 0:case 11:case 15:Ka(e,n,l,o),u&2048&&uo(9,n);break;case 1:Ka(e,n,l,o);break;case 3:Ka(e,n,l,o),u&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Qr(e)));break;case 12:if(u&2048){Ka(e,n,l,o),e=n.stateNode;try{var d=n.memoizedProps,_=d.id,j=d.onPostCommit;typeof j=="function"&&j(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Nt(n,n.return,O)}}else Ka(e,n,l,o);break;case 31:Ka(e,n,l,o);break;case 13:Ka(e,n,l,o);break;case 23:break;case 22:d=n.stateNode,_=n.alternate,n.memoizedState!==null?d._visibility&2?Ka(e,n,l,o):po(e,n):d._visibility&2?Ka(e,n,l,o):(d._visibility|=2,ar(e,n,l,o,(n.subtreeFlags&10256)!==0||!1)),u&2048&&ep(_,n);break;case 24:Ka(e,n,l,o),u&2048&&tp(n.alternate,n);break;default:Ka(e,n,l,o)}}function ar(e,n,l,o,u){for(u=u&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var d=e,_=n,j=l,O=o,Z=_.flags;switch(_.tag){case 0:case 11:case 15:ar(d,_,j,O,u),uo(8,_);break;case 23:break;case 22:var J=_.stateNode;_.memoizedState!==null?J._visibility&2?ar(d,_,j,O,u):po(d,_):(J._visibility|=2,ar(d,_,j,O,u)),u&&Z&2048&&ep(_.alternate,_);break;case 24:ar(d,_,j,O,u),u&&Z&2048&&tp(_.alternate,_);break;default:ar(d,_,j,O,u)}n=n.sibling}}function po(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var l=e,o=n,u=o.flags;switch(o.tag){case 22:po(l,o),u&2048&&ep(o.alternate,o);break;case 24:po(l,o),u&2048&&tp(o.alternate,o);break;default:po(l,o)}n=n.sibling}}var ho=8192;function sr(e,n,l){if(e.subtreeFlags&ho)for(e=e.child;e!==null;)A_(e,n,l),e=e.sibling}function A_(e,n,l){switch(e.tag){case 26:sr(e,n,l),e.flags&ho&&e.memoizedState!==null&&ww(l,Fa,e.memoizedState,e.memoizedProps);break;case 5:sr(e,n,l);break;case 3:case 4:var o=Fa;Fa=lu(e.stateNode.containerInfo),sr(e,n,l),Fa=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=ho,ho=16777216,sr(e,n,l),ho=o):sr(e,n,l));break;default:sr(e,n,l)}}function R_(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function mo(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];Nn=o,T_(o,e)}R_(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)E_(e),e=e.sibling}function E_(e){switch(e.tag){case 0:case 11:case 15:mo(e),e.flags&2048&&gl(9,e,e.return);break;case 3:mo(e);break;case 12:mo(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Kc(e)):mo(e);break;default:mo(e)}}function Kc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];Nn=o,T_(o,e)}R_(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:gl(8,n,n.return),Kc(n);break;case 22:l=n.stateNode,l._visibility&2&&(l._visibility&=-3,Kc(n));break;default:Kc(n)}e=e.sibling}}function T_(e,n){for(;Nn!==null;){var l=Nn;switch(l.tag){case 0:case 11:case 15:gl(8,l,n);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var o=l.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:Qr(l.memoizedState.cache)}if(o=l.child,o!==null)o.return=l,Nn=o;else e:for(l=e;Nn!==null;){o=Nn;var u=o.sibling,d=o.return;if(y_(o),o===l){Nn=null;break e}if(u!==null){u.return=d,Nn=u;break e}Nn=d}}}var zj={getCacheForType:function(e){var n=On(un),l=n.data.get(e);return l===void 0&&(l=e(),n.data.set(e,l)),l},cacheSignal:function(){return On(un).controller.signal}},qj=typeof WeakMap=="function"?WeakMap:Map,yt=0,Ot=null,nt=null,st=0,St=0,pa=null,_l=!1,lr=!1,np=!1,zs=0,Xt=0,vl=0,li=0,ap=0,ha=0,ir=0,go=null,ea=null,sp=!1,Zc=0,C_=0,Yc=1/0,Xc=null,bl=null,vn=0,yl=null,rr=null,qs=0,lp=0,ip=null,O_=null,_o=0,rp=null;function ma(){return(yt&2)!==0&&st!==0?st&-st:$.T!==null?pp():z()}function $_(){if(ha===0)if((st&536870912)===0||ut){var e=_t;_t<<=1,(_t&3932160)===0&&(_t=262144),ha=e}else ha=536870912;return e=da.current,e!==null&&(e.flags|=32),ha}function ta(e,n,l){(e===Ot&&(St===2||St===9)||e.cancelPendingCommit!==null)&&(or(e,0),xl(e,st,ha,!1)),ia(e,l),((yt&2)===0||e!==Ot)&&(e===Ot&&((yt&2)===0&&(li|=l),Xt===4&&xl(e,st,ha,!1)),rs(e))}function M_(e,n,l){if((yt&6)!==0)throw Error(r(327));var o=!l&&(n&127)===0&&(n&e.expiredLanes)===0||Ut(e,n),u=o?Gj(e,n):cp(e,n,!0),d=o;do{if(u===0){lr&&!o&&xl(e,n,0,!1);break}else{if(l=e.current.alternate,d&&!Uj(l)){u=cp(e,n,!1),d=!1;continue}if(u===2){if(d=n,e.errorRecoveryDisabledLanes&d)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var j=e;u=go;var O=j.current.memoizedState.isDehydrated;if(O&&(or(j,_).flags|=256),_=cp(j,_,!1),_!==2){if(np&&!O){j.errorRecoveryDisabledLanes|=d,li|=d,u=4;break e}d=ea,ea=u,d!==null&&(ea===null?ea=d:ea.push.apply(ea,d))}u=_}if(d=!1,u!==2)continue}}if(u===1){or(e,0),xl(e,n,0,!0);break}e:{switch(o=e,d=u,d){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:xl(o,n,ha,!_l);break e;case 2:ea=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(u=Zc+300-rt(),10<u)){if(xl(o,n,ha,!_l),Dn(o,0,!0)!==0)break e;qs=n,o.timeoutHandle=dv(I_.bind(null,o,l,ea,Xc,sp,n,ha,li,ir,_l,d,"Throttled",-0,0),u);break e}I_(o,l,ea,Xc,sp,n,ha,li,ir,_l,d,null,-0,0)}}break}while(!0);rs(e)}function I_(e,n,l,o,u,d,_,j,O,Z,J,re,Y,X){if(e.timeoutHandle=-1,re=n.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ja},A_(n,d,re);var Te=(d&62914560)===d?Zc-rt():(d&4194048)===d?C_-rt():0;if(Te=Sw(re,Te),Te!==null){qs=d,e.cancelPendingCommit=Te(H_.bind(null,e,n,d,l,o,u,_,j,O,J,re,null,Y,X)),xl(e,d,_,!Z);return}}H_(e,n,d,l,o,u,_,j,O)}function Uj(e){for(var n=e;;){var l=n.tag;if((l===0||l===11||l===15)&&n.flags&16384&&(l=n.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var o=0;o<l.length;o++){var u=l[o],d=u.getSnapshot;u=u.value;try{if(!ca(d(),u))return!1}catch{return!1}}if(l=n.child,n.subtreeFlags&16384&&l!==null)l.return=n,n=l;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function xl(e,n,l,o){n&=~ap,n&=~li,e.suspendedLanes|=n,e.pingedLanes&=~n,o&&(e.warmLanes|=n),o=e.expirationTimes;for(var u=n;0<u;){var d=31-Mt(u),_=1<<d;o[d]=-1,u&=~_}l!==0&&za(e,l,n)}function Pc(){return(yt&6)===0?(vo(0),!1):!0}function op(){if(nt!==null){if(St===0)var e=nt.return;else e=nt,Rs=Pl=null,Sf(e),Ji=null,Wr=0,e=nt;for(;e!==null;)f_(e.alternate,e),e=e.return;nt=null}}function or(e,n){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,iw(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),qs=0,op(),Ot=e,nt=l=ks(e.current,null),st=n,St=0,pa=null,_l=!1,lr=Ut(e,n),np=!1,ir=ha=ap=li=vl=Xt=0,ea=go=null,sp=!1,(n&8)!==0&&(n|=n&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=n;0<o;){var u=31-Mt(o),d=1<<u;n|=e[u],o&=~d}return zs=n,_c(),l}function L_(e,n){Ze=null,$.H=ro,n===Qi||n===Nc?(n=Jm(),St=3):n===ff?(n=Jm(),St=4):St=n===Uf?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,pa=n,nt===null&&(Xt=1,qc(e,Na(n,e.current)))}function D_(){var e=da.current;return e===null?!0:(st&4194048)===st?Ea===null:(st&62914560)===st||(st&536870912)!==0?e===Ea:!1}function z_(){var e=$.H;return $.H=ro,e===null?ro:e}function q_(){var e=$.A;return $.A=zj,e}function Qc(){Xt=4,_l||(st&4194048)!==st&&da.current!==null||(lr=!0),(vl&134217727)===0&&(li&134217727)===0||Ot===null||xl(Ot,st,ha,!1)}function cp(e,n,l){var o=yt;yt|=2;var u=z_(),d=q_();(Ot!==e||st!==n)&&(Xc=null,or(e,n)),n=!1;var _=Xt;e:do try{if(St!==0&&nt!==null){var j=nt,O=pa;switch(St){case 8:op(),_=6;break e;case 3:case 2:case 9:case 6:da.current===null&&(n=!0);var Z=St;if(St=0,pa=null,cr(e,j,O,Z),l&&lr){_=0;break e}break;default:Z=St,St=0,pa=null,cr(e,j,O,Z)}}Bj(),_=Xt;break}catch(J){L_(e,J)}while(!0);return n&&e.shellSuspendCounter++,Rs=Pl=null,yt=o,$.H=u,$.A=d,nt===null&&(Ot=null,st=0,_c()),_}function Bj(){for(;nt!==null;)U_(nt)}function Gj(e,n){var l=yt;yt|=2;var o=z_(),u=q_();Ot!==e||st!==n?(Xc=null,Yc=rt()+500,or(e,n)):lr=Ut(e,n);e:do try{if(St!==0&&nt!==null){n=nt;var d=pa;t:switch(St){case 1:St=0,pa=null,cr(e,n,d,1);break;case 2:case 9:if(Pm(d)){St=0,pa=null,B_(n);break}n=function(){St!==2&&St!==9||Ot!==e||(St=7),rs(e)},d.then(n,n);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:Pm(d)?(St=0,pa=null,B_(n)):(St=0,pa=null,cr(e,n,d,7));break;case 5:var _=null;switch(nt.tag){case 26:_=nt.memoizedState;case 5:case 27:var j=nt;if(_?kv(_):j.stateNode.complete){St=0,pa=null;var O=j.sibling;if(O!==null)nt=O;else{var Z=j.return;Z!==null?(nt=Z,Jc(Z)):nt=null}break t}}St=0,pa=null,cr(e,n,d,5);break;case 6:St=0,pa=null,cr(e,n,d,6);break;case 8:op(),Xt=6;break e;default:throw Error(r(462))}}Hj();break}catch(J){L_(e,J)}while(!0);return Rs=Pl=null,$.H=o,$.A=u,yt=l,nt!==null?0:(Ot=null,st=0,_c(),Xt)}function Hj(){for(;nt!==null&&!on();)U_(nt)}function U_(e){var n=u_(e.alternate,e,zs);e.memoizedProps=e.pendingProps,n===null?Jc(e):nt=n}function B_(e){var n=e,l=n.alternate;switch(n.tag){case 15:case 0:n=s_(l,n,n.pendingProps,n.type,void 0,st);break;case 11:n=s_(l,n,n.pendingProps,n.type.render,n.ref,st);break;case 5:Sf(n);default:f_(l,n),n=nt=qm(n,zs),n=u_(l,n,zs)}e.memoizedProps=e.pendingProps,n===null?Jc(e):nt=n}function cr(e,n,l,o){Rs=Pl=null,Sf(n),Ji=null,Wr=0;var u=n.return;try{if(Cj(e,u,n,l,st)){Xt=1,qc(e,Na(l,e.current)),nt=null;return}}catch(d){if(u!==null)throw nt=u,d;Xt=1,qc(e,Na(l,e.current)),nt=null;return}n.flags&32768?(ut||o===1?e=!0:lr||(st&536870912)!==0?e=!1:(_l=e=!0,(o===2||o===9||o===3||o===6)&&(o=da.current,o!==null&&o.tag===13&&(o.flags|=16384))),G_(n,e)):Jc(n)}function Jc(e){var n=e;do{if((n.flags&32768)!==0){G_(n,_l);return}e=n.return;var l=Mj(n.alternate,n,zs);if(l!==null){nt=l;return}if(n=n.sibling,n!==null){nt=n;return}nt=n=e}while(n!==null);Xt===0&&(Xt=5)}function G_(e,n){do{var l=Ij(e.alternate,e);if(l!==null){l.flags&=32767,nt=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!n&&(e=e.sibling,e!==null)){nt=e;return}nt=e=l}while(e!==null);Xt=6,nt=null}function H_(e,n,l,o,u,d,_,j,O){e.cancelPendingCommit=null;do Wc();while(vn!==0);if((yt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(d=n.lanes|n.childLanes,d|=Pd,Xn(e,l,d,_,j,O),e===Ot&&(nt=Ot=null,st=0),rr=n,yl=e,qs=l,lp=d,ip=u,O_=o,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Zj(Ie,function(){return Y_(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||o){o=$.T,$.T=null,u=ae.p,ae.p=2,_=yt,yt|=4;try{Lj(e,n,l)}finally{yt=_,ae.p=u,$.T=o}}vn=1,V_(),F_(),K_()}}function V_(){if(vn===1){vn=0;var e=yl,n=rr,l=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||l){l=$.T,$.T=null;var o=ae.p;ae.p=2;var u=yt;yt|=4;try{S_(n,e);var d=xp,_=Tm(e.containerInfo),j=d.focusedElem,O=d.selectionRange;if(_!==j&&j&&j.ownerDocument&&Em(j.ownerDocument.documentElement,j)){if(O!==null&&Fd(j)){var Z=O.start,J=O.end;if(J===void 0&&(J=Z),"selectionStart"in j)j.selectionStart=Z,j.selectionEnd=Math.min(J,j.value.length);else{var re=j.ownerDocument||document,Y=re&&re.defaultView||window;if(Y.getSelection){var X=Y.getSelection(),Te=j.textContent.length,ze=Math.min(O.start,Te),Et=O.end===void 0?ze:Math.min(O.end,Te);!X.extend&&ze>Et&&(_=Et,Et=ze,ze=_);var G=Rm(j,ze),U=Rm(j,Et);if(G&&U&&(X.rangeCount!==1||X.anchorNode!==G.node||X.anchorOffset!==G.offset||X.focusNode!==U.node||X.focusOffset!==U.offset)){var K=re.createRange();K.setStart(G.node,G.offset),X.removeAllRanges(),ze>Et?(X.addRange(K),X.extend(U.node,U.offset)):(K.setEnd(U.node,U.offset),X.addRange(K))}}}}for(re=[],X=j;X=X.parentNode;)X.nodeType===1&&re.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<re.length;j++){var se=re[j];se.element.scrollLeft=se.left,se.element.scrollTop=se.top}}du=!!yp,xp=yp=null}finally{yt=u,ae.p=o,$.T=l}}e.current=n,vn=2}}function F_(){if(vn===2){vn=0;var e=yl,n=rr,l=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||l){l=$.T,$.T=null;var o=ae.p;ae.p=2;var u=yt;yt|=4;try{b_(e,n.alternate,n)}finally{yt=u,ae.p=o,$.T=l}}vn=3}}function K_(){if(vn===4||vn===3){vn=0,en();var e=yl,n=rr,l=qs,o=O_;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?vn=5:(vn=0,rr=yl=null,Z_(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(bl=null),ra(l),n=n.stateNode,ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(Je,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=$.T,u=ae.p,ae.p=2,$.T=null;try{for(var d=e.onRecoverableError,_=0;_<o.length;_++){var j=o[_];d(j.value,{componentStack:j.stack})}}finally{$.T=n,ae.p=u}}(qs&3)!==0&&Wc(),rs(e),u=e.pendingLanes,(l&261930)!==0&&(u&42)!==0?e===rp?_o++:(_o=0,rp=e):_o=0,vo(0)}}function Z_(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Qr(n)))}function Wc(){return V_(),F_(),K_(),Y_()}function Y_(){if(vn!==5)return!1;var e=yl,n=lp;lp=0;var l=ra(qs),o=$.T,u=ae.p;try{ae.p=32>l?32:l,$.T=null,l=ip,ip=null;var d=yl,_=qs;if(vn=0,rr=yl=null,qs=0,(yt&6)!==0)throw Error(r(331));var j=yt;if(yt|=4,E_(d.current),k_(d,d.current,_,l),yt=j,vo(0,!1),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(Je,d)}catch{}return!0}finally{ae.p=u,$.T=o,Z_(e,n)}}function X_(e,n,l){n=Na(l,n),n=qf(e.stateNode,n,2),e=pl(e,n,2),e!==null&&(ia(e,2),rs(e))}function Nt(e,n,l){if(e.tag===3)X_(e,e,l);else for(;n!==null;){if(n.tag===3){X_(n,e,l);break}else if(n.tag===1){var o=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(bl===null||!bl.has(o))){e=Na(l,e),l=Pg(2),o=pl(n,l,2),o!==null&&(Qg(l,o,n,e),ia(o,2),rs(o));break}}n=n.return}}function up(e,n,l){var o=e.pingCache;if(o===null){o=e.pingCache=new qj;var u=new Set;o.set(n,u)}else u=o.get(n),u===void 0&&(u=new Set,o.set(n,u));u.has(l)||(np=!0,u.add(l),e=Vj.bind(null,e,n,l),n.then(e,e))}function Vj(e,n,l){var o=e.pingCache;o!==null&&o.delete(n),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ot===e&&(st&l)===l&&(Xt===4||Xt===3&&(st&62914560)===st&&300>rt()-Zc?(yt&2)===0&&or(e,0):ap|=l,ir===st&&(ir=0)),rs(e)}function P_(e,n){n===0&&(n=Bt()),e=Zl(e,n),e!==null&&(ia(e,n),rs(e))}function Fj(e){var n=e.memoizedState,l=0;n!==null&&(l=n.retryLane),P_(e,l)}function Kj(e,n){var l=0;switch(e.tag){case 31:case 13:var o=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(n),P_(e,l)}function Zj(e,n){return rn(e,n)}var eu=null,ur=null,dp=!1,tu=!1,fp=!1,jl=0;function rs(e){e!==ur&&e.next===null&&(ur===null?eu=ur=e:ur=ur.next=e),tu=!0,dp||(dp=!0,Xj())}function vo(e,n){if(!fp&&tu){fp=!0;do for(var l=!1,o=eu;o!==null;){if(e!==0){var u=o.pendingLanes;if(u===0)var d=0;else{var _=o.suspendedLanes,j=o.pingedLanes;d=(1<<31-Mt(42|e)+1)-1,d&=u&~(_&~j),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,ev(o,d))}else d=st,d=Dn(o,o===Ot?d:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(d&3)===0||Ut(o,d)||(l=!0,ev(o,d));o=o.next}while(l);fp=!1}}function Yj(){Q_()}function Q_(){tu=dp=!1;var e=0;jl!==0&&lw()&&(e=jl);for(var n=rt(),l=null,o=eu;o!==null;){var u=o.next,d=J_(o,n);d===0?(o.next=null,l===null?eu=u:l.next=u,u===null&&(ur=l)):(l=o,(e!==0||(d&3)!==0)&&(tu=!0)),o=u}vn!==0&&vn!==5||vo(e),jl!==0&&(jl=0)}function J_(e,n){for(var l=e.suspendedLanes,o=e.pingedLanes,u=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var _=31-Mt(d),j=1<<_,O=u[_];O===-1?((j&l)===0||(j&o)!==0)&&(u[_]=ct(j,n)):O<=n&&(e.expiredLanes|=j),d&=~j}if(n=Ot,l=st,l=Dn(e,e===n?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,l===0||e===n&&(St===2||St===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&Ln(o),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Ut(e,l)){if(n=l&-l,n===e.callbackPriority)return n;switch(o!==null&&Ln(o),ra(l)){case 2:case 8:l=Ae;break;case 32:l=Ie;break;case 268435456:l=ot;break;default:l=Ie}return o=W_.bind(null,e),l=rn(l,o),e.callbackPriority=n,e.callbackNode=l,n}return o!==null&&o!==null&&Ln(o),e.callbackPriority=2,e.callbackNode=null,2}function W_(e,n){if(vn!==0&&vn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Wc()&&e.callbackNode!==l)return null;var o=st;return o=Dn(e,e===Ot?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(M_(e,o,n),J_(e,rt()),e.callbackNode!=null&&e.callbackNode===l?W_.bind(null,e):null)}function ev(e,n){if(Wc())return null;M_(e,n,!0)}function Xj(){rw(function(){(yt&6)!==0?rn(le,Yj):Q_()})}function pp(){if(jl===0){var e=Xi;e===0&&(e=tn,tn<<=1,(tn&261888)===0&&(tn=256)),jl=e}return jl}function tv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ri(""+e)}function nv(e,n){var l=n.ownerDocument.createElement("input");return l.name=n.name,l.value=n.value,e.id&&l.setAttribute("form",e.id),n.parentNode.insertBefore(l,n),e=new FormData(e),l.parentNode.removeChild(l),e}function Pj(e,n,l,o,u){if(n==="submit"&&l&&l.stateNode===u){var d=tv((u[$e]||null).action),_=o.submitter;_&&(n=(n=_[$e]||null)?tv(n.formAction):_.getAttribute("formAction"),n!==null&&(d=n,_=null));var j=new Gl("action","action",null,o,u);e.push({event:j,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(jl!==0){var O=_?nv(u,_):new FormData(u);$f(l,{pending:!0,data:O,method:u.method,action:d},null,O)}}else typeof d=="function"&&(j.preventDefault(),O=_?nv(u,_):new FormData(u),$f(l,{pending:!0,data:O,method:u.method,action:d},d,O))},currentTarget:u}]})}}for(var hp=0;hp<Xd.length;hp++){var mp=Xd[hp],Qj=mp.toLowerCase(),Jj=mp[0].toUpperCase()+mp.slice(1);Va(Qj,"on"+Jj)}Va($m,"onAnimationEnd"),Va(Mm,"onAnimationIteration"),Va(Im,"onAnimationStart"),Va("dblclick","onDoubleClick"),Va("focusin","onFocus"),Va("focusout","onBlur"),Va(hj,"onTransitionRun"),Va(mj,"onTransitionStart"),Va(gj,"onTransitionCancel"),Va(Lm,"onTransitionEnd"),jn("onMouseEnter",["mouseout","mouseover"]),jn("onMouseLeave",["mouseout","mouseover"]),jn("onPointerEnter",["pointerout","pointerover"]),jn("onPointerLeave",["pointerout","pointerover"]),ya("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ya("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ya("onBeforeInput",["compositionend","keypress","textInput","paste"]),ya("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ya("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ya("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bo="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(" "),Wj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bo));function av(e,n){n=(n&4)!==0;for(var l=0;l<e.length;l++){var o=e[l],u=o.event;o=o.listeners;e:{var d=void 0;if(n)for(var _=o.length-1;0<=_;_--){var j=o[_],O=j.instance,Z=j.currentTarget;if(j=j.listener,O!==d&&u.isPropagationStopped())break e;d=j,u.currentTarget=Z;try{d(u)}catch(J){gc(J)}u.currentTarget=null,d=O}else for(_=0;_<o.length;_++){if(j=o[_],O=j.instance,Z=j.currentTarget,j=j.listener,O!==d&&u.isPropagationStopped())break e;d=j,u.currentTarget=Z;try{d(u)}catch(J){gc(J)}u.currentTarget=null,d=O}}}}function at(e,n){var l=n[We];l===void 0&&(l=n[We]=new Set);var o=e+"__bubble";l.has(o)||(sv(n,e,2,!1),l.add(o))}function gp(e,n,l){var o=0;n&&(o|=4),sv(l,e,o,n)}var nu="_reactListening"+Math.random().toString(36).slice(2);function _p(e){if(!e[nu]){e[nu]=!0,_s.forEach(function(l){l!=="selectionchange"&&(Wj.has(l)||gp(l,!1,e),gp(l,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[nu]||(n[nu]=!0,gp("selectionchange",!1,n))}}function sv(e,n,l,o){switch($v(n)){case 2:var u=Aw;break;case 8:u=Rw;break;default:u=Op}l=u.bind(null,n,l,e),u=void 0,!Oi||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(u=!0),o?u!==void 0?e.addEventListener(n,l,{capture:!0,passive:u}):e.addEventListener(n,l,!0):u!==void 0?e.addEventListener(n,l,{passive:u}):e.addEventListener(n,l,!1)}function vp(e,n,l,o,u){var d=o;if((n&1)===0&&(n&2)===0&&o!==null)e:for(;;){if(o===null)return;var _=o.tag;if(_===3||_===4){var j=o.stateNode.containerInfo;if(j===u)break;if(_===4)for(_=o.return;_!==null;){var O=_.tag;if((O===3||O===4)&&_.stateNode.containerInfo===u)return;_=_.return}for(;j!==null;){if(_=_n(j),_===null)return;if(O=_.tag,O===5||O===6||O===26||O===27){o=d=_;continue e}j=j.parentNode}}o=o.return}Ci(function(){var Z=d,J=Ti(l),re=[];e:{var Y=Dm.get(e);if(Y!==void 0){var X=Gl,Te=e;switch(e){case"keypress":if(Mi(l)===0)break e;case"keydown":case"keyup":X=fc;break;case"focusin":Te="focus",X=as;break;case"focusout":Te="blur",X=as;break;case"beforeblur":case"afterblur":X=as;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=Hl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=zd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=Ud;break;case $m:case Mm:case Im:X=cc;break;case Lm:X=Gd;break;case"scroll":case"scrollend":X=rc;break;case"wheel":X=R;break;case"copy":case"cut":case"paste":X=uc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Hr;break;case"toggle":case"beforetoggle":X=W}var ze=(n&4)!==0,Et=!ze&&(e==="scroll"||e==="scrollend"),G=ze?Y!==null?Y+"Capture":null:Y;ze=[];for(var U=Z,K;U!==null;){var se=U;if(K=se.stateNode,se=se.tag,se!==5&&se!==26&&se!==27||K===null||G===null||(se=il(U,G),se!=null&&ze.push(yo(U,se,K))),Et)break;U=U.return}0<ze.length&&(Y=new X(Y,Te,null,l,J),re.push({event:Y,listeners:ze}))}}if((n&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",Y&&l!==Ei&&(Te=l.relatedTarget||l.fromElement)&&(_n(Te)||Te[Ye]))break e;if((X||Y)&&(Y=J.window===J?J:(Y=J.ownerDocument)?Y.defaultView||Y.parentWindow:window,X?(Te=l.relatedTarget||l.toElement,X=Z,Te=Te?_n(Te):null,Te!==null&&(Et=f(Te),ze=Te.tag,Te!==Et||ze!==5&&ze!==27&&ze!==6)&&(Te=null)):(X=null,Te=Z),X!==Te)){if(ze=Hl,se="onMouseLeave",G="onMouseEnter",U="mouse",(e==="pointerout"||e==="pointerover")&&(ze=Hr,se="onPointerLeave",G="onPointerEnter",U="pointer"),Et=X==null?Y:cn(X),K=Te==null?Y:cn(Te),Y=new ze(se,U+"leave",X,l,J),Y.target=Et,Y.relatedTarget=K,se=null,_n(J)===Z&&(ze=new ze(G,U+"enter",Te,l,J),ze.target=K,ze.relatedTarget=Et,se=ze),Et=se,X&&Te)t:{for(ze=ew,G=X,U=Te,K=0,se=G;se;se=ze(se))K++;se=0;for(var De=U;De;De=ze(De))se++;for(;0<K-se;)G=ze(G),K--;for(;0<se-K;)U=ze(U),se--;for(;K--;){if(G===U||U!==null&&G===U.alternate){ze=G;break t}G=ze(G),U=ze(U)}ze=null}else ze=null;X!==null&&lv(re,Y,X,ze,!1),Te!==null&&Et!==null&&lv(re,Et,Te,ze,!0)}}e:{if(Y=Z?cn(Z):window,X=Y.nodeName&&Y.nodeName.toLowerCase(),X==="select"||X==="input"&&Y.type==="file")var vt=jm;else if(ym(Y))if(wm)vt=dj;else{vt=cj;var Me=oj}else X=Y.nodeName,!X||X.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?Z&&zr(Z.elementType)&&(vt=jm):vt=uj;if(vt&&(vt=vt(e,Z))){xm(re,vt,l,J);break e}Me&&Me(e,Y,Z),e==="focusout"&&Z&&Y.type==="number"&&Z.memoizedProps.value!=null&&al(Y,"number",Y.value)}switch(Me=Z?cn(Z):window,e){case"focusin":(ym(Me)||Me.contentEditable==="true")&&(Bi=Me,Kd=Z,Yr=null);break;case"focusout":Yr=Kd=Bi=null;break;case"mousedown":Zd=!0;break;case"contextmenu":case"mouseup":case"dragend":Zd=!1,Cm(re,l,J);break;case"selectionchange":if(pj)break;case"keydown":case"keyup":Cm(re,l,J)}var Pe;if(ne)e:{switch(e){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else Ui?Vr(e,l)&&(lt="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(lt="onCompositionStart");lt&&(tt&&l.locale!=="ko"&&(Ui||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&Ui&&(Pe=$i()):(Ba=J,qr="value"in Ba?Ba.value:Ba.textContent,Ui=!0)),Me=au(Z,lt),0<Me.length&&(lt=new dc(lt,e,null,l,J),re.push({event:lt,listeners:Me}),Pe?lt.data=Pe:(Pe=bm(l),Pe!==null&&(lt.data=Pe)))),(Pe=Ge?sj(e,l):lj(e,l))&&(lt=au(Z,"onBeforeInput"),0<lt.length&&(Me=new dc("onBeforeInput","beforeinput",null,l,J),re.push({event:Me,listeners:lt}),Me.data=Pe)),Pj(re,e,Z,l,J)}av(re,n)})}function yo(e,n,l){return{instance:e,listener:n,currentTarget:l}}function au(e,n){for(var l=n+"Capture",o=[];e!==null;){var u=e,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=il(e,l),u!=null&&o.unshift(yo(e,u,d)),u=il(e,n),u!=null&&o.push(yo(e,u,d))),e.tag===3)return o;e=e.return}return[]}function ew(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function lv(e,n,l,o,u){for(var d=n._reactName,_=[];l!==null&&l!==o;){var j=l,O=j.alternate,Z=j.stateNode;if(j=j.tag,O!==null&&O===o)break;j!==5&&j!==26&&j!==27||Z===null||(O=Z,u?(Z=il(l,d),Z!=null&&_.unshift(yo(l,Z,O))):u||(Z=il(l,d),Z!=null&&_.push(yo(l,Z,O)))),l=l.return}_.length!==0&&e.push({event:n,listeners:_})}var tw=/\r\n?/g,nw=/\u0000|\uFFFD/g;function iv(e){return(typeof e=="string"?e:""+e).replace(tw,`
|
|
9
|
+
`).replace(nw,"")}function rv(e,n){return n=iv(n),iv(e)===n}function Rt(e,n,l,o,u,d){switch(l){case"children":typeof o=="string"?n==="body"||n==="textarea"&&o===""||sl(e,o):(typeof o=="number"||typeof o=="bigint")&&n!=="body"&&sl(e,""+o);break;case"className":es(e,"class",o);break;case"tabIndex":es(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":es(e,l,o);break;case"style":sc(e,o,d);break;case"data":if(n!=="object"){es(e,"data",o);break}case"src":case"href":if(o===""&&(n!=="a"||l!=="href")){e.removeAttribute(l);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(l);break}o=Ri(""+o),e.setAttribute(l,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(l==="formAction"?(n!=="input"&&Rt(e,n,"name",u.name,u,null),Rt(e,n,"formEncType",u.formEncType,u,null),Rt(e,n,"formMethod",u.formMethod,u,null),Rt(e,n,"formTarget",u.formTarget,u,null)):(Rt(e,n,"encType",u.encType,u,null),Rt(e,n,"method",u.method,u,null),Rt(e,n,"target",u.target,u,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(l);break}o=Ri(""+o),e.setAttribute(l,o);break;case"onClick":o!=null&&(e.onclick=ja);break;case"onScroll":o!=null&&at("scroll",e);break;case"onScrollEnd":o!=null&&at("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(l=o.__html,l!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=l}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}l=Ri(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(l,""+o):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":o===!0?e.setAttribute(l,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(l,o):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(l,o):e.removeAttribute(l);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(l):e.setAttribute(l,o);break;case"popover":at("beforetoggle",e),at("toggle",e),bs(e,"popover",o);break;case"xlinkActuate":ie(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":ie(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":ie(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":ie(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":ie(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":ie(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":ie(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":ie(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":ie(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":bs(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Id.get(l)||l,bs(e,l,o))}}function bp(e,n,l,o,u,d){switch(l){case"style":sc(e,o,d);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(l=o.__html,l!=null){if(u.children!=null)throw Error(r(60));e.innerHTML=l}}break;case"children":typeof o=="string"?sl(e,o):(typeof o=="number"||typeof o=="bigint")&&sl(e,""+o);break;case"onScroll":o!=null&&at("scroll",e);break;case"onScrollEnd":o!=null&&at("scrollend",e);break;case"onClick":o!=null&&(e.onclick=ja);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Wa.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(u=l.endsWith("Capture"),n=l.slice(2,u?l.length-7:void 0),d=e[$e]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(n,d,u),typeof o=="function")){typeof d!="function"&&d!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(n,o,u);break e}l in e?e[l]=o:o===!0?e.setAttribute(l,""):bs(e,l,o)}}}function Mn(e,n,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",e),at("load",e);var o=!1,u=!1,d;for(d in l)if(l.hasOwnProperty(d)){var _=l[d];if(_!=null)switch(d){case"src":o=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Rt(e,n,d,_,l,null)}}u&&Rt(e,n,"srcSet",l.srcSet,l,null),o&&Rt(e,n,"src",l.src,l,null);return;case"input":at("invalid",e);var j=d=_=u=null,O=null,Z=null;for(o in l)if(l.hasOwnProperty(o)){var J=l[o];if(J!=null)switch(o){case"name":u=J;break;case"type":_=J;break;case"checked":O=J;break;case"defaultChecked":Z=J;break;case"value":d=J;break;case"defaultValue":j=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:Rt(e,n,o,J,l,null)}}nc(e,d,j,O,Z,_,u,!1);return;case"select":at("invalid",e),o=_=d=null;for(u in l)if(l.hasOwnProperty(u)&&(j=l[u],j!=null))switch(u){case"value":d=j;break;case"defaultValue":_=j;break;case"multiple":o=j;default:Rt(e,n,u,j,l,null)}n=d,l=_,e.multiple=!!o,n!=null?xs(e,!!o,n,!1):l!=null&&xs(e,!!o,l,!0);return;case"textarea":at("invalid",e),d=u=o=null;for(_ in l)if(l.hasOwnProperty(_)&&(j=l[_],j!=null))switch(_){case"value":o=j;break;case"defaultValue":u=j;break;case"children":d=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:Rt(e,n,_,j,l,null)}ac(e,o,u,d);return;case"option":for(O in l)l.hasOwnProperty(O)&&(o=l[O],o!=null)&&(O==="selected"?e.selected=o&&typeof o!="function"&&typeof o!="symbol":Rt(e,n,O,o,l,null));return;case"dialog":at("beforetoggle",e),at("toggle",e),at("cancel",e),at("close",e);break;case"iframe":case"object":at("load",e);break;case"video":case"audio":for(o=0;o<bo.length;o++)at(bo[o],e);break;case"image":at("error",e),at("load",e);break;case"details":at("toggle",e);break;case"embed":case"source":case"link":at("error",e),at("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in l)if(l.hasOwnProperty(Z)&&(o=l[Z],o!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:Rt(e,n,Z,o,l,null)}return;default:if(zr(n)){for(J in l)l.hasOwnProperty(J)&&(o=l[J],o!==void 0&&bp(e,n,J,o,l,void 0));return}}for(j in l)l.hasOwnProperty(j)&&(o=l[j],o!=null&&Rt(e,n,j,o,l,null))}function aw(e,n,l,o){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,d=null,_=null,j=null,O=null,Z=null,J=null;for(X in l){var re=l[X];if(l.hasOwnProperty(X)&&re!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":O=re;default:o.hasOwnProperty(X)||Rt(e,n,X,null,o,re)}}for(var Y in o){var X=o[Y];if(re=l[Y],o.hasOwnProperty(Y)&&(X!=null||re!=null))switch(Y){case"type":d=X;break;case"name":u=X;break;case"checked":Z=X;break;case"defaultChecked":J=X;break;case"value":_=X;break;case"defaultValue":j=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,n));break;default:X!==re&&Rt(e,n,Y,X,o,re)}}ki(e,_,j,O,Z,J,d,u);return;case"select":X=_=j=Y=null;for(d in l)if(O=l[d],l.hasOwnProperty(d)&&O!=null)switch(d){case"value":break;case"multiple":X=O;default:o.hasOwnProperty(d)||Rt(e,n,d,null,o,O)}for(u in o)if(d=o[u],O=l[u],o.hasOwnProperty(u)&&(d!=null||O!=null))switch(u){case"value":Y=d;break;case"defaultValue":j=d;break;case"multiple":_=d;default:d!==O&&Rt(e,n,u,d,o,O)}n=j,l=_,o=X,Y!=null?xs(e,!!l,Y,!1):!!o!=!!l&&(n!=null?xs(e,!!l,n,!0):xs(e,!!l,l?[]:"",!1));return;case"textarea":X=Y=null;for(j in l)if(u=l[j],l.hasOwnProperty(j)&&u!=null&&!o.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:Rt(e,n,j,null,o,u)}for(_ in o)if(u=o[_],d=l[_],o.hasOwnProperty(_)&&(u!=null||d!=null))switch(_){case"value":Y=u;break;case"defaultValue":X=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==d&&Rt(e,n,_,u,o,d)}Lr(e,Y,X);return;case"option":for(var Te in l)Y=l[Te],l.hasOwnProperty(Te)&&Y!=null&&!o.hasOwnProperty(Te)&&(Te==="selected"?e.selected=!1:Rt(e,n,Te,null,o,Y));for(O in o)Y=o[O],X=l[O],o.hasOwnProperty(O)&&Y!==X&&(Y!=null||X!=null)&&(O==="selected"?e.selected=Y&&typeof Y!="function"&&typeof Y!="symbol":Rt(e,n,O,Y,o,X));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ze in l)Y=l[ze],l.hasOwnProperty(ze)&&Y!=null&&!o.hasOwnProperty(ze)&&Rt(e,n,ze,null,o,Y);for(Z in o)if(Y=o[Z],X=l[Z],o.hasOwnProperty(Z)&&Y!==X&&(Y!=null||X!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,n));break;default:Rt(e,n,Z,Y,o,X)}return;default:if(zr(n)){for(var Et in l)Y=l[Et],l.hasOwnProperty(Et)&&Y!==void 0&&!o.hasOwnProperty(Et)&&bp(e,n,Et,void 0,o,Y);for(J in o)Y=o[J],X=l[J],!o.hasOwnProperty(J)||Y===X||Y===void 0&&X===void 0||bp(e,n,J,Y,o,X);return}}for(var G in l)Y=l[G],l.hasOwnProperty(G)&&Y!=null&&!o.hasOwnProperty(G)&&Rt(e,n,G,null,o,Y);for(re in o)Y=o[re],X=l[re],!o.hasOwnProperty(re)||Y===X||Y==null&&X==null||Rt(e,n,re,Y,o,X)}function ov(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function sw(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,l=performance.getEntriesByType("resource"),o=0;o<l.length;o++){var u=l[o],d=u.transferSize,_=u.initiatorType,j=u.duration;if(d&&j&&ov(_)){for(_=0,j=u.responseEnd,o+=1;o<l.length;o++){var O=l[o],Z=O.startTime;if(Z>j)break;var J=O.transferSize,re=O.initiatorType;J&&ov(re)&&(O=O.responseEnd,_+=J*(O<j?1:(j-Z)/(O-Z)))}if(--o,n+=8*(d+_)/(u.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var yp=null,xp=null;function su(e){return e.nodeType===9?e:e.ownerDocument}function cv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function uv(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function jp(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var wp=null;function lw(){var e=window.event;return e&&e.type==="popstate"?e===wp?!1:(wp=e,!0):(wp=null,!1)}var dv=typeof setTimeout=="function"?setTimeout:void 0,iw=typeof clearTimeout=="function"?clearTimeout:void 0,fv=typeof Promise=="function"?Promise:void 0,rw=typeof queueMicrotask=="function"?queueMicrotask:typeof fv<"u"?function(e){return fv.resolve(null).then(e).catch(ow)}:dv;function ow(e){setTimeout(function(){throw e})}function wl(e){return e==="head"}function pv(e,n){var l=n,o=0;do{var u=l.nextSibling;if(e.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"||l==="/&"){if(o===0){e.removeChild(u),hr(n);return}o--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")o++;else if(l==="html")xo(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,xo(l);for(var d=l.firstChild;d;){var _=d.nextSibling,j=d.nodeName;d[Gt]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=_}}else l==="body"&&xo(e.ownerDocument.body);l=u}while(l);hr(n)}function hv(e,n){var l=e;e=0;do{var o=l.nextSibling;if(l.nodeType===1?n?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(n?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),o&&o.nodeType===8)if(l=o.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=o}while(l)}function Sp(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var l=n;switch(n=n.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Sp(l),En(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function cw(e,n,l,o){for(;e.nodeType===1;){var u=l;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[Gt])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Ta(e.nextSibling),e===null)break}return null}function uw(e,n,l){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Ta(e.nextSibling),e===null))return null;return e}function mv(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ta(e.nextSibling),e===null))return null;return e}function Np(e){return e.data==="$?"||e.data==="$~"}function kp(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function dw(e,n){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||l.readyState!=="loading")n();else{var o=function(){n(),l.removeEventListener("DOMContentLoaded",o)};l.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Ta(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Ap=null;function gv(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(n===0)return Ta(e.nextSibling);n--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||n++}e=e.nextSibling}return null}function _v(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(n===0)return e;n--}else l!=="/$"&&l!=="/&"||n++}e=e.previousSibling}return null}function vv(e,n,l){switch(n=su(l),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function xo(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);En(e)}var Ca=new Map,bv=new Set;function lu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Us=ae.d;ae.d={f:fw,r:pw,D:hw,C:mw,L:gw,m:_w,X:bw,S:vw,M:yw};function fw(){var e=Us.f(),n=Pc();return e||n}function pw(e){var n=Lt(e);n!==null&&n.tag===5&&n.type==="form"?Lg(n):Us.r(e)}var dr=typeof document>"u"?null:document;function yv(e,n,l){var o=dr;if(o&&typeof n=="string"&&n){var u=Vn(n);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),bv.has(u)||(bv.add(u),e={rel:e,crossOrigin:l,href:n},o.querySelector(u)===null&&(n=o.createElement("link"),Mn(n,"link",e),mt(n),o.head.appendChild(n)))}}function hw(e){Us.D(e),yv("dns-prefetch",e,null)}function mw(e,n){Us.C(e,n),yv("preconnect",e,n)}function gw(e,n,l){Us.L(e,n,l);var o=dr;if(o&&e&&n){var u='link[rel="preload"][as="'+Vn(n)+'"]';n==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+Vn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+Vn(l.imageSizes)+'"]')):u+='[href="'+Vn(e)+'"]';var d=u;switch(n){case"style":d=fr(e);break;case"script":d=pr(e)}Ca.has(d)||(e=y({rel:"preload",href:n==="image"&&l&&l.imageSrcSet?void 0:e,as:n},l),Ca.set(d,e),o.querySelector(u)!==null||n==="style"&&o.querySelector(jo(d))||n==="script"&&o.querySelector(wo(d))||(n=o.createElement("link"),Mn(n,"link",e),mt(n),o.head.appendChild(n)))}}function _w(e,n){Us.m(e,n);var l=dr;if(l&&e){var o=n&&typeof n.as=="string"?n.as:"script",u='link[rel="modulepreload"][as="'+Vn(o)+'"][href="'+Vn(e)+'"]',d=u;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=pr(e)}if(!Ca.has(d)&&(e=y({rel:"modulepreload",href:e},n),Ca.set(d,e),l.querySelector(u)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(wo(d)))return}o=l.createElement("link"),Mn(o,"link",e),mt(o),l.head.appendChild(o)}}}function vw(e,n,l){Us.S(e,n,l);var o=dr;if(o&&e){var u=xn(o).hoistableStyles,d=fr(e);n=n||"default";var _=u.get(d);if(!_){var j={loading:0,preload:null};if(_=o.querySelector(jo(d)))j.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},l),(l=Ca.get(d))&&Rp(e,l);var O=_=o.createElement("link");mt(O),Mn(O,"link",e),O._p=new Promise(function(Z,J){O.onload=Z,O.onerror=J}),O.addEventListener("load",function(){j.loading|=1}),O.addEventListener("error",function(){j.loading|=2}),j.loading|=4,iu(_,n,o)}_={type:"stylesheet",instance:_,count:1,state:j},u.set(d,_)}}}function bw(e,n){Us.X(e,n);var l=dr;if(l&&e){var o=xn(l).hoistableScripts,u=pr(e),d=o.get(u);d||(d=l.querySelector(wo(u)),d||(e=y({src:e,async:!0},n),(n=Ca.get(u))&&Ep(e,n),d=l.createElement("script"),mt(d),Mn(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function yw(e,n){Us.M(e,n);var l=dr;if(l&&e){var o=xn(l).hoistableScripts,u=pr(e),d=o.get(u);d||(d=l.querySelector(wo(u)),d||(e=y({src:e,async:!0,type:"module"},n),(n=Ca.get(u))&&Ep(e,n),d=l.createElement("script"),mt(d),Mn(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},o.set(u,d))}}function xv(e,n,l,o){var u=(u=H.current)?lu(u):null;if(!u)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(n=fr(l.href),l=xn(u).hoistableStyles,o=l.get(n),o||(o={type:"style",instance:null,count:0,state:null},l.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=fr(l.href);var d=xn(u).hoistableStyles,_=d.get(e);if(_||(u=u.ownerDocument||u,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,_),(d=u.querySelector(jo(e)))&&!d._p&&(_.instance=d,_.state.loading=5),Ca.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ca.set(e,l),d||xw(u,e,l,_.state))),n&&o===null)throw Error(r(528,""));return _}if(n&&o!==null)throw Error(r(529,""));return null;case"script":return n=l.async,l=l.src,typeof l=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=pr(l),l=xn(u).hoistableScripts,o=l.get(n),o||(o={type:"script",instance:null,count:0,state:null},l.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function fr(e){return'href="'+Vn(e)+'"'}function jo(e){return'link[rel="stylesheet"]['+e+"]"}function jv(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function xw(e,n,l,o){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=e.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Mn(n,"link",l),mt(n),e.head.appendChild(n))}function pr(e){return'[src="'+Vn(e)+'"]'}function wo(e){return"script[async]"+e}function wv(e,n,l){if(n.count++,n.instance===null)switch(n.type){case"style":var o=e.querySelector('style[data-href~="'+Vn(l.href)+'"]');if(o)return n.instance=o,mt(o),o;var u=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),mt(o),Mn(o,"style",u),iu(o,l.precedence,e),n.instance=o;case"stylesheet":u=fr(l.href);var d=e.querySelector(jo(u));if(d)return n.state.loading|=4,n.instance=d,mt(d),d;o=jv(l),(u=Ca.get(u))&&Rp(o,u),d=(e.ownerDocument||e).createElement("link"),mt(d);var _=d;return _._p=new Promise(function(j,O){_.onload=j,_.onerror=O}),Mn(d,"link",o),n.state.loading|=4,iu(d,l.precedence,e),n.instance=d;case"script":return d=pr(l.src),(u=e.querySelector(wo(d)))?(n.instance=u,mt(u),u):(o=l,(u=Ca.get(d))&&(o=y({},l),Ep(o,u)),e=e.ownerDocument||e,u=e.createElement("script"),mt(u),Mn(u,"link",o),e.head.appendChild(u),n.instance=u);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,iu(o,l.precedence,e));return n.instance}function iu(e,n,l){for(var o=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=o.length?o[o.length-1]:null,d=u,_=0;_<o.length;_++){var j=o[_];if(j.dataset.precedence===n)d=j;else if(d!==u)break}d?d.parentNode.insertBefore(e,d.nextSibling):(n=l.nodeType===9?l.head:l,n.insertBefore(e,n.firstChild))}function Rp(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function Ep(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var ru=null;function Sv(e,n,l){if(ru===null){var o=new Map,u=ru=new Map;u.set(l,o)}else u=ru,o=u.get(l),o||(o=new Map,u.set(l,o));if(o.has(e))return o;for(o.set(e,null),l=l.getElementsByTagName(e),u=0;u<l.length;u++){var d=l[u];if(!(d[Gt]||d[ke]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var _=d.getAttribute(n)||"";_=e+_;var j=o.get(_);j?j.push(d):o.set(_,[d])}}return o}function Nv(e,n,l){e=e.ownerDocument||e,e.head.insertBefore(l,n==="title"?e.querySelector("head > title"):null)}function jw(e,n,l){if(l===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function kv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ww(e,n,l,o){if(l.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=fr(o.href),d=n.querySelector(jo(u));if(d){n=d._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=ou.bind(e),n.then(e,e)),l.state.loading|=4,l.instance=d,mt(d);return}d=n.ownerDocument||n,o=jv(o),(u=Ca.get(u))&&Rp(o,u),d=d.createElement("link"),mt(d);var _=d;_._p=new Promise(function(j,O){_.onload=j,_.onerror=O}),Mn(d,"link",o),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,n),(n=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=ou.bind(e),n.addEventListener("load",l),n.addEventListener("error",l))}}var Tp=0;function Sw(e,n){return e.stylesheets&&e.count===0&&uu(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var o=setTimeout(function(){if(e.stylesheets&&uu(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+n);0<e.imgBytes&&Tp===0&&(Tp=62500*sw());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&uu(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>Tp?50:800)+n);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(u)}}:null}function ou(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var cu=null;function uu(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,cu=new Map,n.forEach(Nw,e),cu=null,ou.call(e))}function Nw(e,n){if(!(n.state.loading&4)){var l=cu.get(e);if(l)var o=l.get(null);else{l=new Map,cu.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var _=u[d];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(l.set(_.dataset.precedence,_),o=_)}o&&l.set(null,o)}u=n.instance,_=u.getAttribute("data-precedence"),d=l.get(_)||o,d===o&&l.set(null,u),l.set(_,u),this.count++,o=ou.bind(this),u.addEventListener("load",o),u.addEventListener("error",o),d?d.parentNode.insertBefore(u,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),n.state.loading|=4}}var So={$$typeof:q,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function kw(e,n,l,o,u,d,_,j,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Hn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hn(0),this.hiddenUpdates=Hn(null),this.identifierPrefix=o,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Av(e,n,l,o,u,d,_,j,O,Z,J,re){return e=new kw(e,n,l,_,O,Z,J,re,j),n=1,d===!0&&(n|=24),d=ua(3,null,null,n),e.current=d,d.stateNode=e,n=cf(),n.refCount++,e.pooledCache=n,n.refCount++,d.memoizedState={element:o,isDehydrated:l,cache:n},pf(d),e}function Rv(e){return e?(e=Vi,e):Vi}function Ev(e,n,l,o,u,d){u=Rv(u),o.context===null?o.context=u:o.pendingContext=u,o=fl(n),o.payload={element:l},d=d===void 0?null:d,d!==null&&(o.callback=d),l=pl(e,o,n),l!==null&&(ta(l,e,n),to(l,e,n))}function Tv(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<n?l:n}}function Cp(e,n){Tv(e,n),(e=e.alternate)&&Tv(e,n)}function Cv(e){if(e.tag===13||e.tag===31){var n=Zl(e,67108864);n!==null&&ta(n,e,67108864),Cp(e,67108864)}}function Ov(e){if(e.tag===13||e.tag===31){var n=ma();n=Ja(n);var l=Zl(e,n);l!==null&&ta(l,e,n),Cp(e,n)}}var du=!0;function Aw(e,n,l,o){var u=$.T;$.T=null;var d=ae.p;try{ae.p=2,Op(e,n,l,o)}finally{ae.p=d,$.T=u}}function Rw(e,n,l,o){var u=$.T;$.T=null;var d=ae.p;try{ae.p=8,Op(e,n,l,o)}finally{ae.p=d,$.T=u}}function Op(e,n,l,o){if(du){var u=$p(o);if(u===null)vp(e,n,o,fu,l),Mv(e,o);else if(Tw(u,e,n,l,o))o.stopPropagation();else if(Mv(e,o),n&4&&-1<Ew.indexOf(e)){for(;u!==null;){var d=Lt(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var _=Ct(d.pendingLanes);if(_!==0){var j=d;for(j.pendingLanes|=2,j.entangledLanes|=2;_;){var O=1<<31-Mt(_);j.entanglements[1]|=O,_&=~O}rs(d),(yt&6)===0&&(Yc=rt()+500,vo(0))}}break;case 31:case 13:j=Zl(d,2),j!==null&&ta(j,d,2),Pc(),Cp(d,2)}if(d=$p(o),d===null&&vp(e,n,o,fu,l),d===u)break;u=d}u!==null&&o.stopPropagation()}else vp(e,n,o,null,l)}}function $p(e){return e=Ti(e),Mp(e)}var fu=null;function Mp(e){if(fu=null,e=_n(e),e!==null){var n=f(e);if(n===null)e=null;else{var l=n.tag;if(l===13){if(e=p(n),e!==null)return e;e=null}else if(l===31){if(e=h(n),e!==null)return e;e=null}else if(l===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return fu=e,null}function $v(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ue()){case le:return 2;case Ae:return 8;case Ie:case qe:return 32;case ot:return 268435456;default:return 32}default:return 32}}var Ip=!1,Sl=null,Nl=null,kl=null,No=new Map,ko=new Map,Al=[],Ew="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Mv(e,n){switch(e){case"focusin":case"focusout":Sl=null;break;case"dragenter":case"dragleave":Nl=null;break;case"mouseover":case"mouseout":kl=null;break;case"pointerover":case"pointerout":No.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ko.delete(n.pointerId)}}function Ao(e,n,l,o,u,d){return e===null||e.nativeEvent!==d?(e={blockedOn:n,domEventName:l,eventSystemFlags:o,nativeEvent:d,targetContainers:[u]},n!==null&&(n=Lt(n),n!==null&&Cv(n)),e):(e.eventSystemFlags|=o,n=e.targetContainers,u!==null&&n.indexOf(u)===-1&&n.push(u),e)}function Tw(e,n,l,o,u){switch(n){case"focusin":return Sl=Ao(Sl,e,n,l,o,u),!0;case"dragenter":return Nl=Ao(Nl,e,n,l,o,u),!0;case"mouseover":return kl=Ao(kl,e,n,l,o,u),!0;case"pointerover":var d=u.pointerId;return No.set(d,Ao(No.get(d)||null,e,n,l,o,u)),!0;case"gotpointercapture":return d=u.pointerId,ko.set(d,Ao(ko.get(d)||null,e,n,l,o,u)),!0}return!1}function Iv(e){var n=_n(e.target);if(n!==null){var l=f(n);if(l!==null){if(n=l.tag,n===13){if(n=p(l),n!==null){e.blockedOn=n,xe(e.priority,function(){Ov(l)});return}}else if(n===31){if(n=h(l),n!==null){e.blockedOn=n,xe(e.priority,function(){Ov(l)});return}}else if(n===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function pu(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var l=$p(e.nativeEvent);if(l===null){l=e.nativeEvent;var o=new l.constructor(l.type,l);Ei=o,l.target.dispatchEvent(o),Ei=null}else return n=Lt(l),n!==null&&Cv(n),e.blockedOn=l,!1;n.shift()}return!0}function Lv(e,n,l){pu(e)&&l.delete(n)}function Cw(){Ip=!1,Sl!==null&&pu(Sl)&&(Sl=null),Nl!==null&&pu(Nl)&&(Nl=null),kl!==null&&pu(kl)&&(kl=null),No.forEach(Lv),ko.forEach(Lv)}function hu(e,n){e.blockedOn===n&&(e.blockedOn=null,Ip||(Ip=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Cw)))}var mu=null;function Dv(e){mu!==e&&(mu=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){mu===e&&(mu=null);for(var n=0;n<e.length;n+=3){var l=e[n],o=e[n+1],u=e[n+2];if(typeof o!="function"){if(Mp(o||l)===null)continue;break}var d=Lt(l);d!==null&&(e.splice(n,3),n-=3,$f(d,{pending:!0,data:u,method:l.method,action:o},o,u))}}))}function hr(e){function n(O){return hu(O,e)}Sl!==null&&hu(Sl,e),Nl!==null&&hu(Nl,e),kl!==null&&hu(kl,e),No.forEach(n),ko.forEach(n);for(var l=0;l<Al.length;l++){var o=Al[l];o.blockedOn===e&&(o.blockedOn=null)}for(;0<Al.length&&(l=Al[0],l.blockedOn===null);)Iv(l),l.blockedOn===null&&Al.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(o=0;o<l.length;o+=3){var u=l[o],d=l[o+1],_=u[$e]||null;if(typeof d=="function")_||Dv(l);else if(_){var j=null;if(d&&d.hasAttribute("formAction")){if(u=d,_=d[$e]||null)j=_.formAction;else if(Mp(u)!==null)continue}else j=_.action;typeof j=="function"?l[o+1]=j:(l.splice(o,3),o-=3),Dv(l)}}}function zv(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(_){return u=_})},focusReset:"manual",scroll:"manual"})}function n(){u!==null&&(u(),u=null),o||setTimeout(l,20)}function l(){if(!o&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(l,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),u!==null&&(u(),u=null)}}}function Lp(e){this._internalRoot=e}gu.prototype.render=Lp.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var l=n.current,o=ma();Ev(l,o,e,n,null,null)},gu.prototype.unmount=Lp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Ev(e.current,2,null,e,null,null),Pc(),n[Ye]=null}};function gu(e){this._internalRoot=e}gu.prototype.unstable_scheduleHydration=function(e){if(e){var n=z();e={blockedOn:null,target:e,priority:n};for(var l=0;l<Al.length&&n!==0&&n<Al[l].priority;l++);Al.splice(l,0,e),l===0&&Iv(e)}};var qv=a.version;if(qv!=="19.2.7")throw Error(r(527,qv,"19.2.7"));ae.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=m(n),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var Ow={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_u.isDisabled&&_u.supportsFiber)try{Je=_u.inject(Ow),ht=_u}catch{}}return Eo.createRoot=function(e,n){if(!c(e))throw Error(r(299));var l=!1,o="",u=Kg,d=Zg,_=Yg;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(d=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=Av(e,1,!1,null,null,l,o,null,u,d,_,zv),e[Ye]=n.current,_p(e),new Lp(n)},Eo.hydrateRoot=function(e,n,l){if(!c(e))throw Error(r(299));var o=!1,u="",d=Kg,_=Zg,j=Yg,O=null;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(u=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(_=l.onCaughtError),l.onRecoverableError!==void 0&&(j=l.onRecoverableError),l.formState!==void 0&&(O=l.formState)),n=Av(e,1,!0,n,l??null,o,u,O,d,_,j,zv),n.context=Rv(null),l=n.current,o=ma(),o=Ja(o),u=fl(o),u.callback=null,pl(l,u,o),l=o,n.current.lanes=l,ia(n,l),rs(n),e[Ye]=n.current,_p(e),new gu(n)},Eo.version="19.2.7",Eo}var Xv;function Bw(){if(Xv)return qp.exports;Xv=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(a){console.error(a)}}return t(),qp.exports=Uw(),qp.exports}var Gw=Bw();function Hw({error:t,onAddPasskey:a,onSignOut:i,pending:r}){const[c,f]=b.useState(!1),[p,h]=b.useState(!1),v=b.useId(),m=b.useRef(null),x=b.useRef(null),y=b.useRef(null),A=b.useRef(null);b.useEffect(()=>{if(c){h(!1);return}h(!0);const I=window.setTimeout(()=>h(!1),160);return()=>window.clearTimeout(I)},[c]),b.useEffect(()=>{if(!c)return;y.current?.focus();const I=k=>{k.target instanceof Node&&!m.current?.contains(k.target)&&f(!1)};return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[c]),b.useEffect(()=>{t!==null&&f(!0)},[t]);const w=()=>{f(!1),x.current?.focus()},C=I=>{f(!1),I()},T=I=>{if(I.key==="Escape"){I.preventDefault(),w();return}if(I.key==="Tab"){f(!1);return}if(I.key==="Home"||I.key==="End"){I.preventDefault(),(I.key==="Home"?y:A).current?.focus();return}if(I.key==="ArrowDown"||I.key==="ArrowUp"){I.preventDefault();const k=[y.current,A.current].filter(D=>D!==null&&!D.disabled);if(k.length===0)return;const q=k.indexOf(document.activeElement),E=I.key==="ArrowDown"?1:-1,M=q===-1?0:(q+E+k.length)%k.length;k[M]?.focus()}},N=r!==null;return s.jsxs("div",{className:"account-menu",ref:m,children:[s.jsxs("button",{"aria-busy":N,"aria-controls":c?v:void 0,"aria-expanded":c,"aria-haspopup":"menu","aria-label":"Account menu",className:"account-menu__trigger",disabled:N,onClick:()=>f(I=>!I),ref:x,title:"Account",type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:"account-menu__mark",children:s.jsx("span",{className:"account-menu__mark-dot"})}),s.jsx("span",{className:"account-menu__trigger-label",children:"account"}),s.jsx("span",{"aria-hidden":"true",className:"account-menu__chevron",children:c?"⌃":"⌄"})]}),c||p?s.jsxs("div",{"aria-hidden":p&&!c?"true":void 0,className:"account-menu__panel","data-closing":p&&!c?"true":void 0,inert:p&&!c?!0:void 0,children:[s.jsxs("div",{className:"account-menu__heading",children:[s.jsx("span",{children:"Account"}),s.jsxs("span",{className:"account-menu__status",children:[s.jsx("span",{"aria-hidden":"true",className:"account-menu__status-dot"}),"passkey authenticated"]})]}),s.jsxs("div",{"aria-label":"Account",id:v,onKeyDown:T,role:"menu",children:[s.jsxs("button",{className:"account-menu__item",disabled:N,onClick:()=>C(a),ref:y,role:"menuitem",type:"button",children:[s.jsx("span",{className:"account-menu__item-label",children:r==="register"?"Adding passkey…":"Add passkey"}),s.jsx("span",{className:"account-menu__item-detail",children:"Register a backup authenticator"})]}),s.jsxs("button",{className:"account-menu__item account-menu__item--sign-out",disabled:N,onClick:()=>C(i),ref:A,role:"menuitem",type:"button",children:[s.jsx("span",{className:"account-menu__item-label",children:r==="logout"?"Signing out…":"Sign out"}),s.jsx("span",{className:"account-menu__item-detail",children:"End this dashboard session"})]})]}),t===null?null:s.jsx("p",{className:"account-menu__error",role:"alert",children:t})]}):null]})}var Wy=Jy();const Vw=["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function Pv(t){return[...t.querySelectorAll(Vw)].filter(a=>{const i=window.getComputedStyle(a);return a.getAttribute("aria-hidden")!=="true"&&!a.hidden&&i.display!=="none"&&i.visibility!=="hidden"})}function vd({applicationRootId:t,children:a,labelledBy:i,onClose:r,open:c,panelClassName:f}){const p=b.useRef(null),h=b.useRef(null),[v,m]=b.useState(c);if(b.useEffect(()=>{if(c){m(!0);return}if(!v)return;const w=window.setTimeout(()=>m(!1),200);return()=>window.clearTimeout(w)},[c,v]),b.useEffect(()=>{if(!c||!v)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const w=document.getElementById(t),C=w?.hasAttribute("inert")??!1,T=w?.getAttribute("aria-hidden")??null;w?.setAttribute("inert",""),w?.setAttribute("aria-hidden","true");const N=p.current;return((N?Pv(N)[0]:void 0)??N)?.focus(),()=>{w&&(C||w.removeAttribute("inert"),T===null?w.removeAttribute("aria-hidden"):w.setAttribute("aria-hidden",T)),h.current?.focus(),h.current=null}},[t,c,v]),!v)return null;const x=w=>{if(w.key==="Escape"){w.preventDefault(),r();return}if(w.key!=="Tab"||!p.current)return;const C=Pv(p.current);if(C.length===0){w.preventDefault(),p.current.focus();return}const T=C[0],N=C[C.length-1];(!w.shiftKey&&document.activeElement===N||w.shiftKey&&document.activeElement===T||!p.current.contains(document.activeElement))&&(w.preventDefault(),(w.shiftKey?N:T)?.focus())},y=w=>{w.target===w.currentTarget&&r()},A=!c;return Wy.createPortal(s.jsx("div",{"aria-hidden":A?"true":void 0,className:"accessible-dialog__backdrop","data-closing":A?"true":void 0,inert:A?!0:void 0,onMouseDown:y,children:s.jsx("div",{"aria-hidden":A?"true":void 0,"aria-labelledby":i,"aria-modal":"true",className:f===void 0?"accessible-dialog":`accessible-dialog ${f}`,"data-closing":A?"true":void 0,inert:A?!0:void 0,onKeyDown:x,ref:p,role:"dialog",tabIndex:-1,children:a})}),document.body)}const Fw={runs:"M5 3h4a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z M15 13h4a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2z M7 11v4a2 2 0 0 0 2 2h4",calls:"M4 17l6-6-6-6 M12 19h8",context:"M12 2L2 7l10 5 10-5-10-5z M2 12l10 5 10-5 M2 17l10 5 10-5",progress:"M3 17l2 2 4-4 M3 7l2 2 4-4 M13 6h8 M13 12h8 M13 18h8",workflows:"M6 3v12 M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M18 9a9 9 0 0 1-9 9",adapters:"M12 22v-5 M9 8V2 M15 8V2 M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8z",artifacts:"M3 3h18a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8 M10 12h4",builder:"M12 20h9 M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z",more:"M5 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2z M12 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2z M19 11a1 1 0 1 0 0 2a1 1 0 1 0 0-2z",dark:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z",light:"M12 4V2 M12 22v-2 M4.93 4.93l1.41 1.41 M17.66 17.66l1.41 1.41 M2 12h2 M20 12h2 M6.34 17.66l-1.41 1.41 M19.07 4.93l-1.41 1.41 M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z",search:"M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14z M21 21l-4.35-4.35"};function Ol({className:t,name:a}){return s.jsx("svg",{"aria-hidden":"true",className:t===void 0?"monoline-icon":`monoline-icon ${t}`,focusable:"false",viewBox:"0 0 24 24",children:s.jsx("path",{d:Fw[a]})})}function Hh({announcement:t}){const a=b.useRef(t?.key??null),[i,r]=b.useState(t?.message??"");return b.useEffect(()=>{if(!t){a.current=null,r("");return}t.key!==a.current&&(a.current=t.key,r(t.message))},[t]),s.jsx("div",{"aria-atomic":"true","aria-live":"polite",className:"visually-hidden",role:"status",children:i})}const Kw=["runs","calls","context","progress","workflows","adapters"],Qv={runs:"Workflow runs",calls:"Single calls",context:"Context runs",progress:"Progress reports",workflows:"Workflows",adapters:"Adapters"},Zw=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent??""),ex=Zw?"⌘K":"ctrl K",Jv=`jump to a run, call, context run or report · ${ex}`;function Wv(t){const[a,i]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(t).matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const r=window.matchMedia(t),c=()=>i(r.matches);return c(),r.addEventListener("change",c),()=>r.removeEventListener("change",c)},[t]),a}function eb(t){return`jump-palette-option-${t.id}`}function Yw({applicationRootId:t="root",items:a,onOpen:i}){const[r,c]=b.useState(!1),[f,p]=b.useState(""),[h,v]=b.useState(0),m=b.useRef(null),x=b.useRef(null),y=b.useRef(null),A=b.useRef(null),w=Wv("(max-width: 880px)"),C=Wv("(max-width: 1279px)"),T=f.trim().toLowerCase(),N=b.useMemo(()=>Kw.map(ue=>({groupId:ue,items:a.filter(_e=>_e.group===ue&&(T===""||_e.searchTerms.some(ge=>ge.toLowerCase().includes(T))))})).filter(ue=>ue.items.length>0),[a,T]),I=b.useMemo(()=>N.flatMap(ue=>ue.items),[N]),k=Math.min(h,Math.max(I.length-1,0)),q=I[k],E=I.length===1?"1 match":`${I.length} matches`,M=C?"jump to…":"jump to a run, call or context…",D=b.useCallback(()=>{c(!1),p(""),v(0)},[]),F=b.useCallback(()=>{p(""),v(0),c(!0)},[]);b.useEffect(()=>{const ue=_e=>{!_e.metaKey&&!_e.ctrlKey||_e.altKey||_e.key!=="k"&&_e.key!=="K"||w||(_e.preventDefault(),r?D():F())};return window.addEventListener("keydown",ue),()=>window.removeEventListener("keydown",ue)},[D,w,r,F]),b.useEffect(()=>{r&&w&&D()},[D,w,r]),b.useEffect(()=>{if(!r)return;y.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const ue=document.getElementById(t),_e=ue?.hasAttribute("inert")??!1,ge=ue?.getAttribute("aria-hidden")??null;return ue?.setAttribute("inert",""),ue?.setAttribute("aria-hidden","true"),m.current?.focus(),()=>{ue&&(_e||ue.removeAttribute("inert"),ge===null?ue.removeAttribute("aria-hidden"):ue.setAttribute("aria-hidden",ge)),y.current?.focus(),y.current=null}},[t,r]),b.useEffect(()=>{A.current?.scrollIntoView?.({block:"nearest"})},[k,I.length]);const te=()=>{q!==void 0&&(D(),i(q))},oe=ue=>{if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){if(ue.preventDefault(),I.length===0)return;const _e=ue.key==="ArrowDown"?1:-1;v(ge=>(Math.min(ge,I.length-1)+_e+I.length)%I.length);return}if(ue.key==="Enter"){ue.preventDefault(),te();return}if(ue.key==="Escape"){ue.preventDefault(),D();return}ue.key==="Tab"&&ue.preventDefault()},P=r?{key:`${T}:${I.length}`,message:E}:null;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"aria-label":Jv,className:"app-shell__jump-trigger",onClick:F,ref:x,title:Jv,type:"button",children:[s.jsx(Ol,{className:"monoline-icon--thin",name:"search"}),s.jsx("span",{className:"app-shell__jump-placeholder",children:M}),s.jsx("span",{"aria-hidden":"true",className:"app-shell__jump-kbd",children:ex})]}),r?Wy.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"jump-palette__scrim",onMouseDown:ue=>{ue.target===ue.currentTarget&&D()}}),s.jsxs("div",{"aria-modal":"true",className:"jump-palette",role:"dialog","aria-label":"jump to",children:[s.jsxs("div",{className:"jump-palette__input-row",children:[s.jsx(Ol,{className:"monoline-icon--thin jump-palette__search-icon",name:"search"}),s.jsx("input",{"aria-activedescendant":q===void 0?void 0:eb(q),"aria-autocomplete":"list","aria-controls":"jump-palette-listbox","aria-expanded":"true","aria-label":"jump to",autoComplete:"off",className:"jump-palette__input",onChange:ue=>{p(ue.target.value),v(0)},onKeyDown:oe,placeholder:"jump to a run, call, context run or report",ref:m,role:"combobox",spellCheck:!1,type:"text",value:f}),s.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"esc"})]}),s.jsxs("div",{"aria-label":"matches",className:"jump-palette__listbox",id:"jump-palette-listbox",role:"listbox",children:[N.map(ue=>s.jsxs("div",{"aria-label":Qv[ue.groupId],className:"jump-palette__group",role:"group",children:[s.jsx("div",{"aria-hidden":"true",className:"jump-palette__group-label",children:Qv[ue.groupId]}),ue.items.map(_e=>{const ge=_e===q;return s.jsxs("div",{"aria-selected":ge,className:"jump-palette__option","data-item-id":_e.id,id:eb(_e),onClick:()=>{v(I.indexOf(_e)),D(),i(_e)},onMouseEnter:()=>{v(I.indexOf(_e))},ref:ge?A:void 0,role:"option",tabIndex:-1,children:[s.jsx("span",{className:"jump-palette__name",children:_e.name}),s.jsx("span",{className:"jump-palette__sub",children:_e.sub}),s.jsx("span",{"aria-hidden":"true",className:"jump-palette__gap"}),s.jsx("span",{className:"jump-palette__meta",children:_e.meta}),_e.status===""?null:s.jsx("span",{className:"jump-palette__tag","data-status":_e.status,children:_e.status})]},_e.id)})]},ue.groupId)),I.length===0?s.jsxs("p",{className:"jump-palette__empty",children:["Nothing on the sheet matches “",f,"”."]}):null]}),s.jsxs("div",{className:"jump-palette__foot",children:[s.jsxs("span",{className:"jump-palette__foot-keys",children:[s.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"↑"}),s.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"↓"}),"move"]}),s.jsxs("span",{className:"jump-palette__foot-keys",children:[s.jsx("span",{"aria-hidden":"true",className:"jump-palette__kbd",children:"↵"}),"open"]}),s.jsx("span",{"aria-hidden":"true",className:"jump-palette__gap"}),s.jsx("span",{className:"jump-palette__count",children:E})]}),s.jsx(Hh,{announcement:P})]})]}),document.body):null]})}const Xw="clinkx-theme";function tx(t=document.documentElement){return t.getAttribute("data-theme")==="dark"?"dark":"light"}function nx(t,a){try{(a??window.localStorage).setItem(Xw,t)}catch{}}function ax(t,a=document.documentElement){if(t==="dark"){a.setAttribute("data-theme","dark");return}a.removeAttribute("data-theme")}function sx(t){return t==="dark"?"light":"dark"}const Pw={dark:"switch to light theme",light:"switch to dark theme"};function lx(){const[t,a]=b.useState(tx);return[t,()=>{const r=sx(t);a(r),nx(r),ax(r)}]}function Qw(){const[t,a]=lx(),i=Pw[t];return s.jsx("button",{"aria-label":i,className:"app-shell__theme-toggle",onClick:a,title:i,type:"button",children:s.jsx("span",{"aria-hidden":"true",children:t==="dark"?"◑":"◐"})})}function Jw(){const[t,a]=lx(),i=t==="dark";return s.jsxs("button",{"aria-checked":i,"aria-label":"dark appearance",className:"app-shell__more-theme",onClick:a,role:"switch",type:"button",children:[s.jsx(Ol,{className:"app-shell__more-theme-icon",name:i?"dark":"light"}),s.jsx("span",{className:"app-shell__more-theme-label",children:"appearance"}),s.jsx("span",{className:"app-shell__more-theme-value",children:t}),s.jsx("span",{"aria-hidden":"true",className:`app-shell__more-switch${i?" app-shell__more-switch--on":""}`,children:s.jsx("span",{className:"app-shell__more-knob"})})]})}const ix=[{destination:"runs",desktopLabel:"runs",icon:"runs",mobileLabel:"runs"},{destination:"activities",desktopLabel:"single calls",icon:"calls",mobileLabel:"calls"},{destination:"context_runs",desktopLabel:"context runs",icon:"context",mobileLabel:"context"},{destination:"progress_reports",desktopLabel:"progress",icon:"progress",mobileLabel:"progress"}],jh=[{destination:"workflows",desktopLabel:"workflows",icon:"workflows",mobileLabel:"workflows"},{destination:"adapters",desktopLabel:"adapters",icon:"adapters",mobileLabel:"adapters"},{destination:"artifacts",desktopLabel:"artifacts",icon:"artifacts",mobileLabel:"artifacts"}],Tu=[{destination:"prompt_builder",desktopLabel:"prompt builder",icon:"builder",mobileLabel:"builder"}],Ww=[...ix,...jh,...Tu];function Hp(t){return t===void 0?"—":String(t)}const eS={initial_loading:"loading",current:"live",stale:"stale",offline:"offline",auth_expired:"auth expired",connection_changed:"connection changed",error:"error"};function tS({count:t}){const a=Math.min(t,8);return s.jsx("span",{"aria-hidden":"true",className:"app-shell__calls-dots",children:a===0?s.jsx("span",{className:"app-shell__calls-dot app-shell__calls-dot--idle"}):Array.from({length:a},(i,r)=>s.jsx("span",{className:"app-shell__calls-dot"},r))})}function nS({accountActions:t,activeDestination:a,applicationRootId:i="root",children:r,environment:c,jumpItems:f,navigationCounts:p,observationAvailable:h=!0,onJumpOpen:v,onNavigate:m,pageTitle:x,pollingPhase:y,reportedRunningCalls:A}){const w=h?eS[y]:"static",C=h?y:"static",[T,N]=b.useState(!1),[I,k]=b.useState(!1),q=[...jh,...Tu].find(M=>M.destination===a);b.useEffect(()=>{if(!I||typeof window.matchMedia!="function")return;const M=window.matchMedia("(min-width: 881px)"),D=()=>{M.matches&&k(!1)};return D(),M.addEventListener("change",D),()=>M.removeEventListener("change",D)},[I]);const E=`Reported running workflow calls · ${A.refreshedLabel??"refresh pending"} · not a worker-health signal`;return s.jsxs("div",{className:"app-shell",children:[s.jsxs("header",{className:"app-shell__bar",children:[s.jsxs("span",{"aria-hidden":"true",className:"app-shell__mobile-identity",children:[s.jsx("span",{className:"app-shell__identity-mark",children:s.jsx("span",{className:"app-shell__identity-dot"})}),s.jsx("span",{className:"app-shell__identity-name",children:"ClinkX"})]}),s.jsx("div",{className:"app-shell__brand-line",children:s.jsx("span",{className:"app-shell__page-title",children:x})}),s.jsx("span",{className:"app-shell__mobile-title",children:x}),f!==void 0&&v!==void 0?s.jsx(Yw,{applicationRootId:i,items:f,onOpen:v}):null,s.jsx("span",{"aria-hidden":"true",className:"app-shell__bar-spacer"}),s.jsxs("span",{className:`app-shell__live-tag app-shell__live-tag--${C}`,"data-phase":C,children:[s.jsx("span",{"aria-hidden":"true",className:"app-shell__live-dot"}),w]}),s.jsx("span",{className:"app-shell__theme-control",children:s.jsx(Qw,{})}),t===void 0?s.jsx("button",{className:"app-shell__run-action",onClick:()=>m("workflows"),type:"button",children:"run workflow"}):s.jsx(Hw,{...t})]}),s.jsxs("div",{className:"app-shell__workspace",children:[s.jsxs("aside",{className:"app-shell__sidebar","aria-label":"Dashboard context",children:[s.jsxs("div",{className:"app-shell__identity","aria-hidden":"true",children:[s.jsx("span",{className:"app-shell__identity-mark",children:s.jsx("span",{className:"app-shell__identity-dot"})}),s.jsx("span",{className:"app-shell__identity-name",children:"ClinkX"})]}),s.jsx("nav",{className:"app-shell__desktop-nav","aria-label":"Primary",children:Ww.map(M=>{const D=M.destination===a;return s.jsxs(b.Fragment,{children:[Tu[0]?.destination===M.destination?s.jsx("div",{"aria-hidden":"true",className:"app-shell__nav-separator"}):null,s.jsxs("button",{"aria-current":D?"page":void 0,className:"app-shell__nav-button",onClick:()=>m(M.destination),type:"button",children:[s.jsx(Ol,{className:"app-shell__nav-icon",name:M.icon}),s.jsx("span",{className:"app-shell__nav-label",children:M.desktopLabel}),s.jsx("span",{className:"app-shell__nav-count",children:Hp(p[M.destination])})]})]},M.destination)})}),s.jsxs("section",{className:"app-shell__instrument","aria-labelledby":"calls-label",children:[s.jsx("h2",{className:"app-shell__section-label",id:"calls-label",title:E,children:"Running calls"}),s.jsx("p",{className:"app-shell__instrument-value",children:A.count===null?"not loaded":s.jsxs(s.Fragment,{children:[s.jsx(tS,{count:A.count}),s.jsx("span",{className:"app-shell__calls-count",children:A.count})]})})]}),s.jsxs("section",{className:"app-shell__environment","aria-labelledby":"env-label",children:[s.jsx("h2",{className:"app-shell__section-label",id:"env-label",children:s.jsxs("button",{"aria-controls":"app-shell-environment-list","aria-expanded":T,className:"app-shell__environment-toggle",onClick:()=>N(M=>!M),title:"effective paths of this dashboard process",type:"button",children:[s.jsx("span",{className:"app-shell__environment-word",children:"Env"}),s.jsx("span",{className:"app-shell__environment-toggle-word",children:T?"[ hide ]":"[ show ]"})]})}),s.jsxs("dl",{className:"app-shell__environment-list",hidden:!T,id:"app-shell-environment-list",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"WORKSPACE_ROOT"}),s.jsx("dd",{children:c?.workspaceRoot??"not reported"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"STATE_DIR"}),s.jsx("dd",{children:c?.stateDir??"not reported"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"RUNS_ROOT"}),s.jsx("dd",{children:c?.runsRoot??"not reported"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"ACTIVITIES_ROOT"}),s.jsx("dd",{children:c?.activitiesRoot??"not reported"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"WORKFLOWS_PATH"}),s.jsx("dd",{children:c?.workflowsPath??"not reported"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"TEMPLATES_PATH"}),s.jsx("dd",{children:c?.templatesPath??"not reported"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"CHILD_CONFIG"}),s.jsx("dd",{children:c?.childConfig??"not reported"})]})]})]})]}),s.jsxs("main",{className:"app-shell__main","aria-labelledby":"dashboard-page-title",id:"main-content",tabIndex:0,children:[r,s.jsx("span",{"aria-hidden":"true",className:"app-shell__version-stamp",children:"clinkx-workflows · dashboard · observer · state_version 1"})]})]}),s.jsxs("nav",{className:"app-shell__mobile-tabs","aria-label":"Mobile",children:[ix.map(M=>{const D=M.destination===a;return s.jsxs("button",{"aria-current":D?"page":void 0,"aria-label":`${M.mobileLabel} · ${Hp(p[M.destination])}`,className:"app-shell__mobile-tab",onClick:()=>m(M.destination),type:"button",children:[s.jsx(Ol,{className:"app-shell__mobile-tab-icon",name:M.icon}),s.jsx("span",{className:"app-shell__mobile-tab-label",children:M.mobileLabel})]},M.destination)}),s.jsxs("button",{"aria-current":q===void 0?void 0:"page","aria-label":"more · catalogs and the prompt builder",className:"app-shell__mobile-tab","data-more-open":I?"true":void 0,onClick:()=>k(M=>!M),type:"button",children:[s.jsx(Ol,{className:"app-shell__mobile-tab-icon",name:q===void 0?"more":q.icon}),s.jsx("span",{className:"app-shell__mobile-tab-label",children:q===void 0?"more":q.mobileLabel})]})]}),s.jsx(vd,{applicationRootId:i,labelledBy:"app-shell-more-title",onClose:()=>k(!1),open:I,panelClassName:"accessible-dialog--sheet app-shell__more-sheet",children:s.jsxs("div",{className:"app-shell__more-sheet-inner",children:[s.jsx("button",{"aria-label":"close",className:"app-shell__more-handle",onClick:()=>k(!1),type:"button",children:s.jsx("span",{"aria-hidden":"true",className:"app-shell__more-handle-pill"})}),s.jsx("div",{className:"app-shell__more-head",children:s.jsx("span",{className:"app-shell__more-title",id:"app-shell-more-title",children:"Catalogs"})}),s.jsx("div",{className:"app-shell__more-rows",children:jh.map(M=>{const D=M.destination===a;return s.jsxs("button",{"aria-current":D?"page":void 0,className:`app-shell__more-row${D?" app-shell__more-row--active":""}`,onClick:()=>{k(!1),m(M.destination)},type:"button",children:[s.jsx(Ol,{className:"app-shell__more-row-icon",name:M.icon}),s.jsx("span",{className:"app-shell__more-row-label",children:M.desktopLabel}),s.jsx("span",{className:"app-shell__more-row-count",children:Hp(p[M.destination])}),s.jsx("span",{"aria-hidden":"true",className:"app-shell__more-row-chevron",children:"›"})]},M.destination)})}),s.jsx("div",{"aria-hidden":"true",className:"app-shell__more-divider"}),s.jsx("div",{className:"app-shell__more-head",children:s.jsx("span",{className:"app-shell__more-title",children:"Compose"})}),s.jsx("div",{className:"app-shell__more-rows",children:Tu.map(M=>{const D=M.destination===a;return s.jsxs("button",{"aria-current":D?"page":void 0,className:`app-shell__more-row${D?" app-shell__more-row--active":""}`,onClick:()=>{k(!1),m(M.destination)},type:"button",children:[s.jsx(Ol,{className:"app-shell__more-row-icon",name:M.icon}),s.jsxs("span",{className:"app-shell__more-row-text",children:[s.jsx("span",{className:"app-shell__more-row-label",children:M.desktopLabel}),s.jsx("span",{className:"app-shell__more-row-desc",children:"assemble a run-workflow prompt"})]}),s.jsx("span",{"aria-hidden":"true",className:"app-shell__more-row-chevron",children:"›"})]},M.destination)})}),s.jsx("div",{"aria-hidden":"true",className:"app-shell__more-divider"}),s.jsx(Jw,{})]})})]})}function bn(t,a){const i=Date.parse(t);if(!Number.isFinite(i))return"not reported";const r=Math.max(0,a-i),c=Math.floor(r/1e3);if(c<60)return`${String(c)}s ago`;const f=Math.floor(c/60);if(f<60)return`${String(f)}m ago`;const p=Math.floor(f/60);return p<24?`${String(p)}h ago`:`${String(Math.floor(p/24))}d ago`}function Bu(t){const a=Math.max(0,t),i=Math.floor(a/1e3);if(i<60)return`${String(i)}s`;const r=Math.floor(i/60);return r<60?`${String(r)}m`:`${String(Math.floor(r/60))}h`}function Mr(t){return t.status!=="pending"&&t.status!=="running"?"terminal":t.orphaned||t.workerLockObservation==="orphaned"?"orphaned":t.workerLockObservation==="live"?"live":t.workerLockObservation==="heartbeat_live"?"heartbeat_live":"unknown"}function Jo(t){return t==="live"||t==="heartbeat_live"}function tb(t){const a=t.callTotal;if(a===void 0)return`${t.stageId} · ${t.state}`;const i=t.callSucceeded??0,r=a===1?"call":"calls";return(t.state==="pending"||t.state==="cancelled")&&i===0?`${t.stageId} · ${String(a)} ${r} · ${t.state}`:`${t.stageId} · ${String(i)}/${String(a)} ${r} · ${t.state}`}function Rr(t){const a=Math.floor(Math.max(0,t)/1e3),i=Math.floor(a/3600),r=Math.floor(a%3600/60),c=a%60;return i>0?`${String(i)}:${String(r).padStart(2,"0")}:${String(c).padStart(2,"0")}`:`${String(r)}:${String(c).padStart(2,"0")}`}function aS(t,a){return a==="orphaned"?"orphaned":a==="unknown"?"worker unknown":t.status}function sS(t,a){if(t.startedAt!==void 0&&t.completedAt!==void 0){const i=Math.max(0,Date.parse(t.completedAt)-Date.parse(t.startedAt));return`duration ${Bu(i)}`}if(t.startedAt!==void 0){const i=Date.parse(t.stateUpdatedAt),r=Mr(t),c=Jo(r)||r==="unknown"||!Number.isFinite(i)?a:i;return`started ${bn(t.startedAt,c)}`}return t.completedAt!==void 0?`completed ${bn(t.completedAt,a)}`:"timing not reported"}function lS(t,a){if(t.startedAt===void 0)return null;const i=Date.parse(t.startedAt);if(!Number.isFinite(i))return null;if(t.completedAt!==void 0){const p=Date.parse(t.completedAt);if(Number.isFinite(p))return Math.max(0,p-i)}const r=Mr(t),c=Date.parse(t.stateUpdatedAt),f=r==="orphaned"&&Number.isFinite(c)?c:a;return Math.max(0,f-i)}function iS(t,a,i){if(a==="orphaned")return`stale · last write ${bn(t.stateUpdatedAt,i)}`;if(t.status==="running"){const c=t.stageMarkers.find(p=>p.state==="running");if(c===void 0)return"▸ finalizing";if(c.callTotal===void 0)return`▸ ${c.stageId}`;const f=c.callSucceeded??0;return`▸ ${c.stageId} · ${String(f)}/${String(c.callTotal)} calls done`}if(t.status==="pending")return"";const r=bn(t.completedAt??t.stateUpdatedAt,i);if(t.status==="failed"){const c=t.stageMarkers.find(f=>f.state==="failed");return c===void 0?`failed · ${r}`:`failed at ${c.stageId} · ${r}`}return`finished ${r}`}function Vh(t){const a=t.resumable===!0&&t.workflowName!=="plan-review-receipts"&&(t.status==="failed"||t.status==="cancelled");return t.orphaned===!0?{tool:"resume_workflow",label:"resume + cancel handoff",text:`resume_workflow run_id=${t.runId}
|
|
10
|
+
cancel_workflow run_id=${t.runId}`}:t.status==="pending"||t.status==="running"?{tool:"cancel_workflow",label:"cancel handoff",text:`cancel_workflow run_id=${t.runId}`}:a?{tool:"resume_workflow",label:"resume handoff",text:`resume_workflow run_id=${t.runId}`}:null}function nb(t,a){if(t.availability==="unavailable")return{availability:"unavailable",row:t,statusLabel:t.reason.replaceAll("_"," ")};const i=Mr(t),r=[...i==="heartbeat_live"?["heartbeat"]:[],...t.async?["async"]:[],...t.debugKeepArtifacts?["debug kept"]:[]];return{availability:"available",row:t,workflowLabel:`${t.workflowName} · v${t.workflowVersion}`,statusLabel:aS(t,i),workerObservation:i,showLiveMotion:Jo(i),statusTags:t.status==="failed"&&t.stageCounts.succeeded>0?["partially_succeeded"]:t.status==="succeeded"&&(t.callCounts.failed>0||t.stageCounts.failed>0)?["degraded"]:[],timingLabel:sS(t,a),updatedAgeLabel:bn(t.stateUpdatedAt,a),reportedRunningCallsLabel:`${String(t.reportedRunningCalls)} reported running calls — not a worker-health signal`,elapsedLabel:(()=>{const c=lS(t,a);return c===null?"timing not reported":Rr(c)})(),stageProgressLabel:iS(t,i,a),flags:r,actionHandoff:Vh(t)}}const rS={initial_loading:"Loading runs…",current:"Current",stale:"Stale data — retrying",offline:"Offline — retained data shown",auth_expired:"Authentication expired",connection_changed:"Connection changed — rebootstrap required",error:"Run data request failed"};function rx(t){const i=[...t.live,...t.history].reduce((r,c)=>r+(c.availability==="available"?c.reportedRunningCalls:0),0);return{phaseLabel:rS[t.phase],lastRefreshLabel:t.lastRefreshAtMs===null?"last refresh not loaded":`last refresh ${bn(new Date(t.lastRefreshAtMs).toISOString(),t.displayNowMs)}`,liveCountLabel:`${String(t.live.length)} reported live runs loaded`,historyCountLabel:`${String(t.history.length)} history runs loaded · page ${String(t.historyPage+1)}`,reportedRunningCallsLabel:`${String(i)} reported running calls · not a worker-health signal`,observedAgeLabel:t.lastRefreshAtMs===null||t.displayNowMs-t.lastRefreshAtMs<1e4?null:`observed ${bn(new Date(t.lastRefreshAtMs).toISOString(),t.displayNowMs)}`,live:t.live.map(r=>nb(r,t.displayNowMs)),history:t.history.map(r=>nb(r,t.displayNowMs))}}const ox=new Set(["succeeded","failed","cancelled"]);function Ks(t){if(t===void 0)return null;const a=Date.parse(t);return Number.isFinite(a)?a:null}function Gu(t){return typeof t!="string"?null:/T(\d{2}:\d{2}:\d{2})/.exec(t)?.[1]??null}function Xa(t){const a=Math.max(0,t);return a<1e3?`${Math.round(a)}ms`:Rr(a)}function Fh(t){return t.length===0?"not reported":t.join(", ")}const oS="CLI default",cS="accepted value not recorded";function ab(t,a){if(a?.state==="recorded")return a.value;const i=t!==void 0&&"applied"in t?t.applied:void 0;if(t!==void 0&&t.provenance!=="cli_default_unknown"){if(typeof i=="string")return i;if(i?.state==="recorded")return i.value}return a?.state==="accepted_unrepresentable"||typeof i=="object"&&i.state==="accepted_unrepresentable"?cS:t?.provenance==="cli_default_unknown"?oS:"not recorded"}function bd(t,a){return[ab(t?.model,a?.model),ab(t?.effort,a?.effort)]}const sb=["model","effort"];function cx(t,a){const i=bd(t,a);return[`${sb[0]} ${i[0]}`,`${sb[1]} ${i[1]}`]}function Hu(t){if(t==null)return"not recorded";const a=`${t.cli_name??"not recorded"}/${t.role??"not recorded"}`,i=[t.model===void 0?null:`model ${t.model}`,t.effort===void 0?null:`effort ${t.effort}`].filter(r=>r!==null);return t.cli_name===void 0&&t.role===void 0&&i.length===0?"not recorded":i.length===0?a:`${a} · ${i.join(" · ")}`}function uS(t){if(!(t==null||t.availability==="absent"))return t.effectiveDelegate}function dS(t){return t===void 0?[]:[{label:"configured context curator",value:Hu(t.curator)},{label:"configured context finalizer",value:Hu(t.finalizer)}]}function fS(t){const a=["curator","finalizer"].flatMap(i=>{const[r,c]=bd(t.audit[i]);return[{label:`${i} model`,value:r},{label:`${i} effort`,value:c}]});return{operationLabel:t.execution==="cache_source"?"cache hit — no delegate dispatched":"current source execution",sourceLabel:t.execution==="cache_source"?"historical/source execution audit":"current source execution audit",artifactRunId:t.artifactRunId,facts:a}}function pS(t,a){const i=Ks(t.startedAt);if(i===null)return t.status==="pending"?"not started":"not reported";const r=ox.has(t.status)?Ks(t.completedAt)??Ks(t.stateUpdatedAt):a;return r===null?"not reported":Xa(r-i)}function Vu(t,a){if("durationMs"in t&&t.durationMs!==void 0)return Xa(t.durationMs);const i=Ks(t.startedAt);if(i===null)return t.state==="pending"?"not started":"not reported";const r=Ks(t.completedAt);return r!==null?Xa(r-i):t.state==="running"?Xa(a-i):"not reported"}function ux(t,a){return t.length>0?`Uses data from ${t.join(" + ")}`:a===0?"Entry stage":"No upstream data dependency"}function lb(t,a,i){const r=Ks(a.startedAt);if(r===null)return null;const c=Ks(a.completedAt),f="durationMs"in a&&a.durationMs!==void 0?r+Math.max(0,a.durationMs):null,p=c??f??(a.state==="running"?i:null);return p===null||p<r?null:{id:t,state:a.state,startMs:r,endMs:p}}function hS(t){const a=Math.max(0,Math.round(t/1e3)),i=Math.floor(a/3600),r=Math.floor(a%3600/60),c=a%60;return i>0?`+${i}:${String(r).padStart(2,"0")}:${String(c).padStart(2,"0")}`:`+${r}:${String(c).padStart(2,"0")}`}function mS(t){const a=Math.max(1e3,t/3),r=[1e3,5e3,1e4,15e3,3e4,6e4,12e4,24e4,3e5,6e5,9e5,18e5,36e5,72e5,108e5,216e5,432e5,864e5,1728e5,2592e5,6048e5].reduce((v,m)=>Math.abs(m-a)<Math.abs(v-a)?m:v);if(Math.floor(t/r)+1<=6)return r;const c=t/5,f=10**Math.floor(Math.log10(c)),p=c/f;return(p<=1?1:p<=2?2:p<=5?5:10)*f}function gS(t,a,i){const r=new Map(a.availability==="available"?a.stages.map(T=>[T.stageId,T.dependsOn]):[]),c=t.stages.map((T,N)=>{const I=r.get(T.stageId)??[];return{stageId:T.stageId,stateLabel:T.state,dependsOn:I,dependencyLabel:a.availability==="available"?ux(I,N):null,stageBar:lb(T.stageId,T,i),callBars:T.calls.flatMap(k=>{const q=lb(k.callId,k,i);if(q===null)return[];const E=k.snapshotIdentity?.adapter??"adapter not reported",M=k.snapshotIdentity?.role??"role not reported";return[{bar:q,stageId:T.stageId,callId:k.callId,adapterLabel:E,roleLabel:M,durationLabel:Vu(k,i),tooltipLabel:`member ${k.callId} · CLI ${E} · role ${M} · ${k.state} · ${Vu(k,i)}`}]}),callCountLabel:T.state==="pending"||T.state==="cancelled"?`· ${T.calls.length}`:`${T.calls.filter(k=>k.state==="succeeded"||k.state==="failed").length}/${T.calls.length}`}}),f=c.flatMap(T=>[...T.stageBar===null?[]:[T.stageBar],...T.callBars.map(N=>N.bar)]);if(f.length===0)return null;const p=Ks(t.startedAt)??Math.min(...f.map(T=>T.startMs)),h=Math.max(...f.map(T=>T.endMs)),v=Math.max(0,h-p),m=Math.max(1,v*1.05),x=T=>({id:T.id,state:T.state,startPercent:(T.startMs-p)/m*100,widthPercent:(T.endMs-T.startMs)/m*100}),y=t.stages.reduce((T,N)=>T+N.calls.length,0),A=Jo(Mr(t))?Math.min(100,Math.max(0,(i-p)/m*100)):null,w=mS(v),C=Array.from({length:Math.floor(v/w)+1},(T,N)=>{const I=N*w;return{label:hS(I),positionPercent:I/m*100}});return{spanLabel:`span ${Xa(v)} · ${t.stages.length} stages · ${y} calls`,ticks:C,fanInPositions:c.map(T=>T.stageBar).filter(T=>T!==null).map(T=>(T.endMs-p)/m*100),livePositionPercent:A,stages:c.map(T=>({stageId:T.stageId,stateLabel:T.stateLabel,callCountLabel:T.callCountLabel,dependsOn:T.dependsOn,dependencyLabel:T.dependencyLabel,stageBar:T.stageBar===null?null:x(T.stageBar),callBars:T.callBars.map(N=>({...x(N.bar),stageId:N.stageId,callId:N.callId,adapterLabel:N.adapterLabel,roleLabel:N.roleLabel,durationLabel:N.durationLabel,tooltipLabel:N.tooltipLabel}))}))}}function _S(t,a){const i=[t.hasWorkflowInput?"workflow input persisted":null,t.hasOutput?"output persisted":null,t.hasRawError?"raw error persisted":null,t.hasArtifactReference?"artifact referenced":null].filter(f=>f!==null),[r,c]=cx(t.invocation,t.observedInvocation);return{callId:t.callId,statusLabel:t.state,adapterLabel:t.snapshotIdentity?.adapter??null,modelLabel:r,effortLabel:c,retryLabel:t.retryCount===0?null:t.attemptsConsumed===void 0?`${t.retryCount} ${t.retryCount===1?"retry":"retries"}`:`attempt ${t.attemptsConsumed}`,timingLabel:Vu(t,a),failureLabel:t.failureClass===void 0?null:`${t.failureClass} failure`,contentLabels:i}}function ib(t,a){const i=Object.keys(a);return[{label:t,value:String(i.reduce((r,c)=>r+a[c],0))},...i.filter(r=>a[r]>0).map(r=>({label:`${t} ${r}`,value:String(a[r])}))]}function vS(t){return t.kind==="generic"?{kind:t.kind,title:"Persisted state counts",facts:[...ib("stages",t.stageCounts),...ib("calls",t.callCounts)]}:{kind:t.kind,title:"Plan-review transport facts",facts:[{label:"execution",value:t.executionStatus},{label:"seats",value:String(t.seatCount)},{label:"completed",value:String(t.completedSeats)},...t.failedSeats===0?[]:[{label:"failed",value:String(t.failedSeats)}],...t.missingSeats===0?[]:[{label:"missing",value:String(t.missingSeats)}],{label:"chairman",value:t.chairmanStatus},{label:"context",value:t.contextStatus},{label:"contract digest",value:t.executionContractDigestPrefix}]}}function bS(t){return t.availability==="available"?`${t.kind.replace("_"," ")} result available`:`result unavailable · ${t.reason.replaceAll("_"," ")}`}function yS(t){return typeof t!="object"||t===null||!("availability"in t)?{availability:"unavailable",reason:"invalid"}:t.availability==="available"&&"kind"in t&&["text","json","plan_review"].includes(String(t.kind))||t.availability==="unavailable"&&"reason"in t&&["run_pending","run_running","run_failed","run_cancelled","not_persisted","missing","invalid","too_large"].includes(String(t.reason))?t:{availability:"unavailable",reason:"invalid"}}function xS(t){return typeof t=="object"&&t!==null&&"availability"in t&&t.availability==="available"&&"stages"in t&&Array.isArray(t.stages)||typeof t=="object"&&t!==null&&"availability"in t&&t.availability==="unavailable"&&"reason"in t&&typeof t.reason=="string"?t:{availability:"unavailable",reason:"invalid"}}function jS(t){const a=t.card;return typeof a=="object"&&a!==null&&"kind"in a&&(a.kind==="generic"||a.kind==="council-plan-review")?a:{kind:"generic",stageCounts:t.stageCounts,callCounts:t.callCounts}}function wS(t,a){const i=Mr(t),r=Jo(i)||i==="unknown"?a:Ks(t.stateUpdatedAt)??a,c=xS(t.snapshotEnrichment),f=c.availability==="available"?new Map(c.stages.map(N=>[N.stageId,N])):new Map,p=c.availability==="available",h=yS(t.result),v=!ox.has(t.status),m=pS(t,r),x=Gu(t.startedAt),y=t.completedAt??t.stateUpdatedAt,A=Gu(y),w=[...x===null?t.startedAt===void 0?[]:[{label:"started",value:t.startedAt}]:[{label:"started",value:x}],{label:v?"elapsed":"duration",value:m},...v?[{label:"updated",value:bn(t.stateUpdatedAt,a)}]:A===null?[]:[{label:"finished",value:A}]],C=Vh(t),T=[{label:"started_at",value:t.startedAt??"not reported"},...t.completedAt===void 0?[]:[{label:"completed_at",value:t.completedAt}],{label:"last persisted update",value:t.stateUpdatedAt},{label:"resumable",value:t.resumable===!0?"yes":"no"},{label:"generation · state revision",value:`${t.runGeneration} · ${t.stateRevision}`},{label:"project folder",value:Fh(t.projectFolders)},...C===null?[]:[{label:"mcp tool handoff",value:C.text}]];return{runId:t.runId,workflowLabel:`${t.workflowName} · v${t.workflowVersion}`,statusLabel:i==="orphaned"?"orphaned":i==="unknown"?"worker unknown":t.status,statusState:i==="unknown"?"worker-unknown":i==="orphaned"?"orphaned":t.status,workerEvidenceLabel:i==="live"?"pid probe":i==="heartbeat_live"?"heartbeat":null,workerEvidenceDescription:i==="live"?"worker liveness from a local process probe":i==="heartbeat_live"?"worker liveness from a lock heartbeat refreshed within its declared freshness window, not a local process probe":null,isLive:v,elapsedLabel:m,startedLabel:t.startedAt??"not reported",updatedLabel:t.stateUpdatedAt,headerFacts:w,detailFacts:T,modeLabels:[...t.async?["async"]:[],...t.debugKeepArtifacts?["debug artifacts kept"]:[]],snapshotAvailable:p,snapshotLabel:p?"Graph derived from verified workflow snapshot":`Workflow snapshot unavailable · ${c.reason.replaceAll("_"," ")}`,timeline:gS(t,c,r),stages:t.stages.map((N,I)=>{const k=f.get(N.stageId),q=k?.dependsOn??[];return{stageId:N.stageId,label:k?.label??N.stageId,statusLabel:N.state,timingLabel:Vu(N,r),dependsOn:q,sequenceLabel:`Stage ${String(I+1)} of ${String(t.stages.length)}`,dependencyLabel:p?ux(q,I):null,calls:N.calls.map(E=>_S(E,r))}}),decisiveFailureLabel:t.decisiveFailure===void 0?null:[t.decisiveFailure.stageId,t.decisiveFailure.callId,`${t.decisiveFailure.failureClass} failure`].filter(N=>N!==void 0).join(" · "),result:h,resultLabel:bS(h),card:vS(jS(t))}}const dx={standalone:"standalone",refine:"refine",workflow_preflight:"workflow preflight",historical:"historical"};function SS(t,a){if(t.startedAt!==null&&t.completedAt!==null){const i=Math.max(0,Date.parse(t.completedAt)-Date.parse(t.startedAt));return`duration ${Bu(i)}`}return t.startedAt!==null?`started ${bn(t.startedAt,a)}`:t.completedAt!==null?`completed ${bn(t.completedAt,a)}`:t.durationMs!==null?`duration ${Bu(t.durationMs)}`:"timing not reported"}function Un(t){return t.replaceAll("_"," ")}function Fu(t){return t===null?"":` · score ${t.toFixed(1)}`}function NS(t){const{coverage:a}=t;if(a.status==="not_evaluated")return"coverage not evaluated";const i=a.policy===null?"":` · ${a.policy}`;return`coverage ${a.status} ${String(a.selected)}/${String(a.required)}${i}`}function kS(t){const a=t.cache.write==="not_attempted"?"":` · write ${Un(t.cache.write)}`;return`cache ${Un(t.cache.lookup)}${a}`}function AS(t){return`curator ${Un(t.curator.status)}${Fu(t.curator.score)} · finalizer ${Un(t.finalizer.status)}${Fu(t.finalizer.score)}`}function RS(t){const a=(i,r)=>`${i} ${r.status==="succeeded"&&r.score!==null?r.score.toFixed(1):Un(r.status)}`;return`${a("curator",t.curator)} · ${a("finalizer",t.finalizer)}`}function ES(t){const{coverage:a}=t;return a.status==="satisfied"||a.status==="not_evaluated"?"":`coverage ${String(a.selected)}/${String(a.required)}`}function TS(t){return`cache ${Un(t.cache.lookup)}`}function CS(t){return t.durationMs===null?"":t.durationMs>=1e3?Rr(t.durationMs):`${String(t.durationMs)} ms`}function rb(t){return t==="current"?null:t}function OS(t){return t.fallback.status==="not_applicable"||t.fallback.status==="not_used"?null:`fallback ${Un(t.fallback.status)}`}const $S=["all","orphaned","pending","running","succeeded","partial","failed","cancelled","unsupported"];function fx(t){return t.lifecycle===null?"unsupported":t.orphaned||t.liveness==="orphaned"?"orphaned":t.lifecycle.status}function ob(t,a){return a==="all"||fx(t)===a}function px(t,a="workflow_preflight",i="workflow preflight",r=Date.now()){return{contextRunId:i,operationKindLabel:dx[a],statusLabel:t.status,statusState:t.status,phaseLabel:Un(t.phase),coverageLabel:NS(t),coverageState:t.coverage.status,cacheLabel:kS(t),isCacheHit:t.cache.lookup==="hit",delegateLabel:AS(t),fallbackLabel:OS(t),delegateFootnote:RS(t),coverageFootnote:ES(t),cacheFootnote:TS(t),durationFootnote:CS(t),updatedAt:t.updatedAt??"not reported",timingLabel:SS(t,r),updatedAgeLabel:t.updatedAt===null?"not reported":bn(t.updatedAt,r),legacyUnsupported:!1,compatibilityLabel:"current",compatChip:null,artifactRunId:t.artifactRunId}}function Kh(t,a){const i=fx(t);if(t.lifecycle===null){const c=Un(t.compatibility);return{contextRunId:t.id,operationKindLabel:dx[t.operationKind],statusLabel:"unsupported",statusState:i,phaseLabel:"lifecycle unavailable",coverageLabel:"coverage unavailable",coverageState:"not_available",cacheLabel:"cache unavailable",isCacheHit:!1,delegateLabel:"lifecycle unavailable",fallbackLabel:null,delegateFootnote:"",coverageFootnote:"",cacheFootnote:"cache unavailable",durationFootnote:"",updatedAt:"not reported",timingLabel:"timing not reported",updatedAgeLabel:"not reported",legacyUnsupported:!0,compatibilityLabel:c,compatChip:rb(c),artifactRunId:null}}const r={...px(t.lifecycle,t.operationKind,t.id,a),statusLabel:i,statusState:i,compatibilityLabel:Un(t.compatibility)};return{...r,compatChip:rb(r.compatibilityLabel)}}function cb(t,a){const[i,r]=bd(a);return[{label:`${t} model`,value:i},{label:`${t} effort`,value:r}]}function MS(t,a=Date.now()){const i=Kh(t,a),r=[{label:"route identity",value:t.id},{label:"identity domain",value:Un(t.source)},{label:"operation",value:i.operationKindLabel},{label:"compatibility",value:i.compatibilityLabel}],c=t.lifecycle;return c===null?{...i,identityFacts:r,lifecycleFacts:[],delegateFacts:[],cacheFacts:[],coverageFacts:[],countFacts:[],reasonCodes:[],legacyNotice:"This historical manifest has a forward-incompatible artifact set. No lifecycle was synthesized and no raw manifest content is exposed.",canViewArtifacts:!1}:(r.push({label:"artifact run id",value:c.artifactRunId??"none persisted"}),{...i,identityFacts:r,lifecycleFacts:[{label:"status",value:i.statusLabel},...i.statusState==="orphaned"?[{label:"persisted status",value:c.status}]:[],{label:"liveness",value:t.liveness},{label:"phase",value:i.phaseLabel},{label:"created",value:c.createdAt??"not reported"},{label:"updated",value:c.updatedAt??"not reported"},{label:"started",value:c.startedAt??"not started"},{label:"completed",value:c.completedAt??"not completed"},{label:"duration",value:c.durationMs===null?"not reported":`${String(c.durationMs)} ms`}],delegateFacts:[{label:"curator",value:`${Un(c.curator.status)}${Fu(c.curator.score)}`},...cb("curator",t.invocationAudit?.curator),{label:"finalizer",value:`${Un(c.finalizer.status)}${Fu(c.finalizer.score)}`},...cb("finalizer",t.invocationAudit?.finalizer)],cacheFacts:[{label:"lookup",value:Un(c.cache.lookup)},{label:"write",value:Un(c.cache.write)}],coverageFacts:[{label:"policy",value:c.coverage.policy??"none"},{label:"coverage",value:c.coverage.status},{label:"required",value:String(c.coverage.required)},{label:"selected",value:String(c.coverage.selected)},{label:"missing",value:String(c.coverage.missing)}],countFacts:[{label:"files seen",value:String(c.counts.filesSeen)},{label:"files considered",value:String(c.counts.filesConsidered)},{label:"files selected",value:String(c.counts.filesSelected)},{label:"files omitted",value:String(c.counts.filesOmitted)},{label:"search results",value:String(c.counts.searchResults)},{label:"bytes read",value:String(c.counts.bytesRead)},{label:"bytes written",value:String(c.counts.bytesWritten)}],reasonCodes:c.reasonCodes.map(Un),legacyNotice:null,canViewArtifacts:c.artifactRunId!==null})}const IS=new Set(["resolving","cache_lookup","validating","scanning","searching","selecting"]),LS=new Set(["writing","materializing","committing"]),vu=new Set(["not_configured","disabled","succeeded","failed","cancelled","skipped"]),ub=new Set(["running","succeeded","failed","cancelled"]);function Vo(t){return t.status==="pending"?"pending":t.status==="running"?"running":t.status==="cancelled"?"cancelled":t.status==="failed"?"failed":"succeeded"}function DS(t){return IS.has(t.phase)?Vo(t):t.phase!=="terminal"||ub.has(t.curator.status)||ub.has(t.finalizer.status)||zS(t)?"succeeded":Vo(t)}function zS(t){return t.counts.filesSelected>0||t.counts.filesOmitted>0||t.coverage.status!=="not_evaluated"||t.reasonCodes.includes("empty_selection")||t.cache.lookup==="hit"||t.cache.write==="written"||hx(t)}function hx(t){return t.counts.bytesWritten>0||t.artifactRunId!==null}function qS(t){return t.phase==="complete"?"succeeded":t.phase==="terminal"?hx(t)?Vo(t):"skipped":LS.has(t.phase)?Vo(t):"pending"}function db(t,a){return t.phase!=="terminal"?a:a==="pending"?"skipped":a==="running"?Vo(t):a}function Cu(t){return t.replaceAll("_"," ")}function US(t){return[{id:"discover",state:DS(t),score:null,knobLabel:null},{id:"curator",state:db(t,t.curator.status),score:t.curator.score,knobLabel:`configured intent · ${Hu(t.effectiveDelegate?.curator)}`},{id:"finalizer",state:db(t,t.finalizer.status),score:t.finalizer.score,knobLabel:`configured intent · ${Hu(t.effectiveDelegate?.finalizer)}`},{id:"materialize",state:qS(t),score:null,knobLabel:null}]}function Ou(t){return t?.replaceAll("_"," ")??"not recorded"}function BS(t){return t===void 0?"not recorded":t?"yes":"no"}function GS({configuration:t}){return s.jsxs("dl",{className:"context-preflight__configuration","aria-label":"Preflight configuration",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"profile"}),s.jsx("dd",{children:Ou(t.profile)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"effective mode"}),s.jsx("dd",{children:Ou(t.effectiveMode)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"on delegate failure"}),s.jsx("dd",{children:t.failurePolicy==="fail"?"fail closed":Ou(t.failurePolicy)})]})]})}function HS(t){if(t.coverage.status==="not_evaluated")return"not evaluated for this profile";const a=t.coverage.missing===0?"":` · ${String(t.coverage.missing)} missing`;return`${t.coverage.status} · ${String(t.coverage.selected)}/${String(t.coverage.required)} obligations${a}`}function mx(t){return t.cache.lookup==="hit"?`${String(t.counts.filesSelected)} files restored`:`${String(t.counts.filesSelected)} of ${String(t.counts.filesConsidered)} files selected`}function VS(t){if(t.durationMs!==null)return t.durationMs;const a=Date.parse(t.createdAt??t.startedAt??""),i=!["pending","running"].includes(t.status),r=Date.parse((i?t.completedAt:null)??t.updatedAt??"");return!Number.isFinite(a)||!Number.isFinite(r)?null:Math.max(0,r-a)}const wh=new Set(["cache_disabled","cache_miss"]);function FS(t){const a=t.coverage.status==="not_evaluated"?"coverage not evaluated":`coverage ${String(t.coverage.selected)}/${String(t.coverage.required)}${t.coverage.missing===0?"":` · ${String(t.coverage.missing)} missing`}`,i=[mx(t),a,...t.cache.lookup==="hit"?["cache hit"]:[]],r=VS(t);r!==null&&i.push(Xa(r));const c=t.reasonCodes.filter(f=>!wh.has(f)).map(Cu);return c.length>0&&i.push(c.join(" · ")),i.join(" · ")}function $u({invocation:t}){if(t===void 0)return null;const a=fS(t);return s.jsxs("section",{"aria-label":"Context preflight invocation evidence",className:"run-detail__snapshot-unavailable",children:[s.jsx("h4",{children:a.operationLabel}),s.jsxs("p",{children:[a.sourceLabel," · artifact run"," ",s.jsx("span",{className:"op-mono overflow-safe",children:a.artifactRunId})]}),s.jsx("dl",{className:"context-preflight__facts",children:a.facts.map(i=>s.jsxs("div",{children:[s.jsx("dt",{children:i.label}),s.jsx("dd",{children:i.value})]},i.label))}),s.jsx("p",{className:"context-preflight__note",children:"Value-only execution evidence · no argv or unavailable value bytes."})]})}function KS({preflight:t,invocation:a,onInspectSessionLog:i}){const[r,c]=b.useState(!1);if(t===null||t.availability==="absent")return s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",role:"status",children:[s.jsx("header",{className:"context-preflight__header",children:s.jsx("h3",{id:"run-preflight-title",children:"Context preflight"})}),s.jsx("p",{className:"context-preflight__summary",children:"This run reported no context-builder preflight."})]}),s.jsx($u,{invocation:a})]});if(t.availability==="legacy_without_telemetry")return s.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",children:[s.jsxs("header",{className:"context-preflight__header",children:[s.jsx("h3",{id:"run-preflight-title",children:"Context preflight"}),s.jsx("span",{className:"run-detail__status","data-state":t.status,children:t.status})]}),s.jsx("p",{className:"context-preflight__summary",role:"status",children:"Preflight completed, but this legacy run has no lifecycle telemetry."}),s.jsx($u,{invocation:a})]});if(t.availability!=="current"){const p={bypassed:{label:"bypassed",state:"disabled",message:`Context preflight was bypassed by effective mode ${t.effectiveMode}.`},awaiting_telemetry:{label:"awaiting telemetry",state:"running",message:"Context preflight is awaiting lifecycle telemetry."},telemetry_unavailable:{label:"telemetry unavailable",state:"partial",message:"This run is terminal, but context preflight lifecycle telemetry is unavailable."}}[t.availability];return s.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",children:[s.jsxs("header",{className:"context-preflight__header",children:[s.jsx("h3",{id:"run-preflight-title",children:"Context preflight"}),s.jsx("span",{className:"run-detail__status","data-state":p.state,children:p.label})]}),s.jsx("p",{className:"context-preflight__summary",role:"status",children:p.message}),s.jsx($u,{invocation:a})]})}const f=px(t);return s.jsxs("section",{className:"context-preflight","aria-labelledby":"run-preflight-title",children:[s.jsxs("header",{className:"context-preflight__header",children:[s.jsx("h3",{id:"run-preflight-title",children:"Context preflight"}),s.jsx("span",{className:"run-detail__status","data-state":f.statusState,children:f.statusLabel}),s.jsx("button",{"aria-expanded":r,className:"run-detail__fact-toggle",onClick:()=>c(p=>!p),type:"button",children:r?"[ collapse ]":"[ expand ]"})]}),s.jsx("p",{className:"context-preflight__summary",children:FS(t)}),s.jsx("div",{className:"context-preflight__detail",hidden:!r,children:s.jsx(ZS,{invocation:a,preflight:t,view:f,...i===void 0?{}:{onInspectSessionLog:i}})})]})}function ZS({invocation:t,preflight:a,view:i,onInspectSessionLog:r}){const c=US(a),f=c.filter(h=>vu.has(h.state)).length,p=c.map(h=>`${h.id}: ${Cu(h.state)}${h.score===null?"":`, score ${h.score.toFixed(1)} out of 10`}`).join("; ");return s.jsxs(s.Fragment,{children:[s.jsx(GS,{configuration:a}),s.jsxs("div",{"aria-label":"Context preflight progress","aria-valuemax":c.length,"aria-valuemin":0,"aria-valuenow":f,"aria-valuetext":`${String(f)} of ${String(c.length)} milestones resolved · ${i.statusLabel}`,"aria-describedby":"context-preflight-milestone-summary",className:"context-preflight__stage-track",role:"progressbar",children:[s.jsx("span",{className:"visually-hidden",id:"context-preflight-milestone-summary",children:p}),s.jsx("div",{className:"context-preflight__stage-list","aria-hidden":"true",children:c.map((h,v)=>{const m=c[v+1],x=m!==void 0&&vu.has(h.state)&&vu.has(m.state),y=m?.state==="running"&&vu.has(h.state),A=h.state==="succeeded"?null:Cu(h.state),w=h.score===null?null:`${A===null?"":" · "}${h.score.toFixed(1)}/10`;return s.jsxs("div",{className:["context-preflight__stage",x?"context-preflight__stage--resolved-connector":"",y?"context-preflight__stage--live-connector":""].filter(Boolean).join(" "),title:h.knobLabel??void 0,children:[s.jsx("span",{className:`context-preflight__stage-dot context-preflight__stage-dot--${h.state}`,children:h.state==="failed"?"×":null}),s.jsxs("span",{className:"context-preflight__stage-label",children:[s.jsx("span",{children:h.id}),A===null&&w===null?null:s.jsxs("span",{className:"context-preflight__stage-state",children:[A,w]})]})]},h.id)})})]}),s.jsxs("dl",{className:"context-preflight__facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"finalizer execution"}),s.jsx("dd",{children:Ou(a.finalizerExecutionStatus)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"effective enabled"}),s.jsx("dd",{children:BS(a.finalizerEffectiveEnabled)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"selection"}),s.jsx("dd",{children:mx(a)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"coverage"}),s.jsx("dd",{children:HS(a)})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"cache"}),s.jsx("dd",{children:i.cacheLabel})]}),["complete","terminal"].includes(a.phase)?null:s.jsxs("div",{children:[s.jsx("dt",{children:"current phase"}),s.jsx("dd",{children:i.phaseLabel})]}),i.artifactRunId===null?null:s.jsxs("div",{children:[s.jsx("dt",{children:"artifact run"}),s.jsx("dd",{className:"op-mono overflow-safe",children:i.artifactRunId})]}),i.fallbackLabel===null?null:s.jsxs("div",{children:[s.jsx("dt",{children:"fallback"}),s.jsx("dd",{children:i.fallbackLabel})]}),a.reasonCodes.filter(h=>!wh.has(h)).length===0?null:s.jsxs("div",{className:"context-preflight__fact--wide",children:[s.jsx("dt",{children:"reasons"}),s.jsx("dd",{children:a.reasonCodes.filter(h=>!wh.has(h)).map(Cu).join(" · ")})]})]}),s.jsx($u,{invocation:t}),r===void 0?null:s.jsx("button",{"aria-label":"Inspect context preflight curator/finalizer session log",className:"run-detail__inspect context-preflight__log",onClick:r,title:"curator · finalizer session log",type:"button",children:"[ log ]"})]})}const YS=1400;function XS(t){const a=document.createElement("textarea");a.className="copy-fallback-input",a.value=t,a.setAttribute("readonly",""),document.body.append(a),a.select();try{return document.execCommand("copy")}catch{return!1}finally{a.remove()}}async function PS(t){try{if(navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}return XS(t)}function ga({label:t,text:a}){const[i,r]=b.useState("idle");b.useEffect(()=>{if(i!=="copied")return;const f=setTimeout(()=>r("idle"),YS);return()=>{clearTimeout(f)}},[i]);const c=i==="copied"?"copied ✓":i==="failed"?"copy failed; select the text":"[ copy ]";return s.jsxs("span",{className:"copy-control",children:[s.jsx("button",{"aria-label":t,className:"copy-control__button","data-copy-state":i,onClick:()=>{PS(a).then(f=>r(f?"copied":"failed"))},type:"button",children:c}),i==="idle"?null:s.jsx("span",{"aria-live":"polite",className:"copy-control__status",role:"status",children:i==="copied"?"Copied":"Copy failed; select the text"})]})}function wr({children:t}){return s.jsx("pre",{className:"selectable-content",tabIndex:0,children:t})}function Zh({activeTabId:t,ariaLabel:a,onChange:i,tabs:r}){const c=b.useId(),f=b.useRef(new Map),p=Math.max(0,r.findIndex(x=>x.id===t)),h=r[p],v=x=>{const y=r[x];y&&(i(y.id),f.current.get(y.id)?.focus())},m=(x,y)=>{if(r.length===0)return;let A=null;x.key==="ArrowRight"?A=(y+1)%r.length:x.key==="ArrowLeft"?A=(y-1+r.length)%r.length:x.key==="Home"?A=0:x.key==="End"&&(A=r.length-1),A!==null&&(x.preventDefault(),v(A))};return s.jsxs("div",{className:"tab-list",children:[s.jsx("div",{"aria-label":a,className:"tab-list__tabs",role:"tablist",children:r.map((x,y)=>{const A=x.id===h?.id;return s.jsx("button",{"aria-controls":`${c}-${x.id}-panel`,"aria-selected":A,className:"tab-list__tab",id:`${c}-${x.id}-tab`,onClick:()=>i(x.id),onKeyDown:w=>m(w,y),ref:w=>{w?f.current.set(x.id,w):f.current.delete(x.id)},role:"tab",tabIndex:A?0:-1,type:"button",children:x.label},x.id)})}),r.map(x=>{const y=x.id===h?.id;return!y&&x.keepMounted!==!0?null:s.jsx("div",{"aria-labelledby":`${c}-${x.id}-tab`,className:"tab-list__panel",hidden:!y,id:`${c}-${x.id}-panel`,role:"tabpanel",tabIndex:y?0:-1,children:x.panel},x.id)})]})}const Ku="X-ClinkX-Agent-Instance-Id",Zu="X-ClinkX-Local-Origin-Proof",QS="dashboard-connection-v1",gx="clinkx-dashboard-connection-v1:",JS="clinkx-dashboard-local-origin-proof-v1:",Sh="clinkx-dashboard-auth-expired",Vp=["v","apiOrigin","agentInstanceId","token"],yd=/^[A-Za-z0-9_-]{43}$/,_x=/^[A-Za-z0-9_-]{43}$/,Fo=/^[A-Za-z0-9_-]{22}$/;let kn=null,Yn=null,Pa=0,Ps=!1,Bs="bearer";const vx=new WeakMap;class jt extends Error{constructor(){super("connection_changed"),this.name="ConnectionChangedError"}}function ds(){return{mode:"local",apiOrigin:window.location.origin,uiOrigin:window.location.origin,agentInstanceId:null}}const WS=new Set(["127.0.0.1","localhost","[::1]"]);function Wo(t){if(t==null&&typeof window>"u")return!1;try{const a=new URL(t??window.location.origin);return a.protocol==="http:"&&WS.has(a.hostname)}catch{return!1}}function Yu(){return`${JS}${encodeURIComponent(window.location.origin)}`}function Yh(){if(!Wo())return null;try{const t=window.sessionStorage.getItem(Yu());if(t===null)return null;if(_x.test(t))return t;window.sessionStorage.removeItem(Yu())}catch{}return null}function eN(t){if(!Wo()||!_x.test(t))throw new Error("invalid local dashboard origin proof");window.sessionStorage.setItem(Yu(),t)}function ps(){try{window.sessionStorage.removeItem(Yu())}catch{}}function bx(t){return`${gx}${encodeURIComponent(t)}`}function Xh(t){try{const a=new URL(t);return a.protocol==="https:"&&a.username===""&&a.password===""&&a.pathname==="/"&&a.search===""&&a.hash===""&&a.origin===t}catch{return!1}}function tN(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;const a=t;return Object.keys(a).sort().join("\0")!==["agentInstanceId","apiOrigin","mode","uiOrigin"].sort().join("\0")||a.uiOrigin!==window.location.origin?!1:a.mode==="local"?a.apiOrigin===window.location.origin&&(a.agentInstanceId===null||typeof a.agentInstanceId=="string"&&Fo.test(a.agentInstanceId)):a.mode==="remote"&&typeof a.apiOrigin=="string"&&Xh(a.apiOrigin)&&typeof a.agentInstanceId=="string"&&Fo.test(a.agentInstanceId)}function nN(t,a){try{const i=JSON.parse(t);if(typeof i!="object"||i===null||Array.isArray(i))return null;const r=i;if(Object.keys(r).sort().join("\0")!==["bearer","connection","schemaVersion"].sort().join("\0")||r.schemaVersion!=="dashboard-browser-authority-v1"||!tN(r.connection)||typeof r.bearer!="object"||r.bearer===null||Array.isArray(r.bearer))return null;const c=r.bearer;return Object.keys(c).join("\0")!=="token"||typeof c.token!="string"||!yd.test(c.token)||bx(r.connection.apiOrigin)!==a?null:i}catch{return null}}function yx(){const t=[];try{for(let a=0;a<window.sessionStorage.length;a+=1){const i=window.sessionStorage.key(a);i?.startsWith(gx)&&t.push(i)}}catch{return[]}return t}function zl(){try{for(const t of yx())window.sessionStorage.removeItem(t)}catch{}}function xx(){if(kn===null||Yn===null)return;const t={schemaVersion:"dashboard-browser-authority-v1",connection:kn,bearer:Yn};try{zl(),window.sessionStorage.setItem(bx(kn.apiOrigin),JSON.stringify(t))}catch{}}function aN(){const t=[];try{for(const i of yx()){const r=window.sessionStorage.getItem(i),c=r===null?null:nN(r,i);c===null?window.sessionStorage.removeItem(i):t.push(c)}}catch{return!1}if(t.length!==1)return t.length>1&&zl(),!1;const a=t[0];return a===void 0?!1:(kn=a.connection,Yn=a.bearer,Pa+=1,Ps=!1,!0)}function Nh(t,a){zl(),kn=t,Yn={token:a},Pa+=1,Ps=!1,xx()}function sN(){window.history.replaceState(window.history.state,"",window.location.pathname+window.location.search)}function lN(t){const a=t.split("&");if(a.length!==Vp.length)return null;const i=[];for(let v=0;v<Vp.length;v+=1){const m=a[v],x=Vp[v];if(m===void 0||x===void 0)return null;const y=m.indexOf("=");if(y<=0||m.indexOf("=",y+1)!==-1||m.slice(0,y)!==x)return null;i.push(m.slice(y+1))}const[r,c,f,p]=i;if(r!=="1"||c===void 0||f===void 0||p===void 0||!Fo.test(f)||!yd.test(p))return null;let h;try{h=decodeURIComponent(c)}catch{return null}return encodeURIComponent(h)!==c||!Xh(h)?null:{apiOrigin:h,agentInstanceId:f,token:p}}function iN(t){if(!t.startsWith("token="))return null;const a=t.slice(6);return yd.test(a)?a:null}function ci(){return{...kn??ds(),authenticated:Yn!==null,revision:Pa,rebootstrapRequired:Ps}}function jx(){const t=window.location.hash;if(t!==""){const a=t.startsWith("#")?t.slice(1):t;sN();const i=lN(a);if(i!==null)return Xh(window.location.origin)?(Nh({mode:"remote",apiOrigin:i.apiOrigin,uiOrigin:window.location.origin,agentInstanceId:i.agentInstanceId},i.token),ci()):(zl(),kn=ds(),Yn=null,Pa+=1,Ps=!0,ci());const r=iN(a);return r!==null?(Nh(ds(),r),ci()):(zl(),kn=ds(),Yn=null,Pa+=1,Ps=!0,ci())}return(kn===null||Yn===null)&&aN(),kn===null&&(kn=ds()),ci()}function rN(){return kn===null&&(kn=ds()),ci()}function oN(t){const a=t.trim();return yd.test(a)?(Nh(ds(),a),!0):!1}function cN(){return Yn!==null}function kh(){Yn!==null&&(Yn=null,Pa+=1,zl())}function Xu(t){Bs=t,t==="passkey"||t==="none"?(Yn=null,zl(),kn=ds(),Ps=!1,Pa+=1):ps()}function Uo(){throw ps(),Yn=null,Pa+=1,Ps=!0,zl(),new jt}function wx(t){if(Ps||t.revision!==Pa)throw new jt}function Sx(t,a){wx(a);const i=t.headers.get(Ku);if(a.agentInstanceId===null){a.requireAgentInstanceHeader&&(i===null||!Fo.test(i))&&Uo();return}i!==a.agentInstanceId&&Uo()}function Fs(t){const a=vx.get(t);a!==void 0&&Sx(t,a)}async function sa(t){Fs(t);const a=await t.json();return Fs(t),a}async function Ph(t){Fs(t);const a=await t.text();return Fs(t),a}const uN=/^\/api\/progress-reports\/[A-Za-z0-9][A-Za-z0-9_-]{0,63}\/status-override$/,dN="/api/prompt-builder/library/save";function fN(t){return uN.test(t)||t===dN}function pN(t,a){let i;try{i=new URL(t,a)}catch{throw new Error("apiFetch only permits normalized /api/* paths")}if(!t.startsWith("/api/")||i.origin!==a||i.hash!==""||i.pathname+i.search!==t||!i.pathname.startsWith("/api/"))throw new Error("apiFetch only permits normalized /api/* paths");return i}async function Nx(t,a){if(kn===null&&jx(),Ps)throw new jt;const i=kn??ds(),r=pN(t,i.apiOrigin),c={revision:Pa,agentInstanceId:Bs==="bearer"?i.agentInstanceId:null,requireAgentInstanceHeader:Bs==="bearer"&&t==="/api/connection"},f=new Headers(a.headers);Bs==="passkey"||Yn===null?f.delete("Authorization"):f.set("Authorization",`Bearer ${Yn.token}`),Bs==="bearer"&&i.mode==="remote"&&i.agentInstanceId!==null?f.set(Ku,i.agentInstanceId):f.delete(Ku);const p=Bs==="passkey"?Yh():null;p===null?f.delete(Zu):f.set(Zu,p);let h;try{h=await fetch(r.href,{...a,method:a.method,headers:f,credentials:Bs==="bearer"?"omit":"same-origin",redirect:"error",referrerPolicy:"no-referrer"})}catch(v){throw wx(c),v}return vx.set(h,c),Sx(h,c),h.status===401&&(Bs==="passkey"||Bs==="none"?(ps(),window.dispatchEvent(new CustomEvent(Sh))):kh()),h}async function ms(t,a){const i=(a?.method??"GET").toUpperCase();if(i!=="GET"&&i!=="HEAD")throw new Error("apiFetch only permits GET and HEAD requests");return Nx(t,{...a,method:i})}async function kx(t,a){if(!fN(t))throw new Error("apiMutate only permits the progress-report status-override path or the prompt-builder library save path");return Nx(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}function hN(t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const a=t;return Object.keys(a).sort().join("\0")!==["agentInstanceId","schemaVersion"].sort().join("\0")?null:a.schemaVersion===QS&&typeof a.agentInstanceId=="string"&&Fo.test(a.agentInstanceId)?a:null}async function Ax(){const t=await ms("/api/connection");if(t.status===401)throw new Error("dashboard authorization expired");if(!t.ok)return Uo();const a=hN(await sa(t)),i=t.headers.get(Ku);if(a===null||i!==a.agentInstanceId)return Uo();const r=kn??ds();return r.agentInstanceId!==null&&r.agentInstanceId!==a.agentInstanceId?Uo():(r.agentInstanceId===null&&(kn={...r,agentInstanceId:a.agentInstanceId},Pa+=1,xx()),ci())}const mN=new Set(["unauthorized","not_found","run_generation_changed","run_state_changed","agent_instance_changed","content_too_large_for_dashboard"]),gN={input:"prompt",output:"output",error:"error",artifact:"artifact"};class Ya extends Error{constructor(a,i,r){super(a),this.kind=a,this.status=i,this.code=r,this.name="InspectorApiError"}}function _N(t){return t??new AbortController().signal}async function vN(t){try{const a=await sa(t);return typeof a.error?.code=="string"&&mN.has(a.error.code)?a.error.code:void 0}catch(a){if(a instanceof jt)throw new Ya("connection_changed",409,"agent_instance_changed");return}}function bN(t=ms){return{async readPane(a,i){const r=_N(i),c=encodeURIComponent(a.runId),f=encodeURIComponent(a.stageId),p=encodeURIComponent(a.callId),h=encodeURIComponent(a.runGeneration),v=`/api/runs/${c}/stages/${f}/calls/${p}/${gN[a.kind]}?generation=${h}`;let m;try{m=await t(v,{signal:r})}catch(y){throw y instanceof jt?new Ya("connection_changed",409,"agent_instance_changed"):r.aborted||y instanceof DOMException&&y.name==="AbortError"?new Ya("aborted"):new Ya("offline")}if(m.status===401)throw new Ya("auth_expired",401,"unauthorized");if(!m.ok){const y=await vN(m);throw y==="agent_instance_changed"?new Ya("connection_changed",m.status,y):new Ya("request_error",m.status,y)}let x;try{x=await Ph(m)}catch(y){throw y instanceof jt?new Ya("connection_changed",409,"agent_instance_changed"):y}return{content:x,etag:m.headers.get("ETag"),mediaType:m.headers.get("Content-Type")??"text/plain; charset=utf-8"}}}}const yN={input:"workflow input (pre-dispatch)",output:"final persisted output",error:"raw persisted error",artifact:"validated artifact"},xN={input:"input",output:"output",error:"error",artifact:"artifact"};function jN(t){return[["input",t.hasWorkflowInput],["output",t.hasOutput],["error",t.hasRawError],["artifact",t.hasArtifactReference]].filter(a=>a[1]).map(([a])=>({kind:a,label:yN[a]}))}function wN(t){return(t.state==="failed"||t.state==="cancelled")&&t.hasRawError&&!t.hasWorkflowInput&&!t.hasOutput&&!t.hasArtifactReference?`This ${t.state} call has only a raw persisted error; no workflow input, final output, or validated artifact is available.`:null}function SN(t){switch(t){case"content_too_large_for_dashboard":return"Content exceeds the dashboard cap.";case"not_found":return"Persisted content is missing or was pruned.";case"run_state_changed":case"obsolete_etag":return"Persisted state changed while this pane was loading. Retry this pane.";case"auth_expired":return"Dashboard authorization expired.";case"connection_changed":return"Dashboard connection changed; rebootstrap is required.";case"offline":return"Dashboard is offline. Retry this pane when the server is reachable.";case"request_error":return"Persisted content could not be loaded. Retry this pane."}}const NN={maxDepth:12,maxNodes:1e3};function kN(t,a){let i=Math.max(1,a.maxNodes),r=!1;const c=(f,p)=>{if(i<=0)return r=!0,"[node limit]";if(i-=1,f===null||typeof f!="object")return f;if(p>=Math.max(1,a.maxDepth))return r=!0,"[depth limit]";if(Array.isArray(f)){const v=[];for(let m=0;m<f.length;m+=1){if(i<=0){r=!0,v.push("[node limit]");break}v.push(c(f[m],p+1))}return v}const h={};for(const v in f)if(Object.prototype.hasOwnProperty.call(f,v)){if(i<=0){r=!0,h["[truncated]"]="[node limit]";break}h[v]=c(f[v],p+1)}return h};return{value:c(t,0),truncated:r}}function AN(t,a=NN){let i;try{i=JSON.parse(t)}catch{return{kind:"text",rendered:t,truncated:!1}}const r=kN(i,a);return{kind:"json",rendered:JSON.stringify(r.value,null,2),truncated:r.truncated}}function RN(t,a){return t.runId===a.runId&&t.runGeneration===a.runGeneration&&t.stateRevision===a.stateRevision}function yr(){let t=0,a=null;return{begin(i){a?.controller.abort();const r=new AbortController,c={...i,requestId:++t};return a={identity:c,controller:r},{identity:c,signal:r.signal}},isActive(i){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted},accepts(i,r){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted&&RN(i,r)},acceptsDetail(i,r){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted&&i.runId===r.runId&&i.runGeneration===r.runGeneration},acceptsEtag(i,r){return a!==null&&a.identity.requestId===i.requestId&&!a.controller.signal.aborted&&r===`"${i.stateRevision}"`},cancel(){a?.controller.abort(),a=null}}}var gt;(function(t){t.assertEqual=c=>{};function a(c){}t.assertIs=a;function i(c){throw new Error}t.assertNever=i,t.arrayToEnum=c=>{const f={};for(const p of c)f[p]=p;return f},t.getValidEnumValues=c=>{const f=t.objectKeys(c).filter(h=>typeof c[c[h]]!="number"),p={};for(const h of f)p[h]=c[h];return t.objectValues(p)},t.objectValues=c=>t.objectKeys(c).map(function(f){return c[f]}),t.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const f=[];for(const p in c)Object.prototype.hasOwnProperty.call(c,p)&&f.push(p);return f},t.find=(c,f)=>{for(const p of c)if(f(p))return p},t.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function r(c,f=" | "){return c.map(p=>typeof p=="string"?`'${p}'`:p).join(f)}t.joinValues=r,t.jsonStringifyReplacer=(c,f)=>typeof f=="bigint"?f.toString():f})(gt||(gt={}));var fb;(function(t){t.mergeShapes=(a,i)=>({...a,...i})})(fb||(fb={}));const Ce=gt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tl=t=>{switch(typeof t){case"undefined":return Ce.undefined;case"string":return Ce.string;case"number":return Number.isNaN(t)?Ce.nan:Ce.number;case"boolean":return Ce.boolean;case"function":return Ce.function;case"bigint":return Ce.bigint;case"symbol":return Ce.symbol;case"object":return Array.isArray(t)?Ce.array:t===null?Ce.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ce.promise:typeof Map<"u"&&t instanceof Map?Ce.map:typeof Set<"u"&&t instanceof Set?Ce.set:typeof Date<"u"&&t instanceof Date?Ce.date:Ce.object;default:return Ce.unknown}},ee=gt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Qs extends Error{get errors(){return this.issues}constructor(a){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=a}format(a){const i=a||function(f){return f.message},r={_errors:[]},c=f=>{for(const p of f.issues)if(p.code==="invalid_union")p.unionErrors.map(c);else if(p.code==="invalid_return_type")c(p.returnTypeError);else if(p.code==="invalid_arguments")c(p.argumentsError);else if(p.path.length===0)r._errors.push(i(p));else{let h=r,v=0;for(;v<p.path.length;){const m=p.path[v];v===p.path.length-1?(h[m]=h[m]||{_errors:[]},h[m]._errors.push(i(p))):h[m]=h[m]||{_errors:[]},h=h[m],v++}}};return c(this),r}static assert(a){if(!(a instanceof Qs))throw new Error(`Not a ZodError: ${a}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,gt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(a=i=>i.message){const i={},r=[];for(const c of this.issues)if(c.path.length>0){const f=c.path[0];i[f]=i[f]||[],i[f].push(a(c))}else r.push(a(c));return{formErrors:r,fieldErrors:i}}get formErrors(){return this.flatten()}}Qs.create=t=>new Qs(t);const Ah=(t,a)=>{let i;switch(t.code){case ee.invalid_type:t.received===Ce.undefined?i="Required":i=`Expected ${t.expected}, received ${t.received}`;break;case ee.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(t.expected,gt.jsonStringifyReplacer)}`;break;case ee.unrecognized_keys:i=`Unrecognized key(s) in object: ${gt.joinValues(t.keys,", ")}`;break;case ee.invalid_union:i="Invalid input";break;case ee.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${gt.joinValues(t.options)}`;break;case ee.invalid_enum_value:i=`Invalid enum value. Expected ${gt.joinValues(t.options)}, received '${t.received}'`;break;case ee.invalid_arguments:i="Invalid function arguments";break;case ee.invalid_return_type:i="Invalid function return type";break;case ee.invalid_date:i="Invalid date";break;case ee.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(i=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?i=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?i=`Invalid input: must end with "${t.validation.endsWith}"`:gt.assertNever(t.validation):t.validation!=="regex"?i=`Invalid ${t.validation}`:i="Invalid";break;case ee.too_small:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:i="Invalid input";break;case ee.too_big:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?i=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:i="Invalid input";break;case ee.custom:i="Invalid input";break;case ee.invalid_intersection_types:i="Intersection results could not be merged";break;case ee.not_multiple_of:i=`Number must be a multiple of ${t.multipleOf}`;break;case ee.not_finite:i="Number must be finite";break;default:i=a.defaultError,gt.assertNever(t)}return{message:i}};let EN=Ah;function TN(){return EN}const CN=t=>{const{data:a,path:i,errorMaps:r,issueData:c}=t,f=[...i,...c.path||[]],p={...c,path:f};if(c.message!==void 0)return{...c,path:f,message:c.message};let h="";const v=r.filter(m=>!!m).slice().reverse();for(const m of v)h=m(p,{data:a,defaultError:h}).message;return{...c,path:f,message:h}};function Ne(t,a){const i=TN(),r=CN({issueData:a,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,i,i===Ah?void 0:Ah].filter(c=>!!c)});t.common.issues.push(r)}class _a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(a,i){const r=[];for(const c of i){if(c.status==="aborted")return He;c.status==="dirty"&&a.dirty(),r.push(c.value)}return{status:a.value,value:r}}static async mergeObjectAsync(a,i){const r=[];for(const c of i){const f=await c.key,p=await c.value;r.push({key:f,value:p})}return _a.mergeObjectSync(a,r)}static mergeObjectSync(a,i){const r={};for(const c of i){const{key:f,value:p}=c;if(f.status==="aborted"||p.status==="aborted")return He;f.status==="dirty"&&a.dirty(),p.status==="dirty"&&a.dirty(),f.value!=="__proto__"&&(typeof p.value<"u"||c.alwaysSet)&&(r[f.value]=p.value)}return{status:a.value,value:r}}}const He=Object.freeze({status:"aborted"}),Lo=t=>({status:"dirty",value:t}),Da=t=>({status:"valid",value:t}),pb=t=>t.status==="aborted",hb=t=>t.status==="dirty",Er=t=>t.status==="valid",Pu=t=>typeof Promise<"u"&&t instanceof Promise;var Le;(function(t){t.errToObj=a=>typeof a=="string"?{message:a}:a||{},t.toString=a=>typeof a=="string"?a:a?.message})(Le||(Le={}));class ql{constructor(a,i,r,c){this._cachedPath=[],this.parent=a,this.data=i,this._path=r,this._key=c}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const mb=(t,a)=>{if(Er(a))return{success:!0,data:a.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new Qs(t.common.issues);return this._error=i,this._error}}};function et(t){if(!t)return{};const{errorMap:a,invalid_type_error:i,required_error:r,description:c}=t;if(a&&(i||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return a?{errorMap:a,description:c}:{errorMap:(p,h)=>{const{message:v}=t;return p.code==="invalid_enum_value"?{message:v??h.defaultError}:typeof h.data>"u"?{message:v??r??h.defaultError}:p.code!=="invalid_type"?{message:h.defaultError}:{message:v??i??h.defaultError}},description:c}}class ft{get description(){return this._def.description}_getType(a){return Tl(a.data)}_getOrReturnCtx(a,i){return i||{common:a.parent.common,data:a.data,parsedType:Tl(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}_processInputParams(a){return{status:new _a,ctx:{common:a.parent.common,data:a.data,parsedType:Tl(a.data),schemaErrorMap:this._def.errorMap,path:a.path,parent:a.parent}}}_parseSync(a){const i=this._parse(a);if(Pu(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(a){const i=this._parse(a);return Promise.resolve(i)}parse(a,i){const r=this.safeParse(a,i);if(r.success)return r.data;throw r.error}safeParse(a,i){const r={common:{issues:[],async:i?.async??!1,contextualErrorMap:i?.errorMap},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:Tl(a)},c=this._parseSync({data:a,path:r.path,parent:r});return mb(r,c)}"~validate"(a){const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:Tl(a)};if(!this["~standard"].async)try{const r=this._parseSync({data:a,path:[],parent:i});return Er(r)?{value:r.value}:{issues:i.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:a,path:[],parent:i}).then(r=>Er(r)?{value:r.value}:{issues:i.common.issues})}async parseAsync(a,i){const r=await this.safeParseAsync(a,i);if(r.success)return r.data;throw r.error}async safeParseAsync(a,i){const r={common:{issues:[],contextualErrorMap:i?.errorMap,async:!0},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:a,parsedType:Tl(a)},c=this._parse({data:a,path:r.path,parent:r}),f=await(Pu(c)?c:Promise.resolve(c));return mb(r,f)}refine(a,i){const r=c=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(c):i;return this._refinement((c,f)=>{const p=a(c),h=()=>f.addIssue({code:ee.custom,...r(c)});return typeof Promise<"u"&&p instanceof Promise?p.then(v=>v?!0:(h(),!1)):p?!0:(h(),!1)})}refinement(a,i){return this._refinement((r,c)=>a(r)?!0:(c.addIssue(typeof i=="function"?i(r,c):i),!1))}_refinement(a){return new gi({schema:this,typeName:Ve.ZodEffects,effect:{type:"refinement",refinement:a}})}superRefine(a){return this._refinement(a)}constructor(a){this.spa=this.safeParseAsync,this._def=a,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return Zs.create(this,this._def)}nullable(){return _i.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hs.create(this)}promise(){return td.create(this,this._def)}or(a){return Ju.create([this,a],this._def)}and(a){return Wu.create(this,a,this._def)}transform(a){return new gi({...et(this._def),schema:this,typeName:Ve.ZodEffects,effect:{type:"transform",transform:a}})}default(a){const i=typeof a=="function"?a:()=>a;return new nd({...et(this._def),innerType:this,defaultValue:i,typeName:Ve.ZodDefault})}brand(){return new Cx({typeName:Ve.ZodBranded,type:this,...et(this._def)})}catch(a){const i=typeof a=="function"?a:()=>a;return new ad({...et(this._def),innerType:this,catchValue:i,typeName:Ve.ZodCatch})}describe(a){const i=this.constructor;return new i({...this._def,description:a})}pipe(a){return Jh.create(this,a)}readonly(){return sd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ON=/^c[^\s-]{8,}$/i,$N=/^[0-9a-z]+$/,MN=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IN=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,LN=/^[a-z0-9_-]{21}$/i,DN=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zN=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,UN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Fp;const BN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,GN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,HN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,VN=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,FN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,KN=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Rx="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ZN=new RegExp(`^${Rx}$`);function Ex(t){let a="[0-5]\\d";t.precision?a=`${a}\\.\\d{${t.precision}}`:t.precision==null&&(a=`${a}(\\.\\d+)?`);const i=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${a})${i}`}function YN(t){return new RegExp(`^${Ex(t)}$`)}function XN(t){let a=`${Rx}T${Ex(t)}`;const i=[];return i.push(t.local?"Z?":"Z"),t.offset&&i.push("([+-]\\d{2}:?\\d{2})"),a=`${a}(${i.join("|")})`,new RegExp(`^${a}$`)}function PN(t,a){return!!((a==="v4"||!a)&&BN.test(t)||(a==="v6"||!a)&&HN.test(t))}function QN(t,a){if(!DN.test(t))return!1;try{const[i]=t.split(".");if(!i)return!1;const r=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),c=JSON.parse(atob(r));return!(typeof c!="object"||c===null||"typ"in c&&c?.typ!=="JWT"||!c.alg||a&&c.alg!==a)}catch{return!1}}function JN(t,a){return!!((a==="v4"||!a)&&GN.test(t)||(a==="v6"||!a)&&VN.test(t))}class Ml extends ft{_parse(a){if(this._def.coerce&&(a.data=String(a.data)),this._getType(a)!==Ce.string){const f=this._getOrReturnCtx(a);return Ne(f,{code:ee.invalid_type,expected:Ce.string,received:f.parsedType}),He}const r=new _a;let c;for(const f of this._def.checks)if(f.kind==="min")a.data.length<f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),r.dirty());else if(f.kind==="max")a.data.length>f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),r.dirty());else if(f.kind==="length"){const p=a.data.length>f.value,h=a.data.length<f.value;(p||h)&&(c=this._getOrReturnCtx(a,c),p?Ne(c,{code:ee.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message}):h&&Ne(c,{code:ee.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message}),r.dirty())}else if(f.kind==="email")qN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"email",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="emoji")Fp||(Fp=new RegExp(UN,"u")),Fp.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"emoji",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="uuid")IN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"uuid",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="nanoid")LN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"nanoid",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="cuid")ON.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"cuid",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="cuid2")$N.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"cuid2",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="ulid")MN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"ulid",code:ee.invalid_string,message:f.message}),r.dirty());else if(f.kind==="url")try{new URL(a.data)}catch{c=this._getOrReturnCtx(a,c),Ne(c,{validation:"url",code:ee.invalid_string,message:f.message}),r.dirty()}else f.kind==="regex"?(f.regex.lastIndex=0,f.regex.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"regex",code:ee.invalid_string,message:f.message}),r.dirty())):f.kind==="trim"?a.data=a.data.trim():f.kind==="includes"?a.data.includes(f.value,f.position)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.invalid_string,validation:{includes:f.value,position:f.position},message:f.message}),r.dirty()):f.kind==="toLowerCase"?a.data=a.data.toLowerCase():f.kind==="toUpperCase"?a.data=a.data.toUpperCase():f.kind==="startsWith"?a.data.startsWith(f.value)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.invalid_string,validation:{startsWith:f.value},message:f.message}),r.dirty()):f.kind==="endsWith"?a.data.endsWith(f.value)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.invalid_string,validation:{endsWith:f.value},message:f.message}),r.dirty()):f.kind==="datetime"?XN(f).test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.invalid_string,validation:"datetime",message:f.message}),r.dirty()):f.kind==="date"?ZN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.invalid_string,validation:"date",message:f.message}),r.dirty()):f.kind==="time"?YN(f).test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.invalid_string,validation:"time",message:f.message}),r.dirty()):f.kind==="duration"?zN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"duration",code:ee.invalid_string,message:f.message}),r.dirty()):f.kind==="ip"?PN(a.data,f.version)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"ip",code:ee.invalid_string,message:f.message}),r.dirty()):f.kind==="jwt"?QN(a.data,f.alg)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"jwt",code:ee.invalid_string,message:f.message}),r.dirty()):f.kind==="cidr"?JN(a.data,f.version)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"cidr",code:ee.invalid_string,message:f.message}),r.dirty()):f.kind==="base64"?FN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"base64",code:ee.invalid_string,message:f.message}),r.dirty()):f.kind==="base64url"?KN.test(a.data)||(c=this._getOrReturnCtx(a,c),Ne(c,{validation:"base64url",code:ee.invalid_string,message:f.message}),r.dirty()):gt.assertNever(f);return{status:r.value,value:a.data}}_regex(a,i,r){return this.refinement(c=>a.test(c),{validation:i,code:ee.invalid_string,...Le.errToObj(r)})}_addCheck(a){return new Ml({...this._def,checks:[...this._def.checks,a]})}email(a){return this._addCheck({kind:"email",...Le.errToObj(a)})}url(a){return this._addCheck({kind:"url",...Le.errToObj(a)})}emoji(a){return this._addCheck({kind:"emoji",...Le.errToObj(a)})}uuid(a){return this._addCheck({kind:"uuid",...Le.errToObj(a)})}nanoid(a){return this._addCheck({kind:"nanoid",...Le.errToObj(a)})}cuid(a){return this._addCheck({kind:"cuid",...Le.errToObj(a)})}cuid2(a){return this._addCheck({kind:"cuid2",...Le.errToObj(a)})}ulid(a){return this._addCheck({kind:"ulid",...Le.errToObj(a)})}base64(a){return this._addCheck({kind:"base64",...Le.errToObj(a)})}base64url(a){return this._addCheck({kind:"base64url",...Le.errToObj(a)})}jwt(a){return this._addCheck({kind:"jwt",...Le.errToObj(a)})}ip(a){return this._addCheck({kind:"ip",...Le.errToObj(a)})}cidr(a){return this._addCheck({kind:"cidr",...Le.errToObj(a)})}datetime(a){return typeof a=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:a}):this._addCheck({kind:"datetime",precision:typeof a?.precision>"u"?null:a?.precision,offset:a?.offset??!1,local:a?.local??!1,...Le.errToObj(a?.message)})}date(a){return this._addCheck({kind:"date",message:a})}time(a){return typeof a=="string"?this._addCheck({kind:"time",precision:null,message:a}):this._addCheck({kind:"time",precision:typeof a?.precision>"u"?null:a?.precision,...Le.errToObj(a?.message)})}duration(a){return this._addCheck({kind:"duration",...Le.errToObj(a)})}regex(a,i){return this._addCheck({kind:"regex",regex:a,...Le.errToObj(i)})}includes(a,i){return this._addCheck({kind:"includes",value:a,position:i?.position,...Le.errToObj(i?.message)})}startsWith(a,i){return this._addCheck({kind:"startsWith",value:a,...Le.errToObj(i)})}endsWith(a,i){return this._addCheck({kind:"endsWith",value:a,...Le.errToObj(i)})}min(a,i){return this._addCheck({kind:"min",value:a,...Le.errToObj(i)})}max(a,i){return this._addCheck({kind:"max",value:a,...Le.errToObj(i)})}length(a,i){return this._addCheck({kind:"length",value:a,...Le.errToObj(i)})}nonempty(a){return this.min(1,Le.errToObj(a))}trim(){return new Ml({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ml({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ml({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(a=>a.kind==="datetime")}get isDate(){return!!this._def.checks.find(a=>a.kind==="date")}get isTime(){return!!this._def.checks.find(a=>a.kind==="time")}get isDuration(){return!!this._def.checks.find(a=>a.kind==="duration")}get isEmail(){return!!this._def.checks.find(a=>a.kind==="email")}get isURL(){return!!this._def.checks.find(a=>a.kind==="url")}get isEmoji(){return!!this._def.checks.find(a=>a.kind==="emoji")}get isUUID(){return!!this._def.checks.find(a=>a.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(a=>a.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(a=>a.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(a=>a.kind==="cuid2")}get isULID(){return!!this._def.checks.find(a=>a.kind==="ulid")}get isIP(){return!!this._def.checks.find(a=>a.kind==="ip")}get isCIDR(){return!!this._def.checks.find(a=>a.kind==="cidr")}get isBase64(){return!!this._def.checks.find(a=>a.kind==="base64")}get isBase64url(){return!!this._def.checks.find(a=>a.kind==="base64url")}get minLength(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxLength(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Ml.create=t=>new Ml({checks:[],typeName:Ve.ZodString,coerce:t?.coerce??!1,...et(t)});function WN(t,a){const i=(t.toString().split(".")[1]||"").length,r=(a.toString().split(".")[1]||"").length,c=i>r?i:r,f=Number.parseInt(t.toFixed(c).replace(".","")),p=Number.parseInt(a.toFixed(c).replace(".",""));return f%p/10**c}class Tr extends ft{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(a){if(this._def.coerce&&(a.data=Number(a.data)),this._getType(a)!==Ce.number){const f=this._getOrReturnCtx(a);return Ne(f,{code:ee.invalid_type,expected:Ce.number,received:f.parsedType}),He}let r;const c=new _a;for(const f of this._def.checks)f.kind==="int"?gt.isInteger(a.data)||(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.invalid_type,expected:"integer",received:"float",message:f.message}),c.dirty()):f.kind==="min"?(f.inclusive?a.data<f.value:a.data<=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.too_small,minimum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),c.dirty()):f.kind==="max"?(f.inclusive?a.data>f.value:a.data>=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.too_big,maximum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),c.dirty()):f.kind==="multipleOf"?WN(a.data,f.value)!==0&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.not_multiple_of,multipleOf:f.value,message:f.message}),c.dirty()):f.kind==="finite"?Number.isFinite(a.data)||(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.not_finite,message:f.message}),c.dirty()):gt.assertNever(f);return{status:c.value,value:a.data}}gte(a,i){return this.setLimit("min",a,!0,Le.toString(i))}gt(a,i){return this.setLimit("min",a,!1,Le.toString(i))}lte(a,i){return this.setLimit("max",a,!0,Le.toString(i))}lt(a,i){return this.setLimit("max",a,!1,Le.toString(i))}setLimit(a,i,r,c){return new Tr({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:Le.toString(c)}]})}_addCheck(a){return new Tr({...this._def,checks:[...this._def.checks,a]})}int(a){return this._addCheck({kind:"int",message:Le.toString(a)})}positive(a){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Le.toString(a)})}negative(a){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Le.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Le.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Le.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:Le.toString(i)})}finite(a){return this._addCheck({kind:"finite",message:Le.toString(a)})}safe(a){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Le.toString(a)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Le.toString(a)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}get isInt(){return!!this._def.checks.find(a=>a.kind==="int"||a.kind==="multipleOf"&>.isInteger(a.value))}get isFinite(){let a=null,i=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(i===null||r.value>i)&&(i=r.value):r.kind==="max"&&(a===null||r.value<a)&&(a=r.value)}return Number.isFinite(i)&&Number.isFinite(a)}}Tr.create=t=>new Tr({checks:[],typeName:Ve.ZodNumber,coerce:t?.coerce||!1,...et(t)});class Ko extends ft{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(a){if(this._def.coerce)try{a.data=BigInt(a.data)}catch{return this._getInvalidInput(a)}if(this._getType(a)!==Ce.bigint)return this._getInvalidInput(a);let r;const c=new _a;for(const f of this._def.checks)f.kind==="min"?(f.inclusive?a.data<f.value:a.data<=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.too_small,type:"bigint",minimum:f.value,inclusive:f.inclusive,message:f.message}),c.dirty()):f.kind==="max"?(f.inclusive?a.data>f.value:a.data>=f.value)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.too_big,type:"bigint",maximum:f.value,inclusive:f.inclusive,message:f.message}),c.dirty()):f.kind==="multipleOf"?a.data%f.value!==BigInt(0)&&(r=this._getOrReturnCtx(a,r),Ne(r,{code:ee.not_multiple_of,multipleOf:f.value,message:f.message}),c.dirty()):gt.assertNever(f);return{status:c.value,value:a.data}}_getInvalidInput(a){const i=this._getOrReturnCtx(a);return Ne(i,{code:ee.invalid_type,expected:Ce.bigint,received:i.parsedType}),He}gte(a,i){return this.setLimit("min",a,!0,Le.toString(i))}gt(a,i){return this.setLimit("min",a,!1,Le.toString(i))}lte(a,i){return this.setLimit("max",a,!0,Le.toString(i))}lt(a,i){return this.setLimit("max",a,!1,Le.toString(i))}setLimit(a,i,r,c){return new Ko({...this._def,checks:[...this._def.checks,{kind:a,value:i,inclusive:r,message:Le.toString(c)}]})}_addCheck(a){return new Ko({...this._def,checks:[...this._def.checks,a]})}positive(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Le.toString(a)})}negative(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Le.toString(a)})}nonpositive(a){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Le.toString(a)})}nonnegative(a){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Le.toString(a)})}multipleOf(a,i){return this._addCheck({kind:"multipleOf",value:a,message:Le.toString(i)})}get minValue(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a}get maxValue(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a}}Ko.create=t=>new Ko({checks:[],typeName:Ve.ZodBigInt,coerce:t?.coerce??!1,...et(t)});class Rh extends ft{_parse(a){if(this._def.coerce&&(a.data=!!a.data),this._getType(a)!==Ce.boolean){const r=this._getOrReturnCtx(a);return Ne(r,{code:ee.invalid_type,expected:Ce.boolean,received:r.parsedType}),He}return Da(a.data)}}Rh.create=t=>new Rh({typeName:Ve.ZodBoolean,coerce:t?.coerce||!1,...et(t)});class Qu extends ft{_parse(a){if(this._def.coerce&&(a.data=new Date(a.data)),this._getType(a)!==Ce.date){const f=this._getOrReturnCtx(a);return Ne(f,{code:ee.invalid_type,expected:Ce.date,received:f.parsedType}),He}if(Number.isNaN(a.data.getTime())){const f=this._getOrReturnCtx(a);return Ne(f,{code:ee.invalid_date}),He}const r=new _a;let c;for(const f of this._def.checks)f.kind==="min"?a.data.getTime()<f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.too_small,message:f.message,inclusive:!0,exact:!1,minimum:f.value,type:"date"}),r.dirty()):f.kind==="max"?a.data.getTime()>f.value&&(c=this._getOrReturnCtx(a,c),Ne(c,{code:ee.too_big,message:f.message,inclusive:!0,exact:!1,maximum:f.value,type:"date"}),r.dirty()):gt.assertNever(f);return{status:r.value,value:new Date(a.data.getTime())}}_addCheck(a){return new Qu({...this._def,checks:[...this._def.checks,a]})}min(a,i){return this._addCheck({kind:"min",value:a.getTime(),message:Le.toString(i)})}max(a,i){return this._addCheck({kind:"max",value:a.getTime(),message:Le.toString(i)})}get minDate(){let a=null;for(const i of this._def.checks)i.kind==="min"&&(a===null||i.value>a)&&(a=i.value);return a!=null?new Date(a):null}get maxDate(){let a=null;for(const i of this._def.checks)i.kind==="max"&&(a===null||i.value<a)&&(a=i.value);return a!=null?new Date(a):null}}Qu.create=t=>new Qu({checks:[],coerce:t?.coerce||!1,typeName:Ve.ZodDate,...et(t)});class gb extends ft{_parse(a){if(this._getType(a)!==Ce.symbol){const r=this._getOrReturnCtx(a);return Ne(r,{code:ee.invalid_type,expected:Ce.symbol,received:r.parsedType}),He}return Da(a.data)}}gb.create=t=>new gb({typeName:Ve.ZodSymbol,...et(t)});class Eh extends ft{_parse(a){if(this._getType(a)!==Ce.undefined){const r=this._getOrReturnCtx(a);return Ne(r,{code:ee.invalid_type,expected:Ce.undefined,received:r.parsedType}),He}return Da(a.data)}}Eh.create=t=>new Eh({typeName:Ve.ZodUndefined,...et(t)});class Th extends ft{_parse(a){if(this._getType(a)!==Ce.null){const r=this._getOrReturnCtx(a);return Ne(r,{code:ee.invalid_type,expected:Ce.null,received:r.parsedType}),He}return Da(a.data)}}Th.create=t=>new Th({typeName:Ve.ZodNull,...et(t)});class _b extends ft{constructor(){super(...arguments),this._any=!0}_parse(a){return Da(a.data)}}_b.create=t=>new _b({typeName:Ve.ZodAny,...et(t)});class vb extends ft{constructor(){super(...arguments),this._unknown=!0}_parse(a){return Da(a.data)}}vb.create=t=>new vb({typeName:Ve.ZodUnknown,...et(t)});class Ul extends ft{_parse(a){const i=this._getOrReturnCtx(a);return Ne(i,{code:ee.invalid_type,expected:Ce.never,received:i.parsedType}),He}}Ul.create=t=>new Ul({typeName:Ve.ZodNever,...et(t)});class bb extends ft{_parse(a){if(this._getType(a)!==Ce.undefined){const r=this._getOrReturnCtx(a);return Ne(r,{code:ee.invalid_type,expected:Ce.void,received:r.parsedType}),He}return Da(a.data)}}bb.create=t=>new bb({typeName:Ve.ZodVoid,...et(t)});class hs extends ft{_parse(a){const{ctx:i,status:r}=this._processInputParams(a),c=this._def;if(i.parsedType!==Ce.array)return Ne(i,{code:ee.invalid_type,expected:Ce.array,received:i.parsedType}),He;if(c.exactLength!==null){const p=i.data.length>c.exactLength.value,h=i.data.length<c.exactLength.value;(p||h)&&(Ne(i,{code:p?ee.too_big:ee.too_small,minimum:h?c.exactLength.value:void 0,maximum:p?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),r.dirty())}if(c.minLength!==null&&i.data.length<c.minLength.value&&(Ne(i,{code:ee.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),r.dirty()),c.maxLength!==null&&i.data.length>c.maxLength.value&&(Ne(i,{code:ee.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),r.dirty()),i.common.async)return Promise.all([...i.data].map((p,h)=>c.type._parseAsync(new ql(i,p,i.path,h)))).then(p=>_a.mergeArray(r,p));const f=[...i.data].map((p,h)=>c.type._parseSync(new ql(i,p,i.path,h)));return _a.mergeArray(r,f)}get element(){return this._def.type}min(a,i){return new hs({...this._def,minLength:{value:a,message:Le.toString(i)}})}max(a,i){return new hs({...this._def,maxLength:{value:a,message:Le.toString(i)}})}length(a,i){return new hs({...this._def,exactLength:{value:a,message:Le.toString(i)}})}nonempty(a){return this.min(1,a)}}hs.create=(t,a)=>new hs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ve.ZodArray,...et(a)});function br(t){if(t instanceof hn){const a={};for(const i in t.shape){const r=t.shape[i];a[i]=Zs.create(br(r))}return new hn({...t._def,shape:()=>a})}else return t instanceof hs?new hs({...t._def,type:br(t.element)}):t instanceof Zs?Zs.create(br(t.unwrap())):t instanceof _i?_i.create(br(t.unwrap())):t instanceof hi?hi.create(t.items.map(a=>br(a))):t}class hn extends ft{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const a=this._def.shape(),i=gt.objectKeys(a);return this._cached={shape:a,keys:i},this._cached}_parse(a){if(this._getType(a)!==Ce.object){const m=this._getOrReturnCtx(a);return Ne(m,{code:ee.invalid_type,expected:Ce.object,received:m.parsedType}),He}const{status:r,ctx:c}=this._processInputParams(a),{shape:f,keys:p}=this._getCached(),h=[];if(!(this._def.catchall instanceof Ul&&this._def.unknownKeys==="strip"))for(const m in c.data)p.includes(m)||h.push(m);const v=[];for(const m of p){const x=f[m],y=c.data[m];v.push({key:{status:"valid",value:m},value:x._parse(new ql(c,y,c.path,m)),alwaysSet:m in c.data})}if(this._def.catchall instanceof Ul){const m=this._def.unknownKeys;if(m==="passthrough")for(const x of h)v.push({key:{status:"valid",value:x},value:{status:"valid",value:c.data[x]}});else if(m==="strict")h.length>0&&(Ne(c,{code:ee.unrecognized_keys,keys:h}),r.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const x of h){const y=c.data[x];v.push({key:{status:"valid",value:x},value:m._parse(new ql(c,y,c.path,x)),alwaysSet:x in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const m=[];for(const x of v){const y=await x.key,A=await x.value;m.push({key:y,value:A,alwaysSet:x.alwaysSet})}return m}).then(m=>_a.mergeObjectSync(r,m)):_a.mergeObjectSync(r,v)}get shape(){return this._def.shape()}strict(a){return Le.errToObj,new hn({...this._def,unknownKeys:"strict",...a!==void 0?{errorMap:(i,r)=>{const c=this._def.errorMap?.(i,r).message??r.defaultError;return i.code==="unrecognized_keys"?{message:Le.errToObj(a).message??c}:{message:c}}}:{}})}strip(){return new hn({...this._def,unknownKeys:"strip"})}passthrough(){return new hn({...this._def,unknownKeys:"passthrough"})}extend(a){return new hn({...this._def,shape:()=>({...this._def.shape(),...a})})}merge(a){return new hn({unknownKeys:a._def.unknownKeys,catchall:a._def.catchall,shape:()=>({...this._def.shape(),...a._def.shape()}),typeName:Ve.ZodObject})}setKey(a,i){return this.augment({[a]:i})}catchall(a){return new hn({...this._def,catchall:a})}pick(a){const i={};for(const r of gt.objectKeys(a))a[r]&&this.shape[r]&&(i[r]=this.shape[r]);return new hn({...this._def,shape:()=>i})}omit(a){const i={};for(const r of gt.objectKeys(this.shape))a[r]||(i[r]=this.shape[r]);return new hn({...this._def,shape:()=>i})}deepPartial(){return br(this)}partial(a){const i={};for(const r of gt.objectKeys(this.shape)){const c=this.shape[r];a&&!a[r]?i[r]=c:i[r]=c.optional()}return new hn({...this._def,shape:()=>i})}required(a){const i={};for(const r of gt.objectKeys(this.shape))if(a&&!a[r])i[r]=this.shape[r];else{let f=this.shape[r];for(;f instanceof Zs;)f=f._def.innerType;i[r]=f}return new hn({...this._def,shape:()=>i})}keyof(){return Tx(gt.objectKeys(this.shape))}}hn.create=(t,a)=>new hn({shape:()=>t,unknownKeys:"strip",catchall:Ul.create(),typeName:Ve.ZodObject,...et(a)});hn.strictCreate=(t,a)=>new hn({shape:()=>t,unknownKeys:"strict",catchall:Ul.create(),typeName:Ve.ZodObject,...et(a)});hn.lazycreate=(t,a)=>new hn({shape:t,unknownKeys:"strip",catchall:Ul.create(),typeName:Ve.ZodObject,...et(a)});class Ju extends ft{_parse(a){const{ctx:i}=this._processInputParams(a),r=this._def.options;function c(f){for(const h of f)if(h.result.status==="valid")return h.result;for(const h of f)if(h.result.status==="dirty")return i.common.issues.push(...h.ctx.common.issues),h.result;const p=f.map(h=>new Qs(h.ctx.common.issues));return Ne(i,{code:ee.invalid_union,unionErrors:p}),He}if(i.common.async)return Promise.all(r.map(async f=>{const p={...i,common:{...i.common,issues:[]},parent:null};return{result:await f._parseAsync({data:i.data,path:i.path,parent:p}),ctx:p}})).then(c);{let f;const p=[];for(const v of r){const m={...i,common:{...i.common,issues:[]},parent:null},x=v._parseSync({data:i.data,path:i.path,parent:m});if(x.status==="valid")return x;x.status==="dirty"&&!f&&(f={result:x,ctx:m}),m.common.issues.length&&p.push(m.common.issues)}if(f)return i.common.issues.push(...f.ctx.common.issues),f.result;const h=p.map(v=>new Qs(v));return Ne(i,{code:ee.invalid_union,unionErrors:h}),He}}get options(){return this._def.options}}Ju.create=(t,a)=>new Ju({options:t,typeName:Ve.ZodUnion,...et(a)});const Gs=t=>t instanceof Oh?Gs(t.schema):t instanceof gi?Gs(t.innerType()):t instanceof ed?[t.value]:t instanceof mi?t.options:t instanceof $h?gt.objectValues(t.enum):t instanceof nd?Gs(t._def.innerType):t instanceof Eh?[void 0]:t instanceof Th?[null]:t instanceof Zs?[void 0,...Gs(t.unwrap())]:t instanceof _i?[null,...Gs(t.unwrap())]:t instanceof Cx||t instanceof sd?Gs(t.unwrap()):t instanceof ad?Gs(t._def.innerType):[];class Qh extends ft{_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==Ce.object)return Ne(i,{code:ee.invalid_type,expected:Ce.object,received:i.parsedType}),He;const r=this.discriminator,c=i.data[r],f=this.optionsMap.get(c);return f?i.common.async?f._parseAsync({data:i.data,path:i.path,parent:i}):f._parseSync({data:i.data,path:i.path,parent:i}):(Ne(i,{code:ee.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),He)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(a,i,r){const c=new Map;for(const f of i){const p=Gs(f.shape[a]);if(!p.length)throw new Error(`A discriminator value for key \`${a}\` could not be extracted from all schema options`);for(const h of p){if(c.has(h))throw new Error(`Discriminator property ${String(a)} has duplicate value ${String(h)}`);c.set(h,f)}}return new Qh({typeName:Ve.ZodDiscriminatedUnion,discriminator:a,options:i,optionsMap:c,...et(r)})}}function Ch(t,a){const i=Tl(t),r=Tl(a);if(t===a)return{valid:!0,data:t};if(i===Ce.object&&r===Ce.object){const c=gt.objectKeys(a),f=gt.objectKeys(t).filter(h=>c.indexOf(h)!==-1),p={...t,...a};for(const h of f){const v=Ch(t[h],a[h]);if(!v.valid)return{valid:!1};p[h]=v.data}return{valid:!0,data:p}}else if(i===Ce.array&&r===Ce.array){if(t.length!==a.length)return{valid:!1};const c=[];for(let f=0;f<t.length;f++){const p=t[f],h=a[f],v=Ch(p,h);if(!v.valid)return{valid:!1};c.push(v.data)}return{valid:!0,data:c}}else return i===Ce.date&&r===Ce.date&&+t==+a?{valid:!0,data:t}:{valid:!1}}class Wu extends ft{_parse(a){const{status:i,ctx:r}=this._processInputParams(a),c=(f,p)=>{if(pb(f)||pb(p))return He;const h=Ch(f.value,p.value);return h.valid?((hb(f)||hb(p))&&i.dirty(),{status:i.value,value:h.data}):(Ne(r,{code:ee.invalid_intersection_types}),He)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([f,p])=>c(f,p)):c(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Wu.create=(t,a,i)=>new Wu({left:t,right:a,typeName:Ve.ZodIntersection,...et(i)});class hi extends ft{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==Ce.array)return Ne(r,{code:ee.invalid_type,expected:Ce.array,received:r.parsedType}),He;if(r.data.length<this._def.items.length)return Ne(r,{code:ee.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),He;!this._def.rest&&r.data.length>this._def.items.length&&(Ne(r,{code:ee.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const f=[...r.data].map((p,h)=>{const v=this._def.items[h]||this._def.rest;return v?v._parse(new ql(r,p,r.path,h)):null}).filter(p=>!!p);return r.common.async?Promise.all(f).then(p=>_a.mergeArray(i,p)):_a.mergeArray(i,f)}get items(){return this._def.items}rest(a){return new hi({...this._def,rest:a})}}hi.create=(t,a)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hi({items:t,typeName:Ve.ZodTuple,rest:null,...et(a)})};class yb extends ft{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==Ce.map)return Ne(r,{code:ee.invalid_type,expected:Ce.map,received:r.parsedType}),He;const c=this._def.keyType,f=this._def.valueType,p=[...r.data.entries()].map(([h,v],m)=>({key:c._parse(new ql(r,h,r.path,[m,"key"])),value:f._parse(new ql(r,v,r.path,[m,"value"]))}));if(r.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const v of p){const m=await v.key,x=await v.value;if(m.status==="aborted"||x.status==="aborted")return He;(m.status==="dirty"||x.status==="dirty")&&i.dirty(),h.set(m.value,x.value)}return{status:i.value,value:h}})}else{const h=new Map;for(const v of p){const m=v.key,x=v.value;if(m.status==="aborted"||x.status==="aborted")return He;(m.status==="dirty"||x.status==="dirty")&&i.dirty(),h.set(m.value,x.value)}return{status:i.value,value:h}}}}yb.create=(t,a,i)=>new yb({valueType:a,keyType:t,typeName:Ve.ZodMap,...et(i)});class Zo extends ft{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.parsedType!==Ce.set)return Ne(r,{code:ee.invalid_type,expected:Ce.set,received:r.parsedType}),He;const c=this._def;c.minSize!==null&&r.data.size<c.minSize.value&&(Ne(r,{code:ee.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),i.dirty()),c.maxSize!==null&&r.data.size>c.maxSize.value&&(Ne(r,{code:ee.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),i.dirty());const f=this._def.valueType;function p(v){const m=new Set;for(const x of v){if(x.status==="aborted")return He;x.status==="dirty"&&i.dirty(),m.add(x.value)}return{status:i.value,value:m}}const h=[...r.data.values()].map((v,m)=>f._parse(new ql(r,v,r.path,m)));return r.common.async?Promise.all(h).then(v=>p(v)):p(h)}min(a,i){return new Zo({...this._def,minSize:{value:a,message:Le.toString(i)}})}max(a,i){return new Zo({...this._def,maxSize:{value:a,message:Le.toString(i)}})}size(a,i){return this.min(a,i).max(a,i)}nonempty(a){return this.min(1,a)}}Zo.create=(t,a)=>new Zo({valueType:t,minSize:null,maxSize:null,typeName:Ve.ZodSet,...et(a)});class Oh extends ft{get schema(){return this._def.getter()}_parse(a){const{ctx:i}=this._processInputParams(a);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Oh.create=(t,a)=>new Oh({getter:t,typeName:Ve.ZodLazy,...et(a)});class ed extends ft{_parse(a){if(a.data!==this._def.value){const i=this._getOrReturnCtx(a);return Ne(i,{received:i.data,code:ee.invalid_literal,expected:this._def.value}),He}return{status:"valid",value:a.data}}get value(){return this._def.value}}ed.create=(t,a)=>new ed({value:t,typeName:Ve.ZodLiteral,...et(a)});function Tx(t,a){return new mi({values:t,typeName:Ve.ZodEnum,...et(a)})}class mi extends ft{_parse(a){if(typeof a.data!="string"){const i=this._getOrReturnCtx(a),r=this._def.values;return Ne(i,{expected:gt.joinValues(r),received:i.parsedType,code:ee.invalid_type}),He}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(a.data)){const i=this._getOrReturnCtx(a),r=this._def.values;return Ne(i,{received:i.data,code:ee.invalid_enum_value,options:r}),He}return Da(a.data)}get options(){return this._def.values}get enum(){const a={};for(const i of this._def.values)a[i]=i;return a}get Values(){const a={};for(const i of this._def.values)a[i]=i;return a}get Enum(){const a={};for(const i of this._def.values)a[i]=i;return a}extract(a,i=this._def){return mi.create(a,{...this._def,...i})}exclude(a,i=this._def){return mi.create(this.options.filter(r=>!a.includes(r)),{...this._def,...i})}}mi.create=Tx;class $h extends ft{_parse(a){const i=gt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(a);if(r.parsedType!==Ce.string&&r.parsedType!==Ce.number){const c=gt.objectValues(i);return Ne(r,{expected:gt.joinValues(c),received:r.parsedType,code:ee.invalid_type}),He}if(this._cache||(this._cache=new Set(gt.getValidEnumValues(this._def.values))),!this._cache.has(a.data)){const c=gt.objectValues(i);return Ne(r,{received:r.data,code:ee.invalid_enum_value,options:c}),He}return Da(a.data)}get enum(){return this._def.values}}$h.create=(t,a)=>new $h({values:t,typeName:Ve.ZodNativeEnum,...et(a)});class td extends ft{unwrap(){return this._def.type}_parse(a){const{ctx:i}=this._processInputParams(a);if(i.parsedType!==Ce.promise&&i.common.async===!1)return Ne(i,{code:ee.invalid_type,expected:Ce.promise,received:i.parsedType}),He;const r=i.parsedType===Ce.promise?i.data:Promise.resolve(i.data);return Da(r.then(c=>this._def.type.parseAsync(c,{path:i.path,errorMap:i.common.contextualErrorMap})))}}td.create=(t,a)=>new td({type:t,typeName:Ve.ZodPromise,...et(a)});class gi extends ft{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ve.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(a){const{status:i,ctx:r}=this._processInputParams(a),c=this._def.effect||null,f={addIssue:p=>{Ne(r,p),p.fatal?i.abort():i.dirty()},get path(){return r.path}};if(f.addIssue=f.addIssue.bind(f),c.type==="preprocess"){const p=c.transform(r.data,f);if(r.common.async)return Promise.resolve(p).then(async h=>{if(i.value==="aborted")return He;const v=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return v.status==="aborted"?He:v.status==="dirty"||i.value==="dirty"?Lo(v.value):v});{if(i.value==="aborted")return He;const h=this._def.schema._parseSync({data:p,path:r.path,parent:r});return h.status==="aborted"?He:h.status==="dirty"||i.value==="dirty"?Lo(h.value):h}}if(c.type==="refinement"){const p=h=>{const v=c.refinement(h,f);if(r.common.async)return Promise.resolve(v);if(v instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){const h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?He:(h.status==="dirty"&&i.dirty(),p(h.value),{status:i.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?He:(h.status==="dirty"&&i.dirty(),p(h.value).then(()=>({status:i.value,value:h.value}))))}if(c.type==="transform")if(r.common.async===!1){const p=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Er(p))return He;const h=c.transform(p.value,f);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(p=>Er(p)?Promise.resolve(c.transform(p.value,f)).then(h=>({status:i.value,value:h})):He);gt.assertNever(c)}}gi.create=(t,a,i)=>new gi({schema:t,typeName:Ve.ZodEffects,effect:a,...et(i)});gi.createWithPreprocess=(t,a,i)=>new gi({schema:a,effect:{type:"preprocess",transform:t},typeName:Ve.ZodEffects,...et(i)});class Zs extends ft{_parse(a){return this._getType(a)===Ce.undefined?Da(void 0):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}Zs.create=(t,a)=>new Zs({innerType:t,typeName:Ve.ZodOptional,...et(a)});class _i extends ft{_parse(a){return this._getType(a)===Ce.null?Da(null):this._def.innerType._parse(a)}unwrap(){return this._def.innerType}}_i.create=(t,a)=>new _i({innerType:t,typeName:Ve.ZodNullable,...et(a)});class nd extends ft{_parse(a){const{ctx:i}=this._processInputParams(a);let r=i.data;return i.parsedType===Ce.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}nd.create=(t,a)=>new nd({innerType:t,typeName:Ve.ZodDefault,defaultValue:typeof a.default=="function"?a.default:()=>a.default,...et(a)});class ad extends ft{_parse(a){const{ctx:i}=this._processInputParams(a),r={...i,common:{...i.common,issues:[]}},c=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Pu(c)?c.then(f=>({status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new Qs(r.common.issues)},input:r.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Qs(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ad.create=(t,a)=>new ad({innerType:t,typeName:Ve.ZodCatch,catchValue:typeof a.catch=="function"?a.catch:()=>a.catch,...et(a)});class xb extends ft{_parse(a){if(this._getType(a)!==Ce.nan){const r=this._getOrReturnCtx(a);return Ne(r,{code:ee.invalid_type,expected:Ce.nan,received:r.parsedType}),He}return{status:"valid",value:a.data}}}xb.create=t=>new xb({typeName:Ve.ZodNaN,...et(t)});class Cx extends ft{_parse(a){const{ctx:i}=this._processInputParams(a),r=i.data;return this._def.type._parse({data:r,path:i.path,parent:i})}unwrap(){return this._def.type}}class Jh extends ft{_parse(a){const{status:i,ctx:r}=this._processInputParams(a);if(r.common.async)return(async()=>{const f=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return f.status==="aborted"?He:f.status==="dirty"?(i.dirty(),Lo(f.value)):this._def.out._parseAsync({data:f.value,path:r.path,parent:r})})();{const c=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?He:c.status==="dirty"?(i.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:r.path,parent:r})}}static create(a,i){return new Jh({in:a,out:i,typeName:Ve.ZodPipeline})}}class sd extends ft{_parse(a){const i=this._def.innerType._parse(a),r=c=>(Er(c)&&(c.value=Object.freeze(c.value)),c);return Pu(i)?i.then(c=>r(c)):r(i)}unwrap(){return this._def.innerType}}sd.create=(t,a)=>new sd({innerType:t,typeName:Ve.ZodReadonly,...et(a)});var Ve;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ve||(Ve={}));const wt=Ml.create,Ws=Tr.create,Ox=Rh.create;Ul.create;const Zn=hs.create,Ke=hn.create,ek=Ju.create,$x=Qh.create;Wu.create;hi.create;const it=ed.create,dt=mi.create;td.create;Zs.create;_i.create;const Kn=wt().min(1).max(128).regex(/^[A-Za-z0-9_-]+$/),Wh=wt().min(16).max(128).regex(/^[A-Za-z0-9_-]+$/),Mx=Ws().int().min(1).max(1e6),tk=Ws().int().min(0).max(Number.MAX_SAFE_INTEGER-1),Kp=Ws().int().min(0).max(Number.MAX_SAFE_INTEGER),bu=Ws().int().min(0).max(Number.MAX_SAFE_INTEGER),Ix=Ke({laneId:wt().min(1).max(160).regex(/^[A-Za-z0-9_:-]+$/)}).strict(),nk=Ke({family:it("workflow"),runId:wt().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/),runGeneration:Wh,stageId:Kn.optional(),callId:Kn.optional(),attempt:Mx.optional()}).strict().superRefine((t,a)=>{t.callId!==void 0&&t.stageId===void 0&&a.addIssue({code:ee.custom,message:"call requires stage"}),t.attempt!==void 0&&t.callId===void 0&&a.addIssue({code:ee.custom,message:"attempt requires call"})}),ak=Ke({family:it("activity"),activityId:Kn,activityGeneration:Wh,sessionId:Kn.optional(),threadId:Kn.optional(),turnId:Kn.optional()}).strict().superRefine((t,a)=>{t.sessionId!==void 0&&t.sessionId!==t.activityId&&a.addIssue({code:ee.custom,message:"session mismatch"}),t.threadId!==void 0&&t.sessionId===void 0&&a.addIssue({code:ee.custom,message:"thread requires session"}),t.turnId!==void 0&&t.threadId===void 0&&a.addIssue({code:ee.custom,message:"turn requires thread"})}),sk=Ke({family:it("context"),contextRunId:wt().max(40).refine(t=>{if(!/^ctxop_\d{8}T\d{6}Z_[0-9a-f]{12}$/.test(t))return!1;const a=t.slice(6,22),i=[a.slice(0,4),"-",a.slice(4,6),"-",a.slice(6,8),"T",a.slice(9,11),":",a.slice(11,13),":",a.slice(13,15),".000Z"].join(""),r=new Date(i);return!Number.isNaN(r.getTime())&&r.toISOString()===i}),contextGeneration:Wh,executor:dt(["curator","finalizer"]).optional(),executionId:Kn.optional(),attempt:Mx.optional()}).strict().superRefine((t,a)=>{t.executionId!==void 0&&t.executor===void 0&&a.addIssue({code:ee.custom,message:"execution requires executor"}),t.attempt!==void 0&&t.executionId===void 0&&a.addIssue({code:ee.custom,message:"attempt requires execution"})}),Lx=ek([nk,ak,sk]),mr=wt().max(4096),lk=Ke({content:wt().max(32768).refine(t=>new TextEncoder().encode(t).byteLength<=32768),omission:dt(["none","size_limit","structure_limit","invalid"])}).strict().superRefine((t,a)=>{if(t.omission!=="none"){t.content!==""&&a.addIssue({code:ee.custom,message:"omitted arguments contain content"});return}try{JSON.parse(t.content)}catch{a.addIssue({code:ee.custom,message:"arguments are not JSON"})}}),ik=$x("kind",[Ke({kind:it("user"),content:wt().max(32768)}).strict(),Ke({kind:it("assistant"),content:wt().max(32768)}).strict(),Ke({kind:it("tool_call"),toolName:Kn,callId:Kn,summary:mr,arguments:lk.optional()}).strict(),Ke({kind:it("tool_result"),toolName:Kn,callId:Kn,outcome:dt(["succeeded","failed","cancelled"]),summary:mr}).strict(),Ke({kind:it("approval_request"),approvalId:Kn,action:mr,risk:dt(["low","medium","high"])}).strict(),Ke({kind:it("approval_resolution"),approvalId:Kn,decision:dt(["approved","denied","cancelled"])}).strict(),Ke({kind:it("error"),code:Kn,message:mr,retryable:Ox()}).strict(),Ke({kind:it("lifecycle"),state:dt(["pending","queued","resolving","running","parsing","awaiting_approval","succeeded","partial","failed","cancelled","interrupted","timeout","completed"])}).strict(),Ke({kind:it("usage"),completeness:dt(["complete","partial","unknown"]),inputTokens:bu.nullable(),outputTokens:bu.nullable(),cachedInputTokens:bu.nullable(),reasoningTokens:bu.nullable()}).strict(),Ke({kind:it("reasoning"),summary:mr}).strict(),Ke({kind:it("unknown"),originalKind:Kn,summary:mr,forwardCaptured:it(!0)}).strict()]).superRefine((t,a)=>{if(t.kind!=="usage")return;const i=[t.inputTokens,t.outputTokens,t.cachedInputTokens,t.reasoningTokens],r=i.filter(c=>c!==null).length;t.completeness==="unknown"&&r!==0?a.addIssue({code:ee.custom,message:"unknown usage has counters"}):t.completeness==="complete"&&(t.inputTokens===null||t.outputTokens===null)?a.addIssue({code:ee.custom,message:"complete usage lacks totals"}):t.completeness==="partial"&&(r===0||r===i.length)&&a.addIssue({code:ee.custom,message:"partial usage is not partial"})}),rk=dt(["unknown_event_type","provider_payload_omitted","malformed_field_omitted","unsupported_field_omitted","content_truncated","corrupt_capture"]);function ok(t){if(t.family==="workflow"&&t.attempt!==void 0)return`attempt:${String(t.attempt)}`;if(t.family==="activity"&&t.turnId!==void 0)return`turn:${t.turnId}`;if(t.family==="context"&&t.executionId!==void 0&&t.attempt!==void 0)return`execution:${t.executionId}:${String(t.attempt)}`}const Dx=Ke({schemaVersion:it("session-log-v1"),sequence:tk,timestamp:wt().max(64).datetime({offset:!0}),producerFamily:dt(["workflow","activity","context"]),owner:Lx,lane:Ix,authority:it("observability_only"),redaction:Ke({ran:it(!0),status:dt(["no_matches","redacted"]),count:Ws().int().min(0).max(1e4),coverage:it("pattern_best_effort").optional()}).strict(),truncation:dt(["none","head","tail","middle"]),completeness:dt(["complete","partial","unknown"]),parseWarnings:Zn(rk).max(8).refine(t=>new Set(t).size===t.length),event:ik}).strict().superRefine((t,a)=>{t.producerFamily!==t.owner.family&&a.addIssue({code:ee.custom,message:"producer mismatch"}),ok(t.owner)!==t.lane.laneId&&a.addIssue({code:ee.custom,message:"lane mismatch"}),(t.redaction.status==="no_matches"&&t.redaction.count!==0||t.redaction.status==="redacted"&&t.redaction.count===0)&&a.addIssue({code:ee.custom,message:"redaction mismatch"}),t.event.kind==="tool_call"&&t.event.arguments!==void 0&&t.event.arguments.omission!=="none"&&(t.completeness!=="partial"||!t.parseWarnings.includes("provider_payload_omitted"))&&a.addIssue({code:ee.custom,message:"omitted arguments require loss metadata"});const i=t.parseWarnings.includes("content_truncated"),r=t.parseWarnings.some(c=>["malformed_field_omitted","unsupported_field_omitted","content_truncated","corrupt_capture"].includes(c));t.truncation==="none"&&i&&a.addIssue({code:ee.custom,message:"unexpected truncation warning"}),t.truncation!=="none"&&!i&&a.addIssue({code:ee.custom,message:"missing truncation warning"}),t.truncation!=="none"&&t.completeness!=="partial"&&a.addIssue({code:ee.custom,message:"truncation completeness mismatch"}),t.completeness==="complete"&&r&&a.addIssue({code:ee.custom,message:"complete event claims loss"})}),ck=dt(["retention_gap","truncated","incomplete_capture","parse_warning","corrupt_capture"]),uk=$x("availability",[Ke({availability:it("available")}).strict(),Ke({availability:it("degraded"),reasons:Zn(ck).min(1).max(5).refine(t=>new Set(t).size===t.length)}).strict(),Ke({availability:it("not_retained"),reason:dt(["retention_disabled","retention_expired","producer_did_not_retain"])}).strict(),Ke({availability:it("not_executed"),reason:dt(["not_requested","disabled","skipped","cancelled_before_start"])}).strict(),Ke({availability:it("pruned"),reason:dt(["retention_limit","age_limit","size_limit","event_limit","operator_request"])}).strict()]),dk=Ke({schemaVersion:it("session-log-v1"),owner:Lx,lane:Ix,availability:uk,requestedSequence:Kp,floorSequence:Kp,nextSequence:Kp,truncated:Ox(),events:Zn(Dx).max(500)}).strict().superRefine((t,a)=>{t.truncated!==t.requestedSequence<t.floorSequence&&a.addIssue({code:ee.custom,message:"truncation mismatch"});const i=JSON.stringify(t.owner),r=Math.max(t.requestedSequence,t.floorSequence),c=new Set;t.truncated&&c.add("retention_gap");let f;for(const h of t.events){if(JSON.stringify(h.owner)!==i||h.lane.laneId!==t.lane.laneId||h.sequence<r||f!==void 0&&h.sequence<=f){a.addIssue({code:ee.custom,message:"event page mismatch"});break}f=h.sequence,h.truncation!=="none"&&c.add("truncated"),h.completeness!=="complete"&&c.add("incomplete_capture"),h.parseWarnings.some(v=>v==="malformed_field_omitted"||v==="unsupported_field_omitted")&&c.add("parse_warning"),h.parseWarnings.includes("corrupt_capture")&&c.add("corrupt_capture")}const p=f===void 0?r:f+1;if(t.nextSequence!==p&&a.addIssue({code:ee.custom,message:"cursor mismatch"}),t.availability.availability==="available")c.size!==0&&a.addIssue({code:ee.custom,message:"available page claims loss"});else if(t.availability.availability==="degraded"){const h=new Set(t.availability.reasons);(h.size!==c.size||[...c].some(v=>!h.has(v)))&&a.addIssue({code:ee.custom,message:"degraded loss mismatch"})}else(t.events.length!==0||c.size!==0)&&a.addIssue({code:ee.custom,message:"unavailable page claims data or loss"})});function fk(t){return Dx.parse(t)}function pk(t){return dk.parse(t)}const zx=new Set(["run_generation_changed","activity_generation_changed","context_generation_changed"]),hk=new Set([...zx,"agent_instance_changed","session_logs_unavailable","not_found"]);class xt extends Error{kind;status;code;constructor(a,i,r){super(a),this.name="SessionLogApiError",this.kind=a,this.status=i,this.code=r}}function jb(t){return t??new AbortController().signal}function wb(t){return t.family==="workflow"?{path:["/api/runs/",encodeURIComponent(t.runId),"/stages/",encodeURIComponent(t.stageId),"/calls/",encodeURIComponent(t.callId),"/session-logs"].join(""),generation:t.runGeneration}:t.family==="activity"?{path:`/api/activities/${encodeURIComponent(t.activityId)}/session-logs`,generation:t.activityGeneration}:"runId"in t&&"runGeneration"in t?{path:`/api/runs/${encodeURIComponent(t.runId)}/context-preflight/session-logs`,generation:t.runGeneration}:{path:`/api/context-runs/${encodeURIComponent(t.contextRunId)}/session-logs`,generation:t.contextGeneration}}function di(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0}function mk(t){const a=di(t),r=di(a?.error)?.code;return typeof r=="string"&&hk.has(r)?r:void 0}function ld(t,a){const i=Object.keys(t).sort(),r=[...a].sort();return i.length===r.length&&i.every((c,f)=>c===r[f])}function qx(t,a){return t.family!==a.family?!1:t.family==="workflow"&&a.family==="workflow"?t.runId===a.runId&&t.stageId===a.stageId&&t.callId===a.callId&&t.attempt!==void 0:t.family==="activity"&&a.family==="activity"?t.activityId===a.activityId&&t.turnId!==void 0:t.family==="context"&&a.family==="context"?t.contextRunId===a.contextRunId&&t.executor!==void 0&&t.executionId!==void 0&&t.attempt!==void 0:!1}function gk(t,a){const i=di(t),r=di(i?.lane);if(i===void 0||!ld(i,["owner","lane","nextSequence"])||r===void 0||!ld(r,["laneId"])||!Number.isSafeInteger(i.nextSequence)||i.nextSequence<0)throw new xt("request_error",502);try{const c=fk({schemaVersion:"session-log-v1",sequence:0,timestamp:"2000-01-01T00:00:00.000Z",producerFamily:di(i.owner)?.family,owner:i.owner,lane:i.lane,authority:"observability_only",redaction:{ran:!0,status:"no_matches",count:0},truncation:"none",completeness:"complete",parseWarnings:[],event:{kind:"lifecycle",state:"pending"}});if(!qx(c.owner,a))throw new xt("request_error",502);return Object.freeze({owner:c.owner,lane:c.lane,nextSequence:i.nextSequence})}catch(c){throw c instanceof xt?c:new xt("request_error",502)}}function _k(t,a){const i=di(t),r=di(i?.availability),c=i?.lanes,f=r?.availability==="available",p=r?.availability==="not_retained"&&r.reason==="producer_did_not_retain";if(i===void 0||!ld(i,["schemaVersion","availability","lanes"])||i?.schemaVersion!=="session-log-index-v1"||!f&&!p||r===void 0||!ld(r,f?["availability"]:["availability","reason"])||!Array.isArray(c)||c.length>2e3||f!==c.length>0)throw new xt("request_error",502);const h=c.map(m=>gk(m,a));if(new Set(h.map(({owner:m})=>m.family==="workflow"?m.runGeneration:m.family==="activity"?m.activityGeneration:m.contextGeneration)).size>1)throw new xt("request_error",502);return Object.freeze({schemaVersion:"session-log-index-v1",availability:Object.freeze(f?{availability:"available"}:{availability:"not_retained",reason:"producer_did_not_retain"}),lanes:Object.freeze(h)})}function vk(t,a,i){try{const r=pk(t);if(r.events.length>500||JSON.stringify(r.lane)!==JSON.stringify(i.lane)||JSON.stringify(r.owner)!==JSON.stringify(i.owner)||!qx(r.owner,a))throw new xt("request_error",502);return r}catch(r){throw r instanceof xt?r:new xt("request_error",502)}}async function Sb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof jt?new xt("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new xt("aborted"):new xt("offline")}if(r.status===401)throw new xt("auth_expired",401);if(!r.ok){let c;try{c=mk(await sa(r))}catch(f){if(f instanceof jt)throw new xt("connection_changed",409,"agent_instance_changed")}throw c!==void 0&&zx.has(c)?new xt("generation_changed",r.status,c):c==="agent_instance_changed"?new xt("connection_changed",r.status,c):c==="session_logs_unavailable"?new xt("unavailable",r.status,c):c==="not_found"?new xt("missing",r.status,c):new xt("request_error",r.status,c)}try{return await sa(r)}catch(c){throw c instanceof jt?new xt("connection_changed",409,"agent_instance_changed"):new xt("request_error",r.status)}}function Ux(t=ms){return Object.freeze({async listLanes(a,i){const r=wb(a),c=new URLSearchParams({generation:r.generation});return _k(await Sb(t,`${r.path}?${c.toString()}`,jb(i)),a)},async readPage(a,i,r,c){const f=wb(a),p=new URLSearchParams({generation:f.generation,sequence:String(r.sequence),limit:String(r.limit)});return vk(await Sb(t,`${f.path}/${encodeURIComponent(i.lane.laneId)}?${p.toString()}`,jb(c)),a,i)}})}const Nb=500,yu=200;class na extends Error{constructor(){super("session_log_protocol_error"),this.name="SessionLogProtocolError"}}function xu(t,a){return t<a?-1:t>a?1:0}function bk(t,a){if(t.owner.family==="workflow"&&a.owner.family==="workflow")return(t.owner.attempt??0)-(a.owner.attempt??0);if(t.owner.family==="activity"&&a.owner.family==="activity")return xu(t.owner.turnId??t.lane.laneId,a.owner.turnId??a.lane.laneId);if(t.owner.family==="context"&&a.owner.family==="context"){const i=xu(t.owner.executor??"",a.owner.executor??"");if(i!==0)return i;const r=xu(t.owner.executionId??t.lane.laneId,a.owner.executionId??a.lane.laneId);return r===0?(t.owner.attempt??0)-(a.owner.attempt??0):r}return xu(t.lane.laneId,a.lane.laneId)}function Mh(t,a){return t.family!==a.family?!1:t.family==="workflow"&&a.family==="workflow"?t.runId===a.runId&&t.stageId===a.stageId&&t.callId===a.callId:t.family==="activity"&&a.family==="activity"?t.activityId===a.activityId:t.family==="context"&&a.family==="context"&&t.contextRunId===a.contextRunId}function Zp(t,a){const i=t.owner,r=i.family==="workflow"&&i.attempt!==void 0?`attempt:${String(i.attempt)}`:i.family==="activity"&&i.turnId!==void 0?`turn:${i.turnId}`:i.family==="context"&&i.executionId!==void 0&&i.attempt!==void 0?`execution:${i.executionId}:${String(i.attempt)}`:void 0;return Mh(i,a)&&r===t.lane.laneId&&Number.isSafeInteger(t.nextSequence)&&t.nextSequence>=0}function ii(t,a){return JSON.stringify(t)===JSON.stringify(a)}function kb(t){const a=new Set;for(const i of t)if(i.availability.availability==="degraded")for(const r of i.availability.reasons)a.add(r);else if(i.availability.availability!=="available")return i.availability;return a.size===0?{availability:"available"}:{availability:"degraded",reasons:[...a]}}function yk(t){const a={async discover(i,r=null,c){const f=await t.listLanes(i,c),p=new Set(f.lanes.map(({lane:x})=>x.laneId)),h=new Set(f.lanes.map(({owner:x})=>x.family==="workflow"?x.runGeneration:x.family==="activity"?x.activityGeneration:x.contextGeneration));if(f.schemaVersion!=="session-log-index-v1"||f.lanes.some(x=>!Zp(x,i))||p.size!==f.lanes.length||h.size>1||f.availability.availability==="available"!=f.lanes.length>0)throw new na;const v=Object.freeze([...f.lanes].sort(bk)),m=v.find(({lane:x})=>x.laneId===r)??v[0]??null;return Object.freeze({index:f,lanes:v,selectedLane:m})},async loadLane(i,r,c){const f=c??new AbortController().signal;if(!Zp(r,i))throw new na;if(r.nextSequence===0)return Object.freeze({schemaVersion:"session-log-v1",owner:r.owner,lane:r.lane,availability:{availability:"available"},requestedSequence:0,floorSequence:0,nextSequence:0,truncated:!1,events:Object.freeze([])});const p=[],h=new Map;let v=0;for(let x=0;x<yu;x+=1){const y=await t.readPage(i,r,{sequence:v,limit:Nb},f);if(y.requestedSequence!==v||!ii(y.lane,r.lane)||!ii(y.owner,r.owner)||!Mh(y.owner,i))throw new na;if(!(y.availability.availability==="available"||y.availability.availability==="degraded")){if(y.events.length!==0||y.nextSequence!==v)throw new na;return y}if(y.nextSequence<=v)throw new na;p.push(y);for(const w of y.events){const C=h.get(w.sequence);if(C!==void 0&&!ii(C,w))throw new na;C===void 0&&h.set(w.sequence,w)}if(v=y.nextSequence,v>=r.nextSequence)break}if(p.length===yu&&v<r.nextSequence)throw new na;const m=p[0];if(m===void 0)throw new na;return Object.freeze({schemaVersion:"session-log-v1",owner:m.owner,lane:m.lane,availability:kb(p),requestedSequence:0,floorSequence:m.floorSequence,nextSequence:v,truncated:p.some(x=>x.truncated),events:Object.freeze([...h.values()].sort((x,y)=>x.sequence-y.sequence))})},async readTail(i,r,c,f){if(!Zp(r,i))throw new na;if(c.lane.laneId!==r.lane.laneId||!ii(c.owner,r.owner)||c.nextSequence>r.nextSequence)return a.loadLane(i,r,f);if(r.nextSequence===c.nextSequence)return c;const p=f??new AbortController().signal,h=[],v=new Map;for(const x of c.events)v.set(x.sequence,x);let m=c.nextSequence;for(let x=0;x<yu;x+=1){const y=await t.readPage(i,r,{sequence:m,limit:Nb},p);if(y.requestedSequence!==m||!ii(y.lane,r.lane)||!ii(y.owner,r.owner)||!Mh(y.owner,i))throw new na;if(!(y.availability.availability==="available"||y.availability.availability==="degraded")||y.floorSequence>c.nextSequence)return a.loadLane(i,r,f);if(y.nextSequence<=m)throw new na;h.push(y);for(const w of y.events){const C=v.get(w.sequence);if(C!==void 0&&!ii(C,w))throw new na;C===void 0&&v.set(w.sequence,w)}if(m=y.nextSequence,m>=r.nextSequence)break}if(h.length===yu&&m<r.nextSequence)throw new na;return h.length===0||m===c.nextSequence?c:Object.freeze({schemaVersion:"session-log-v1",owner:c.owner,lane:c.lane,availability:kb([c,...h]),requestedSequence:c.requestedSequence,floorSequence:c.floorSequence,nextSequence:m,truncated:c.truncated||h.some(x=>x.truncated),events:Object.freeze([...v.values()].sort((x,y)=>x.sequence-y.sequence))})}};return Object.freeze(a)}const xk={available:"Available",degraded:"Degraded",not_retained:"Not retained",not_executed:"Not executed",pruned:"Pruned"},jk={not_retained:"This session log was not retained.",not_executed:"No session execution occurred for this lane.",pruned:"This session log was pruned."};function wk(t){const a=t.availability.availability==="available"?[]:t.availability.availability==="degraded"?t.availability.reasons.map(Ab):[Ab(t.availability.reason)];return{events:[...t.events].sort((i,r)=>i.sequence-r.sequence),availabilityLabel:xk[t.availability.availability],availabilityState:t.availability.availability,reasons:a,gapMessage:t.truncated&&t.floorSequence>t.requestedSequence?`Sequences ${String(t.requestedSequence)}–${String(t.floorSequence-1)} are no longer retained.`:null,unavailableMessage:t.availability.availability==="available"||t.availability.availability==="degraded"?null:jk[t.availability.availability]}}function Ab(t){return t.replaceAll("_"," ")}function Pt(t){return Date.parse(t.timestamp)}function fi(t){const a=Math.max(0,Math.round(t/1e3)),i=Math.floor(a/3600),r=Math.floor(a%3600/60),c=a%60;return i>0?`+${String(i)}:${String(r).padStart(2,"0")}:${String(c).padStart(2,"0")}`:`+${String(r)}:${String(c).padStart(2,"0")}`}function ec(t){if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return`${String(Math.round(t))}ms`;if(t<6e4)return`${(t/1e3).toFixed(1).replace(/\.0$/,"")}s`;const a=Math.round(t/1e3),i=Math.floor(a/60);return i<60?`${String(i)}m ${String(a%60).padStart(2,"0")}s`:`${String(Math.floor(i/60))}h ${String(i%60).padStart(2,"0")}m`}function fs(t){return t===null?"unknown":String(t).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function em(t){const a=[];t.truncation!=="none"&&a.push({label:`${t.truncation} truncated`,level:"warn"}),t.completeness!=="complete"&&a.push({label:`${t.completeness} capture`,level:"warn"}),t.redaction.status==="redacted"&&t.redaction.count>0&&a.push({label:`redacted ${String(t.redaction.count)}`,level:"neutral"});for(const i of t.parseWarnings)a.push({label:i.replaceAll("_"," "),level:i==="corrupt_capture"?"fail":"warn"});return a}function Sk(t){const a=[],i=new Set;for(const r of t)for(const c of em(r))i.has(c.label)||(i.add(c.label),a.push(c));return a}const Nk={pending:"running",queued:"running",resolving:"running",running:"running",parsing:"running",awaiting_approval:"running",succeeded:"ok",completed:"ok",partial:"ok",failed:"failed",timeout:"failed",interrupted:"failed",cancelled:"cancelled"};function kk(t){for(let a=t.length-1;a>=0;a-=1){const i=t[a];if(!(i===void 0||i.event.kind!=="lifecycle"))return Nk[i.event.state]??"running"}return null}const Ak={user:"prompt",assistant:"assistant",tool_call:"tool call",tool_result:"tool result",approval_request:"approval req",approval_resolution:"approval res",error:"error",lifecycle:"lifecycle",usage:"usage",reasoning:"reasoning",unknown:"unknown event"};function gr(t){return(t.split(`
|
|
11
|
+
`).find(i=>i.trim().length>0)??"").replace(/\s+/g," ").trim()}function Rk(t){const a=t.event;let i;switch(a.kind){case"user":case"assistant":i=gr(a.content);break;case"tool_call":i=`${a.toolName} · ${a.callId} · ${gr(a.summary)}`;break;case"tool_result":i=`${a.toolName} · ${a.callId} · ${a.outcome} · ${gr(a.summary)}`;break;case"approval_request":i=`${gr(a.action)} · ${a.risk} risk · ${a.approvalId}`;break;case"approval_resolution":i=`${a.decision} · ${a.approvalId}`;break;case"error":i=`${a.code} · ${a.retryable?"retryable":"not retryable"} · ${a.message}`;break;case"usage":i=[`in ${fs(a.inputTokens)}`,`out ${fs(a.outputTokens)}`,`cached ${fs(a.cachedInputTokens)}`,`reasoning ${fs(a.reasoningTokens)}`,a.completeness].join(" · ");break;case"lifecycle":i=a.state;break;case"reasoning":i=gr(a.summary);break;case"unknown":i=`${a.originalKind} · ${gr(a.summary)}`;break}return i.length>200?`${i.slice(0,199)}…`:i}function bi(t){switch(t.kind){case"user":case"assistant":return t.content;case"lifecycle":return t.state;case"tool_call":return`${t.toolName} · ${t.callId}
|
|
12
|
+
${t.summary}`;case"tool_result":return`${t.toolName} · ${t.callId} · ${t.outcome}
|
|
13
|
+
${t.summary}`;case"approval_request":return`${t.action}
|
|
14
|
+
Risk: ${t.risk} · Approval: ${t.approvalId}`;case"approval_resolution":return`${t.decision}
|
|
15
|
+
Approval: ${t.approvalId}`;case"error":return`${t.code} · ${t.retryable?"retryable":"not retryable"}
|
|
16
|
+
${t.message}`;case"usage":return[`Completeness: ${t.completeness}`,`Input tokens: ${t.inputTokens??"unknown"}`,`Output tokens: ${t.outputTokens??"unknown"}`,`Cached input tokens: ${t.cachedInputTokens??"unknown"}`,`Reasoning tokens: ${t.reasoningTokens??"unknown"}`].join(`
|
|
17
|
+
`);case"reasoning":return t.summary;case"unknown":return`${t.originalKind}
|
|
18
|
+
${t.summary}`}}const Ek=3e4;function yi(t){switch(t.kind){case"message":case"reasoning":case"error":return[t.event];case"tool":return t.result===null?[t.call]:[t.call,t.result];case"group":return t.cards.flatMap(yi);case"approval":{const a=[];return t.request!==null&&a.push(t.request),t.resolution!==null&&a.push(t.resolution),a}case"tick":return t.events;case"stamp":return t.events;case"gap":return[]}}function Yp(t){switch(t.kind){case"group":return t.sequenceRange[0];case"stamp":return t.anchor.sequence;case"gap":return Number.MAX_SAFE_INTEGER;default:{const a=yi(t)[0];return a===void 0?-1:a.sequence}}}function Rb(t){switch(t.kind){case"error":case"approval":return!0;case"tool":return t.status!=="succeeded"&&t.status!=="running";case"group":return!1;default:return yi(t).some(a=>em(a).some(i=>i.level!=="neutral"))}}function Eb(t){return t.kind==="__tick"}function Ih(t){return t.kind==="tool"}const Tk=new Set(["succeeded","partial","failed","cancelled","interrupted","timeout","completed"]);function tm(t){for(let a=t.length-1;a>=0;a-=1){const i=t[a];if(i!==void 0&&i.event.kind==="lifecycle")return Tk.has(i.event.state)}return!1}function Ck(t,a){if(t.event.kind!==a.event.kind)return!1;switch(t.event.kind){case"lifecycle":return a.event.kind==="lifecycle"&&t.event.state===a.event.state;case"usage":return a.event.kind==="usage"&&t.event.completeness===a.event.completeness&&t.event.inputTokens===a.event.inputTokens&&t.event.outputTokens===a.event.outputTokens&&t.event.cachedInputTokens===a.event.cachedInputTokens&&t.event.reasoningTokens===a.event.reasoningTokens;case"unknown":return a.event.kind==="unknown"&&t.event.originalKind===a.event.originalKind&&t.event.summary===a.event.summary&&t.event.forwardCaptured===a.event.forwardCaptured;default:return!1}}function Ok(t,a){if(a===null)return null;const i=Pt(a)-Pt(t);return Number.isFinite(i)&&i>=0?i:null}function Mu(t,a,i){const r="callId"in t.event?t.event.callId:"",c="toolName"in t.event?t.event.toolName:"tool",f=a!==null&&a.event.kind==="tool_result"?a.event.outcome:null,p=f!==null?f:i?"unresolved":"running";return{kind:"tool",callId:r,toolName:c,call:t,result:a,durationMs:Ok(t,a),status:p,fidelityEvents:a===null?[t]:[t,a]}}function $k(t){const a=[],i=new Map,r=new Map;for(const c of t)switch(c.event.kind){case"user":a.push({kind:"message",speaker:"prompt",event:c});break;case"assistant":a.push({kind:"message",speaker:"assistant",event:c});break;case"tool_call":{const f=Mu(c,null,!1);i.set(f.callId,{index:a.length,card:f}),a.push(f);break}case"tool_result":{const f=c.event.callId,p=i.get(f);if(p!==void 0&&p.card.result===null){const h=Mu(p.card.call,c,!1);i.set(f,{index:p.index,card:h}),a[p.index]=h}else{const h=Mu(c,c,!1);i.set(f,{index:a.length,card:h}),a.push(h)}break}case"approval_request":{const f={kind:"approval",approvalId:c.event.approvalId,request:c,resolution:null,fidelityEvents:[c]};r.set(c.event.approvalId,{index:a.length,item:f}),a.push(f);break}case"approval_resolution":{const f=r.get(c.event.approvalId);if(f!==void 0&&f.item.resolution===null){const p={...f.item,resolution:c,fidelityEvents:[...f.item.fidelityEvents,c]};r.set(c.event.approvalId,{index:f.index,item:p}),a[f.index]=p}else{const p={kind:"approval",approvalId:c.event.approvalId,request:null,resolution:c,fidelityEvents:[c]};r.set(c.event.approvalId,{index:a.length,item:p}),a.push(p)}break}case"error":a.push({kind:"error",event:c});break;case"reasoning":a.push({kind:"reasoning",event:c,foldedCount:1});break;default:a.push({kind:"__tick",event:c});break}return a}function Mk(t){const a=new Map;for(const c of t)a.set(c.toolName,(a.get(c.toolName)??0)+1);const r=[...a.entries()].sort((c,f)=>f[1]!==c[1]?f[1]-c[1]:c[0].localeCompare(f[0])).map(([c,f])=>`${c} ×${String(f)}`);return`${String(t.length)} tools · ${r.join(", ")}`}function Ik(t){return t.event.kind==="tool_call"?t.event.summary:""}function Lk(t){const a=[];let i=0;for(;i<t.length;){const r=t[i];if(r===void 0||!Ih(r)||r.status!=="succeeded"){r!==void 0&&a.push(r),i+=1;continue}let c=i;for(;c<t.length;){const p=t[c];if(p===void 0||!Ih(p)||p.status!=="succeeded")break;c+=1}const f=t.slice(i,c);if(f.length>=3){const p=f[0],h=f[f.length-1],v=f.reduce((m,x)=>x.durationMs===null?m:m+x.durationMs,0);a.push({kind:"group",cards:f,summary:Mk(f),preview:f.map(m=>Ik(m.call).replaceAll(/\s+/g," ").trim()).filter(m=>m.length>0).join(" · "),totalMs:v,sequenceRange:[p.call.sequence,h.call.sequence]})}else a.push(...f);i=c}return a}function Dk(t){const a=[];for(const i of t){const r=a[a.length-1];if(Eb(i)&&r!==void 0&&r.kind==="tick"){const c=r;if(Ck(c.events[0],i.event)){c.events.push(i.event),c.sequenceRange=[c.events[0].sequence,i.event.sequence];continue}}if(i.kind==="reasoning"&&r!==void 0&&r.kind==="reasoning"){const c=r.event.event.kind==="reasoning"?r.event.event.summary:"",f=i.event.event.kind==="reasoning"?i.event.event.summary:"";if(c===f){a[a.length-1]={...r,foldedCount:r.foldedCount+1};continue}}a.push(Eb(i)?{kind:"tick",events:[i.event],eventKind:i.event.event.kind,sequenceRange:null}:i)}return a}function zk(t){switch(t.family){case"workflow":{const a=[`run ${t.runId}`];return t.stageId!==void 0&&a.push(t.stageId),t.callId!==void 0&&a.push(t.callId),t.attempt!==void 0&&a.push(`attempt ${String(t.attempt)}`),a.join(" · ")}case"activity":return[`activity ${t.activityId}`,...t.turnId===void 0?[]:[`turn ${t.turnId}`]].join(" · ");case"context":return[t.executor??"curator",`context ${t.contextRunId}`,...t.executionId===void 0?[]:[`execution ${t.executionId}`],...t.attempt===void 0?[]:[`attempt ${String(t.attempt)}`]].join(" · ")}}function qk(t){return t.timestamp.slice(11,19)}function Uk(t,a){const i=t[0];if(i===void 0)return null;let r=0;for(;r<t.length;){const v=t[r];if(v===void 0||v.event.kind!=="lifecycle")break;r+=1}const c=t.slice(0,r),f=c.flatMap(v=>v.event.kind==="lifecycle"?[v.event.state]:[]),p=a.floorSequence??0,h=[qk(i)];return a.includeOwnerFacts!==!1&&h.push(zk(i.owner)),f.length>0?h.push(f.join(" → ")):p>0&&h.push(`retention floor ${String(p)}`),{kind:"stamp",variant:"start",anchor:i,events:c,title:r>0?"session started":"capture begins",meta:h,failed:!1}}function Bk(t){if(t.event.kind!=="usage")return null;const a=t.event;if(a.inputTokens===null&&a.outputTokens===null)return{label:null};const i=[];if(a.inputTokens!==null){const r=a.cachedInputTokens!==null?` (cached ${fs(a.cachedInputTokens)})`:"";i.push(`tokens in ${fs(a.inputTokens)}${r}`)}return a.outputTokens!==null&&i.push(`out ${fs(a.outputTokens)}`),a.reasoningTokens!==null&&i.push(`reasoning ${fs(a.reasoningTokens)}`),{label:i.length>0?i.join(" · "):null}}function Gk(t,a,i){const r=t[t.length-1];if(r===void 0)return null;let c=t.length;for(;c>0;){const y=t[c-1];if(y===void 0||y.event.kind!=="lifecycle"&&y.event.kind!=="usage")break;c-=1}const f=t.slice(c);let p=null;for(let y=f.length-1;y>=0;y-=1){const A=f[y];if(A!==void 0&&A.event.kind==="lifecycle"){p=A.event.state;break}}if(p===null)for(let y=t.length-1;y>=0;y-=1){const A=t[y];if(A!==void 0&&A.event.kind==="lifecycle"){p=A.event.state;break}}const h=t[0],v=h===void 0?null:Pt(r)-Pt(h),m=[];v!==null&&Number.isFinite(v)&&v>0&&m.push(ec(v));for(let y=f.length-1;y>=0;y-=1){const A=f[y];if(A===void 0||A.event.kind!=="usage")continue;const w=Bk(A)?.label;w!=null&&m.push(w);break}const x=a.filter(y=>y.kind==="error").length;return x>0&&m.push(`${String(x)} ${x===1?"error":"errors"}`),i>0&&m.push(`${String(i)} unresolved ${i===1?"tool":"tools"}`),{kind:"stamp",variant:"end",anchor:r,events:f,title:p??"settled",meta:m,failed:p==="failed"}}function Hk(t){const a=[];let i=null;for(const r of t){if(r.kind==="stamp"||r.kind==="gap"){a.push(r);continue}const c=yi(r);let f=null,p=null;for(const h of c){const v=Pt(h);Number.isFinite(v)&&((f===null||v<f)&&(f=v),(p===null||v>p)&&(p=v))}if(f===null||p===null){a.push(r);continue}if(i!==null&&f-i>Ek){const h=f-i;a.push({kind:"gap",durationMs:h,label:`${ec(h)} quiet`})}a.push(r),i=i===null?p:Math.max(i,p)}return a}function Vk(t){return t.filter(a=>a.kind!=="stamp"&&a.kind!=="gap")}function Tb(t,a={}){const i=a.laneSettled??tm(t),c=$k(t).map(w=>Ih(w)?Mu(w.call,w.result,i):w),f=Lk(c),p=Dk(f);let h=Number.POSITIVE_INFINITY;for(const w of t)if(w.event.kind!=="lifecycle"){h=w.sequence;break}let v=Number.NEGATIVE_INFINITY;for(let w=t.length-1;w>=0;w-=1){const C=t[w];if(C===void 0)break;if(C.event.kind!=="lifecycle"&&C.event.kind!=="usage"){v=w+1<t.length?t[w+1]?.sequence??Number.NEGATIVE_INFINITY:Number.NEGATIVE_INFINITY;break}}const m=Uk(t,a),x=[];for(const w of p){if(w.kind==="tick"){const C=w.events[0]?.sequence??-1,N=(w.events[w.events.length-1]?.sequence??-1)<h,I=i&&C>=v;if(N||I)continue}x.push(w)}const y=x.filter(w=>w.kind==="tool"&&w.status==="unresolved").length,A=[];if(m!==null&&A.push(m),A.push(...Hk(x)),i){const w=Gk(t,x,y);w!==null&&A.push(w)}return{items:A,laneSettled:i}}function Bx({lanes:t}){return s.jsxs("div",{"aria-label":"Session log lane",className:"session-log-viewer__lanes",role:"group",children:[s.jsx("span",{className:"session-log-viewer__lanes-label",children:"lane"}),t.map(a=>s.jsxs("button",{"aria-pressed":a.active,className:"session-log-viewer__lane-chip","data-status":a.status??"unknown",onClick:()=>a.onSelect(a.id),type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__lane-dot"}),a.label]},a.id))]})}const Do=500,Fk=Do*4,Kk=480,Zk=["all","messages","tools","reasoning","issues"];function Yk(t,a){return t.length<=a?t:t.slice(t.length-a)}function Xk(t){switch(t.owner.family){case"workflow":return t.owner.runGeneration;case"activity":return t.owner.activityGeneration;case"context":return t.owner.contextGeneration}}function $l(t,a){return`${t}-e${String(a)}`}function Pk(t,a){if(a.length===0)return[{text:t,hit:!1}];const i=[],r=t.toLowerCase();let c=0;for(;c<=t.length;){const f=r.indexOf(a,c);if(f<0){i.push({text:t.slice(c),hit:!1});break}f>c&&i.push({text:t.slice(c,f),hit:!1}),i.push({text:t.slice(f,f+a.length),hit:!0}),c=f+a.length}return i.some(f=>f.text.length>0)?i:[{text:t,hit:!1}]}function Qa({text:t,query:a}){const i=b.useMemo(()=>Pk(t,a.trim().toLowerCase()),[a,t]);return s.jsx(s.Fragment,{children:i.map((r,c)=>r.hit?s.jsx("mark",{className:"session-log-viewer__hit",children:r.text},c):s.jsx("span",{children:r.text},c))})}function xi({events:t}){const a=b.useMemo(()=>Sk(t),[t]);return a.length===0?null:s.jsx("ul",{"aria-label":"Event fidelity",className:"session-log-viewer__chips",children:a.map(i=>s.jsx("li",{className:"session-log-viewer__chip","data-level":i.level,children:i.label},i.label))})}function Iu({kind:t}){return s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__node","data-node":t})}function Gx({event:t,originMs:a}){const i=a!==null&&Number.isFinite(Pt(t))?fi(Pt(t)-a):"—";return s.jsx("span",{className:"session-log-viewer__gutter-offset",title:t.timestamp,children:i})}function xd({event:t,originMs:a}){const i=a!==null&&Number.isFinite(Pt(t))?fi(Pt(t)-a):"—";return s.jsx("span",{className:"session-log-viewer__inline-offset",title:t.timestamp,children:i})}function Hx({item:t,originMs:a,pinned:i,query:r}){const c=t.event,f=bi(c.event);return s.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--message",children:[s.jsxs("div",{className:"session-log-viewer__card-head",children:[s.jsx("strong",{className:"session-log-viewer__speaker",children:t.speaker}),s.jsx("span",{className:"session-log-viewer__seq",children:`#${String(c.sequence)}`}),s.jsx(xd,{event:c,originMs:a}),i?s.jsx("span",{className:"session-log-viewer__pinned-chip",children:"pinned"}):null,s.jsx(xi,{events:[c]}),s.jsx("span",{className:"session-log-viewer__spacer"}),f.length===0?null:s.jsx("span",{className:"session-log-viewer__card-copy",children:s.jsx(ga,{label:`Copy ${t.speaker} message`,text:f})})]}),f.length===0?null:s.jsx(t1,{query:r,text:f})]})}const Qk=7.5,Jk=4;function Wk(t){const a=Number.parseFloat(getComputedStyle(t).fontSize);return Qk*(Number.isFinite(a)?a:16)}function e1(t){return t<1024?`${String(t)} B`:`${(t/1024).toFixed(1)} KiB`}function t1({query:t,text:a}){const r=`message-content-${b.useId()}`,c=b.useRef(null),[f,p]=b.useState(!1),[h,v]=b.useState(!1);return b.useLayoutEffect(()=>{const m=c.current;if(m===null)return;const x=()=>{const A=m.scrollHeight,w=Wk(m);p(A>w+Jk)};x();const y=typeof ResizeObserver>"u"?null:new ResizeObserver(x);return y!==null&&y.observe(m),()=>y?.disconnect()},[a]),s.jsxs("div",{className:"session-log-viewer__message-content","data-collapsed":(!h&&f).toString(),children:[s.jsx("pre",{className:"session-log-viewer__content session-log-viewer__message-body",id:r,ref:c,children:s.jsx(Qa,{text:a,query:t})}),f?s.jsx("button",{"aria-controls":r,"aria-expanded":h,className:"session-log-viewer__message-toggle",onClick:()=>v(m=>!m),type:"button",children:h?"collapse":`show all · ${e1(a.length)}`}):null]})}function n1(t){return t==="succeeded"?"ok":t}function a1(t){if(t===null)return null;const a=bi(t.event),i=a.includes(`
|
|
19
|
+
`)?a.slice(a.indexOf(`
|
|
20
|
+
`)+1):a;return i.trim().length===0?null:i}function s1(t){return t.length<=150&&t.split(`
|
|
21
|
+
`).length<=3}function l1(t){return(t.split(`
|
|
22
|
+
`).find(i=>i.trim().length>0)??t).replace(/\s+/g," ").trim()}function jd({open:t}){return s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__chevron","data-open":t})}function Vx({event:t,query:a}){const[i,r]=b.useState(!1),c=b.useId(),f=t.event.kind==="tool_call"?t.event.arguments:void 0;if(f===void 0)return null;if(f.omission!=="none"){const p=f.omission==="size_limit"?"size limit":f.omission==="structure_limit"?"structure limit":"invalid arguments";return s.jsxs("p",{className:"session-log-viewer__tool-output-meta",children:["Arguments omitted · ",p]})}return s.jsxs("div",{className:"session-log-viewer__tool-output",children:[s.jsxs("button",{"aria-controls":c,"aria-expanded":i,className:"session-log-viewer__tool-head","data-toggle":!0,onClick:()=>r(p=>!p),type:"button",children:["Arguments ",s.jsx(jd,{open:i})]}),i?s.jsxs("div",{id:c,children:[s.jsx(ga,{label:"Copy tool arguments",text:f.content}),s.jsx("pre",{className:"session-log-viewer__content session-log-viewer__tool-output-body","data-capped":"true",children:s.jsx(Qa,{text:f.content,query:a})})]}):null]})}function Fx({card:t,child:a,originMs:i,query:r}){const c=t.call.event.kind==="tool_call"?l1(t.call.event.summary):`${t.toolName} · result — call outside the retained window`,f=a1(t.result),p=f!==null&&s1(f),[h,v]=b.useState(p),m=f!==null&&!p,x=f===null?0:f.split(`
|
|
23
|
+
`).length,y=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"session-log-viewer__tool-tag",children:t.toolName}),s.jsx("span",{className:"session-log-viewer__tool-command",title:c,children:s.jsx(Qa,{text:c,query:r})}),s.jsx(xi,{events:t.fidelityEvents}),s.jsx("span",{className:"session-log-viewer__tool-meta",children:t.durationMs===null?"—":ec(t.durationMs)}),s.jsx("span",{className:"session-log-viewer__tool-status","data-status":t.status,children:n1(t.status)}),s.jsx(jd,{open:h&&m})]});return s.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--tool","data-child":a?"true":void 0,"data-status":t.status,children:[m?s.jsx("button",{"aria-expanded":h,className:"session-log-viewer__tool-head","data-toggle":!0,onClick:()=>v(A=>!A),type:"button",children:y}):s.jsxs("div",{className:"session-log-viewer__tool-head",children:[y,s.jsx("span",{className:"session-log-viewer__inline-offset",children:i===null?"":fi(Pt(t.call)-i)})]}),t.call.event.kind==="tool_call"&&t.call.event.arguments!==void 0?s.jsx(Vx,{event:t.call,query:r}):null,f!==null&&h?s.jsxs("div",{className:"session-log-viewer__tool-output",children:[s.jsxs("div",{className:"session-log-viewer__tool-output-meta",children:[s.jsx("span",{children:`output · ${String(x)} ${x===1?"line":"lines"}`}),s.jsx("span",{className:"session-log-viewer__spacer"}),s.jsx(ga,{label:`Copy ${t.toolName} output`,text:f})]}),s.jsx("pre",{className:"session-log-viewer__content session-log-viewer__tool-output-body","data-capped":x>12?"true":void 0,children:s.jsx(Qa,{text:f,query:r})})]}):null]})}function i1({group:t,open:a,onToggle:i,query:r}){const c=b.useId();return s.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--group",children:[s.jsxs("button",{"aria-controls":c,"aria-expanded":a,className:"session-log-viewer__group-head","data-toggle":!0,onClick:i,type:"button",children:[s.jsx("span",{className:"session-log-viewer__group-summary",children:t.summary}),s.jsx("span",{className:"session-log-viewer__group-preview",title:t.preview,children:s.jsx(Qa,{text:t.preview,query:r})}),s.jsx("span",{className:"session-log-viewer__group-meta",children:`#${String(t.sequenceRange[0])}–#${String(t.sequenceRange[1])} · ${t.totalMs===null?"—":ec(t.totalMs)}`}),s.jsx(jd,{open:a})]}),a?s.jsx("ul",{className:"session-log-viewer__group-children",id:c,children:t.cards.map(f=>s.jsx("li",{children:s.jsx(Fx,{card:f,child:!0,originMs:null,query:r})},f.callId))}):null]})}function r1(t,a){if(t.resolution!==null&&t.resolution.event.kind==="approval_resolution"){const i=t.resolution.event.decision;return{word:i,tone:i==="approved"?"approved":"denied"}}return a?{word:"unresolved",tone:"unresolved"}:{word:"awaiting decision",tone:"pending"}}function o1(t){return t.resolution!==null&&t.resolution.event.kind==="approval_resolution"?t.resolution.event.decision:"pending"}function c1({item:t,originMs:a,settled:i,query:r}){const c=t.request??t.resolution;if(c===null)return s.jsx("div",{className:"session-log-viewer__card"});const f=t.request?.event.kind==="approval_request"?t.request.event:null,p=r1(t,i),h=f!==null?f.action:"request outside the retained window",v=f!==null?`${f.risk} risk · ${f.approvalId}`:t.approvalId,m=t.request!==null&&t.resolution!==null?` · ${ec(Pt(t.resolution)-Pt(t.request))} later`:"",x=yi(t).map(y=>bi(y.event)).join(`
|
|
24
|
+
`);return s.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--approval","data-decision":p.tone,children:[s.jsxs("div",{className:"session-log-viewer__card-head",children:[s.jsx("strong",{className:"session-log-viewer__speaker",children:"approval"}),s.jsx("span",{className:"session-log-viewer__seq",children:`#${String(c.sequence)}`}),s.jsx(xd,{event:c,originMs:a}),s.jsx("span",{className:"session-log-viewer__sub",children:v}),s.jsx(xi,{events:t.fidelityEvents}),s.jsx("span",{className:"session-log-viewer__spacer"}),s.jsx("span",{className:"session-log-viewer__decision","data-tone":p.tone,children:p.word==="awaiting decision"||p.tone==="unresolved"?p.word:`${p.word}${m}`}),s.jsx("span",{className:"session-log-viewer__card-copy",children:s.jsx(ga,{label:"Copy approval",text:x})})]}),s.jsx("pre",{className:"session-log-viewer__content session-log-viewer__card-body",children:s.jsx(Qa,{text:h,query:r})})]})}function u1({item:t,originMs:a,query:i}){const r=t.event,c=r.event.kind==="error"?r.event:null,f=bi(r.event);return s.jsxs("div",{className:"session-log-viewer__card session-log-viewer__card--error",role:"alert",children:[s.jsxs("div",{className:"session-log-viewer__card-head",children:[s.jsx("strong",{className:"session-log-viewer__speaker session-log-viewer__speaker--fail",children:"error"}),s.jsx("span",{className:"session-log-viewer__seq",children:`#${String(r.sequence)}`}),s.jsx(xd,{event:r,originMs:a}),s.jsx("span",{className:"session-log-viewer__sub",children:c===null?"":`${c.code} · ${c.retryable?"retryable":"not retryable"}`}),s.jsx(xi,{events:[r]}),s.jsx("span",{className:"session-log-viewer__spacer"}),s.jsx("span",{className:"session-log-viewer__card-copy",children:s.jsx(ga,{label:"Copy error",text:f})})]}),s.jsx("pre",{className:"session-log-viewer__content session-log-viewer__card-body",children:s.jsx(Qa,{text:c===null?f:c.message,query:i})})]})}function d1({item:t,query:a}){const i=t.events[0],r=t.events[t.events.length-1];if(i===void 0||r===void 0)return s.jsx("div",{});const c=t.sequenceRange!==null,f=c?`#${String(t.sequenceRange[0])}–#${String(t.sequenceRange[1])}`:`#${String(i.sequence)}`;let p,h;switch(i.event.kind){case"lifecycle":p="lifecycle",h=i.event.state;break;case"usage":p="usage",h=`in ${fs(i.event.inputTokens)} · out ${fs(i.event.outputTokens)}`;break;default:p="unknown event",h=i.event.kind==="unknown"&&i.event.originalKind==="producer_payload_omitted"?i.event.summary:`${i.event.kind==="unknown"?i.event.originalKind:""} — omitted`;break}return s.jsxs("div",{className:"session-log-viewer__tick",children:[s.jsxs("span",{className:"session-log-viewer__tick-text",children:[`${f} · ${p} · `,s.jsx(Qa,{text:h,query:a}),c?` · ×${String(t.events.length)}`:""]}),s.jsx(xi,{events:t.events})]})}function f1({item:t}){return s.jsxs("div",{className:"session-log-viewer__stamp","data-variant":t.variant,"data-failed":t.failed?"true":void 0,"data-testid":"session-log-conversation-stamp",children:[s.jsx("strong",{className:"session-log-viewer__stamp-title",children:t.title}),t.meta.map(a=>s.jsx("span",{className:"session-log-viewer__stamp-meta",children:a},a)),s.jsx(xi,{events:t.events})]})}function p1({item:t}){return s.jsxs("div",{className:"session-log-viewer__gap","data-testid":"session-log-conversation-gap",children:[s.jsx("span",{className:"session-log-viewer__gap-label",children:t.label}),s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__gap-rule"})]})}function h1({instanceId:t,item:a,originMs:i,settled:r,query:c,openGroups:f,onToggleGroup:p}){const h=a.kind==="stamp"?a.anchor:yi(a)[0],v=a.kind==="stamp"||h===void 0?-1:h.sequence,m=a.kind==="stamp"&&h!==void 0?`${$l(t,h.sequence)}-${a.variant}`:v>=0?$l(t,v):void 0;let x="tick";switch(a.kind){case"message":x=a.speaker==="prompt"?"prompt":"assistant";break;case"reasoning":case"tool":case"group":case"approval":case"error":x=a.kind==="group"?"group":a.kind;break;case"stamp":x=a.variant==="start"?"stamp-start":"stamp-end";break;case"tick":case"gap":x=a.kind;break}const y=a.kind==="gap",A=a.kind==="stamp"||y,w=a.kind==="message"?"session-log-conversation-event":a.kind==="tool"?"session-log-conversation-tool":a.kind==="group"?"session-log-conversation-group":a.kind==="approval"?"session-log-conversation-approval":a.kind==="error"?"session-log-conversation-error":a.kind==="reasoning"?"session-log-conversation-reasoning":a.kind==="tick"?"session-log-conversation-system":void 0;return s.jsxs("li",{className:`session-log-viewer__entry session-log-viewer__entry--${a.kind}`,"data-event-kind":a.kind==="tick"?a.eventKind:a.kind==="message"||a.kind==="reasoning"||a.kind==="error"?h?.event.kind:a.kind,"data-seq":v>=0?String(v):void 0,"data-status":a.kind==="tool"?a.status:void 0,...a.kind==="message"&&h!==void 0?{"data-message-role":h.event.kind}:{},...a.kind==="approval"?{"data-decision":o1(a)}:{},...a.kind==="group"?{"data-sequence-range":`${a.sequenceRange[0]}-${a.sequenceRange[1]}`}:{},...a.kind==="tick"&&a.sequenceRange!==null?{"data-sequence-range":`${a.sequenceRange[0]}-${a.sequenceRange[1]}`}:{},"data-testid":w,id:m,tabIndex:A?void 0:-1,children:[y?null:s.jsx(Iu,{kind:x}),y||h===void 0?null:s.jsx(Gx,{event:h,originMs:i}),s.jsx("div",{className:"session-log-viewer__entry-content",children:a.kind==="message"?s.jsx(Hx,{item:a,originMs:i,pinned:!1,query:c}):a.kind==="reasoning"?s.jsxs("div",{className:"session-log-viewer__reasoning",children:[s.jsxs("div",{className:"session-log-viewer__reasoning-head",children:[s.jsx("span",{children:"reasoning"}),s.jsx("span",{className:"session-log-viewer__seq",children:`#${String(a.event.sequence)}`}),s.jsx(xd,{event:a.event,originMs:i}),a.foldedCount>1?s.jsx("span",{children:`×${String(a.foldedCount)}`}):null]}),s.jsx("pre",{className:"session-log-viewer__content session-log-viewer__reasoning-body",children:s.jsx(Qa,{text:a.event.event.kind==="reasoning"?a.event.event.summary.replaceAll("**",""):"",query:c})})]}):a.kind==="tool"?s.jsx(Fx,{card:a,child:!1,originMs:i,query:c}):a.kind==="group"?s.jsx(i1,{group:a,open:f.has(`group-${String(a.sequenceRange[0])}`),onToggle:()=>p(`group-${String(a.sequenceRange[0])}`),query:c}):a.kind==="approval"?s.jsx(c1,{item:a,originMs:i,settled:r,query:c}):a.kind==="error"?s.jsx(u1,{item:a,originMs:i,query:c}):a.kind==="tick"?s.jsx(d1,{item:a,query:c}):a.kind==="stamp"?s.jsx(f1,{item:a}):a.kind==="gap"?s.jsx(p1,{item:a}):null})]})}function m1(t,a,i,r){switch(t.event.kind){case"user":return"prompt";case"assistant":return"assistant";case"reasoning":return"reasoning";case"tool_call":{const c=a.get(t.event.callId);return c===void 0||c.event.kind!=="tool_result"?r?"tool-unresolved":"tool-running":c.event.outcome==="succeeded"?"tool-ok":c.event.outcome==="cancelled"?"tool-cancelled":"tool-failed"}case"approval_request":{const c=i.get(t.event.approvalId);return c===void 0?r?"approval-unresolved":"approval-pending":c.event.kind==="approval_resolution"&&c.event.decision==="approved"?"approval-approved":"approval-denied"}case"error":return"error";default:return"assistant"}}function g1(t){return t.startsWith("tool-")?`tool · ${t.slice(5)}`:t.startsWith("approval-")?`approval · ${t.slice(9)}`:t}function Cb(t,a){const i=t.event;return bi(i).toLowerCase().includes(a)||i.kind==="tool_call"&&i.arguments?.omission==="none"&&i.arguments.content.toLowerCase().includes(a)}function _1(t){const r=(bi(t.event).split(`
|
|
25
|
+
`).find(c=>c.trim().length>0)??"").replace(/\s+/g," ").trim();return r.length>64?`${r.slice(0,63)}…`:r}const Ob={error:0,"tool-failed":1,"approval-denied":2,"tool-unresolved":3,"approval-unresolved":4,"approval-pending":5,"tool-running":6,"approval-approved":7,"tool-ok":8,assistant:9,prompt:10,reasoning:11,"tool-cancelled":12};function v1(t){if(t.length<=Kk)return t;const a=new Map;for(const i of t){const r=String(Math.round(i.pct*4)),c=a.get(r);(c===void 0||Ob[i.kind]<Ob[c.kind])&&a.set(r,i)}return[...a.values()].sort((i,r)=>i.pct-r.pct)}function b1(t){const a=t/1e3;return a<=90?15e3:a<=300?3e4:a<=900?6e4:a<=1800?3e5:a<=7200?6e5:18e5}function To(t,a,i){return Math.max(0,Math.min(100,(t-a)/i*100))}function $b(t,a){const i=t.find(r=>r.sequence===a);return i===void 0?null:Pt(i)}function y1({event:t,instanceId:a,originMs:i,query:r}){const[c,f]=b.useState(!1),p=bi(t.event),h=Ak[t.event.kind],v=Rk(t),m=i!==null?fi(Math.max(0,Pt(t)-i)):t.timestamp.slice(11,19);return s.jsxs("li",{className:"session-log-viewer__ledger-row","data-event-kind":t.event.kind,"data-sequence":t.sequence,"data-testid":"session-log-event",id:$l(a,t.sequence),tabIndex:-1,children:[s.jsxs("button",{"aria-expanded":c,className:"session-log-viewer__ledger-head","data-toggle":!0,onClick:()=>f(x=>!x),type:"button",children:[s.jsx("span",{className:"session-log-viewer__ledger-seq",children:`#${String(t.sequence)}`}),s.jsx("time",{className:"session-log-viewer__ledger-time",dateTime:t.timestamp,title:t.timestamp,children:m}),s.jsx("span",{className:"session-log-viewer__chip session-log-viewer__ledger-kind",children:h}),s.jsx("span",{className:"session-log-viewer__ledger-summary",title:v,children:s.jsx(Qa,{text:v,query:r})}),s.jsx(xi,{events:[t]}),s.jsx(jd,{open:c})]}),c?s.jsxs("div",{children:[s.jsx("pre",{className:"session-log-viewer__ledger-body",children:s.jsx(Qa,{text:p,query:r})}),t.event.kind==="tool_call"&&t.event.arguments!==void 0?s.jsx(Vx,{event:t,query:r}):null]}):null]})}function x1(){const t=[{caps:["j","k"],label:"move"},{caps:["↵"],label:"expand"},{caps:["c"],label:"copy"},{caps:["/"],label:"find"},{caps:["esc"],label:"clear"}];return s.jsx(s.Fragment,{children:t.map(a=>s.jsxs("span",{className:"session-log-viewer__foot-key",children:[a.caps.map(i=>s.jsx("kbd",{className:"session-log-viewer__kbd",children:i},i)),a.label]},a.label))})}function j1({active:t=!0,fill:a=!1,lanes:i,page:r}){const c=b.useId(),f=`${c}-session-log-title`,[p,h]=b.useState("conversation"),[v,m]=b.useState(Do),[x,y]=b.useState("all"),[A,w]=b.useState(""),[C,T]=b.useState(null),[N,I]=b.useState(!1),[k,q]=b.useState(!1),[E,M]=b.useState(()=>new Set),[D,F]=b.useState(!1),[te,oe]=b.useState(null),[P,ue]=b.useState({lo:null,hi:null,atBottom:!0}),_e=`${r.owner.family}\0${Xk(r)}\0${r.lane.laneId}`;b.useEffect(()=>{m(Do),y("all"),w(""),T(null),M(new Set)},[_e]);const ge=b.useMemo(()=>wk(r),[r]),be=b.useMemo(()=>tm(ge.events),[ge.events]),ve=ge.events.length,$=ve>0,ae=$?Pt(ge.events[0]):null,ce=b.useMemo(()=>{const z=new Map;for(const xe of ge.events)xe.event.kind==="tool_result"&&z.set(xe.event.callId,xe);return z},[ge.events]),de=b.useMemo(()=>Yk(ge.events,v),[ge.events,v]),ye=b.useMemo(()=>Tb(de,{laneSettled:be,floorSequence:r.floorSequence,includeOwnerFacts:(i?.length??1)>1}),[i?.length,r.floorSequence,be,de]),S=b.useMemo(()=>ge.events.find(z=>z.event.kind==="user")??null,[ge.events]),L=de[0]?.sequence??0,B=S!==null&&S.sequence<L?S:null,Q=S===null&&r.floorSequence>0,me=Math.max(0,ve-de.length-(B!==null?1:0)),H=b.useCallback(()=>{qe.current="prepend",m(z=>Math.min(z+Do,ve))},[ve]),pe=b.useCallback(()=>{qe.current="prepend",m(ve)},[ve]),Be=b.useCallback(z=>{M(xe=>{const we=new Set(xe);return we.has(z)?we.delete(z):we.add(z),we})},[]),Se=b.useMemo(()=>{const z=Tb(ge.events,{laneSettled:be});return Vk(z.items).filter(Rb).length},[be,ge.events]),Re=b.useMemo(()=>{let z=0,xe=0,we=0;for(const ke of ge.events)switch(ke.event.kind){case"user":case"assistant":z+=1;break;case"tool_call":case"tool_result":xe+=1;break;case"reasoning":we+=1;break}return{all:ve,messages:z,tools:xe,reasoning:we,issues:Se}},[Se,ve,ge.events]),Qe=A.trim().toLowerCase(),Vt=b.useCallback(z=>{switch(x){case"all":return!0;case"messages":return z.kind==="message";case"tools":return z.kind==="tool"||z.kind==="group";case"reasoning":return z.kind==="reasoning";case"issues":return Rb(z)}},[x]),Kt=b.useCallback(z=>Qe.length===0?!0:yi(z).some(xe=>Cb(xe,Qe)),[Qe]),Tt=b.useMemo(()=>{const z=x==="all"&&Qe.length===0;return ye.items.filter(xe=>xe.kind==="stamp"||xe.kind==="gap"?z:Vt(xe)&&Kt(xe))},[ye.items,x,Kt,Vt,Qe.length]),Qt=b.useCallback(z=>{switch(x){case"all":return!0;case"messages":return z.event.kind==="user"||z.event.kind==="assistant";case"tools":return z.event.kind==="tool_call"||z.event.kind==="tool_result";case"reasoning":return z.event.kind==="reasoning";case"issues":return S1(z,ce,be)}},[x,ce,be]),Dt=b.useCallback(z=>Qe.length===0||Cb(z,Qe),[Qe]),Jt=b.useMemo(()=>de.filter(z=>Qt(z)&&Dt(z)),[Dt,Qt,de]),Wt=x!=="all"||Qe.length>0,Zt=me>0?`the latest ${String(de.length)} of ${String(ve)} events`:"this lane",rn=Qe.length>0?`no matches for “${A.trim()}”${x!=="all"?` in ${x}`:""} · searched ${Zt}`:`no ${x} in ${Zt}`,Ln=$&&Wt&&(p==="conversation"&&Tt.length===0||p==="ledger"&&Jt.length===0),on=b.useCallback(()=>{w(""),T(null)},[]),en=b.useMemo(()=>{if(!$)return null;const z=ge.events[0],xe=ge.events[ve-1],we=Pt(z),ke=be?Pt(xe):Date.now(),$e=Math.max(1e3,ke-we),Ye=new Map;for(const Xe of ge.events)Xe.event.kind==="approval_resolution"&&Ye.set(Xe.event.approvalId,Xe);const We=ge.events.filter(Xe=>Xe.event.kind==="user"||Xe.event.kind==="assistant"||Xe.event.kind==="reasoning"||Xe.event.kind==="tool_call"||Xe.event.kind==="approval_request"||Xe.event.kind==="error").map(Xe=>{const Gt=m1(Xe,ce,Ye,be),En=Pt(Xe),_n=Number.isFinite(En)?fi(En-we):"",Lt=g1(Gt),cn=_1(Xe);return{seq:Xe.sequence,pct:To(En,we,$e),kind:Gt,ariaLabel:`#${String(Xe.sequence)} · ${Lt} · ${_n}${cn.length>0?` — ${cn}`:""}`,passes:Qt(Xe)&&Dt(Xe),loaded:Xe.sequence>=L||B!==null&&Xe.sequence===B.sequence}}),It=b1($e),yn=[];for(let Xe=It;Xe<$e;Xe+=It)yn.push({pct:To(we+Xe,we,$e)});return{marks:v1(We),ticks:yn,spanMs:$e,originMs:we,firstTimeMs:Pt(z),loadedLeftPct:To(Pt(de[0]??z),we,$e),axisLeft:`${z.timestamp.slice(11,19)} · +0:00`,axisRight:be?`${fi(Math.max(0,Pt(xe)-we))} · ${xe.timestamp.slice(11,19)}`:`now · ${fi(ke-we)}`,live:!be}},[Dt,Qt,$,B,ce,be,ve,ge.events,de,L]),rt=b.useRef(null),Ue=b.useRef(null),le=b.useRef(!0),Ae=b.useRef(0),Ie=b.useRef(null),qe=b.useRef("bottom"),ot=b.useRef(null),$t=b.useRef(null),pt=b.useRef(!0),Je=b.useRef(t),ht=b.useRef(!1),kt=b.useRef(null),Mt=b.useRef(!1),mn=b.useCallback(()=>{const z=rt.current;if(z===null||z.clientHeight===0)return;const xe=z.getBoundingClientRect();let we=null,ke=null,$e=0;for(const We of z.querySelectorAll("[data-seq]")){const It=Number.parseInt(We.dataset.seq??"",10);if(!Number.isFinite(It))continue;const yn=We.getBoundingClientRect();yn.bottom>xe.top+2&&yn.top<xe.bottom-2&&(we===null&&(we=It,$e=yn.top-xe.top),ke=It)}const Ye=z.scrollHeight-(z.scrollTop+z.clientHeight)<30;le.current=Ye,kt.current=we===null?null:{seq:we,top:$e},ue(We=>We.lo===we&&We.hi===ke&&We.atBottom===Ye?We:{lo:we,hi:ke,atBottom:Ye})},[]),Rn=b.useCallback(z=>{z.clientHeight!==0&&($t.current=z.scrollTop,pt.current=le.current)},[]);b.useLayoutEffect(()=>{!Je.current&&t&&(ht.current=!0),Je.current=t},[t]),b.useLayoutEffect(()=>{const z=rt.current;if(z===null||z.clientHeight===0)return;const xe=Ie.current!==_e,we=qe.current,ke=$t.current,$e=ht.current&&!xe&&we!=="bottom"&&ke!==null;if(ht.current=!1,$e){z.scrollTop=pt.current?z.scrollHeight:ke,Ae.current=z.scrollHeight,ot.current=ve,Mt.current=!1,mn(),Rn(z);return}if(xe)Ie.current=_e,ot.current=ve;else{const Xe=ot.current;if(ot.current=ve,Xe!==null&&ve>Xe&&!le.current){const Gt=ve-Xe,En=Math.min(v,Xe)+Gt,_n=Math.max(v,Math.min(En,Fk));if(Mt.current=!0,_n!==v){m(_n);return}}}const Ye=Ae.current,We=z.scrollHeight>Ye,It=Ye>0&&Ye-(z.scrollTop+z.clientHeight)<30,yn=Mt.current;if(Mt.current=!1,we==="bottom"||xe)z.scrollTop=z.scrollHeight,we==="bottom"&&(qe.current=null);else if(we==="prepend")We&&(z.scrollTop+=z.scrollHeight-Ye),qe.current=null;else if(We&&It)z.scrollTop=z.scrollHeight;else if(yn&&kt.current!==null){const Xe=kt.current,Gt=z.querySelector(`[data-seq="${String(Xe.seq)}"]`);if(Gt!==null){const En=Gt.getBoundingClientRect().top-z.getBoundingClientRect().top-Xe.top;En!==0&&(z.scrollTop+=En)}}Ae.current=z.scrollHeight,mn(),Rn(z)}),b.useEffect(()=>{qe.current="bottom"},[p,x,Qe,_e]),b.useEffect(()=>()=>{Ue.current!==null&&cancelAnimationFrame(Ue.current)},[]);const gn=b.useCallback(()=>{qe.current=null;const z=rt.current;z!==null&&z.clientHeight>0&&(le.current=z.scrollHeight-(z.scrollTop+z.clientHeight)<30,Rn(z)),Ue.current===null&&(Ue.current=requestAnimationFrame(()=>{Ue.current=null,mn()}))},[mn,Rn]),tn=b.useCallback(()=>{const z=rt.current;z!==null&&(z.scrollTop=z.scrollHeight,mn())},[mn]),_t=b.useCallback(z=>{const xe=rt.current;if(xe===null)return;const we=z.getBoundingClientRect(),ke=xe.getBoundingClientRect();we.top<ke.top+8?xe.scrollTop-=ke.top+8-we.top:we.bottom>ke.bottom-8&&(xe.scrollTop+=we.bottom-ke.bottom+8)},[]),nn=b.useCallback(z=>{qe.current=null,T(z),z<L&&z!==B?.sequence&&m(ve),y("all"),h("conversation"),requestAnimationFrame(()=>{const xe=document.getElementById($l(c,z));xe!==null&&(_t(xe),mn())})},[_t,c,mn,B?.sequence,ve,L]);b.useEffect(()=>{if(C!==null)for(const z of ye.items){if(z.kind!=="group"||C<z.sequenceRange[0]||C>z.sequenceRange[1])continue;const xe=`group-${String(z.sequenceRange[0])}`;E.has(xe)||Be(xe)}},[ye.items,C,E,Be]);const Ct=b.useRef(null),Dn=b.useCallback(()=>{q(!0),requestAnimationFrame(()=>Ct.current?.focus())},[]),Ut=b.useCallback(z=>{const xe=rt.current;if(xe===null)return;const we=[...xe.querySelectorAll("[data-seq]")].filter($e=>$e.tagName==="LI"&&$e.hasAttribute("tabindex")).sort(($e,Ye)=>Number.parseInt($e.dataset.seq??"0",10)-Number.parseInt(Ye.dataset.seq??"0",10));if(we.length===0)return;let ke;if(z==="home")ke=we[0];else if(z==="end")ke=we[we.length-1];else{const $e=C===null?-1:we.findIndex(It=>It.dataset.seq===String(C)),Ye=z>0?0:we.length-1,We=$e<0?Ye:Math.max(0,Math.min(we.length-1,$e+z));ke=we[We]??we[Ye]}ke.focus(),T(Number.parseInt(ke.dataset.seq??"",10)),_t(ke)},[_t,C]),ct=b.useCallback(z=>{if(z.metaKey||z.ctrlKey||z.altKey)return;const xe=z.target;if(xe instanceof HTMLElement&&(xe.isContentEditable||xe.closest("input,textarea")!==null))return;const we=xe instanceof HTMLElement&&xe.closest("button")!==null;switch(z.key){case"j":z.preventDefault(),Ut(1);break;case"k":z.preventDefault(),Ut(-1);break;case"ArrowDown":if(we)return;z.preventDefault(),Ut(1);break;case"ArrowUp":if(we)return;z.preventDefault(),Ut(-1);break;case"Home":if(xe!==z.currentTarget)return;z.preventDefault(),Ut("home");break;case"End":if(xe!==z.currentTarget)return;z.preventDefault(),Ut("end");break;case"Enter":case" ":{if(we||C===null)return;const $e=document.getElementById($l(c,C))?.querySelector("[data-toggle]")??null;$e!==null&&(z.preventDefault(),$e.click());break}case"c":{if(C===null)return;const $e=document.getElementById($l(c,C))?.querySelector(".copy-control__button")??null;$e!==null&&$e.click();break}case"/":z.preventDefault(),Dn();break;case"Escape":T(null),A.length>0&&w("");break}},[Dn,C,c,Ut,A]),Bt=b.useMemo(()=>p==="conversation"?Tt.filter(z=>z.kind!=="stamp"&&z.kind!=="gap").map(Yp):Jt.map(z=>z.sequence),[p,Jt,Tt]),Hn=b.useCallback(z=>{if(z.key==="Escape"){w(""),T(null),z.currentTarget.blur();return}if(z.key!=="Enter"&&z.key!=="ArrowDown"&&z.key!=="ArrowUp")return;z.preventDefault();const xe=Bt;if(xe.length===0)return;const we=C===null?-1:xe.indexOf(C),ke=z.shiftKey||z.key==="ArrowUp",$e=It=>(It%xe.length+xe.length)%xe.length,Ye=we<0?ke?xe.length-1:0:$e(we+(ke?-1:1)),We=xe[Ye];We!==void 0&&(T(We),qe.current=null,requestAnimationFrame(()=>{const It=document.getElementById($l(c,We));It!==null&&(_t(It),mn())}))},[_t,C,c,Bt,mn]),ia=b.useMemo(()=>{if(Qe.length===0||Bt.length===0)return null;if(C===null)return`${String(Bt.length)} ${Bt.length===1?"match":"matches"}`;const z=Bt.indexOf(C);return z<0?`${String(Bt.length)} ${Bt.length===1?"match":"matches"}`:`${String(z+1)} of ${String(Bt.length)}`},[C,Bt,Qe.length]),Xn=b.useRef(null);b.useLayoutEffect(()=>{const z=Xn.current;if(z===null)return;for(const ke of z.querySelectorAll("[data-mark-pct]"))ke.style.setProperty("--mark-left",`${ke.dataset.markPct??"0"}%`);for(const ke of z.querySelectorAll("[data-tick-pct]"))ke.style.setProperty("--tick-left",`${ke.dataset.tickPct??"0"}%`);const xe=z.querySelector("[data-loaded]");xe!==null&&xe.style.setProperty("--loaded-left",`${z.dataset.loadedLeft??"0"}%`);const we=z.querySelector("[data-tip]");we!==null&&te!==null&&(we.style.setProperty("--tip-left",`${String(te.pct)}%`),we.dataset.side=te.pct>=50?"right":"left")}),b.useLayoutEffect(()=>{const z=Xn.current;if(z===null)return;const xe=z.querySelector("[data-vp]");if(xe===null)return;const we=w1(ge.events),ke=Number.parseFloat(z.dataset.spanMs??"0")||1e3,$e=we===null||P.lo===null?null:$b(ge.events,P.lo),Ye=we===null||P.hi===null?null:$b(ge.events,P.hi);if($e===null||Ye===null){xe.dataset.empty="true";return}delete xe.dataset.empty;const We=To($e,we,ke),It=To(Ye,we,ke);xe.style.setProperty("--vp-left",`${String(We)}%`),xe.style.setProperty("--vp-width",`${String(Math.max(1.2,It-We))}%`)});const za=ge.availabilityState!=="available"||ge.gapMessage!==null,qa=ge.unavailableMessage!==null,Ua=`requested sequence ${String(r.requestedSequence)} · floor ${String(r.floorSequence)} · next cursor ${String(r.nextSequence)} · schema session-log-v1 · authority observability_only · lane ${r.lane.laneId}`,Ja=me>0?s.jsxs("li",{className:"session-log-viewer__earlier",children:[s.jsx("button",{className:"session-log-viewer__earlier-button",onClick:H,type:"button",children:`show earlier ${String(Math.min(Do,me))} events`}),s.jsx("span",{className:"session-log-viewer__earlier-note",children:`latest ${String(de.length)} of ${String(ve)}`})]}):null,ra=Ln?s.jsxs("li",{className:"session-log-viewer__empty-find",role:"status",children:[s.jsx("span",{className:"session-log-viewer__empty-text",children:rn}),s.jsx("span",{className:"session-log-viewer__spacer"}),Qe.length>0?s.jsx("button",{className:"session-log-viewer__bracket",onClick:x==="all"?on:()=>{on(),y("all")},type:"button",children:x==="all"?"[ clear find ]":"[ clear find and filter ]"}):s.jsx("button",{className:"session-log-viewer__bracket",onClick:()=>y("all"),type:"button",children:"[ show all ]"}),me>0?s.jsx("button",{className:"session-log-viewer__bracket",onClick:pe,type:"button",children:`[ load all ${String(ve)} events ]`}):null]}):null;return s.jsxs("section",{"aria-labelledby":f,className:"session-log-viewer","data-fill":a?"true":void 0,"data-view":p,children:[s.jsxs("div",{className:"session-log-viewer__head",children:[s.jsxs("div",{className:"session-log-viewer__title-row",children:[s.jsxs("h2",{"aria-label":"Session conversation",className:"session-log-viewer__specimen",id:f,children:[s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__specimen-label session-log-viewer__specimen-label--desktop",children:"Session conversation"}),s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__specimen-label session-log-viewer__specimen-label--phone",children:"Conversation"})]}),s.jsxs("button",{"aria-controls":`${c}-facts`,"aria-expanded":N,className:"session-log-viewer__facts-toggle","data-testid":"session-log-facts-toggle",onClick:()=>I(z=>!z),type:"button",children:[s.jsx("span",{className:"session-log-viewer__facts-toggle-label",children:N?"[ hide ]":"[ facts ]"}),s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__facts-toggle-chevron","data-open":N.toString()})]}),$?s.jsx("div",{"aria-label":"Session log views",className:"session-log-viewer__view-switch",role:"tablist",children:["conversation","ledger"].map(z=>s.jsx("button",{"aria-controls":`${c}-${z}-panel`,"aria-selected":p===z,className:"session-log-viewer__view-switch-button","data-active":(p===z).toString(),id:`${c}-${z}-tab`,onClick:()=>h(z),role:"tab",type:"button",children:z},z))}):null]}),N?s.jsx("p",{className:"session-log-viewer__facts-line",id:`${c}-facts`,children:Ua}):null,i!==void 0&&i.length>1?s.jsx(Bx,{lanes:i}):null,$&&en!==null?s.jsxs("div",{className:"session-log-viewer__strip-block",children:[s.jsxs("div",{className:"session-log-viewer__strip-row",children:[s.jsx("span",{className:"session-log-viewer__axis-label",children:en.axisLeft}),s.jsxs("div",{"aria-label":"Session strip — click a mark to jump",className:"session-log-viewer__strip","data-loaded-left":String(en.loadedLeftPct),"data-span-ms":String(en.spanMs),ref:Xn,role:"group",children:[s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-rail"}),s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-loaded","data-loaded":!0}),s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-vp","data-vp":!0}),en.ticks.map((z,xe)=>s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-tick","data-tick-pct":String(z.pct)},xe)),en.marks.map(z=>s.jsx("button",{"aria-label":z.ariaLabel,className:"session-log-viewer__strip-mark","data-mark-kind":z.kind,"data-mark-pct":String(z.pct),"data-dim":z.passes?void 0:"true","data-outside":z.loaded?void 0:"true","data-focused":C===z.seq?"true":void 0,"data-testid":"session-log-strip-mark",onBlur:()=>oe(xe=>xe?.seq===z.seq?null:xe),onClick:()=>nn(z.seq),onFocus:()=>oe({seq:z.seq,pct:z.pct}),onMouseEnter:()=>oe({seq:z.seq,pct:z.pct}),onMouseLeave:()=>oe(xe=>xe?.seq===z.seq?null:xe),type:"button",children:s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-glyph"})},z.seq)),en.live?s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__strip-now","data-now":!0}):null,te!==null?s.jsx("span",{className:"session-log-viewer__strip-tip","data-tip":!0,role:"tooltip",children:en.marks.find(z=>z.seq===te.seq)?.ariaLabel??""}):null]}),s.jsx("span",{className:"session-log-viewer__axis-label",children:en.axisRight})]}),s.jsxs("div",{className:"session-log-viewer__strip-under",children:[s.jsx("span",{className:"session-log-viewer__axis-label",children:en.axisLeft}),s.jsx("span",{className:"session-log-viewer__axis-label",children:en.axisRight})]})]}):null,$?s.jsxs("div",{className:"session-log-viewer__controls","data-find-open":k.toString(),children:[s.jsx("div",{"aria-label":"Filter transcript",className:"session-log-viewer__filters",role:"group",children:Zk.map(z=>s.jsxs("button",{"aria-pressed":x===z,className:"session-log-viewer__filter-chip","data-active":(x===z).toString(),"data-testid":"session-log-filter-chip",onClick:()=>{y(z),T(null)},type:"button",children:[z,s.jsx("span",{className:"session-log-viewer__filter-count","data-fail":(z==="issues"&&Re.issues>0).toString(),children:String(Re[z])})]},z))}),ia!==null?s.jsx("span",{className:"session-log-viewer__match-note",role:"status",children:ia}):null,s.jsxs("div",{className:"session-log-viewer__find",children:[s.jsx("button",{"aria-label":"find in transcript",className:"session-log-viewer__find-open",onClick:Dn,type:"button",children:s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__find-glyph"})}),s.jsxs("div",{className:"session-log-viewer__find-input-wrap",children:[s.jsx("input",{"aria-label":"find in transcript",className:"session-log-viewer__find-input","data-testid":"session-log-find-input",onChange:z=>{w(z.target.value),T(null)},onKeyDown:Hn,placeholder:"find in transcript",ref:Ct,type:"text",value:A}),A.length>0?s.jsx("button",{"aria-label":"clear find",className:"session-log-viewer__find-clear",onClick:on,type:"button",children:"×"}):s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__find-kbd",children:"/"})]}),s.jsx("button",{className:"session-log-viewer__find-done",onClick:()=>{q(!1),on()},type:"button",children:"done"})]})]}):null,za||qa?s.jsx("section",{"aria-label":"Session log availability",className:"session-log-viewer__availability","data-availability":ge.availabilityState,role:"status",children:qa?s.jsxs(s.Fragment,{children:[s.jsx("strong",{className:"session-log-viewer__availability-word",children:ge.availabilityLabel}),s.jsx("p",{className:"session-log-viewer__unavailable",children:ge.unavailableMessage})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"session-log-viewer__availability-line",children:[s.jsx("span",{"aria-hidden":"true",className:"session-log-viewer__availability-dot"}),s.jsx("strong",{className:"session-log-viewer__availability-word",children:ge.availabilityLabel}),ge.reasons.length===0?null:s.jsx("ul",{className:"session-log-viewer__chips",children:ge.reasons.map(z=>s.jsx("li",{className:"session-log-viewer__chip","data-level":"neutral",children:z},z))})]}),ge.gapMessage===null?null:s.jsx("p",{className:"session-log-viewer__gap",children:ge.gapMessage})]})}):null,qa?null:s.jsx("p",{className:"session-log-viewer__facts-line",children:"Pattern-based redaction is best effort; sensitive content may remain."})]}),qa?null:$?s.jsxs("div",{className:"session-log-viewer__transcript-wrap",children:[s.jsx("div",{"aria-label":p==="conversation"?"Session log conversation":"Session log ledger",className:"session-log-viewer__scroller","data-testid":"session-log-conversation-scroller",onBlur:z=>{z.currentTarget.contains(z.relatedTarget)||F(!1)},onFocus:()=>F(!0),onKeyDown:ct,onScroll:gn,ref:rt,role:"region",tabIndex:0,children:p==="conversation"?s.jsxs("ol",{"aria-label":"Session log conversation",className:"session-log-viewer__entries",id:`${c}-conversation-panel`,role:"tabpanel",children:[B!==null?s.jsxs("li",{className:"session-log-viewer__entry session-log-viewer__entry--message session-log-viewer__entry--pinned","data-seq":String(B.sequence),"data-testid":"session-log-pinned-prompt",id:$l(c,B.sequence),tabIndex:-1,children:[s.jsx(Iu,{kind:"prompt"}),s.jsx(Gx,{event:B,originMs:ae}),s.jsx("div",{className:"session-log-viewer__entry-content",children:s.jsx(Hx,{item:{kind:"message",speaker:"prompt",event:B},originMs:ae,pinned:!0,query:Qe})})]}):null,Q?s.jsxs("li",{className:"session-log-viewer__entry session-log-viewer__entry--missing",children:[s.jsx(Iu,{kind:"missing"}),s.jsx("span",{className:"session-log-viewer__gutter-offset",children:"—"}),s.jsx("div",{className:"session-log-viewer__entry-content",children:s.jsx("div",{className:"session-log-viewer__missing",children:`prompt not retained — sequences 0–${String(r.floorSequence-1)} fell below the retention floor`})})]}):null,Ja,ra,Tt.map(z=>s.jsx(h1,{instanceId:c,item:z,onToggleGroup:Be,openGroups:E,originMs:ae,query:Qe,settled:be},z.kind==="stamp"?`${z.kind}-${z.variant}-${String(Yp(z))}`:`${z.kind}-${String(Yp(z))}`)),be?null:s.jsxs("li",{className:"session-log-viewer__entry session-log-viewer__entry--live",children:[s.jsx(Iu,{kind:"live"}),s.jsx("span",{className:"session-log-viewer__gutter-offset"}),s.jsx("div",{className:"session-log-viewer__entry-content",children:s.jsxs("div",{className:"session-log-viewer__live",role:"status",children:[s.jsx("span",{className:"session-log-viewer__live-word",children:"live"}),s.jsx("span",{children:"awaiting next event"})]})})]})]}):s.jsxs("ol",{"aria-label":"Session log ledger",className:"session-log-viewer__ledger",id:`${c}-ledger-panel`,role:"tabpanel",children:[Ja,ra,Jt.map(z=>s.jsx(y1,{event:z,instanceId:c,originMs:ae,query:Qe},z.sequence))]})}),P.atBottom?null:s.jsxs("button",{className:"session-log-viewer__latest",onClick:tn,type:"button",children:[s.jsx("span",{"aria-hidden":"true",children:"↓"}),"latest"]}),s.jsx("div",{"aria-hidden":"true",className:"session-log-viewer__foot","data-active":D.toString(),children:s.jsx(x1,{})})]}):s.jsx("p",{className:"session-log-viewer__empty",children:"No session events were captured for this lane."})]})}function w1(t){const a=t[0];return a===void 0?null:Pt(a)}function S1(t,a,i){switch(t.event.kind){case"error":case"approval_request":case"approval_resolution":return!0;case"tool_result":return t.event.outcome!=="succeeded";case"tool_call":{const r=a.get(t.event.callId);return r===void 0?i:r.event.kind==="tool_result"&&r.event.outcome!=="succeeded"}default:return em(t).some(r=>r.level!=="neutral")}}const N1=Ux(),k1=2e3;function A1(t){return t.family==="workflow"?[t.family,t.runId,t.runGeneration,t.stageId,t.callId].join("\0"):t.family==="activity"?[t.family,t.activityId,t.activityGeneration].join("\0"):"runId"in t?[t.family,t.runId,t.runGeneration,t.contextRunId].join("\0"):[t.family,t.contextRunId,t.contextGeneration].join("\0")}function R1(t){const a=t.owner;if(a.family==="workflow")return a.attempt===void 0?"attempt 1":`attempt ${String(a.attempt)}`;if(a.family==="activity")return`turn ${a.turnId??t.lane.laneId.replace(/^turn:/,"")}`;const i=a.executor==="finalizer"?"finalizer":"curator";return a.attempt===void 0||a.attempt<=1?i:`${i} · attempt ${String(a.attempt)}`}function E1(t){switch(t){case"loading_index":return"Discovering session log lanes…";case"loading_page":return"Loading session log events…";case"not_retained":return"This session log was not retained.";case"missing":return"This session log lane is no longer retained.";case"unavailable":return"Session log storage is temporarily unavailable.";case"obsolete":return"The selected generation changed; obsolete events were discarded.";case"error":return"The session log could not be loaded.";case"ready":return null}}function Mb(t,a,i,r){const c=kk(r);if(c===null)return;const f=new Map(t.current);f.set(i,c),t.current=f,a(p=>p+1)}function T1(t,a){return t.length!==a.length?!1:t.every((i,r)=>{const c=a[r];return c!==void 0&&i.lane.laneId===c.lane.laneId&&i.nextSequence===c.nextSequence})}function wd({api:t=N1,caption:a,fill:i=!1,onGenerationChanged:r,scope:c,live:f=!0,active:p=!0,refreshToken:h}){const v=A1(c),m=b.useMemo(()=>c,[v]),x=b.useMemo(()=>yk(t),[t]),y=b.useRef(r),[A,w]=b.useState("loading_index"),[C,T]=b.useState([]),[N,I]=b.useState(null),[k,q]=b.useState(null),[E,M]=b.useState("live"),D=b.useRef(new Map),F=b.useRef(C),te=b.useRef(k),oe=b.useRef(h),P=b.useRef(null),[,ue]=b.useState(0);F.current=C,te.current=k,oe.current=h,b.useEffect(()=>{y.current=r},[r]),b.useEffect(()=>{D.current=new Map},[v]),b.useEffect(()=>{const be=new AbortController;return w("loading_index"),T([]),I(null),q(null),M("live"),x.discover(m,null,be.signal).then(ve=>{if(!be.signal.aborted){if(ve.index.availability.availability==="not_retained"){w("not_retained");return}T(ve.lanes),I(ve.selectedLane?.lane.laneId??null)}}).catch(ve=>{be.signal.aborted||(ve instanceof xt&&ve.kind==="generation_changed"?(w("obsolete"),y.current?.()):ve instanceof xt&&ve.kind==="unavailable"?w("unavailable"):ve instanceof xt&&ve.kind==="aborted"||w("error"))}),()=>be.abort()},[x,v,m]),b.useEffect(()=>{if(N===null)return;const be=F.current.find(({lane:$})=>$.laneId===N);if(be===void 0)return;const ve=new AbortController;return w("loading_page"),q(null),M("live"),x.loadLane(m,be,ve.signal).then($=>{ve.signal.aborted||(Mb(D,ue,N,$.events),q($),w("ready"))}).catch($=>{ve.signal.aborted||($ instanceof xt&&$.kind==="generation_changed"?(w("obsolete"),y.current?.()):$ instanceof xt&&$.kind==="missing"?w("missing"):$ instanceof xt&&$.kind==="unavailable"?w("unavailable"):$ instanceof xt&&$.kind==="aborted"||w("error"))}),()=>ve.abort()},[x,N,m]),b.useEffect(()=>{if(!f||!p||A!=="ready"||N===null)return;let be=!1,ve=null,$=null,ae=!1,ce=oe.current,de=!1,ye=!1;M("live");const S=()=>{$!==null&&clearTimeout($),$=null},L=async()=>{if(be)return;if(oe.current!==ce&&(ce=oe.current,ae=!1),document.visibilityState!=="visible"){B();return}const me=te.current;if(me===null){B();return}ve?.abort();const H=new AbortController;ve=H;try{const pe=await x.discover(m,N,H.signal);if(be||H.signal.aborted)return;if(pe.index.availability.availability==="not_retained"){T([]),q(null),w("not_retained");return}T1(F.current,pe.lanes)||T(pe.lanes);const Be=pe.lanes.find(({lane:Re})=>Re.laneId===N);if(Be===void 0){q(null),w("missing");return}const Se=await x.readTail(m,Be,me,H.signal);if(be||H.signal.aborted)return;if(ye=!1,M("live"),Se!==me&&(Mb(D,ue,N,Se.events),q(Se)),tm(Se.events)){if(ae&&oe.current===ce){de=!0;return}ae=!0}}catch(pe){if(be||H.signal.aborted)return;if(pe instanceof xt&&pe.kind==="generation_changed"){w("obsolete"),y.current?.();return}if(pe instanceof xt&&pe.kind==="missing"){q(null),w("missing");return}if((pe instanceof na||pe instanceof xt&&(pe.kind==="auth_expired"||pe.kind==="offline"||pe.kind==="connection_changed"))&&oe.current===ce){M("stopped"),ye=!0,de=!0;return}M("paused")}B()},B=()=>{be||(S(),$=setTimeout(()=>{$=null,L()},k1))},Q=()=>{be||document.visibilityState!=="visible"||(ye?(ye=!1,de=!1,L()):$!==null&&(S(),L()))};return P.current=()=>{be||!de||(de=!1,ye=!1,ae=!1,ce=oe.current,L())},document.addEventListener("visibilitychange",Q),B(),()=>{be=!0,P.current=null,S(),ve?.abort(),document.removeEventListener("visibilitychange",Q)}},[p,x,v,f,A,N,m]),b.useEffect(()=>{P.current?.()},[h]);const _e=b.useMemo(()=>{if(!(C.length<=1))return C.map(be=>({id:be.lane.laneId,label:R1(be),status:D.current.get(be.lane.laneId)??null,active:be.lane.laneId===N,onSelect:ve=>I(ve)}))},[C,N]),ge=E1(A);return s.jsxs("section",{"aria-busy":A==="loading_index"||A==="loading_page","aria-label":"Session log panel",className:"session-log-panel","data-fill":i?"true":void 0,children:[_e===void 0||A==="ready"||k!==null?null:s.jsx(Bx,{lanes:_e}),ge===null?null:s.jsx("p",{role:A==="error"?"alert":"status",children:ge}),A==="ready"&&E==="paused"?s.jsx("p",{role:"status",children:"Live updates paused — session log could not be refreshed."}):null,A==="ready"&&E==="stopped"?s.jsx("p",{role:"status",children:"Live updates stopped — switch away and back, or refresh, to resume."}):null,A==="ready"&&k!==null?s.jsx(j1,{active:p,fill:i,page:k,..._e===void 0?{}:{lanes:_e}}):null]})}class Bn extends Error{constructor(a,i,r){super(a),this.kind=a,this.status=i,this.code=r,this.name="ArtifactApiError"}}function Ib(t){return t??new AbortController().signal}function C1(t,a){return a.aborted||t instanceof DOMException&&t.name==="AbortError"}async function O1(t){try{const a=await sa(t);return typeof a.error?.code=="string"?a.error.code:void 0}catch(a){if(a instanceof jt)throw new Bn("connection_changed",409,"agent_instance_changed");return}}async function Lb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof jt?new Bn("connection_changed",409,"agent_instance_changed"):C1(c,i)?new Bn("aborted"):new Bn("offline")}if(r.status===401)throw new Bn("auth_expired",401,"unauthorized");if(!r.ok){const c=await O1(r);throw c==="agent_instance_changed"?new Bn("connection_changed",r.status,c):new Bn("request_error",r.status,c)}return r}function $1(t=ms){return{async listArtifacts(a={}){const i=Ib(a.signal),r=new URLSearchParams({limit:"100"});a.before!==void 0&&r.set("before",a.before);const c=await Lb(t,`/api/artifacts?${r.toString()}`,i);try{return await sa(c)}catch(f){throw f instanceof jt?new Bn("connection_changed",409,"agent_instance_changed"):new Bn("request_error",c.status)}},async inspectArtifact(a,i){const r=Ib(i),c=encodeURIComponent(a.runId),f=encodeURIComponent(a.stageId),p=encodeURIComponent(a.callId),h=encodeURIComponent(a.runGeneration),v=await Lb(t,`/api/runs/${c}/stages/${f}/calls/${p}/artifact?generation=${h}`,r);if(v.headers.get("ETag")!==`"${a.stateRevision}"`)throw new Bn("stale_revision",v.status);let m;try{m=await Ph(v)}catch(A){throw A instanceof jt?new Bn("connection_changed",409,"agent_instance_changed"):A}let x;try{x=JSON.parse(m)}catch{throw new Bn("malformed_json",v.status)}const y=v.headers.get("X-ClinkX-Validator-Schema-Id");if(y===null||y.length===0)throw new Bn("request_error",v.status);return{byteSize:new TextEncoder().encode(m).byteLength,content:m,parsed:x,validatorId:y}}}}function Kx(t){return t.findIndex(a=>a.disabled!==!0)}function Db(t,a){const i=t.findIndex(r=>r.id===a&&r.disabled!==!0);return i>=0?i:Kx(t)}function zb(t,a,i){if(t.length===0)return-1;for(let r=1;r<=t.length;r+=1){const c=(a+i*r+t.length)%t.length;if(t[c]?.disabled!==!0)return c}return a}function ji({ariaLabel:t,items:a,onMovePastBoundary:i,onSelect:r,rootRef:c,selectedId:f}){const[p,h]=b.useState(()=>Db(a,f)),v=b.useRef(new Map),m=a.map(T=>`${T.id}:${T.disabled===!0?"disabled":"enabled"}`).join("\0"),x=Db(a,f);b.useEffect(()=>{h(x)},[m,x,f]);const y=T=>{T<0||(h(T),v.current.get(T)?.focus())},A=(T,N)=>{let I=null;if(T.key==="ArrowDown"){if(i!==void 0&&!a.slice(N+1).some(k=>k.disabled!==!0)){T.preventDefault(),i(1);return}I=zb(a,N,1)}else if(T.key==="ArrowUp"){if(i!==void 0&&!a.slice(0,N).some(k=>k.disabled!==!0)){T.preventDefault(),i(-1);return}I=zb(a,N,-1)}else if(T.key==="Home")I=Kx(a);else if(T.key==="End")I=[...a].map((k,q)=>({item:k,itemIndex:q})).reverse().find(({item:k})=>k.disabled!==!0)?.itemIndex??-1;else if(T.key==="Enter"||T.key===" "){T.preventDefault();const k=a[N];k&&k.disabled!==!0&&r(k.id);return}I!==null&&(T.preventDefault(),y(I))},w=(T,N)=>s.jsx("div",{"aria-disabled":T.disabled===!0?"true":void 0,"aria-label":T.label,"aria-selected":T.id===f,className:"roving-listbox__option","data-item-id":T.id,onClick:()=>{T.disabled!==!0&&(h(N),v.current.get(N)?.focus(),r(T.id))},onFocus:()=>h(N),onKeyDown:I=>A(I,N),ref:I=>{I?v.current.set(N,I):v.current.delete(N)},role:"option",tabIndex:N===p&&T.disabled!==!0?0:-1,children:T.content},T.id),C=[];for(const[T,N]of a.entries()){const I=C[C.length-1];if(N.group!==void 0&&I?.group?.id===N.group.id){I.items.push({item:N,index:T});continue}C.push({...N.group===void 0?{}:{group:N.group},items:[{item:N,index:T}]})}return s.jsx("div",{className:"roving-listbox","aria-label":t,ref:c,role:"listbox",children:C.map((T,N)=>T.group===void 0?T.items.map(({item:I,index:k})=>w(I,k)):s.jsxs("div",{"aria-label":T.group.label,className:"roving-listbox__group",role:"group",children:[T.group.header,T.items.map(({item:I,index:k})=>w(I,k))]},T.group.id===""?`group-${String(N)}`:T.group.id))})}const M1=32,I1=1e4;function L1(t,a,i){const r=[{value:t,depth:0}];let c=0;for(;r.length>0;){const f=r.pop();if(c+=1,c>i)return"nodes";if(f.depth>a)return"depth";if(f.value!==null&&typeof f.value=="object")for(const p in f.value)Object.prototype.hasOwnProperty.call(f.value,p)&&r.push({value:f.value[p],depth:f.depth+1})}return null}function Lh({value:t}){if(Array.isArray(t))return s.jsx("ol",{className:"bounded-json__collection",children:t.map((a,i)=>s.jsxs("li",{children:[s.jsx("span",{className:"bounded-json__key",children:i}),s.jsx(Lh,{value:a})]},i))});if(t!==null&&typeof t=="object"){const a=[];for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&a.push(s.jsxs("div",{className:"bounded-json__entry",children:[s.jsx("dt",{className:"bounded-json__key",children:i}),s.jsx("dd",{children:s.jsx(Lh,{value:t[i]})})]},i));return s.jsx("dl",{className:"bounded-json__collection",children:a})}return s.jsx("span",{className:`bounded-json__value bounded-json__value--${t===null?"null":typeof t}`,children:typeof t=="string"?t:JSON.stringify(t)})}function Sd({content:t,maxDepth:a=M1,maxNodes:i=I1,mediaType:r}){const[c,f]=b.useState("rendered"),p=b.useMemo(()=>{if(r==="text/plain")return null;try{const h=JSON.parse(t);return{kind:"valid",value:h,exceeded:L1(h,a,i)}}catch{return{kind:"invalid"}}},[t,a,i,r]);return r==="text/plain"?s.jsx(wr,{children:t}):p===null||p.kind==="invalid"?s.jsx(wr,{children:t}):s.jsx(Zh,{activeTabId:c,ariaLabel:"Result representation",onChange:f,tabs:[{id:"rendered",label:"rendered",panel:p.exceeded!==null?s.jsxs("p",{className:"bounded-json__limit",role:"status",children:["JSON exceeds the ",p.exceeded==="depth"?`${a}-level`:`${i}-node`," rendering limit. Use the inert raw-text tab."]}):s.jsx("div",{className:"bounded-json",children:s.jsx(Lh,{value:p.value})})},{id:"raw",label:"raw",panel:s.jsx(wr,{children:t})}]})}function Hs({detail:t,detailAriaLabel:a="Run detail",listAriaLabel:i="Workflow runs",mobileView:r,runList:c}){return s.jsxs("div",{className:"dashboard-layout","data-mobile-view":r,children:[s.jsx("section",{className:"dashboard-layout__run-list overflow-safe","aria-label":i,children:c}),s.jsx("section",{className:"dashboard-layout__detail overflow-safe","aria-label":a,children:t})]})}function wi({children:t}){const a=b.useRef(null),[i,r]=b.useState(!1);return b.useEffect(()=>{const c=a.current?.closest(".dashboard-layout__detail");if(c==null)return;const f=()=>{const p=c.scrollTop>88;r(h=>h===p?h:p)};return f(),c.addEventListener("scroll",f,{passive:!0}),()=>{c.removeEventListener("scroll",f)}},[]),s.jsx("div",{className:"detail-sticky-bar__wrap",ref:a,children:s.jsx("div",{"aria-hidden":!i,className:"detail-sticky-bar","data-scrolled":i,children:t})})}function D1({children:t,label:a}){return s.jsx("div",{className:"mobile-chart-scroll","aria-label":a,role:"region",tabIndex:0,children:s.jsx("div",{className:"mobile-chart-scroll__canvas",children:t})})}function Cr({children:t}){return s.jsx("span",{className:"overflow-safe",children:t})}const Zx="/contracts/council-plan-review-input-v1.json";function La(t){return t>=3600&&t%3600===0?`${String(t/3600)}h`:t>=60&&t%60===0?`${String(t/60)}m`:`${String(t)}s`}function Sr(t){return t.expands==="per_roster_seat"}function Dh(t){return t.calls.some(a=>a.reducer!==void 0)}function z1(t){if(Dh(t))return`${t.id} · deterministic reducer · in-engine`;if(Sr(t))return`${t.id} · 1 seed call, cloned per roster seat`;const a=t.calls.length;return`${t.id} · ${String(a)}${t.parallel&&a>1?" parallel calls":" call"}`}function q1(t){return t.stages===void 0?null:t.stages.map(a=>({id:a.id,title:z1(a),seed:Sr(a),marks:a.calls.map(i=>({reducer:i.reducer!==void 0}))}))}function Yx(t){const a=t.timeoutSeconds===void 0?"":` · ${La(t.timeoutSeconds)}`;if(t.stages===void 0){const r=`${String(t.stageCount)} ${t.stageCount===1?"stage":"stages"}`,c=`${String(t.callCount)} ${t.callCount===1?"call":"calls"}`;return{label:`${r} · ${c}${a}`,note:""}}const i=t.stages.some(Sr);return{label:`${String(t.callCount)}${i?" seed calls":" calls"}${a}`,note:i?"cloned per roster seat":""}}function U1(t){const a=t.stages;if(a===void 0)return null;const i=a.some(Sr);let r;if(i)r=`${String(a.length)}-stage seed · the plan-review expander clones the reviewer and cross-review blueprints once per admitted roster seat`;else{const f=a.filter(v=>v.parallel).length,p=a.find(v=>!v.parallel),h=a[a.length-1];r=`${String(f)} parallel stages · fan-in at ${p===void 0?"—":p.id}`,h!==void 0&&h.onFailure==="abort"&&(r+=` · ${h.id} aborts the run on failure`)}const c=[{label:"call",kind:"call"},...i?[{label:"seed · cloned per seat",kind:"seed"}]:[],...a.some(Dh)?[{label:"in-engine reducer",kind:"reducer"}]:[]];return{note:r,legend:c,stages:a.map((f,p)=>{const v=Dh(f)?"deterministic reducer · in-engine":Sr(f)?"1 seed call · cloned per roster seat":f.parallel&&f.calls.length>1?`${String(f.calls.length)} parallel calls`:"1 call · sequential",m=f.contextFrom.length===0?"":`context ← ${f.contextFrom.join(" · ")}${f.anonymizeContext?" · anonymized":""}`,x=[`on failure ${f.onFailure}`];return f.maxRetries>0&&x.push(`retry ×${String(f.maxRetries)}`),{index:String(p+1).padStart(2,"0"),id:f.id,modeLabel:v,seed:Sr(f),calls:f.calls.map(y=>({id:y.id,who:y.reducer!==void 0?y.reducer:`${y.cliName??"—"} / ${y.role??"—"}`,reducer:y.reducer!==void 0})),contextLabel:m,failureLabel:x.join(" · "),aborts:f.onFailure==="abort"}})}}function B1(t,a){const i=[{label:"stages",value:String(t.stageCount)},{label:"calls",value:String(t.callCount)}];return t.timeoutSeconds!==void 0&&i.push({label:"timeout",value:La(t.timeoutSeconds)}),i.push({label:"on sheet",value:a===void 0||a===0?"idle":`${String(a)} ${a===1?"run":"runs"}`}),i}function G1(t){switch(t){case"number":return 0;case"boolean":return!1;case"string[]":return[];case"string":return"<required:string>"}}function H1(){return{schema_version:"council-plan-review-input-v1",contract_href:Zx}}function V1(t){const a=Object.fromEntries(t.variables.filter(i=>i.required).sort((i,r)=>i.name.localeCompare(r.name)).map(i=>[i.name,G1(i.type)]));return JSON.stringify({tool:"run_workflow",arguments:{workflow:t.name,run_id:"<unique_run_id>",variables:a,...t.name==="plan-review-receipts"?{plan_review:H1()}:{}}},null,2)}function Xx(t){const a={name:t.name,version:t.version,description:t.description,...t.timeoutSeconds===void 0?{}:{timeoutSeconds:t.timeoutSeconds},...t.stages===void 0?{}:{stages:t.stages.map(i=>({id:i.id,parallel:i.parallel,onFailure:i.onFailure,maxRetries:i.maxRetries,contextFrom:[...i.contextFrom],anonymizeContext:i.anonymizeContext,...i.expands===void 0?{}:{expands:i.expands},calls:i.calls.map(r=>({id:r.id,...r.cliName===void 0?{}:{cliName:r.cliName},...r.role===void 0?{}:{role:r.role},...r.reducer===void 0?{}:{reducer:r.reducer}}))}))},stageCount:t.stageCount,callCount:t.callCount,variables:t.variables.map(({name:i,type:r,required:c,description:f})=>({name:i,type:r,required:c,...f===void 0?{}:{description:f}}))};return{...a,copyHandoff:V1(a),...a.name==="plan-review-receipts"?{contractHref:Zx}:{}}}function F1(t){return{name:t.name,command:t.command,parser:t.parser,promptMode:t.promptMode,timeoutSeconds:t.timeoutSeconds,...t.idleTimeoutSeconds===void 0?{}:{idleTimeoutSeconds:t.idleTimeoutSeconds},...t.idleTimeoutStartupSeconds===void 0?{}:{idleTimeoutStartupSeconds:t.idleTimeoutStartupSeconds},roleNames:[...t.roleNames],environmentKeys:[...t.environmentKeys],supportsImages:t.supportsImages,resultContract:{enabled:t.resultContract.enabled,filename:t.resultContract.filename},backend:t.backend,...t.workflowEligible===void 0?{}:{workflowEligible:t.workflowEligible},...t.usableVia===void 0?{}:{usableVia:[...t.usableVia]}}}function nm(t){if(t.backend==="app_server")return"app-server session";switch(t.promptMode){case"stdin":return"prompt on stdin";case"file":return"prompt via file";case"arg":return"prompt as argument"}}function Px(t){const a=t.idleTimeoutStartupSeconds??0,i=[];return a>0&&i.push(`idle start ${La(a)}`),t.resultContract.enabled&&i.push(t.resultContract.filename),t.workflowEligible===!1&&i.push("not workflow-eligible"),{label:La(t.timeoutSeconds),note:i.join(" · ")}}function K1(t){return`[ ${String(t)} ${t===1?"call":"calls"} ]`}function Qx(t){return t===0?"idle":`${String(t)} ${t===1?"call":"calls"}`}function Z1(t,a){const i=[{label:"binary",value:t.command},{label:"prompt",value:t.promptMode},{label:"timeout",value:La(t.timeoutSeconds)},{label:"result contract",value:t.resultContract.enabled?t.resultContract.filename:"none"}];return a!==void 0&&i.push({label:"on sheet",value:Qx(a)}),i}function qb(t){return t===void 0?"not declared":t===0?"off":La(t)}function Y1(t){return[{key:"timeout",value:La(t.timeoutSeconds),raw:`${String(t.timeoutSeconds)}s`,note:"hard wall for the whole call"},{key:"idle startup",value:qb(t.idleTimeoutStartupSeconds),raw:t.idleTimeoutStartupSeconds===void 0?"":`${String(t.idleTimeoutStartupSeconds)}s`,note:"no output within this window after spawn kills the child"},{key:"idle",value:qb(t.idleTimeoutSeconds),raw:t.idleTimeoutSeconds===void 0?"":`${String(t.idleTimeoutSeconds)}s`,note:"longest silence tolerated between outputs"}]}function X1(t){const a=t.idleTimeoutStartupSeconds;return a===void 0||a<=0?null:Math.max(3,a/t.timeoutSeconds*100)}function P1(t){const a=t.idleTimeoutStartupSeconds;return a===void 0||a<=0?null:`idle start · ${La(a)}`}function Q1(t){return t.workflowEligible===void 0?{label:"workflow eligibility not reported",tone:"secondary"}:t.workflowEligible?{label:"workflow eligible",tone:"link"}:{label:"not workflow-eligible · agent sessions only",tone:"primary"}}function J1(t){return t.backend==="app_server"?"App-server tools require CLINKX_APP_SERVER_ENABLED on the MCP server process.":"Reachability names the supported tool path, not live producer availability."}function W1(t){return t.resultContract.enabled?`the child writes its final answer to ${t.resultContract.filename} in the run dir; the bridge reads it before any parser runs`:"the parser’s extracted output is the result"}function eA(t,a){if(t.length<2||a.length===0)return null;const i=a.join("\0");return t.every(c=>c.roleNames.join("\0")===i)?`the same ${String(a.length)} roles are declared on every adapter`:null}const tA=["PATH","HOME","USER","LANG","TMPDIR"];function nA(){return`none declared · the child inherits the baseline ${tA.join(" · ")}`}function aA(t,a,i){const r=[];if(a!==null)for(const c of a.stages)for(const f of c.calls)f.state!=="pending"&&f.snapshotIdentity?.adapter===t&&r.push({kind:"workflow",id:`run:${a.runId}:${c.stageId}:${f.callId}`,runId:a.runId,label:`${a.workflowName} · ${c.stageId} / ${f.callId}`,sub:`run ${a.runId}`,status:f.state});for(const c of i)c.adapter===t&&r.push({kind:"single",id:`activity:${c.activityId}`,activityId:c.activityId,label:`${c.kind} · ${c.role}`,sub:`activity ${c.activityId}`,status:c.status});return r}function sA(t){const a=t.filter(r=>r.kind==="workflow").length,i=t.length-a;return`${String(a)} workflow · ${String(i)} single`}function Ub(t){return t===void 0?"—":t===0?"off":La(t)}function lA(t,a){return[{label:"binary",read:r=>`$ ${r.command}`},{label:"backend",read:r=>r.backend},{label:"parser",read:r=>r.parser},{label:"prompt",read:r=>r.promptMode},{label:"timeout",read:r=>La(r.timeoutSeconds)},{label:"idle startup",read:r=>Ub(r.idleTimeoutStartupSeconds)},{label:"idle",read:r=>Ub(r.idleTimeoutSeconds)},{label:"result contract",read:r=>r.resultContract.enabled?r.resultContract.filename:"none"},{label:"images",read:r=>r.supportsImages?"yes":"no"},{label:"workflow eligible",read:r=>r.workflowEligible===void 0?"not reported":r.workflowEligible?"yes":"no"},{label:"usable via",read:r=>r.usableVia===void 0||r.usableVia.length===0?"not reported":r.usableVia.join(" · ")},{label:"roles",read:r=>String(r.roleNames.length)},{label:"env keys",read:r=>r.environmentKeys.length===0?"none":r.environmentKeys.join(" · ")},{label:"on sheet",read:r=>{const c=a?.[r.name];return c===void 0?"—":Qx(c)}}].map(r=>{const c=t.map(r.read),f=c.every(p=>p===c[0]);return{label:r.label,same:f,cells:c}})}function iA(t,a,i,r){const c=`${String(t)} adapters · ${String(a)} facts · `;return r?`${c}${String(i)} identical ${i===1?"row":"rows"} hidden · a column head opens that adapter`:`${c}${String(i)} ${i===1?"row reads":"rows read"} the same on every adapter and dim to slate · a column head opens that adapter`}function rA(t){return t.replaceAll("_","_")}function am({action:t,countLabel:a,infoLine:i,title:r}){return s.jsxs("header",{className:"catalog-index__header",children:[s.jsx("h2",{className:"catalog-view__title",title:i,children:r}),s.jsx("span",{"aria-hidden":"true",className:"catalog-index__spacer"}),t===void 0?null:t,s.jsx("span",{className:"catalog-index__count",children:a}),i===void 0?null:s.jsx("p",{className:"visually-hidden",children:i})]})}function id({message:t,retry:a,role:i}){return s.jsxs("div",{className:"catalog-notice",role:i,children:[s.jsx("span",{className:"catalog-notice__message",children:t}),a===void 0?null:s.jsx("button",{className:"catalog-bracket",onClick:a.run,type:"button",children:a.label})]})}function Jx({children:t}){return s.jsx("p",{className:"catalog-detail__empty",children:t})}const oA=["plan-review-receipts","council-default","council-answer","council-code-review","council-debug","council-discover","council-plan-review"],cA=["codex","claude","agy","codex-app-server","glm"],Wx=Object.freeze({});function e0(t,a,i){const r=i.indexOf(t),c=i.indexOf(a);return r===-1&&c===-1?t.localeCompare(a):r===-1?1:c===-1?-1:r-c}function t0(t){return t.map(Xx).sort((a,i)=>e0(a.name,i.name,oA))}function n0(t,a){const i=t0(t);return i.find(r=>r.name===a)??i[0]}function uA(t){return`[ ${String(t)} ${t===1?"run":"runs"} ]`}function dA(t,a){const i=Yx(t),r=a===void 0||a===0?"idle":`${String(a)} ${a===1?"run":"runs"} on sheet`;return[`${t.name} version ${t.version}`,i.label,...i.note===""?[]:[i.note],r].join(", ")}function fA({onSelect:t,runCounts:a=Wx,selectedName:i,sourcePath:r,workflows:c}){const f=t0(c),p=n0(c,i),h=String(f.length);return s.jsxs("section",{"aria-label":"Workflow catalog",className:"catalog-index",children:[s.jsx(am,{countLabel:`[ ${h} ]`,infoLine:r===void 0?`[ ${h} loaded descriptors ]`:`[ CLINKX_WORKFLOWS_PATH = ${r} ]`,title:"Shipped workflows"}),s.jsx(ji,{ariaLabel:"Shipped workflows",items:f.map(v=>{const m=a[v.name],x=q1(v),y=Yx(v),A=v.name==="plan-review-receipts";return{id:v.name,label:dA(v,m),content:s.jsxs("div",{className:"catalog-card catalog-card--workflow",children:[s.jsxs("div",{className:"catalog-card__head",children:[s.jsx("span",{className:"catalog-card__name",children:v.name}),s.jsxs("span",{className:"catalog-card__version",children:["v",v.version]}),s.jsx("span",{"aria-hidden":"true",className:"catalog-card__spacer"}),m===void 0||m===0?null:s.jsx("span",{className:"catalog-card__usage",children:uA(m)})]}),A?s.jsx("div",{className:"catalog-card__stamp-row",children:s.jsx("span",{className:"catalog-stamp",children:"review-only"})}):null,s.jsx("p",{className:"catalog-card__blurb",children:v.description}),x===null?null:s.jsx("div",{"aria-hidden":"true",className:"catalog-strip",children:x.map((w,C)=>s.jsxs(b.Fragment,{children:[s.jsxs("span",{className:"catalog-strip__group",title:w.title,children:[s.jsx("span",{className:"catalog-strip__marks",children:w.marks.map((T,N)=>s.jsx("span",{className:["catalog-mark","catalog-mark--9",T.reducer?"catalog-mark--reducer":"",w.seed?"catalog-mark--seed":""].filter(Boolean).join(" ")},N))}),s.jsx("span",{className:"catalog-strip__label",children:w.id})]}),C===x.length-1?null:s.jsx("span",{className:"catalog-strip__connector"})]},w.id))}),s.jsxs("div",{className:"catalog-card__foot",children:[s.jsx("span",{className:"catalog-card__foot-label",children:y.label}),y.note===""?null:s.jsx("span",{className:"catalog-card__foot-note",children:y.note}),s.jsx("span",{"aria-hidden":"true",className:"catalog-card__foot-hint",children:"detail ›"})]})]})}}),onSelect:v=>t?.(v),selectedId:p===void 0?null:p.name})]})}function pA({variables:t}){const a=t.filter(r=>r.required),i=t.filter(r=>!r.required);return s.jsx(s.Fragment,{children:[...a,...i].map(r=>{const c=r.name.startsWith("cb_");return s.jsxs("div",{className:"catalog-vars__row",title:r.description,children:[s.jsx("span",{className:"catalog-vars__name",children:c?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"catalog-vars__prefix",children:"cb_"}),s.jsx("span",{className:"catalog-vars__rest",children:r.name.slice(3)})]}):s.jsx("span",{className:"catalog-vars__rest",children:r.name})}),s.jsx("span",{className:"catalog-vars__type",children:r.type}),s.jsx("span",{className:r.required?"catalog-vars__input catalog-vars__input--required":"catalog-vars__input",children:r.required?"required":"optional"})]},r.name)})})}function hA(t){if(t.name==="plan-review-receipts")return t.variables.find(a=>a.name==="cb_task"&&a.description!==void 0)?.description}function mA({onBack:t,runCounts:a=Wx,workflow:i}){const[r,c]=b.useState({});if(i===void 0)return s.jsx(Jx,{children:"Select a shipped workflow to inspect its definition."});const f=Xx(i),p=U1(i),h=B1(i,a[i.name]),v=i.name==="plan-review-receipts",m=i.variables.filter(C=>C.required),x=i.variables.filter(C=>!C.required),y=r[i.name]===!0||m.length===0,A=y?[...m,...x]:m,w=hA(i);return s.jsxs("section",{className:"app-shell__view catalog-detail",children:[s.jsxs(wi,{children:[s.jsx("span",{className:"detail-sticky-bar__id",children:"workflow"}),s.jsx("span",{className:"detail-sticky-bar__name",children:i.name}),s.jsxs("span",{className:"detail-sticky-bar__muted",children:["v",i.version]}),s.jsx("span",{className:"detail-sticky-bar__spacer"}),s.jsx("span",{className:"detail-sticky-bar__wide",children:s.jsx(ga,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff})})]}),s.jsxs("div",{className:"catalog-detail__back-bar",children:[t===void 0?null:s.jsx("button",{className:"catalog-back",onClick:t,type:"button",children:"‹ workflows"}),s.jsxs("span",{className:"catalog-detail__back-context",children:["v",i.version]})]}),s.jsxs("div",{className:"catalog-detail__content",children:[s.jsxs("div",{className:"catalog-detail__eyebrow",children:[s.jsx("span",{className:"catalog-detail__eyebrow-word",children:"workflow"}),v?s.jsx("span",{className:"catalog-stamp",children:"review-only"}):null]}),s.jsxs("div",{className:"catalog-detail__title-row",children:[s.jsx("h1",{className:"catalog-detail__name",children:i.name}),s.jsxs("span",{className:"catalog-detail__version",children:["v",i.version]}),s.jsxs("div",{className:"catalog-detail__actions",children:[f.contractHref===void 0?null:s.jsx("a",{className:"catalog-bracket",href:f.contractHref,children:"[ plan-review input contract ]"}),s.jsx(ga,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff})]})]}),s.jsx("p",{className:"catalog-detail__description",children:i.description}),s.jsxs("div",{className:"catalog-facts",children:[s.jsx("div",{className:"catalog-facts__group",children:h.map(C=>s.jsxs("span",{className:"catalog-facts__item",children:[s.jsx("span",{className:"catalog-facts__k",children:C.label}),s.jsx("span",{className:"catalog-facts__v",children:C.value})]},C.label))}),s.jsxs("div",{className:"catalog-facts__actions",children:[s.jsx(ga,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff}),f.contractHref===void 0?null:s.jsx("a",{className:"catalog-bracket catalog-bracket--target44",href:f.contractHref,children:"[ input contract ]"})]})]}),p===null?null:s.jsxs("section",{"aria-label":"Stage anatomy",className:"catalog-section",children:[s.jsx("div",{className:"catalog-section__head",children:s.jsx("h2",{className:"catalog-section__stamp",children:"Stage anatomy"})}),s.jsx("p",{className:"catalog-section__note",children:p.note}),s.jsx("div",{"aria-hidden":"true",className:"catalog-anatomy__legend",children:p.legend.map(C=>s.jsxs("span",{className:"catalog-anatomy__legend-item",children:[s.jsx("span",{className:["catalog-mark","catalog-mark--8",C.kind==="reducer"?"catalog-mark--reducer":"",C.kind==="seed"?"catalog-mark--seed":""].filter(Boolean).join(" ")}),s.jsx("span",{className:"catalog-anatomy__legend-label",children:C.label})]},C.label))}),s.jsx("div",{className:"catalog-anatomy",children:p.stages.map(C=>s.jsxs("div",{className:"catalog-anatomy__stage",children:[s.jsxs("div",{className:"catalog-anatomy__stage-head",children:[s.jsx("span",{"aria-hidden":"true",className:"catalog-anatomy__axis"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-anatomy__node"}),s.jsx("span",{className:"catalog-anatomy__index",children:C.index}),s.jsx("span",{className:"catalog-anatomy__id",children:C.id})]}),s.jsx("div",{className:"catalog-anatomy__mode",children:C.modeLabel}),s.jsx("div",{className:"catalog-anatomy__calls",children:C.calls.map(T=>s.jsxs("div",{className:"catalog-anatomy__call",children:[s.jsx("span",{"aria-hidden":"true",className:["catalog-mark","catalog-mark--8",T.reducer?"catalog-mark--reducer":"",C.seed?"catalog-mark--seed":""].filter(Boolean).join(" ")}),s.jsxs("span",{className:"catalog-anatomy__call-text",children:[s.jsx("span",{className:"catalog-anatomy__call-id",children:T.id}),s.jsx("span",{className:"catalog-anatomy__call-who",children:T.who})]})]},T.id))}),s.jsxs("div",{className:"catalog-anatomy__foot",children:[C.contextLabel===""?null:s.jsx("span",{className:"catalog-anatomy__ctx",children:C.contextLabel}),s.jsx("span",{className:C.aborts?"catalog-anatomy__failure catalog-anatomy__failure--abort":"catalog-anatomy__failure",children:C.failureLabel})]})]},C.id))})]}),s.jsxs("section",{"aria-label":"Declared variables",className:"catalog-section",children:[s.jsxs("div",{className:"catalog-section__head",children:[s.jsx("h2",{className:"catalog-section__stamp",children:"Declared variables"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-section__spacer"}),m.length>0&&x.length>0?s.jsx("button",{"aria-pressed":y,className:"catalog-bracket",onClick:()=>c(C=>({...C,[i.name]:!y})),type:"button",children:y?"[ required only ]":`[ show ${String(x.length)} optional ]`}):null]}),s.jsxs("p",{className:"catalog-section__note catalog-section__note--tabular",children:[String(m.length)," required ·"," ",String(x.length)," optional"]}),i.variables.length===0?s.jsx("p",{className:"catalog-card__empty",children:"No declared variables"}):s.jsxs("div",{className:"catalog-vars",children:[s.jsxs("div",{"aria-hidden":"true",className:"catalog-vars__header",children:[s.jsx("span",{children:"name"}),s.jsx("span",{children:"type"}),s.jsx("span",{children:"input"})]}),s.jsx(pA,{variables:A}),w===void 0?null:s.jsx("p",{className:"catalog-vars__note",children:w})]})]}),s.jsxs("section",{"aria-label":"Run handoff",className:"catalog-section catalog-section--last",children:[s.jsxs("div",{className:"catalog-section__head",children:[s.jsx("h2",{className:"catalog-section__stamp",children:"Run handoff"}),s.jsx("span",{className:"catalog-section__caption",children:"run_workflow · required variables only"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-section__spacer"}),s.jsx(ga,{label:`Copy ${i.name} run handoff`,text:f.copyHandoff})]}),s.jsx("div",{className:"catalog-handoff__body",children:s.jsx(wr,{children:f.copyHandoff})})]})]})]})}function a0(t){return t.map(F1).sort((a,i)=>e0(a.name,i.name,cA))}function s0(t,a){const i=a0(t);return i.find(r=>r.name===a)??i[0]}function gA(t,a){const i=[t.name,`$ ${t.command}`,t.parser,...t.supportsImages?["images"]:[],nm(t),`timeout ${La(t.timeoutSeconds)}`],r=Px(t);return r.note!==""&&i.push(r.note),a!==void 0&&a>0&&i.push(`${String(a)} ${a===1?"call":"calls"} on sheet`),i.join(", ")}function _A({adapters:t,compareOn:a=!1,onCompareToggle:i,onSelect:r,selectedName:c,useCounts:f}){const p=a0(t),h=s0(t,c),v=String(p.length),m=a||h===void 0?null:h.name;return s.jsxs("section",{"aria-label":"Adapter catalog",className:"catalog-index",children:[s.jsx(am,{countLabel:`[ ${v} ]`,infoLine:`[ configured adapters · ${v} ]`,title:"CLI adapters",...i===void 0?{}:{action:s.jsx("button",{"aria-pressed":a,className:a?"catalog-bracket catalog-bracket--on":"catalog-bracket",onClick:i,title:"every adapter side by side",type:"button",children:"[ compare ]"})}}),s.jsx(ji,{ariaLabel:"CLI adapters",items:p.map(x=>{const y=f?.[x.name],A=Px(x);return{id:x.name,label:gA(x,y),content:s.jsxs("div",{className:"catalog-card catalog-card--adapter",children:[s.jsxs("div",{className:"catalog-card__head",children:[s.jsx("span",{className:"catalog-card__name",children:x.name}),s.jsx("span",{"aria-hidden":"true",className:"catalog-card__spacer"}),y===void 0||y===0?null:s.jsx("span",{className:"catalog-card__usage",children:K1(y)})]}),s.jsxs("div",{className:"catalog-card__adapter-line",children:[s.jsxs("span",{className:"catalog-card__adapter-command",children:["$ ",x.command]}),s.jsx("span",{className:"catalog-chip",children:x.parser}),x.supportsImages?s.jsx("span",{className:"catalog-chip catalog-chip--muted",children:"images"}):null,s.jsx("span",{className:"catalog-card__adapter-sketch",children:nm(x)})]}),s.jsxs("div",{className:"catalog-card__foot",children:[s.jsx("span",{className:"catalog-card__foot-label",children:A.label}),A.note===""?null:s.jsx("span",{className:"catalog-card__foot-note",children:A.note}),s.jsx("span",{"aria-hidden":"true",className:"catalog-card__foot-hint",children:"detail ›"})]})]})}}),onSelect:x=>r?.(x),selectedId:m})]})}function sm(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function vA({adapter:t}){const a=b.useRef(null),i=X1(t),r=P1(t);return b.useLayoutEffect(()=>{const c=a.current;if(c!==null){if(i===null){c.style.removeProperty("--catalog-idle-pct");return}c.style.setProperty("--catalog-idle-pct",`${i.toFixed(1)}%`)}}),s.jsxs(s.Fragment,{children:[s.jsxs("div",{"aria-hidden":"true",className:i===null?"catalog-timing__bar":"catalog-timing__bar catalog-timing__bar--idle",ref:a,children:[i===null||r===null?null:s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"catalog-timing__idle-label",children:r}),s.jsx("span",{className:"catalog-timing__idle-wash"}),s.jsx("span",{className:"catalog-timing__idle-tick"})]}),s.jsx("span",{className:"catalog-timing__axis"}),s.jsx("span",{className:"catalog-timing__node catalog-timing__node--spawn"}),s.jsx("span",{className:"catalog-timing__node catalog-timing__node--end"})]}),s.jsxs("div",{"aria-hidden":"true",className:"catalog-timing__captions",children:[s.jsx("span",{children:"spawn"}),s.jsxs("span",{children:["timeout · ",La(t.timeoutSeconds)]})]})]})}function bA(t){return`catalog-dot catalog-dot--${t}`}function yA({onOpenUse:t,uses:a}){const i=a.slice(0,6),r=a.length-i.length;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"catalog-panel__uses",children:i.map(c=>s.jsxs("button",{className:"catalog-use",onClick:()=>t?.(c),type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:bA(c.status)}),s.jsx("span",{className:"catalog-use__label",children:c.label}),s.jsx("span",{className:"catalog-use__sub",children:c.sub}),s.jsx("span",{"aria-hidden":"true",className:"catalog-use__hint",children:"›"})]},c.id))}),r>0?s.jsxs("p",{className:"catalog-panel__foot",children:["+ ",String(r)," more on sheet"]}):null]})}function xA({adapter:t,adapters:a=[],onBack:i,onOpenUse:r,uses:c}){if(t===void 0)return s.jsx(Jx,{children:"Select a configured adapter to open it."});const f=Z1(t,c?.length),p=Q1(t),h=Y1(t),v=eA(a,t.roleNames);return s.jsxs("section",{className:"app-shell__view catalog-detail",children:[s.jsxs(wi,{children:[s.jsx("span",{className:"detail-sticky-bar__id",children:"adapter"}),s.jsx("span",{className:"detail-sticky-bar__name",children:t.name}),s.jsxs("span",{className:"detail-sticky-bar__muted",children:["$ ",t.command," · ",t.parser]}),s.jsx("span",{className:"detail-sticky-bar__spacer"})]}),s.jsxs("div",{className:"catalog-detail__back-bar",children:[i===void 0?null:s.jsx("button",{className:"catalog-back",onClick:i,type:"button",children:"‹ adapters"}),s.jsxs("span",{className:"catalog-detail__back-context",children:["$ ",t.command," · ",t.parser]})]}),s.jsxs("div",{className:"catalog-detail__content",children:[s.jsxs("div",{className:"catalog-detail__eyebrow",children:[s.jsx("span",{className:"catalog-detail__eyebrow-word",children:"adapter"}),s.jsx("span",{className:"catalog-chip",children:t.backend}),s.jsx("span",{className:"catalog-chip",children:t.parser}),t.supportsImages?s.jsx("span",{className:"catalog-chip catalog-chip--muted",children:"images"}):null]}),s.jsxs("div",{className:"catalog-detail__title-row",children:[s.jsx("h1",{className:"catalog-detail__name",children:t.name}),s.jsxs("span",{className:"catalog-detail__command",children:["$ ",t.command]}),s.jsx("span",{className:"catalog-detail__sketch",children:nm(t)})]}),s.jsx("div",{className:"catalog-facts",children:s.jsx("div",{className:"catalog-facts__group",children:f.map(m=>s.jsxs("span",{className:"catalog-facts__item",children:[s.jsx("span",{className:"catalog-facts__k",children:m.label}),s.jsx("span",{className:"catalog-facts__v",children:m.value})]},m.label))})}),s.jsxs("div",{className:"catalog-panels",children:[s.jsxs("section",{"aria-label":"Timing",className:"catalog-panel",children:[s.jsxs("div",{className:"catalog-panel__head",children:[s.jsx("h2",{className:"catalog-panel__stamp",children:"Timing"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),s.jsx("span",{className:"catalog-panel__caption",children:"seconds as configured"})]}),s.jsx(vA,{adapter:t}),s.jsx("div",{className:"catalog-panel__ledger",children:h.map(m=>s.jsxs("div",{className:"catalog-timing__row",children:[s.jsx("span",{className:"catalog-timing__key",children:m.key}),s.jsxs("span",{className:"catalog-timing__value",children:[m.value,m.raw===""?null:s.jsxs(s.Fragment,{children:[" ",s.jsx("span",{className:"catalog-timing__raw",children:m.raw})]})]}),s.jsx("span",{"aria-hidden":"true",className:"catalog-timing__key"}),s.jsx("span",{className:"catalog-timing__note",children:m.note})]},m.key))})]}),s.jsxs("div",{className:"catalog-panels__stack",children:[s.jsxs("section",{"aria-label":"Reachability",className:"catalog-panel",children:[s.jsxs("div",{className:"catalog-panel__head",children:[s.jsx("h2",{className:"catalog-panel__stamp",children:"Reachability"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),s.jsx("span",{className:`catalog-panel__flag catalog-panel__flag--${p.tone}`,children:p.label})]}),s.jsx("div",{className:"catalog-panel__chips",children:t.usableVia===void 0||t.usableVia.length===0?s.jsx("span",{className:"catalog-chip catalog-chip--pad catalog-chip--muted",children:"not reported"}):t.usableVia.map(m=>s.jsx("span",{className:"catalog-chip catalog-chip--pad",children:m},m))}),s.jsx("p",{className:"catalog-panel__note",children:J1(t)})]}),s.jsxs("section",{"aria-label":"Result contract",className:"catalog-panel",children:[s.jsxs("div",{className:"catalog-panel__head",children:[s.jsx("h2",{className:"catalog-panel__stamp",children:"Result contract"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),s.jsx("span",{className:"catalog-panel__value",children:t.resultContract.enabled?t.resultContract.filename:"none"})]}),s.jsx("p",{className:"catalog-panel__note",children:W1(t)})]})]}),s.jsxs("section",{"aria-label":"Roles and environment keys",className:"catalog-panel",children:[s.jsxs("div",{className:"catalog-panel__head",children:[s.jsx("h2",{className:"catalog-panel__stamp",children:"Roles"}),s.jsx("span",{className:"catalog-panel__count",children:String(t.roleNames.length)})]}),s.jsx("div",{className:"catalog-panel__chips",children:t.roleNames.map(m=>s.jsx("span",{className:"catalog-chip catalog-chip--pad",children:m},m))}),v===null?null:s.jsx("p",{className:"catalog-panel__note",children:v}),s.jsxs("div",{className:"catalog-panel__head catalog-panel__head--divided",children:[s.jsx("h2",{className:"catalog-panel__stamp",children:"Env keys"}),s.jsx("span",{className:"catalog-panel__count",children:String(t.environmentKeys.length)}),s.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),s.jsx("span",{className:"catalog-panel__caption",children:"names only · values never served"})]}),t.environmentKeys.length===0?s.jsx("p",{className:"catalog-panel__empty",children:nA()}):s.jsx("div",{className:"catalog-panel__chips",children:t.environmentKeys.map(m=>s.jsx("span",{className:"catalog-chip catalog-chip--pad",children:m},m))})]}),c===void 0?null:s.jsxs("section",{"aria-label":"On sheet",className:"catalog-panel catalog-panel--sheet",children:[s.jsxs("div",{className:"catalog-panel__head",children:[s.jsx("h2",{className:"catalog-panel__stamp",children:"On sheet"}),s.jsx("span",{"aria-hidden":"true",className:"catalog-panel__spacer"}),s.jsx("span",{className:"catalog-panel__caption catalog-panel__caption--tabular",children:sA(c)})]}),c.length===0?s.jsx("p",{className:"catalog-panel__empty",children:"no loaded call ran through this adapter"}):s.jsx(yA,{onOpenUse:r,uses:c})]})]})]})]})}function jA({adapters:t,differencesOnly:a=!1,onClose:i,onDifferencesToggle:r,onOpenAdapter:c,selectedName:f,useCounts:p}){const h=lA(t,p),v=h.filter(C=>C.same).length,m=a?h.filter(C=>!C.same):h,x=b.useRef(null),[y,A]=b.useState(!1),w=()=>{const C=x.current;if(C===null)return;const T=C.scrollWidth-C.clientWidth-C.scrollLeft>2;A(N=>N===T?N:T)};return b.useLayoutEffect(w),s.jsx("section",{className:"app-shell__view catalog-detail",children:s.jsxs("div",{className:"catalog-detail__content",children:[s.jsxs("div",{className:"catalog-detail__eyebrow",children:[s.jsx("span",{className:"catalog-detail__eyebrow-word",children:"adapters"}),s.jsx("span",{className:"catalog-chip",children:"compare"})]}),s.jsxs("div",{className:"catalog-detail__title-row",children:[s.jsx("h1",{className:"catalog-detail__name",children:"Compare adapters"}),s.jsxs("div",{className:"catalog-detail__actions",children:[s.jsx("button",{"aria-pressed":a,className:"catalog-bracket",onClick:()=>r?.(),title:"hide the rows that read the same on every adapter",type:"button",children:a?`[ all ${String(h.length)} facts ]`:"[ differences only ]"}),s.jsx("button",{className:"catalog-bracket",onClick:()=>i?.(),type:"button",children:"[ close ]"})]})]}),s.jsx("p",{className:"catalog-compare__note",children:iA(t.length,h.length,v,a)}),s.jsxs("div",{className:"catalog-compare",children:[s.jsxs("div",{className:"catalog-compare__scroll",onScroll:w,ref:x,children:[s.jsxs("div",{className:"catalog-compare__head-row",children:[s.jsx("span",{"aria-hidden":"true",className:"catalog-compare__label"}),t.map(C=>s.jsx("button",{className:C.name===f?"catalog-compare__head-btn catalog-compare__head-btn--sel":"catalog-compare__head-btn",onClick:()=>c?.(C.name),title:`open ${C.name}`,type:"button",children:C.name},C.name))]}),m.map(C=>s.jsxs("div",{className:"catalog-compare__row",children:[s.jsx("span",{className:"catalog-compare__label",children:C.label}),C.cells.map((T,N)=>s.jsx("span",{className:["catalog-compare__cell",C.same?"catalog-compare__cell--same":"",t[N]?.name===f?"catalog-compare__cell--sel":""].filter(Boolean).join(" "),children:rA(T)},t[N]?.name??String(N)))]},C.label)),m.length===0?s.jsxs("p",{className:"catalog-compare__empty",children:["every fact reads the same on all ",String(t.length)," adapters"]}):null]}),s.jsx("span",{"aria-hidden":"true",className:"catalog-compare__fade","data-on":y?"true":"false"})]})]})})}function tc({groupLabel:t,chips:a,selected:i,onSelect:r}){return s.jsx("div",{"aria-label":t,className:"run-list__filters",role:"group",children:a.filter(c=>c.count>0||c.id===i||c.id==="all").map(c=>s.jsxs("button",{"aria-pressed":i===c.id,onClick:()=>{i!==c.id&&r(c.id)},type:"button",children:[s.jsx("span",{children:c.label}),s.jsx("span",{className:"run-list__filter-count",children:String(c.count)})]},c.id))})}const wA=["all","orphaned","running","succeeded","partial","failed","cancelled"];function Oa(t){return[t.runId,t.runGeneration,t.stateRevision,t.stageId,t.callId].join("\0")}function Bb(t){return[t.runId,t.runGeneration,t.stateRevision].join("\0")}function SA(t,a){return t!==void 0&&t.runId===a.runId&&t.runGeneration===a.runGeneration&&t.stateRevision===a.stateRevision}function NA(t){return Mr(t)==="orphaned"?"orphaned":t.status==="failed"&&t.stageCounts.succeeded>0?"partial":t.status}function kA(t){return t instanceof Bn?t.kind==="auth_expired"?"Authentication expired; artifact references were not loaded.":t.kind==="connection_changed"?"Dashboard connection changed; rebootstrap is required.":t.kind==="offline"?"Offline; artifact references could not be refreshed.":t.code==="artifact_catalog_limit_exceeded"?"The retained artifact reference catalog exceeded its server bound; no partial page was returned.":"Artifact references could not be loaded.":"Artifact references could not be loaded."}function AA(t){return t instanceof Bn?t.kind==="auth_expired"?"Authentication expired; artifact bytes were not loaded.":t.kind==="connection_changed"?"Dashboard connection changed; rebootstrap is required.":t.kind==="offline"?"Offline; artifact bytes were not loaded.":t.kind==="malformed_json"?"The inspected artifact was malformed JSON; no content was displayed.":t.kind==="stale_revision"||t.code==="run_state_changed"?"The run revision changed after this reference was loaded; refetch the artifact catalog.":t.status===404||t.code==="not_found"||t.code==="run_generation_changed"?"This retained reference was pruned or its run ID was recycled; refetch the artifact catalog.":t.code==="content_too_large_for_dashboard"?"The artifact exceeds the dashboard inspection cap; no content was displayed.":"Artifact inspection failed; no content was displayed.":"Artifact inspection failed."}function l0(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function RA(t){return`${t.runId} ${t.stageId} ${t.callId} JSON validation deferred until inspect`}function EA({collapsed:t,group:a,reference:i,onToggle:r}){const c=a.references.length;return s.jsxs("button",{"aria-expanded":!t,className:"artifact-group__head",onClick:r,title:a.title??void 0,type:"button",children:[s.jsxs("span",{className:"artifact-group__head-row",children:[s.jsx("span",{className:"artifact-group__name",children:a.name??`run ${i.runId}`}),a.status===null?null:s.jsx("span",{className:`artifact-stamp artifact-stamp--${a.status}`,children:a.status}),s.jsx("span",{"aria-hidden":"true",className:"artifact-group__chevron","data-open":!t})]}),s.jsxs("span",{className:"artifact-group__meta",children:["run ",i.runId," · ",String(c)," ref",c===1?"":"s"," ·"," ","gen ",i.runGeneration," · rev ",i.stateRevision]})]})}function TA(t){return t.phase==="loading"?{label:"validating…",tone:"validating"}:t.phase==="current"?{label:"validated",tone:"validated"}:t.phase==="error"?{label:"rejected",tone:"rejected"}:null}function Gb({nextReference:t,onStep:a,positionLabel:i,previousReference:r}){return s.jsxs("span",{className:"artifact-stepper",children:[s.jsx("button",{"aria-label":"previous reference",className:"artifact-stepper__button",disabled:r===void 0,onClick:()=>{r!==void 0&&a(r)},title:"previous reference",type:"button",children:"‹"}),s.jsx("span",{className:"artifact-stepper__position",children:i}),s.jsx("button",{"aria-label":"next reference",className:"artifact-stepper__button",disabled:t===void 0,onClick:()=>{t!==void 0&&a(t)},title:"next reference",type:"button",children:"›"})]})}function CA({active:t=!1,api:a,mobileView:i="list",onBackToList:r,onLoadedCount:c,onSelectReference:f,runs:p,runsRoot:h,selection:v=null}){const m=l0(),[x,y]=b.useState([void 0]),[A,w]=b.useState(0),[C,T]=b.useState(null),[N,I]=b.useState("loading"),[k,q]=b.useState(null),[E,M]=b.useState({phase:"idle"}),[D,F]=b.useState(null),[te,oe]=b.useState("all"),[P,ue]=b.useState({}),[_e,ge]=b.useState({}),[be,ve]=b.useState(null),$=b.useRef(null),ae=b.useRef(null),ce=b.useRef(0),de=b.useCallback(async(le,Ae)=>{$.current?.controller.abort();const Ie=new AbortController,qe=++ce.current;$.current={id:qe,controller:Ie},I("loading"),q(null);let ot=le,$t=Ae;try{for(;;){const pt=$t[ot],Je=await a.listArtifacts({...pt===void 0?{}:{before:pt},signal:Ie.signal});if($.current?.id!==qe||Ie.signal.aborted)return;if(Je.artifacts.length>0||ot===0){y($t),w(ot),T(Je),I("current"),c?.(Je.artifacts.length),M(ht=>ht.phase==="idle"||Je.artifacts.some(kt=>Oa(kt)===Oa(ht.reference))?ht:{phase:"idle"}),ve(ht=>ht!==null&&Je.artifacts.some(kt=>Oa(kt)===ht)?ht:null);return}ot-=1,$t=$t.slice(0,ot+1),F({key:`artifact-page-pruned-${String(qe)}-${String(ot)}`,message:"That artifact page was pruned; returned to the nearest newer page."})}}catch(pt){if($.current?.id!==qe||Ie.signal.aborted)return;I("error"),q(kA(pt))}},[a,c]);b.useEffect(()=>(de(0,[void 0]),()=>{$.current?.controller.abort(),ae.current?.abort()}),[de]);const ye=b.useCallback(le=>{ae.current?.abort();const Ae=new AbortController;ae.current=Ae,M({phase:"loading",reference:le}),a.inspectArtifact(le,Ae.signal).then(Ie=>{if(Ae.signal.aborted||ae.current!==Ae)return;M({phase:"current",reference:le,inspection:Ie});const qe=Oa(le);ge(ot=>ot[qe]===!0?ot:{...ot,[qe]:!0})}).catch(Ie=>{Ae.signal.aborted||ae.current!==Ae||Ie instanceof Bn&&Ie.kind==="aborted"||M({phase:"error",reference:le,message:AA(Ie)})})},[a]),S=b.useRef(ye);b.useEffect(()=>{S.current=ye},[ye]);const L=C?.artifacts??[],B=b.useMemo(()=>{const le=new Map;for(const Ie of p??[])Ie.availability==="available"&&(le.has(Ie.runId)||le.set(Ie.runId,Ie));const Ae=[];for(let Ie=0;Ie<L.length;Ie+=1){const qe=L[Ie];if(qe===void 0)continue;const ot=Bb(qe);if(SA(L[Ie-1],qe)){Ae[Ae.length-1]?.references.push(qe);continue}const $t=le.get(qe.runId);Ae.push({key:ot,references:[qe],name:$t?.workflowName??null,status:$t===void 0?null:NA($t),title:h===void 0?null:`${h}/${qe.runId}/artifacts/`})}return Ae},[L,p,h]),Q=b.useMemo(()=>te==="all"?B:B.filter(le=>le.status===te),[B,te]),me=b.useMemo(()=>{const le=[];for(const Ae of Q)P[Ae.key]!==!0&&le.push(...Ae.references);return le},[P,Q]),H=b.useMemo(()=>{if(v!==null){const le=L.find(Ae=>Ae.runId===v.runId&&Ae.stageId===v.stageId&&Ae.callId===v.callId);if(le!==void 0)return le}if(be!==null){const le=L.find(Ae=>Oa(Ae)===be);if(le!==void 0)return le}if(!m)return me[0]},[L,m,be,v,me]),pe=H===void 0?null:Oa(H);b.useEffect(()=>{if(H===void 0){ae.current?.abort(),M({phase:"idle"});return}S.current(H)},[pe]);const Be=le=>{ve(Oa(le)),f?.({runId:le.runId,stageId:le.stageId,callId:le.callId})},Se=()=>{if(C?.nextBefore===void 0)return;const le=[...x.slice(0,A+1),C.nextBefore];de(A+1,le)},Re=()=>{A!==0&&de(A-1,x)},Qe=()=>{H!==void 0&&S.current(H)},Vt=H===void 0?void 0:B.find(le=>le.key===Bb(H)),Kt=pe===null?-1:me.findIndex(le=>Oa(le)===pe),Tt=Kt>0?me[Kt-1]:void 0,Qt=Kt>=0&&Kt<me.length-1?me[Kt+1]:void 0,Dt=`${String(Kt+1)} / ${String(me.length)}`,Jt=`${String(Kt+1)} of ${String(me.length)}`,Wt=me.length>1,Zt=N!=="error"&&L.length>0&&C?.nextBefore===void 0,rn=String(L.length),Ln=h===void 0?`[ ${rn} loaded references ]`:`[ RUNS_ROOT = ${h} ]`,on=wA.map(le=>({id:le,label:le,count:le==="all"?B.length:B.filter(Ae=>Ae.status===le).length})),en=s.jsxs("section",{"aria-label":"Run artifacts",className:"artifact-catalog",children:[s.jsx(am,{countLabel:`[ ${rn} references ]`,infoLine:Ln,title:"Run artifacts"}),s.jsx(Hh,{announcement:D}),N==="loading"&&C===null?s.jsx(id,{message:"Loading artifact references…",role:"status"}):null,N==="error"?s.jsx(id,{message:k??"Artifact references could not be loaded.",retry:{label:"[ retry artifacts ]",run:()=>{de(A,x)}},role:"alert"}):null,B.length>0?s.jsx(tc,{chips:on,groupLabel:"Filter artifact groups by run status",onSelect:oe,selected:te}):null,N!=="error"&&L.length===0?s.jsx("p",{className:"artifact-empty",children:"No retained artifact references are loaded on this page."}):null,L.length>0&&Q.length===0?s.jsx("p",{className:"artifact-empty",children:`No loaded artifact references match “${te}”.`}):null,Q.length>0?s.jsx(ji,{ariaLabel:"Retained artifact references",items:Q.flatMap(le=>{const Ae=P[le.key]===!0,[Ie]=le.references;return Ie===void 0?[]:le.references.map((qe,ot)=>{const $t=le.references[ot-1];return{id:Oa(qe),label:RA(qe),disabled:Ae,group:{header:s.jsx(EA,{collapsed:Ae,group:le,onToggle:()=>{ue(pt=>({...pt,[le.key]:!Ae}))},reference:Ie}),id:le.key,label:`${le.name??`run ${Ie.runId}`} artifact references`},content:s.jsx("div",{className:["artifact-option",ot===0?"artifact-option--group-start":"",ot===le.references.length-1||Ae?"artifact-option--group-end":"",Ae?"artifact-option--collapsed":""].filter(Boolean).join(" "),"data-collapsed":Ae?"true":void 0,children:Ae?null:s.jsxs(s.Fragment,{children:[$t===void 0||$t.stageId!==qe.stageId?s.jsx("div",{className:"artifact-stage",children:qe.stageId}):null,s.jsxs("div",{className:"artifact-row",children:[s.jsxs("span",{className:"artifact-row__file",children:[qe.callId,".json"]}),s.jsx("span",{className:["artifact-row__meta",_e[Oa(qe)]===!0?"artifact-row__meta--validated":""].filter(Boolean).join(" "),children:_e[Oa(qe)]===!0?"validated":"deferred"}),s.jsx("span",{"aria-hidden":"true",className:"artifact-row__hint",children:"›"})]})]})})}})}),onSelect:le=>{const Ae=L.find(Ie=>Oa(Ie)===le);Ae!==void 0&&Be(Ae)},selectedId:pe}):null,s.jsxs("nav",{"aria-label":"Artifact pages",className:"artifact-pager",children:[s.jsx("button",{"aria-label":"newer artifacts",className:"artifact-pager__chip",disabled:A===0||N==="loading",onClick:Re,type:"button",children:"[ newer ]"}),s.jsx("button",{"aria-label":"older artifacts",className:"artifact-pager__chip",disabled:C?.nextBefore===void 0||N==="loading",onClick:Se,type:"button",children:"[ older ]"})]}),Zt?s.jsx("p",{className:"artifact-pager__note",children:"end of retained references"}):null]}),rt=TA(E);let Ue;if(H===void 0)Ue=s.jsx("section",{"aria-live":"off",className:"app-shell__view",children:s.jsx("p",{className:"artifact-inspector__empty",children:"Select a reference to validate it on the server and inspect the bytes."})});else{const le=H,Ae=`${le.callId}.json`,Ie=Vt?.name===void 0||Vt.name===null?le.stageId:`${le.stageId} · ${Vt.name}`,qe=Vt?.status===null||Vt?.status===void 0?null:`artifact-stamp artifact-stamp--${Vt.status}`,ot=[["run",le.runId],["generation",le.runGeneration],["revision",le.stateRevision],["kind",le.kind],["reference",Jt]],$t={nextReference:Qt,onStep:Be,positionLabel:Dt,previousReference:Tt};Ue=s.jsxs("section",{"aria-live":"off",className:"app-shell__view catalog-detail",children:[s.jsxs(wi,{children:[s.jsxs("span",{className:"detail-sticky-bar__id",children:["run ",le.runId]}),qe===null?null:s.jsx("span",{className:qe,children:Vt?.status}),s.jsxs("span",{className:"detail-sticky-bar__name",children:[le.stageId," / ",Ae]}),s.jsx("span",{className:"detail-sticky-bar__spacer"}),s.jsx("span",{className:"detail-sticky-bar__wide",children:Wt?s.jsx(Gb,{...$t}):null})]}),s.jsxs("div",{className:"catalog-detail__back-bar",children:[r===void 0?null:s.jsx("button",{className:"catalog-back",onClick:r,type:"button",children:"‹ artifacts"}),s.jsxs("span",{className:"catalog-detail__back-context",children:["run ",le.runId]}),qe===null?null:s.jsx("span",{className:qe,children:Vt?.status})]}),s.jsxs("div",{className:"catalog-detail__content",children:[s.jsxs("div",{className:"catalog-detail__eyebrow",children:[s.jsx("span",{className:"catalog-detail__eyebrow-word",children:"artifact reference"}),qe===null?null:s.jsx("span",{className:qe,children:Vt?.status}),s.jsx("span",{className:"artifact-chip",children:"json"}),rt===null?null:s.jsx("span",{className:`artifact-chip artifact-chip--${rt.tone}`,children:rt.label})]}),s.jsxs("div",{className:"catalog-detail__title-row",children:[s.jsx("h1",{className:"catalog-detail__name",children:Ae}),s.jsx("span",{className:"catalog-detail__version",children:Ie}),s.jsxs("div",{className:"catalog-detail__actions",children:[E.phase==="current"?s.jsx(ga,{label:`Copy ${le.callId} validated artifact bytes`,text:E.inspection.content}):null,Wt?s.jsx(Gb,{...$t}):null]})]}),s.jsxs("div",{className:"catalog-facts",children:[s.jsx("div",{className:"catalog-facts__group",children:ot.map(([pt,Je])=>s.jsxs("span",{className:"catalog-facts__item",children:[s.jsx("span",{className:"catalog-facts__k",children:pt}),s.jsx("span",{className:"catalog-facts__v",children:Je})]},pt))}),s.jsxs("div",{className:"catalog-facts__actions",children:[E.phase==="current"?s.jsx(ga,{label:`Copy ${le.callId} validated artifact bytes`,text:E.inspection.content}):null,Wt?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"catalog-bracket catalog-bracket--target44",disabled:Tt===void 0,onClick:()=>{Tt!==void 0&&Be(Tt)},type:"button",children:"‹ previous"}),s.jsx("button",{className:"catalog-bracket catalog-bracket--target44",disabled:Qt===void 0,onClick:()=>{Qt!==void 0&&Be(Qt)},type:"button",children:"next ›"})]}):null]})]}),E.phase==="loading"?s.jsxs("div",{className:"artifact-phase artifact-phase--loading",role:"status",children:[s.jsxs("div",{className:"artifact-phase__line",children:[s.jsx("span",{"aria-hidden":"true",className:"artifact-dot artifact-dot--breathing"}),s.jsx("span",{children:"Validating artifact on the server…"})]}),s.jsx("div",{"aria-hidden":"true",className:"artifact-phase__placeholder"})]}):null,E.phase==="error"?s.jsxs("div",{className:"artifact-phase artifact-phase--error",role:"alert",children:[s.jsx("h2",{className:"artifact-phase__stamp",children:"Inspection failed"}),s.jsx("p",{className:"artifact-phase__message",children:E.message}),s.jsx("button",{className:"catalog-bracket artifact-phase__retry",onClick:Qe,type:"button",children:"[ retry inspection ]"})]}):null,E.phase==="current"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"artifact-ok__line",children:[s.jsx("span",{"aria-hidden":"true",className:"artifact-dot artifact-dot--ok"}),s.jsx("span",{role:"status",children:"Server validation succeeded."})]}),s.jsxs("div",{className:"artifact-vfacts",children:[s.jsxs("div",{className:"artifact-vfacts__item",children:[s.jsx("span",{className:"artifact-vfacts__k",children:"validator schema id"}),s.jsx("span",{className:"artifact-vfacts__v",children:E.inspection.validatorId})]}),s.jsxs("div",{className:"artifact-vfacts__item",children:[s.jsx("span",{className:"artifact-vfacts__k",children:"validated byte size"}),s.jsxs("span",{className:"artifact-vfacts__v",children:[String(E.inspection.byteSize)," bytes"]})]}),s.jsxs("div",{className:"artifact-vfacts__item",children:[s.jsx("span",{className:"artifact-vfacts__k",children:"revision fence"}),s.jsxs("span",{className:"artifact-vfacts__v",children:['etag "',le.stateRevision,'" matched']})]})]}),s.jsxs("div",{className:"artifact-view__head",children:[s.jsx("span",{"aria-hidden":"true",className:"catalog-section__spacer"}),s.jsx("span",{className:"artifact-view__caption",children:"bounded json"})]}),s.jsxs("div",{className:"artifact-view__body",children:[s.jsx(Sd,{content:E.inspection.content,mediaType:"application/json"}),s.jsx("p",{className:"artifact-view__note",children:"keyed collection view · raw preserves exact bytes"})]})]}):null]})]})}return s.jsx(Hs,{detail:Ue,detailAriaLabel:"Artifact inspection",listAriaLabel:"Artifact references",mobileView:i,runList:s.jsxs("section",{"aria-live":"off",className:"app-shell__view",children:[s.jsx("h1",{className:"visually-hidden",id:t?"dashboard-page-title":void 0,children:"Artifacts"}),en]})})}const OA=bN(),ju={};function $A(){return{input:yr(),output:yr(),error:yr(),artifact:yr()}}function MA(t){return t instanceof Ya?t.code==="run_state_changed"?"run_state_changed":t.code==="content_too_large_for_dashboard"?"content_too_large_for_dashboard":t.code==="not_found"?"not_found":t.kind==="auth_expired"?"auth_expired":t.kind==="connection_changed"?"connection_changed":t.kind==="offline"?"offline":"request_error":"request_error"}function IA({content:t,kind:a,label:i}){const[r,c]=b.useState("rendered"),f=b.useMemo(()=>AN(t.content),[t.content]),p={input:"Prompt",output:"Output",error:"Error",artifact:"Artifact"};return s.jsxs("section",{className:"persisted-call-inspector__loaded-pane",children:[s.jsxs("header",{className:"persisted-call-inspector__content-heading",children:[s.jsx("h3",{children:p[a]}),s.jsxs("p",{children:[i," · ",t.mediaType]})]}),s.jsx(Zh,{activeTabId:r,ariaLabel:`${i} representation`,onChange:c,tabs:[{id:"rendered",label:"rendered",panel:s.jsxs("div",{className:"persisted-call-inspector__representation","data-representation":"rendered","data-value-kind":f.kind,children:[s.jsxs("div",{className:"persisted-call-inspector__representation-header",children:[s.jsx("p",{className:"persisted-call-inspector__format",children:f.kind==="json"?"bounded json":"escaped text"}),s.jsx(ga,{label:`Copy ${i}`,text:t.content})]}),s.jsx(wr,{children:f.rendered}),f.truncated?s.jsx("p",{className:"persisted-call-inspector__notice",role:"status",children:"Rendered JSON reached the viewer depth or node limit. Raw persisted content remains available."}):null]})},{id:"raw",label:"raw",panel:s.jsxs("div",{className:"persisted-call-inspector__representation","data-representation":"raw",children:[s.jsx("div",{className:"persisted-call-inspector__representation-header",children:s.jsx(ga,{label:`Copy ${i}`,text:t.content})}),s.jsx(wr,{children:t.content})]})}]}),s.jsx("p",{className:"persisted-call-inspector__pane-foot",children:"bounded persisted content · byte-capped · loaded per pane on demand"})]})}function LA({kind:t,label:a,onRetry:i,state:r}){return r===void 0||r.status==="loading"?s.jsxs("p",{role:"status",children:["Loading ",a,"…"]}):r.status==="error"?s.jsxs("div",{className:"persisted-call-inspector__pane-state",children:[s.jsx("p",{role:"alert",children:SN(r.failure)}),s.jsxs("button",{onClick:i,type:"button",children:["Retry ",a]})]}):s.jsx(IA,{content:r.content,kind:t,label:a})}function DA({api:t=OA,applicationRootId:a,call:i,callNavigation:r,onClose:c,onObsoleteSelection:f,open:p,selection:h,sessionLogApi:v}){const m=l0(),x=i,y=jN(x),A=[h.runId,h.runGeneration,i.stageId,i.callId].join("\0"),w=`${A}\0${p?"open":"closed"}`,C=y[0]?.kind??(v===void 0?null:"conversation"),[T,N]=b.useState({identity:w,pane:C}),I=T.identity===w?T.pane:C,k=I==="conversation"?v===void 0?C:I:I!==null&&y.some(({kind:L})=>L===I)?I:C,q=b.useCallback(L=>{N({identity:w,pane:L})},[w]),[E,M]=b.useState(()=>C==="conversation");b.useEffect(()=>{M(!1)},[A]),b.useEffect(()=>{k==="conversation"&&M(!0)},[k]);const D=`${A}\0${h.stateRevision}`,[F,te]=b.useState({identity:D,states:ju}),oe=F.identity===D?F.states:ju,P=b.useCallback(L=>{te(B=>({identity:D,states:L(B.identity===D?B.states:ju)}))},[D]),ue=b.useRef($A()),_e="persisted-call-inspector-title",ge=b.useCallback(()=>{for(const L of Object.values(ue.current))L.cancel()},[]);b.useEffect(()=>{ge(),P(()=>ju)},[ge,h.stateRevision,P]),b.useEffect(()=>ge,[ge]),b.useEffect(()=>{if(!p||r===void 0)return;const L=B=>{const Q=B.target;Q instanceof HTMLElement&&(Q.isContentEditable||Q.closest("pre,textarea,input,[contenteditable]")!==null)||(B.key==="ArrowLeft"?(B.preventDefault(),r.onStepCall(-1)):B.key==="ArrowRight"&&(B.preventDefault(),r.onStepCall(1)))};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[r,p]);const be=b.useCallback(L=>{const B=ue.current[L],Q=B.begin(h);P(me=>({...me,[L]:{status:"loading"}})),t.readPane({...h,stageId:i.stageId,callId:i.callId,kind:L},Q.signal).then(me=>{if(B.accepts(Q.identity,h)){if(!B.acceptsEtag(Q.identity,me.etag)){P(H=>({...H,[L]:{status:"error",failure:"obsolete_etag"}}));return}P(H=>({...H,[L]:{status:"loaded",content:me}}))}}).catch(me=>{if(B.accepts(Q.identity,h)){if(me instanceof Ya&&me.code==="run_generation_changed"){f(),c();return}me instanceof Ya&&me.kind==="aborted"||P(H=>({...H,[L]:{status:"error",failure:MA(me)}}))}})},[t,i.callId,i.stageId,c,f,h,P]);b.useEffect(()=>{!p||k===null||k==="conversation"||oe[k]!==void 0||be(k)},[k,be,p,oe]);const ve=wN(x),$=r!==void 0&&r.total>1&&r.position>=1&&r.position<=r.total,ae=$&&r.position>1,ce=$&&r.position<r.total,de=b.useCallback(L=>{r!==void 0&&(L===-1&&!ae||L===1&&!ce||r.onStepCall(L))},[r,ce,ae]),ye=b.useCallback(()=>{f(),c()},[c,f]),S=[...y.map(L=>({id:L.kind,label:m?xN[L.kind]:L.label,panel:s.jsx(LA,{kind:L.kind,label:L.label,onRetry:()=>be(L.kind),state:oe[L.kind]})})),...v===void 0?[]:[{id:"conversation",label:"conversation",...E?{keepMounted:!0}:{},panel:s.jsx(wd,{active:k==="conversation",api:v,fill:!0,onGenerationChanged:ye,refreshToken:h.stateRevision,scope:{family:"workflow",runId:h.runId,runGeneration:h.runGeneration,stageId:i.stageId,callId:i.callId}})}]];return s.jsxs(vd,{applicationRootId:a,labelledBy:_e,onClose:c,open:p,panelClassName:"accessible-dialog--sheet",children:[s.jsx("button",{"aria-label":"close inspector",className:"persisted-call-inspector__grab-handle",onClick:c,type:"button",children:s.jsx("span",{"aria-hidden":"true"})}),s.jsxs("header",{className:"persisted-call-inspector__header",children:[s.jsxs("div",{className:"persisted-call-inspector__heading",children:[s.jsx("h2",{className:"visually-hidden",id:_e,children:"Call inspector"}),s.jsxs("div",{className:"persisted-call-inspector__title-line",children:[s.jsx("strong",{children:i.callId}),i.snapshotIdentity===void 0?null:s.jsxs("span",{className:"persisted-call-inspector__identity-badge",children:[i.snapshotIdentity.adapter," · ",i.snapshotIdentity.role]}),cx(i.invocation,i.observedInvocation).map((L,B)=>{const Q=B===1?"effort":"model";return s.jsx("span",{className:"persisted-call-inspector__identity-badge persisted-call-inspector__knob-badge",children:L},Q)}),s.jsx("span",{className:"persisted-call-inspector__status","data-state":i.state,children:i.state}),$?s.jsxs("span",{className:"persisted-call-inspector__call-nav",children:[s.jsx("button",{"aria-label":"previous call",className:"persisted-call-inspector__call-nav-btn",disabled:!ae,onClick:()=>de(-1),title:"previous call (←)",type:"button",children:"‹"}),s.jsxs("span",{className:"persisted-call-inspector__call-nav-label",children:[String(r.position)," / ",String(r.total)]}),s.jsx("button",{"aria-label":"next call",className:"persisted-call-inspector__call-nav-btn",disabled:!ce,onClick:()=>de(1),title:"next call (→)",type:"button",children:"›"})]}):null]}),s.jsxs("div",{className:"persisted-call-inspector__meta-line",children:[s.jsxs("p",{className:"persisted-call-inspector__identity",children:[m&&i.snapshotIdentity!==void 0?`${i.snapshotIdentity.adapter} · ${i.snapshotIdentity.role} · `:"","run ",h.runId," · stage ",i.stageId,i.durationMs===void 0?"":` · duration ${Xa(i.durationMs)}`]}),s.jsx("span",{className:"persisted-call-inspector__close-hint",children:"esc to close"})]})]}),s.jsx("button",{"aria-label":"Close inspector",className:"persisted-call-inspector__close",onClick:c,type:"button",children:"×"})]}),s.jsxs("div",{className:"persisted-call-inspector__body","data-conversation":k==="conversation"?"true":void 0,children:[s.jsxs("p",{className:"persisted-call-inspector__scope-note",children:["persisted call content is separate from the redacted per-attempt session log",i.hasWorkflowInput?" · workflow input is not the fully composed provider prompt":""]}),ve?s.jsx("p",{className:"persisted-call-inspector__notice",role:"status",children:ve}):null,S.length===0||k===null?s.jsx("p",{className:"persisted-call-inspector__empty",children:"No persisted call content is available."}):s.jsx(Zh,{activeTabId:k,ariaLabel:"Persisted call content",onChange:L=>q(L),tabs:S})]})]})}const i0="clinkx-dashboard-verified-repair-v1",Co=wt().regex(/^[a-f0-9]{64}$/),Xp=wt().min(1).max(6e3),zA=Ke({schema_version:it(i0),availability:dt(["available","unrecorded","unavailable"]),scope:it("at_publication"),ownerAcceptance:it("not_recorded"),reason:dt(["record_unavailable","invalid_projection"]).optional(),executionStatus:dt(["completed","failed","cancelled","interrupted"]).optional(),repairStatus:dt(["verified","blocked","incomplete","failed"]).optional(),frozenDigest:Co.optional(),fixedSourceDigest:Co.optional(),editedPaths:Zn(Ke({phase:dt(["regression","implementation"]),path:wt().min(1).max(512),originalSha256:Co,replacementSha256:Co,status:dt(["applied","original","replacement","unknown"])}).strict()).max(16),phases:Zn(Ke({phase:dt(["capture","reproduce","fixed_regression","fixed_required","copy_preparation","copy_fixed","copy_without_fix","copy_restored","final_required"]),coverageStatus:dt(["complete","incomplete","inapplicable","failed"]),outcome:dt(["assertion_failed","assertion_passed","harness_error"]).optional(),expectationsSha256:Co}).strict()).max(16),reviewVerdict:dt(["approve","request_changes"]).optional(),findings:Zn(Ke({severity:dt(["material","nonblocking"]),message:Xp,citedPaths:Zn(wt().min(1).max(512)).max(64)}).strict()).max(64),gaps:Zn(Xp).max(64),ownerNextSteps:Zn(Xp).max(8)}).strict().superRefine((t,a)=>{t.availability==="available"&&(t.executionStatus===void 0||t.repairStatus===void 0||t.frozenDigest===void 0)&&a.addIssue({code:ee.custom,message:"available repair needs publication status and identity"}),t.availability!=="available"&&(t.executionStatus!==void 0||t.repairStatus!==void 0||t.frozenDigest!==void 0||t.fixedSourceDigest!==void 0||t.reviewVerdict!==void 0||t.editedPaths.length!==0||t.phases.length!==0||t.findings.length!==0||t.gaps.length!==0||t.ownerNextSteps.length!==0)&&a.addIssue({code:ee.custom,message:"unavailable repair cannot claim historical outcomes"})});function qA(t,a){return{schema_version:i0,availability:t,scope:"at_publication",ownerAcceptance:"not_recorded",editedPaths:[],phases:[],findings:[],gaps:[],ownerNextSteps:[],reason:a}}const zh="clinkx-invocation-audit-v2",Hb="clinkx-observed-invocation-v1",Vb="context-builder-invocation-audit-v1",Fb="context-builder-invocation-audit-v2",UA=["caller_override","adapter_pin","cli_default_unknown"],BA=["caller_override","adapter_pin","adapter_default","cli_default_unknown"],GA=["claude_stream_json_init","codex_app_server_thread_start"];class HA extends Error{constructor(a){super(a),this.name="InvocationAuditParseError"}}const VA=128,FA=32,KA=/^[^\s\u0000-][^\s\u0000]*$/,ZA=/^[a-z0-9][a-z0-9_-]*$/,YA=/^[A-Za-z0-9_-]{1,64}$/;function An(t,a){throw new HA(`${t} ${a}`)}function XA(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function gs(t,a){return XA(t)||An(a,"must be an object"),t}function Lu(t,a){return Object.prototype.hasOwnProperty.call(t,a)}function Ia(t,a,i){const r=new Set(a),c=Object.keys(t).find(f=>!r.has(f));c!==void 0&&An(`${i}.${c}`,"is unexpected")}function PA(t,a){return typeof t=="string"&&a.some(i=>i===t)}function Nd(t,a,i){return PA(t,a)||An(i,"is not a recognized value"),t}function Du(t,a,i){const r=a==="model"?VA:FA,c=a==="model"?KA:ZA;return(typeof t!="string"||t.length===0||t.length>r||!c.test(t))&&An(i,`must match the bounded ${a} grammar`),t}function Kb(t,a,i){const r=gs(t,i);Ia(r,["requested","applied","provenance"],i);const c=Nd(r.provenance,UA,`${i}.provenance`);if(c==="caller_override"){const f=Du(r.requested,a,`${i}.requested`),p=Du(r.applied,a,`${i}.applied`);return f!==p&&An(i,"requires requested and applied values to agree"),Object.freeze({provenance:c,requested:f,applied:p})}return c==="adapter_pin"?(r.requested!==void 0&&An(`${i}.requested`,"is impossible for adapter_pin"),Object.freeze({provenance:c,applied:Du(r.applied,a,`${i}.applied`)})):((r.requested!==void 0||r.applied!==void 0)&&An(i,"cannot carry values for cli_default_unknown"),Object.freeze({provenance:c}))}function qh(t,a="invocation"){const i=gs(t,a);Ia(i,["model","effort"],a);const r=i.model===void 0?void 0:Kb(i.model,"model",`${a}.model`),c=i.effort===void 0?void 0:Kb(i.effort,"effort",`${a}.effort`);return Object.freeze({...r===void 0?{}:{model:r},...c===void 0?{}:{effort:c}})}function Bo(t,a,i){const r=gs(t,i);if(r.state==="recorded")return Ia(r,["state","value"],i),Lu(r,"value")||An(`${i}.value`,"is required"),Object.freeze({state:"recorded",value:Du(r.value,a,`${i}.value`)});if(r.state==="accepted_unrepresentable")return Ia(r,["state"],i),Object.freeze({state:"accepted_unrepresentable"});An(`${i}.state`,"is not a recognized value state")}function QA(t,a){return t.state!==a.state?!1:t.state==="accepted_unrepresentable"||a.state==="recorded"&&t.value===a.value}function Zb(t,a,i){const r=gs(t,i),c=Nd(r.provenance,BA,`${i}.provenance`);if(c==="caller_override"){Ia(r,["provenance","requested","applied"],i),(!Lu(r,"requested")||!Lu(r,"applied"))&&An(i,"requires requested and applied value states");const f=Bo(r.requested,a,`${i}.requested`),p=Bo(r.applied,a,`${i}.applied`);return QA(f,p)||An(i,"requires requested and applied value states to agree"),Object.freeze({provenance:c,requested:f,applied:p})}return c==="adapter_pin"||c==="adapter_default"?(Ia(r,["provenance","applied"],i),Lu(r,"applied")||An(`${i}.applied`,"is required"),Object.freeze({provenance:c,applied:Bo(r.applied,a,`${i}.applied`)})):(Ia(r,["provenance"],i),Object.freeze({provenance:c}))}function JA(t,a="invocation"){const i=gs(t,a);Ia(i,["schemaVersion","model","effort"],a),i.schemaVersion!==zh&&An(`${a}.schemaVersion`,"is not the supported V2 version");const r=i.model===void 0?void 0:Zb(i.model,"model",`${a}.model`),c=i.effort===void 0?void 0:Zb(i.effort,"effort",`${a}.effort`);return r===void 0&&c===void 0&&An(a,"must record at least one knob in V2"),Object.freeze({schemaVersion:zh,...r===void 0?{}:{model:r},...c===void 0?{}:{effort:c}})}function Yo(t,a="invocation"){const i=gs(t,a);return i.schemaVersion===zh?JA(i,a):qh(i,a)}function WA(t,a="observedInvocation"){const i=gs(t,a);Ia(i,["schemaVersion","source","model","effort"],a),i.schemaVersion!==Hb&&An(`${a}.schemaVersion`,"is not the supported observed invocation version");const r=Nd(i.source,GA,`${a}.source`),c=i.model===void 0?void 0:Bo(i.model,"model",`${a}.model`),f=i.effort===void 0?void 0:Bo(i.effort,"effort",`${a}.effort`);return c===void 0&&f===void 0&&An(a,"must record at least one observed knob"),Object.freeze({schemaVersion:Hb,source:r,...c===void 0?{}:{model:c},...f===void 0?{}:{effort:f}})}function r0(t,a="observedInvocation"){if(t!==void 0)try{return WA(t,a)}catch{return}}function eR(t,a="invocationAudit"){const i=gs(t,a);Ia(i,["curator","finalizer"],a);const r=i.curator===void 0?void 0:Yo(i.curator,`${a}.curator`),c=i.finalizer===void 0?void 0:Yo(i.finalizer,`${a}.finalizer`);return Object.freeze({...r===void 0?{}:{curator:r},...c===void 0?{}:{finalizer:c}})}function tR(t,a="audit"){const i=gs(t,a);if(Ia(i,["schema_version","curator","finalizer"],a),i.schema_version===Vb){const r=i.curator===void 0?void 0:qh(i.curator,`${a}.curator`),c=i.finalizer===void 0?void 0:qh(i.finalizer,`${a}.finalizer`);return Object.freeze({schema_version:Vb,...r===void 0?{}:{curator:r},...c===void 0?{}:{finalizer:c}})}if(i.schema_version===Fb){const r=i.curator===void 0?void 0:Yo(i.curator,`${a}.curator`),c=i.finalizer===void 0?void 0:Yo(i.finalizer,`${a}.finalizer`);return Object.freeze({schema_version:Fb,...r===void 0?{}:{curator:r},...c===void 0?{}:{finalizer:c}})}An(`${a}.schema_version`,"is not a supported sidecar version")}function nR(t,a="contextPreflightInvocation"){const i=gs(t,a);Ia(i,["execution","artifactRunId","audit"],a);const r=Nd(i.execution,["current","cache_source"],`${a}.execution`);return(typeof i.artifactRunId!="string"||!YA.test(i.artifactRunId))&&An(`${a}.artifactRunId`,"is malformed"),Object.freeze({execution:r,artifactRunId:i.artifactRunId,audit:tR(i.audit,`${a}.audit`)})}const Il=wt().min(1).max(128),Go=wt().regex(/^[a-f0-9]{64}$/),lm=wt().min(1).max(512).refine(t=>!t.startsWith("/")&&!t.includes("\\")&&!/^[A-Za-z]:/.test(t)&&t.split("/").every(a=>a!==""&&a!=="."&&a!=="..")&&!/[\u0000-\u001f\u007f]/.test(t),"artifact path must be a relative path without traversal or control characters"),kd=Ke({source_sha256:Go,build_sha256:Go,procedure_sha256:Go,boundary:dt(["workflow-handoff-fixture","project-command-v1"])}).strict(),aR=Ke({check_id:Il,attempt_id:Il,producer:Il,artifact_path:lm}).strict();Ke({version:it(1),identity:kd,checks:Zn(aR).min(1).max(100),superseded_attempts:Zn(Ke({check_id:Il,attempt_id:Il}).strict()).max(100).default([])}).strict().superRefine((t,a)=>{for(const r of["check_id","producer","artifact_path"]){const c=new Set;t.checks.forEach((f,p)=>{c.has(f[r])&&a.addIssue({code:ee.custom,path:["checks",p,r],message:`duplicate ${r}`}),c.add(f[r])})}const i=new Set;for(const[r,c]of t.superseded_attempts.entries()){const f=JSON.stringify([c.check_id,c.attempt_id]);(i.has(f)||t.checks.some(p=>p.check_id===c.check_id&&p.attempt_id===c.attempt_id)||!t.checks.some(p=>p.check_id===c.check_id))&&a.addIssue({code:ee.custom,path:["superseded_attempts",r],message:"superseded attempt must be unique, known, and different from the current attempt"}),i.add(f)}});const sR=Ke({path:lm,size_bytes:Ws().int().nonnegative().max(Number.MAX_SAFE_INTEGER),sha256:Go}).strict();Ke({check_id:Il,attempt_id:Il,producer:Il,identity:kd,provenance:dt(["trusted_host","provider"]),result:dt(["passed","failed","producer_failed","evidence_missing"]),artifact:sR.optional(),reason:wt().min(1).max(512).optional()}).strict();Ke({path:lm,status:dt(["readable","missing","unreadable","escaped"]),size_bytes:Ws().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional(),sha256:Go.optional()}).strict().superRefine((t,a)=>{t.status==="readable"&&(t.size_bytes===void 0||t.sha256===void 0)&&a.addIssue({code:ee.custom,message:"readable artifact requires byte size and SHA-256"})});const im="clinkx-workflow-verification-v1",lR=16,Xo=wt().regex(/^[a-f0-9]{64}$/),Yb=dt(["complete","incomplete","inapplicable","failed"]),Xb=Ke({code:wt().regex(/^[a-z0-9_]{1,128}$/),check_id:wt().max(128)}).strict(),o0=Ke({status:Yb,checks:Zn(Ke({check_id:wt().min(1).max(128),status:Yb,reasons:Zn(Xb).max(1e3)}).strict()).max(100),reasons:Zn(Xb).max(1e3)}).strict(),iR=Ke({run_id:wt().regex(/^[A-Za-z0-9_-]{1,64}$/),generation:wt().regex(/^[A-Za-z0-9_-]{43}$/),started_at:wt().datetime(),workflow_sha256:Xo,inputs_sha256:Xo}).strict();Ke({schema_version:it(im),inspection_id:wt().uuid(),inspected_at:wt().datetime(),binding:iR,expectations_sha256:Xo,identity:kd.nullable(),required_checks:Ws().int().min(1).max(100).nullable(),evidence_directory:wt().min(1).max(4096).refine(t=>t.startsWith("/")&&!t.includes("\0")),coverage:o0,scope:it("inspected_at"),owner_acceptance:it("not_recorded")}).strict().superRefine((t,a)=>{t.identity===null!=(t.required_checks===null)&&a.addIssue({code:ee.custom,message:"identity and required coverage must both be authenticated or unknown"}),new Set(t.coverage.checks.map(i=>i.check_id)).size!==t.coverage.checks.length&&a.addIssue({code:ee.custom,message:"duplicate required check"}),t.coverage.status==="complete"&&(t.identity===null||t.required_checks!==t.coverage.checks.length||t.coverage.reasons.length!==0||t.coverage.checks.some(i=>i.status!=="complete"||i.reasons.length!==0))&&a.addIssue({code:ee.custom,message:"complete coverage requires authenticated, complete required checks"})});const rR=dt(["unknown","outside_mount","present","missing","unavailable"]),oR=Ke({schema_version:it(im),availability:dt(["unrecorded","available","unavailable"]),reason:dt(["invalid_record","identity_mismatch","too_many_records","unreadable"]).optional(),inspections:Zn(Ke({inspection_id:wt().uuid(),inspected_at:wt().datetime(),expectations_sha256:Xo,identity:kd.nullable(),required_checks:Ws().int().min(1).max(100).nullable(),coverage:o0,retention:rR,evidence_ref:Ke({kind:it("expectations_sha256"),sha256:Xo}).strict(),scope:it("inspected_at"),owner_acceptance:it("not_recorded")}).strict()).max(lR)}).strict(),cR=["not_configured","disabled","pending","running","succeeded","failed","cancelled","skipped"],c0=new Set(["unauthorized","invalid_request","method_not_allowed","host_rejected","origin_rejected","agent_instance_changed","not_found","dashboard_busy","run_directory_limit_exceeded","scan_byte_budget_exceeded","projection_cache_budget_exceeded","live_run_limit_exceeded","artifact_catalog_limit_exceeded","run_generation_changed","run_state_changed","activity_generation_changed","activity_state_changed","content_too_large_for_dashboard","progress_report_malformed","progress_report_overrides_unavailable","prompt_builder_library_unavailable","internal_error"]);class je extends Error{kind;status;code;constructor(a,i,r){super(a),this.name="DashboardApiError",this.kind=a,this.status=i,this.code=r}}function Cl(t){return t??new AbortController().signal}function uR(t){return typeof DOMException<"u"&&t instanceof DOMException&&t.name==="AbortError"}function rd(t,a,i){try{Fs(t)}catch(r){throw r instanceof jt?new je("connection_changed",409,"agent_instance_changed"):r}if(a.aborted||uR(i))throw new je("aborted")}async function xr(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new je("aborted"):new je("offline")}if(r.status===401)throw new je("auth_expired",401,"unauthorized");if(!r.ok){let c;try{const f=await sa(r);typeof f.error?.code=="string"&&c0.has(f.error.code)&&(c=f.error.code)}catch(f){if(f instanceof jt)throw new je("connection_changed",409,"agent_instance_changed");rd(r,i,f)}throw c==="agent_instance_changed"?new je("connection_changed",r.status,c):new je("request_error",r.status,c)}try{return await sa(r)}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):(rd(r,i,c),new je("request_error",r.status))}}async function Pb(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new je("aborted"):new je("offline")}if(r.status===401)throw new je("auth_expired",401,"unauthorized");if(!r.ok){let c;try{const f=await sa(r);typeof f.error?.code=="string"&&c0.has(f.error.code)&&(c=f.error.code)}catch(f){if(f instanceof jt)throw new je("connection_changed",409,"agent_instance_changed");rd(r,i,f)}throw c==="agent_instance_changed"?new je("connection_changed",r.status,c):new je("request_error",r.status,c)}try{return{content:await Ph(r),mediaType:r.headers.get("content-type")?.toLowerCase().startsWith("application/json")?"application/json":"text/plain",etag:r.headers.get("etag")}}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):(rd(r,i,c),new je("request_error",r.status))}}function u0(t,a){if(t!==void 0)try{return Yo(t,a)}catch{return}}function d0(t){const{invocation:a,observedInvocation:i,...r}=t,c=u0(a,"activity.invocation"),f=r0(i,"activity.observedInvocation");return{...r,...c===void 0?{}:{invocation:c},...f===void 0?{}:{observedInvocation:f}}}function dR(t,a,i){const{invocation:r,observedInvocation:c,...f}=t,p=`run.stages[${String(a)}].calls[${String(i)}]`,h=u0(r,`${p}.invocation`),v=r0(c,`${p}.observedInvocation`);return{...f,...h===void 0?{}:{invocation:h},...v===void 0?{}:{observedInvocation:v}}}function fR(t){return typeof t=="string"&&cR.includes(t)}function pR(t){if(t===void 0)return;if(t.availability!=="current")return t;const{finalizerEffectiveEnabled:a,finalizerExecutionStatus:i,...r}=t,c=typeof a=="boolean"?a:void 0,f=fR(i)?i:void 0;return{...r,...c===void 0?{}:{finalizerEffectiveEnabled:c},...f===void 0?{}:{finalizerExecutionStatus:f}}}function f0(t){if(t.availability!=="available")return t;const{contextPreflight:a,contextPreflightInvocation:i,verification:r,verifiedRepair:c,...f}=t,p=t.stages.map((w,C)=>({...w,calls:w.calls.map((T,N)=>dR(T,C,N))})),h=pR(a),v=zA.safeParse(c),m=c===void 0?void 0:v.success?v.data:qA("unavailable","invalid_projection"),x=oR.safeParse(r),y=r===void 0?void 0:x.success?x.data:{schema_version:im,availability:"unavailable",reason:"invalid_record",inspections:[]};let A;if(i!==void 0)try{A=nR(i,"run.contextPreflightInvocation")}catch{A=void 0}return{...f,stages:p,...y===void 0?{}:{verification:y},...m===void 0?{}:{verifiedRepair:m},...h===void 0?{}:{contextPreflight:h},...A===void 0?{}:{contextPreflightInvocation:A}}}async function Qb(t,a,i,r){const c=encodeURIComponent(a.runId),f=await xr(t,`/api/runs/${c}`,Cl(i)),p=f0(f);if(p.runGeneration!==a.runGeneration)throw new je("request_error",409,"run_generation_changed");if(r&&p.stateRevision!==a.stateRevision)throw new je("request_error",409,"run_state_changed");return p}async function Jb(t,a,i,r){const c=encodeURIComponent(a.activityId),f=await xr(t,`/api/activities/${c}`,Cl(i)),p=d0(f);if(p.activityGeneration!==a.activityGeneration)throw new je("request_error",409,"activity_generation_changed");if(r&&p.stateRevision!==a.stateRevision)throw new je("request_error",409,"activity_state_changed");return p}function p0(t=ms){return{async getRunDetailCurrent(a,i){const r=await xr(t,`/api/runs/${encodeURIComponent(a)}`,Cl(i));return f0(r)},async getActivityDetailCurrent(a,i){const r=await xr(t,`/api/activities/${encodeURIComponent(a)}`,Cl(i));return d0(r)},async listActivities(a={}){const i=new URLSearchParams({limit:"100"});return a.before!==void 0&&i.set("before",a.before),await xr(t,`/api/activities?${i.toString()}`,Cl(a.signal))},async getActivityDetailForPolling(a,i){return Jb(t,a,i,!1)},async getActivityDetail(a,i){return Jb(t,a,i,!0)},async getActivityResult(a,i){const r=encodeURIComponent(a.activityId),c=encodeURIComponent(a.activityGeneration);return await Pb(t,`/api/activities/${r}/result?generation=${c}`,Cl(i))},async listRuns(a={}){const i=new URLSearchParams({limit:"100"});return a.before!==void 0&&i.set("before",a.before),await xr(t,`/api/runs?${i.toString()}`,Cl(a.signal))},async getRunDetailForPolling(a,i){return Qb(t,a,i,!1)},async getRunDetail(a,i){return Qb(t,a,i,!0)},async getRunResult(a,i){const r=encodeURIComponent(a.runId),c=encodeURIComponent(a.runGeneration);return await Pb(t,`/api/runs/${r}/result?generation=${c}`,Cl(i))}}}async function hR(t){const a=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(a)].map(i=>i.toString(16).padStart(2,"0")).join("")}async function mR(t){const a=JSON.parse(t);if(a===null||typeof a!="object"||!("schema_version"in a)||a.schema_version!=="council-plan-review-result-v1")throw new Error("validated plan-review result schema is unavailable");return{bytes:new TextEncoder().encode(t).byteLength,schemaVersion:a.schema_version,sha256:await hR(t)}}function gR(t){switch(t.reason){case"run_pending":return"Result is not available while the run is pending.";case"run_running":return"Result is not available while the run is running.";case"run_failed":return"This failed run has no successful result.";case"run_cancelled":return"This cancelled run has no successful result.";case"not_persisted":return"No result was persisted for this run.";case"missing":return"The persisted result is missing or was pruned.";case"invalid":return"The persisted result failed server validation.";case"too_large":return"The persisted result exceeds the dashboard content cap."}}function _R(t){return t instanceof je?t.code==="run_state_changed"?"The run state changed during the result read. Retry to use the current revision.":t.code==="content_too_large_for_dashboard"?"The persisted result exceeds the dashboard content cap.":t.code==="not_found"||t.status===404?"The persisted result is missing or was pruned. Run metadata remains available.":t.kind==="auth_expired"?"Dashboard authorization expired.":t.kind==="connection_changed"?"Dashboard connection changed; rebootstrap is required.":t.kind==="offline"?"The dashboard server is offline.":"The result could not be loaded. Retry the local read.":"The result could not be rendered. Retry the local read."}function h0(t){const a=new TextEncoder().encode(t).byteLength;return a<1024?`${String(a)} B`:`${(a/1024).toFixed(1)} KiB`}function vR({api:t=p0(),availability:a,onRunGenerationChanged:i,selection:r}){const c=b.useRef(yr()),[f,p]=b.useState({kind:"idle"}),h=`${r.runId}\0${r.runGeneration}\0${r.stateRevision}`,v=f.kind!=="idle"&&f.identity!==h?{kind:"idle"}:f;if(b.useEffect(()=>(c.current.cancel(),p({kind:"idle"}),()=>c.current.cancel()),[r.runId,r.runGeneration,r.stateRevision]),a.availability==="unavailable"){const x=a.reason==="not_persisted"||a.reason==="missing";return s.jsxs("section",{"aria-labelledby":"run-result-heading",className:"run-result-panel",children:[s.jsxs("div",{className:"run-result-panel__header",children:[s.jsx("h2",{"aria-label":"Run result",id:"run-result-heading",children:"Result"}),x?s.jsx("span",{className:"run-result-panel__metadata",children:"not retained"}):null]}),s.jsx("p",{className:"run-result-panel__local-state",children:gR(a)})]})}const m=()=>{const x=c.current.begin(r);p({kind:"loading",identity:h}),t.getRunResult(r,x.signal).then(async y=>{if(!c.current.isActive(x.identity))return;if(!c.current.acceptsEtag(x.identity,y.etag)){p({kind:"error",identity:h,message:"The result response belongs to an obsolete state revision. Retry the local read."});return}const A=a.kind==="plan_review"?await mR(y.content):void 0;c.current.acceptsEtag(x.identity,y.etag)&&p({kind:"available",identity:h,raw:y,...A===void 0?{}:{publication:A}})}).catch(y=>{if(c.current.isActive(x.identity)&&!(y instanceof je&&y.kind==="aborted")){if(y instanceof je&&y.code==="run_generation_changed"){i();return}p({kind:"error",identity:h,message:_R(y)})}})};return s.jsxs("section",{"aria-labelledby":"run-result-heading",className:"run-result-panel",children:[s.jsxs("div",{className:"run-result-panel__header",children:[s.jsx("h2",{"aria-label":"Run result",id:"run-result-heading",children:"Result"}),v.kind==="available"?s.jsx("span",{className:"run-result-panel__metadata",children:h0(v.raw.content)}):null,v.kind==="available"?null:s.jsx("button",{"aria-label":v.kind==="error"?"Retry result":"Load result",disabled:v.kind==="loading",onClick:m,type:"button",children:v.kind==="loading"?"[ loading result… ]":v.kind==="error"?"[ retry result ]":"[ load result ]"})]}),v.kind==="loading"?s.jsx("p",{role:"status",children:"Loading persisted result…"}):null,v.kind==="error"?s.jsx("p",{className:"run-result-panel__local-state",role:"status",children:v.message}):null,v.kind==="available"?s.jsxs(s.Fragment,{children:[v.publication?s.jsxs("dl",{"aria-label":"Plan-review publication facts",className:"publication-facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Publication marker"}),s.jsx("dd",{children:"committed and server-validated"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Validated size"}),s.jsxs("dd",{children:[v.publication.bytes," bytes"]})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Validated SHA-256"}),s.jsx("dd",{className:"publication-facts__digest",children:v.publication.sha256})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Result schema"}),s.jsx("dd",{children:v.publication.schemaVersion})]})]}):null,s.jsx(Sd,{content:v.raw.content,mediaType:v.raw.mediaType})]}):null]})}const bR={capture:"Capture",reproduce:"Regression before fix",fixed_regression:"Regression after fix",fixed_required:"Fixed-tree required checks",copy_preparation:"Copy preparation",copy_fixed:"Copy with fix",copy_without_fix:"Copy without fix",copy_restored:"Copy with fix restored",final_required:"Final selected-tree checks"};function yR({repair:t}){return s.jsxs("section",{className:"run-detail__summary-strip","aria-labelledby":"repair-summary-title",children:[s.jsx("h3",{id:"repair-summary-title",children:"Native verified repair"}),s.jsx("p",{children:"Historical facts at publication. Current source applicability is not established. Owner acceptance is not recorded."}),t.availability!=="available"?s.jsx("p",{role:"status",children:t.availability==="unrecorded"?"No terminal repair record published.":"Repair record unavailable. Missing or corrupt proof cannot establish verification."}):s.jsxs(s.Fragment,{children:[s.jsxs("dl",{className:"run-detail__card-facts",children:[s.jsxs("div",{children:[s.jsx("dt",{children:"Execution"}),s.jsx("dd",{children:t.executionStatus})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Repair qualification"}),s.jsx("dd",{children:t.repairStatus})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Owner acceptance"}),s.jsx("dd",{children:"not recorded"})]}),s.jsxs("div",{children:[s.jsx("dt",{children:"Independent review"}),s.jsx("dd",{children:t.reviewVerdict?.replaceAll("_"," ")??"not delivered"})]})]}),s.jsxs("p",{className:"op-mono overflow-safe",children:["Frozen identity: ",t.frozenDigest]}),t.fixedSourceDigest===void 0?null:s.jsxs("p",{className:"op-mono overflow-safe",children:["Fixed source SHA-256: ",t.fixedSourceDigest]}),s.jsx("h4",{children:"Declared edits"}),t.editedPaths.length===0?s.jsx("p",{children:"No applied paths recorded."}):s.jsx("ul",{children:t.editedPaths.map(a=>s.jsxs("li",{className:"overflow-safe",children:[a.path," · ",a.phase," · ",a.status]},`${a.phase}:${a.path}`))}),s.jsx("h4",{children:"Regression and causal checks"}),t.phases.length===0?s.jsx("p",{children:"No phase proof recorded."}):s.jsx("ul",{children:t.phases.map(a=>s.jsxs("li",{className:"overflow-safe",children:[bR[a.phase],": ",a.outcome?.replaceAll("_"," ")??a.coverageStatus," · native coverage ",a.coverageStatus,s.jsxs("details",{children:[s.jsx("summary",{children:"Original expectation pin"}),s.jsx("p",{className:"op-mono overflow-safe",children:a.expectationsSha256})]})]},a.phase))}),t.findings.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Independent findings"}),s.jsx("ul",{children:t.findings.map((a,i)=>s.jsxs("li",{className:"overflow-safe",children:[a.severity,": ",a.message,s.jsxs("p",{children:["Cited paths: ",a.citedPaths.join(", ")]})]},i))})]}),t.gaps.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Qualification gaps"}),s.jsx("ul",{children:t.gaps.map((a,i)=>s.jsx("li",{className:"overflow-safe",children:a},i))}),s.jsx("p",{children:"Retain the current edits. A failed or interrupted repair does not automatically roll them back."})]}),t.ownerNextSteps.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("h4",{children:"Owner next steps"}),s.jsx("ul",{children:t.ownerNextSteps.map((a,i)=>s.jsx("li",{className:"overflow-safe",children:a},i))})]})]})]})}const xR=1400;function jR(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}async function wR(t){try{if(navigator.clipboard)return await navigator.clipboard.writeText(t),!0}catch{}try{const a=document.createElement("textarea");return a.className="copy-fallback-input",a.value=t,a.setAttribute("readonly",""),document.body.append(a),a.select(),document.execCommand("copy")}catch{return!1}}function Pp({phase:t,onRetry:a}){return t==="stale"||t==="offline"||t==="error"?s.jsx("button",{className:"run-detail__button",type:"button",onClick:a,children:"[ retry now ]"}):null}function Qp({source:t}){const a=b.useMemo(()=>Vh(t),[t]),[i,r]=b.useState(!1);if(b.useEffect(()=>{if(!i)return;const f=setTimeout(()=>r(!1),xR);return()=>{clearTimeout(f)}},[i]),a===null)return null;const c=a.text.includes(`
|
|
26
|
+
`)?"[ copy mcp handoff ]":`[ copy ${a.tool} ]`;return s.jsxs(s.Fragment,{children:[s.jsx("button",{"aria-label":`Copy ${a.tool} handoff for ${t.runId}`,className:"run-detail__button","data-copy-state":i?"copied":"idle",onClick:()=>{wR(a.text).then(f=>r(f))},title:`read-only dashboard — copies the MCP tool invocation to dispatch from your client
|
|
27
|
+
${a.text}`,type:"button",children:i?"copied ✓":c}),i?s.jsx("span",{className:"visually-hidden",role:"status",children:"Copied"}):null]})}function SR({stage:t,trackTopPx:a,hoveredKey:i,isPhone:r,onHoverCall:c,onInspectCall:f}){const p=m0(t),h=Math.max(0,t.callBars.length*9-3),v=Math.round((p-h)/2);return s.jsx("div",{className:"run-detail__timeline-track",children:s.jsx("svg",{className:"run-detail__timeline-svg",height:p,children:t.callBars.map((m,x)=>{const y=v+x*9,A=`${m.stageId}\0${m.callId}`,w=()=>f({stageId:m.stageId,callId:m.callId}),C={callKey:A,cxPercent:m.startPercent+m.widthPercent/2,topPx:a+y+3,callId:m.callId,who:`${m.adapterLabel} / ${m.roleLabel}`,state:m.state,duration:m.durationLabel,ariaText:`${m.callId} ${m.adapterLabel} / ${m.roleLabel} · ${m.state} ${m.durationLabel}`};return s.jsxs("g",{"aria-label":`Open persisted log for ${m.tooltipLabel}`,className:"run-detail__timeline-call","data-hov":i===A,onBlur:()=>c(null),onClick:w,onFocus:()=>c(C),onKeyDown:T=>{T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),w())},onMouseEnter:()=>c(C),onMouseLeave:()=>c(null),role:"button",tabIndex:0,children:[r?s.jsx("title",{children:m.tooltipLabel}):null,s.jsx("rect",{className:"run-detail__timeline-bar-hit",height:"9",rx:"4.5",width:`${String(m.widthPercent)}%`,x:`${String(m.startPercent)}%`,y:y-1.5}),s.jsx("rect",{className:`run-detail__timeline-bar run-detail__timeline-bar--call run-detail__timeline-bar--${m.state}`,"data-bar-id":m.id,height:"6",rx:"3",width:`${String(m.widthPercent)}%`,x:`${String(m.startPercent)}%`,y})]},m.id)})})})}function m0(t){return Math.max(30,t.callBars.length*9-3)}const Wb=28;function NR({applicationRootId:t,inspectorApi:a,resultApi:i,sessionLogApi:r,state:c,contextPreflight:f,routeCall:p,onInspectorRouteChange:h,onBack:v,onRetry:m,onRunGenerationChanged:x}){const y=c.detail,A=jR(),w=b.useRef(null),[C,T]=b.useState(null),[N,I]=b.useState(null),[k,q]=b.useState(null),[E,M]=b.useState(!1),[D,F]=b.useState(!1),te=c.selected===null?null:`${c.selected.runId}\0${c.selected.runGeneration}`,oe=p!==void 0,P=p===void 0?" unmanaged":p===null?" none":`${p.stageId} ${p.callId}`;b.useEffect(()=>{q(null),I(null),T(p==null?null:{stageId:p.stageId,callId:p.callId})},[te,P]);const ue=H=>{const pe=C===null?"open":"switch";T(H),oe&&h?.(H,pe)},_e=()=>{T(null),oe&&h?.(null,"close")},ge=b.useMemo(()=>C===null||y===null||y.availability!=="available"?null:y.stages.find(H=>H.stageId===C.stageId)?.calls.find(H=>H.callId===C.callId)??null,[y,C]),be=b.useMemo(()=>y===null||y.availability!=="available"?[]:y.stages.flatMap(H=>H.calls.filter(pe=>pe.hasWorkflowInput||pe.hasOutput||pe.hasRawError||pe.hasArtifactReference).map(pe=>({stageId:H.stageId,callId:pe.callId}))),[y]),ve=b.useMemo(()=>{if(C===null||be.length<=1)return;const H=be.findIndex(pe=>pe.stageId===C.stageId&&pe.callId===C.callId);if(!(H<0))return{total:be.length,position:H+1,onStepCall:pe=>{const Se=be.findIndex(Qe=>Qe.stageId===C.stageId&&Qe.callId===C.callId)+pe,Re=be[Se];Re!==void 0&&ue(Re)}}},[be,C]);if(c.selected===null)return s.jsxs("section",{className:"app-shell__view run-detail run-detail--empty",children:[s.jsx("h2",{className:"app-shell__title",children:"Run detail"}),s.jsx("p",{className:"app-shell__note",children:"Select a retained run to inspect persisted state."})]});if(y===null)return s.jsxs("section",{className:"app-shell__view run-detail","aria-busy":"true",children:[s.jsx("button",{className:"run-detail__back",type:"button",onClick:v,children:"‹ back to run list"}),s.jsx("h2",{className:"app-shell__title",children:"Run detail"}),s.jsx("p",{className:"app-shell__note",children:"Loading selected run state…"})]});if(y.availability==="unavailable")return s.jsxs("section",{className:"app-shell__view run-detail",children:[s.jsx("button",{className:"run-detail__back",type:"button",onClick:v,children:"‹ back to run list"}),s.jsx("h2",{className:"app-shell__title",children:"Run detail unavailable"}),s.jsx("p",{className:"run-detail__run-id op-mono overflow-safe",children:y.runId}),s.jsxs("p",{className:"app-shell__note",children:["Diagnostic metadata only · ",y.reason.replaceAll("_"," ")]})]});const $=wS(y,c.displayNowMs),ae=f!=null&&f.availability==="current"?f:void 0,ce=ae?.contextRunId!==void 0,de=H=>{const pe=w.current;if(pe===null)return;const Be=pe.querySelector(`[data-stage-id="${H.replaceAll('"','\\"')}"]`);if(Be===null)return;const Se=pe.closest(".dashboard-layout__detail");if(Se===null||typeof Se.scrollTo!="function")return;const Re=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;Se.scrollTo({top:Be.getBoundingClientRect().top-Se.getBoundingClientRect().top+Se.scrollTop-12,behavior:Re?"auto":"smooth"})};let ye=28;const S=$.timeline?.stages.map(H=>{const pe=ye;return ye+=m0(H)+2,pe})??[],L=H=>{q(H),I(H===null?null:H.callKey)},B=s.jsx("button",{"aria-expanded":E,className:"run-detail__fact-toggle",onClick:()=>M(H=>!H),type:"button",children:E?"[ hide details ]":"[ details ]"}),Q=k===null?null:k.cxPercent<18?"start":k.cxPercent>82?"end":"middle",me=k===null?0:k.topPx>64?k.topPx-Wb-8:k.topPx-Wb+18;return s.jsxs("section",{className:"app-shell__view run-detail",children:[s.jsxs(wi,{children:[s.jsxs("span",{className:"detail-sticky-bar__id",children:["run ",$.runId]}),s.jsx("span",{className:"run-detail__status","data-state":$.statusState,children:$.statusLabel}),s.jsx("span",{className:"detail-sticky-bar__name",children:y.workflowName}),s.jsx("span",{className:"detail-sticky-bar__spacer"}),s.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__fact",children:[s.jsx("span",{className:"detail-sticky-bar__fact-k",children:$.isLive?"elapsed":"duration"}),s.jsx("span",{className:"detail-sticky-bar__fact-v",children:$.elapsedLabel})]}),s.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__actions",children:[s.jsx(Pp,{phase:c.phase,onRetry:m}),s.jsx(Qp,{source:y})]})]}),s.jsxs("div",{className:"run-detail__mobile-nav",children:[s.jsx("button",{"aria-label":"back to run list",className:"run-detail__back",type:"button",onClick:v,children:"‹ runs"}),s.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["run ",$.runId]}),y.async?s.jsx("span",{className:"run-detail__mode",children:"async"}):null,s.jsx("span",{className:"run-detail__status","data-state":$.statusState,children:$.statusLabel})]}),s.jsx("header",{className:"run-detail__header",children:s.jsxs("div",{className:"run-detail__header-identity",children:[s.jsxs("div",{className:"run-detail__identity-line",children:[s.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["run ",$.runId]}),s.jsx("span",{className:"run-detail__status","data-state":$.statusState,children:$.statusLabel}),$.workerEvidenceLabel===null?null:s.jsx("span",{className:"run-detail__mode",title:$.workerEvidenceDescription??void 0,children:$.workerEvidenceLabel}),$.modeLabels.map(H=>s.jsx("span",{className:"run-detail__mode",children:H},H))]}),s.jsxs("div",{className:"run-detail__workflow-heading",children:[s.jsx("h2",{className:"run-detail__title run-detail__title--major overflow-safe",children:y.workflowName}),s.jsxs("span",{className:"op-caption op-mono",children:["v",y.workflowVersion]}),A?null:s.jsxs("div",{className:"run-detail__header-actions",children:[s.jsx(Pp,{phase:c.phase,onRetry:m}),s.jsx(Qp,{source:y})]})]})]})}),s.jsxs("div",{className:"run-detail__facts",children:[s.jsxs("div",{className:"run-detail__facts-group",children:[$.headerFacts.map(H=>s.jsxs("span",{className:"run-detail__fact",children:[s.jsx("span",{className:"run-detail__fact-k",children:H.label}),s.jsx("span",{className:"run-detail__fact-v",children:H.value})]},H.label)),A?null:B]}),A?s.jsxs("div",{className:"run-detail__facts-actions",children:[B,s.jsx(Pp,{phase:c.phase,onRetry:m}),s.jsx(Qp,{source:y})]}):null]}),s.jsxs("dl",{"aria-label":"Run metadata",className:"run-detail__details",hidden:!E,children:[$.detailFacts.map(H=>s.jsxs("div",{children:[s.jsx("dt",{children:H.label}),s.jsx("dd",{children:s.jsx(Cr,{children:H.value})})]},H.label)),dS(uS(f)).map(H=>s.jsxs("div",{children:[s.jsx("dt",{children:H.label}),s.jsx("dd",{children:s.jsx(Cr,{children:H.value})})]},H.label))]}),$.decisiveFailureLabel===null?null:s.jsxs("section",{className:"run-detail__failure","aria-labelledby":"decisive-failure-title",children:[s.jsx("h3",{id:"decisive-failure-title",children:"Decisive failure"}),s.jsx("p",{className:"op-mono overflow-safe",children:$.decisiveFailureLabel})]}),s.jsxs("section",{className:"run-detail__summary-strip","aria-labelledby":"run-card-title",children:[s.jsxs("h3",{id:"run-card-title",title:`summary card · ${$.card.kind}`,children:[s.jsx("span",{"aria-hidden":"true",children:"Run summary"}),s.jsx("span",{className:"visually-hidden",children:$.card.title})]}),s.jsx("dl",{className:"run-detail__card-facts",children:$.card.facts.map(H=>s.jsxs("div",{children:[s.jsx("dt",{children:H.label}),s.jsx("dd",{children:H.value})]},H.label))})]}),y.verifiedRepair===void 0?null:s.jsx(yR,{repair:y.verifiedRepair}),y.verification===void 0?null:s.jsxs("section",{className:"run-detail__summary-strip","aria-labelledby":"verification-title",children:[s.jsx("h3",{id:"verification-title",children:"Inspected verification proof"}),s.jsx("p",{children:"Historical inspected-at coverage. Current source applicability is not established. Owner acceptance is not recorded."}),y.verification.availability==="unrecorded"?s.jsx("p",{children:"No inspection attached."}):null,y.verification.availability==="unavailable"?s.jsxs("p",{children:["Inspection unavailable · ",y.verification.reason?.replaceAll("_"," ")]}):null,y.verification.inspections.map(H=>s.jsxs("article",{"aria-label":`Inspection ${H.inspection_id}`,children:[s.jsxs("p",{children:[s.jsx("time",{dateTime:H.inspected_at,children:H.inspected_at})," · ",H.coverage.status]}),s.jsxs("p",{children:["Required checks: ",H.required_checks??"unknown"," · Current evidence retention: ",H.retention.replaceAll("_"," ")]}),s.jsxs("p",{className:"op-mono overflow-safe",children:["Original expectations SHA-256: ",H.expectations_sha256]}),H.identity===null?s.jsx("p",{children:"Expected identity: unknown (pin not authenticated)."}):s.jsxs("p",{className:"op-mono overflow-safe",children:["Declared source SHA-256: ",H.identity.source_sha256," · Boundary: ",H.identity.boundary]}),s.jsx("ul",{children:H.coverage.checks.map(pe=>s.jsxs("li",{children:[pe.check_id,": ",pe.status,pe.reasons.length===0?"":` · ${pe.reasons.map(Be=>Be.code).join(", ")}`]},pe.check_id))}),H.coverage.reasons.length===0?null:s.jsxs("p",{children:["Inspection reasons: ",H.coverage.reasons.map(pe=>`${pe.check_id===""?"":`${pe.check_id}: `}${pe.code}`).join(", ")]})]},H.inspection_id))]}),f==null?null:s.jsx(KS,{preflight:f,...y.contextPreflightInvocation===void 0?{}:{invocation:y.contextPreflightInvocation},...ce?{onInspectSessionLog:()=>F(!0)}:{}}),$.snapshotAvailable?s.jsxs("section",{className:"run-detail__chart",children:[s.jsxs("div",{className:"run-detail__chart-heading",children:[s.jsx("h3",{className:"op-specimen",children:"Stage chart"}),s.jsx("span",{className:"run-detail__chart-meta op-mono",children:$.timeline?.spanLabel??"persisted timing not reported"})]}),$.timeline===null?s.jsx("div",{className:"run-detail__timeline-unavailable",role:"status",children:"Verified stage dependencies are available, but no persisted stage or call interval has both a start and a truthful end."}):s.jsx(D1,{label:"Verified workflow stage timeline",children:s.jsxs("div",{className:"run-detail__timeline",children:[s.jsx("span",{className:"run-detail__timeline-label-spacer"}),s.jsx("svg",{"aria-hidden":"true",className:"run-detail__timeline-ticks",children:$.timeline.ticks.map(H=>s.jsx("text",{textAnchor:"middle",x:`${String(H.positionPercent)}%`,y:"12",children:H.label},`${H.label}:${String(H.positionPercent)}`))}),$.timeline.stages.map((H,pe)=>s.jsxs(b.Fragment,{children:[s.jsxs("button",{"aria-label":`${H.stageId} · ${H.stateLabel} — jump to its calls`,className:"mobile-chart-scroll__sticky-label run-detail__timeline-label",onClick:()=>de(H.stageId),title:`${H.stageId} · ${H.stateLabel} — jump to its calls`,type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:"run-detail__timeline-stage-dot","data-state":H.stateLabel}),s.jsx("span",{className:"run-detail__timeline-stage-id overflow-safe",children:H.stageId}),s.jsx("span",{className:"run-detail__timeline-count",children:H.callCountLabel})]}),s.jsx(SR,{hoveredKey:N,isPhone:A,onHoverCall:L,onInspectCall:ue,stage:H,trackTopPx:S[pe]??28})]},H.stageId)),s.jsxs("svg",{"aria-hidden":"true",className:"run-detail__timeline-overlay",preserveAspectRatio:"none",children:[$.timeline.fanInPositions.map((H,pe)=>s.jsx("line",{className:"run-detail__timeline-fan-in",x1:`${String(H)}%`,x2:`${String(H)}%`,y1:"0",y2:"100%"},`${String(H)}:${String(pe)}`)),$.timeline.livePositionPercent===null?null:s.jsxs(s.Fragment,{children:[s.jsx("line",{className:"run-detail__timeline-now",x1:`${String($.timeline.livePositionPercent)}%`,x2:`${String($.timeline.livePositionPercent)}%`,y1:"0",y2:"100%"}),s.jsx("circle",{className:"run-detail__timeline-now-dot",cx:`${String($.timeline.livePositionPercent)}%`,cy:"3",r:"3"})]})]}),k===null||Q===null?null:s.jsx("svg",{className:"run-detail__timeline-overlay run-detail__timeline-tip-layer",children:s.jsxs("g",{"aria-label":k.ariaText,className:"run-detail__timeline-tip",role:"tooltip",children:[s.jsxs("text",{className:"run-detail__timeline-tip-line",textAnchor:Q,x:`${String(k.cxPercent)}%`,y:me,children:[s.jsx("tspan",{className:"run-detail__timeline-tip-id",children:k.callId}),s.jsx("tspan",{className:"run-detail__timeline-tip-who",dx:"8",children:k.who})]}),s.jsxs("text",{className:"run-detail__timeline-tip-line",textAnchor:Q,x:`${String(k.cxPercent)}%`,y:me+15,children:[s.jsx("tspan",{className:"run-detail__timeline-tip-state","data-state":k.state,children:k.state}),s.jsx("tspan",{className:"run-detail__timeline-tip-dur",dx:"8",children:k.duration})]})]})})]})})]}):s.jsxs("section",{className:"run-detail__snapshot-unavailable",role:"status",children:[s.jsx("h3",{children:"Stage graph unavailable"}),s.jsx("p",{children:$.snapshotLabel}),s.jsx("p",{children:"Persisted stage and call state remains available below."})]}),s.jsxs("section",{"aria-labelledby":"stage-rows-title",className:"run-detail__stages",ref:w,children:[s.jsx("h3",{className:"op-specimen",id:"stage-rows-title",children:"Stages"}),s.jsx("div",{className:"run-detail__stages-card",children:$.stages.map((H,pe)=>{const Be=y.stages.find(Re=>Re.stageId===H.stageId),Se=[H.label,H.dependsOn.length===0?null:`context from ${H.dependsOn.join(" · ")}`].filter(Re=>Re!==null).join(" · ");return s.jsxs("article",{"aria-label":`Stage ${H.stageId}`,className:"run-detail__stage","data-stage-id":H.stageId,children:[s.jsxs("header",{className:"run-detail__stage-header",children:[s.jsx("span",{className:"run-detail__stage-number",children:String(pe+1).padStart(2,"0")}),s.jsx("h4",{className:"overflow-safe",title:Se,children:H.stageId}),s.jsx("span",{className:"run-detail__timing",children:H.timingLabel}),s.jsx("span",{className:"run-detail__stage-word","data-state":Be?.state,children:H.statusLabel})]}),s.jsx("div",{className:"run-detail__calls",children:H.calls.length===0?s.jsx("p",{className:"run-detail__section-note",children:"No persisted calls."}):H.calls.map(Re=>{const Qe=`${H.stageId}\0${Re.callId}`;return s.jsxs("article",{"aria-label":`Call ${Re.callId}: ${Re.statusLabel} · ${Re.modelLabel} · ${Re.effortLabel}`,className:"run-detail__call","data-hov":N===Qe,onMouseEnter:()=>I(Qe),onMouseLeave:()=>I(null),children:[s.jsx("span",{"aria-hidden":"true",className:"run-detail__call-state","data-state":Be?.calls.find(Vt=>Vt.callId===Re.callId)?.state,children:Re.statusLabel==="failed"?"×":null}),s.jsxs("span",{className:"run-detail__call-id-cell",children:[s.jsx("h5",{className:"op-mono overflow-safe",children:Re.callId}),Re.retryLabel===null?null:s.jsx("span",{className:"run-detail__call-retry",children:Re.retryLabel})]}),Re.adapterLabel===null?s.jsx("span",{className:"run-detail__call-adapter",children:"not reported"}):s.jsx("span",{className:"run-detail__call-adapter",children:Re.adapterLabel}),s.jsxs("span",{className:"run-detail__call-knobs",title:`${Re.modelLabel} · ${Re.effortLabel}`,children:[s.jsx("span",{className:"run-detail__call-knob overflow-safe",children:Re.modelLabel}),s.jsx("span",{className:"run-detail__call-knob overflow-safe",children:Re.effortLabel})]}),s.jsx("span",{className:"run-detail__call-timing",children:Re.timingLabel}),Re.contentLabels.length===0?s.jsx("span",{"aria-label":"No persisted call content",className:"run-detail__log-unavailable",children:"—"}):s.jsxs("button",{"aria-label":`Inspect persisted content for ${Re.callId}`,className:"run-detail__inspect",onClick:()=>ue({stageId:H.stageId,callId:Re.callId}),title:Re.contentLabels.join(" · "),type:"button",children:[s.jsx("span",{className:"run-detail__inspect-label",children:"[ log ]"}),s.jsx("span",{"aria-hidden":"true",className:"run-detail__inspect-glyph",children:"›"})]}),Re.failureLabel===null?null:s.jsx("p",{className:"run-detail__call-failure",children:Re.failureLabel})]},Re.callId)})})]},H.stageId)})})]}),s.jsx(vR,{...i===void 0?{}:{api:i},availability:$.result,onRunGenerationChanged:x,selection:c.selected}),oe&&p!==void 0&&p!==null&&ge===null?s.jsxs("p",{className:"run-detail__section-note",role:"status",children:["The requested call ",p.callId," in stage ",p.stageId," is not present in this run’s persisted state."]}):null,ge===null?null:s.jsx(DA,{...a===void 0?{}:{api:a},applicationRootId:t,call:ge,...ve===void 0?{}:{callNavigation:ve},onClose:_e,onObsoleteSelection:x,open:!0,selection:c.selected,...r===void 0?{}:{sessionLogApi:r}}),ae===void 0||ae.contextRunId===void 0||r===void 0?null:s.jsx(kR,{applicationRootId:t,contextRunId:ae.contextRunId,onClose:()=>F(!1),onRunGenerationChanged:x,open:D,refreshToken:y.stateRevision,runGeneration:y.runGeneration,runId:y.runId,sessionLogApi:r})]})}function kR({applicationRootId:t,contextRunId:a,onClose:i,onRunGenerationChanged:r,open:c,refreshToken:f,runGeneration:p,runId:h,sessionLogApi:v}){const m=b.useMemo(()=>({family:"context",runId:h,runGeneration:p,contextRunId:a}),[h,p,a]);return s.jsxs(vd,{applicationRootId:t,labelledBy:"preflight-log-title",onClose:i,open:c,panelClassName:"accessible-dialog--sheet run-detail__preflight-log-dialog",children:[s.jsxs("header",{className:"run-detail__preflight-log-header",children:[s.jsx("h3",{id:"preflight-log-title",className:"overflow-safe",children:"Context preflight log"}),s.jsx("button",{className:"run-detail__button",type:"button",onClick:i,children:"[ close ]"})]}),s.jsx(wd,{api:v,onGenerationChanged:r,refreshToken:f,scope:m})]})}const AR=["all","orphaned","running","succeeded","failed","cancelled"];function Ad(t){return t.status!=="running"?"terminal":t.orphaned===!0||t.leaseObservation==="orphaned"?"orphaned":t.leaseObservation==="live"?"live":"unknown"}function rm(t){return Ad(t)==="orphaned"?"orphaned":t.status}function RR(t){return rm(t)}function ey(t,a){return a==="all"?!0:RR(t)===a}function ER(t,a){const i=Date.parse(t.startedAt);if(t.completedAt!==void 0){const r=Date.parse(t.completedAt);if(Number.isFinite(i)&&Number.isFinite(r)){const c=Math.max(0,r-i);return`duration ${Bu(c)}`}if(Number.isFinite(r))return`completed ${bn(t.completedAt,a)}`}if(Number.isFinite(i)){const r=Date.parse(t.stateUpdatedAt),f=Ad(t)!=="orphaned"||!Number.isFinite(r)?a:r;return`started ${bn(t.startedAt,f)}`}return"timing not reported"}function TR(t,a){const i=Date.parse(t.startedAt);if(!Number.isFinite(i))return"not reported";const r=Ad(t);if(r==="orphaned"){const c=Date.parse(t.stateUpdatedAt);return Number.isFinite(c)?Xa(c-i):"not reported"}if(r==="terminal"){const c=Date.parse(t.completedAt??t.stateUpdatedAt);return Number.isFinite(c)?Xa(c-i):"not reported"}return Xa(a-i)}function CR(t,a){const i=Date.parse(t.startedAt);if(!Number.isFinite(i))return null;if(t.completedAt!==void 0){const p=Date.parse(t.completedAt);if(Number.isFinite(p))return Math.max(0,p-i)}const r=Ad(t),c=Date.parse(t.stateUpdatedAt),f=r==="orphaned"&&Number.isFinite(c)?c:a;return Math.max(0,f-i)}function OR(t,a){const i=rm(t);if(i==="orphaned")return`stale · last write ${bn(t.stateUpdatedAt,a)}`;if(i==="running")return"awaiting provider";const r=bn(t.completedAt??t.stateUpdatedAt,a);return i==="failed"?`failed ${r}`:`finished ${r}`}function g0(t,a){const i=rm(t),r=CR(t,a);return{timingLabel:ER(t,a),updatedAgeLabel:bn(t.stateUpdatedAt,a),elapsedLabel:r===null?"timing not reported":Rr(r),statusFootnote:OR(t,a),resultRetentionLabel:t.hasResult?"bounded result retained":"metadata only",statusLabel:i,cardModifier:i}}function $R(t,a){const i=g0(t,a);return{statusLabel:i.statusLabel,statusState:i.cardModifier,observedSpanLabel:TR(t,a),invocationLabels:bd(t.invocation,t.observedInvocation)}}function MR(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function IR({api:t,detail:a,detailPhase:i,nowMs:r,onBack:c,onGenerationChanged:f,selection:p,sessionLogApi:h}){const[v,m]=b.useState(null),[x,y]=b.useState("idle"),[A,w]=b.useState(!1),C=MR(),T=b.useRef(null),N=a?.stateRevision??"",[I,k]=b.useState(N);if(I!==N&&(T.current?.abort(),k(N),m(null),y("idle")),b.useEffect(()=>()=>T.current?.abort(),[]),a===null&&p!==null){const P=i==="error";return s.jsxs("section",{"aria-busy":P?void 0:"true",className:"app-shell__view run-detail run-detail--empty",children:[s.jsxs("div",{className:"run-detail__mobile-nav",children:[s.jsx("button",{"aria-label":"back to single-call list",autoFocus:!0,className:"run-detail__back",onClick:c,type:"button",children:"‹ calls"}),s.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["activity ",p.activityId]})]}),s.jsx("h2",{className:"app-shell__title",children:P?"Single-call detail unavailable":"Single-call detail"}),s.jsx("p",{className:"app-shell__note",role:P?"alert":"status",children:P?"The selected activity detail could not be loaded. Return to the list and retry the call feed.":"Loading selected single-call state…"})]})}if(a===null)return s.jsxs("section",{className:"app-shell__view run-detail run-detail--empty",children:[s.jsx("h2",{className:"app-shell__title",children:"Single-call detail"}),s.jsx("p",{className:"app-shell__note",children:"Select a retained direct call or agent session to inspect its persisted lifecycle and content boundary."})]});const q=()=>{if(!a.hasResult||x==="loading")return;T.current?.abort();const P=new AbortController;T.current=P,y("loading"),t.getActivityResult(a,P.signal).then(ue=>{if(!P.signal.aborted){if(ue.etag!==`"${a.stateRevision}"`){m(null),y("error");return}m(ue),y("loaded")}}).catch(()=>{P.signal.aborted||y("error")})},E=$R(a,r),M=E.statusState==="running"||E.statusState==="orphaned",F=[{label:"started",value:Gu(a.startedAt)??a.startedAt},{label:M?"elapsed":"duration",value:E.observedSpanLabel},M?{label:"journal write",value:bn(a.stateUpdatedAt,r)}:{label:"outcome",value:a.outcome?.kind??"not reported"}],te=[{label:"started",value:a.startedAt},{label:"completed",value:a.completedAt??"not reported"},{label:"last journal write",value:a.stateUpdatedAt},{label:"outcome",value:a.outcome?.kind??"not reported"},{label:"generation · revision",value:`${a.activityGeneration} · ${a.stateRevision}`},{label:"project folder",value:Fh(a.projectFolders)}],oe=s.jsx("button",{"aria-expanded":A,className:"run-detail__fact-toggle",onClick:()=>w(P=>!P),type:"button",children:A?"[ hide details ]":"[ details ]"});return s.jsxs("section",{className:"app-shell__view run-detail activity-detail",children:[s.jsxs(wi,{children:[s.jsxs("span",{className:"detail-sticky-bar__id",children:["activity ",a.activityId]}),s.jsx("span",{className:"run-detail__status","data-state":E.statusState,children:E.statusLabel}),s.jsx("span",{className:"detail-sticky-bar__name",children:a.kind}),s.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__muted",children:[a.adapter," / ",a.role]}),s.jsx("span",{className:"detail-sticky-bar__spacer"}),s.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__fact",children:[s.jsx("span",{className:"detail-sticky-bar__fact-k",children:M?"elapsed":"duration"}),s.jsx("span",{className:"detail-sticky-bar__fact-v",children:E.observedSpanLabel})]})]}),s.jsxs("div",{className:"run-detail__mobile-nav",children:[s.jsx("button",{"aria-label":"back to single-call list",autoFocus:!0,className:"run-detail__back",onClick:c,type:"button",children:"‹ calls"}),s.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["activity ",a.activityId]}),s.jsx("span",{className:"run-detail__status","data-state":E.statusState,children:E.statusLabel})]}),s.jsx("header",{className:"run-detail__header",children:s.jsxs("div",{className:"run-detail__header-identity",children:[s.jsxs("div",{className:"run-detail__identity-line",children:[s.jsxs("span",{className:"op-caption op-mono overflow-safe",children:["activity ",a.activityId]}),s.jsx("span",{className:"run-detail__status","data-state":E.statusState,children:E.statusLabel}),M?s.jsx("span",{className:"run-detail__mode",children:a.phase}):null]}),s.jsxs("div",{className:"run-detail__workflow-heading",children:[s.jsx("h2",{className:"run-detail__title overflow-safe",children:a.kind}),s.jsxs("span",{className:"op-caption op-mono overflow-safe",children:[a.adapter," / ",a.role]})]})]})}),s.jsxs("div",{className:"run-detail__facts",children:[s.jsxs("div",{className:"run-detail__facts-group",children:[F.map(P=>s.jsxs("span",{className:"run-detail__fact",children:[s.jsx("span",{className:"run-detail__fact-k",children:P.label}),s.jsx("span",{className:"run-detail__fact-v",children:P.value})]},P.label)),C?null:oe]}),C?s.jsx("div",{className:"run-detail__facts-actions",children:oe}):null]}),s.jsxs("dl",{"aria-label":"Single-call metadata",className:"run-detail__details",hidden:!A,children:[te.map(P=>s.jsxs("div",{children:[s.jsx("dt",{children:P.label}),s.jsx("dd",{children:s.jsx(Cr,{children:P.value})})]},P.label)),E.invocationLabels.map((P,ue)=>s.jsxs("div",{children:[s.jsx("dt",{children:ue===1?"effort":"model"}),s.jsx("dd",{children:s.jsx(Cr,{children:P})})]},ue===1?"effort":"model"))]}),M?s.jsxs("p",{className:"activity-detail__live-note",role:"status",children:[s.jsx("span",{"aria-hidden":"true",className:"activity-detail__live-dot"}),"reported ",E.statusLabel," — a journal record is not proof its producer process is alive"]}):null,h===void 0?null:s.jsx("section",{className:"run-detail__card activity-detail__content",children:s.jsx(wd,{api:h,...f===void 0?{}:{onGenerationChanged:f},refreshToken:a.stateRevision,scope:{family:"activity",activityId:a.activityId,activityGeneration:a.activityGeneration}})}),s.jsxs("section",{className:"run-detail__card activity-detail__content","aria-labelledby":"activity-content-title",children:[s.jsxs("div",{className:"run-detail__section-heading",children:[s.jsx("h3",{className:"activity-detail__result-heading",id:"activity-content-title",children:"Result"}),a.hasResult?s.jsxs(s.Fragment,{children:[x==="loaded"&&v!==null?s.jsx("span",{className:"activity-detail__result-meta",children:h0(v.content)}):null,s.jsx("button",{className:"run-detail__inspect",disabled:x==="loading",onClick:q,type:"button",children:x==="loaded"?"[ reload ]":"[ load result ]"})]}):s.jsx("span",{className:"activity-detail__result-meta",children:"not retained"})]}),a.hasResult?x==="loading"?s.jsx("p",{role:"status",children:"Loading retained result…"}):x==="error"?s.jsxs("div",{role:"alert",children:[s.jsx("p",{children:"The retained result is unavailable for this exact revision."}),s.jsx("button",{className:"run-detail__button",onClick:q,type:"button",children:"[ retry result ]"})]}):v===null?null:s.jsxs("div",{className:"activity-detail__result",children:[a.resultTruncated?s.jsx("p",{className:"run-detail__section-note",role:"status",children:"Retained output was truncated at the configured persistence limit."}):null,s.jsx(Sd,{content:v.content,mediaType:v.mediaType})]}):s.jsx("p",{children:a.kind==="clink_agent_run"?"A final agent-session result was not retained for this activity.":"Result retention was not enabled when this direct call ran."})]})]})}const LR=["all","orphaned","pending","running","succeeded","failed","cancelled"];function Jp(t){return t==="succeeded"||t==="failed"||t==="cancelled"}function Wp(t,a){return a==="all"?!0:t.availability==="unavailable"?!1:a==="orphaned"?t.workerObservation==="orphaned":a==="pending"||a==="running"?Jo(t.workerObservation)&&t.row.status===a:t.row.status===a}function DR(t){return t.workerObservation==="unknown"?"worker-unknown":t.workerObservation==="orphaned"?"orphaned":t.row.status}function zR({card:t}){return t.availability==="unavailable"?s.jsxs("div",{className:"run-card run-card--unavailable",children:[s.jsxs("span",{className:"run-card__header",children:[s.jsx("span",{className:"run-card__identity",children:s.jsxs("span",{className:"run-card__id",children:["run ",t.row.runId]})}),s.jsx("span",{className:"run-card__status",children:"unreadable"})]}),s.jsx("span",{className:"run-card__diagnostic",children:t.statusLabel})]}):s.jsxs("div",{className:`run-card run-card--${DR(t)}`,children:[s.jsxs("span",{className:"run-card__header",children:[s.jsxs("span",{className:"run-card__identity",children:[s.jsxs("span",{className:"run-card__id",children:["run ",t.row.runId]}),t.flags.map(a=>s.jsx("span",{className:"run-card__flag",children:a},a))]}),s.jsx("span",{className:"run-card__status",children:t.statusLabel})]}),s.jsxs("span",{className:"run-card__workflow",children:[s.jsx("span",{className:"run-card__workflow-name",children:t.row.workflowName}),s.jsxs("span",{className:"run-card__workflow-version",children:["v",t.row.workflowVersion]}),t.statusTags.map(a=>s.jsx("span",{className:"run-card__tag",children:a},a))]}),t.row.stageMarkers.length===0?s.jsx("span",{className:"run-card__stage-empty",children:"stage state not reported"}):s.jsxs("span",{"aria-label":"stage states",className:"run-card__stage-track",children:[s.jsx("span",{className:"run-card__stage-list",children:t.row.stageMarkers.map((a,i,r)=>s.jsx("span",{className:["run-card__stage-node",Jp(a.state)&&Jp(r[i+1]?.state)?"run-card__stage-node--complete-connector":"",t.showLiveMotion&&t.row.status==="running"&&Jp(a.state)&&r[i+1]?.state==="running"?"run-card__stage-node--live-connector":""].filter(Boolean).join(" "),children:s.jsx("span",{"aria-label":tb(a),className:`run-card__stage-dot run-card__stage-dot--${a.state}`,title:tb(a),children:a.state==="failed"?"×":null})},a.stageId))}),t.row.additionalStageCount>0?s.jsxs("span",{className:"run-card__stage-overflow",children:["+",String(t.row.additionalStageCount)," retained stages"]}):null]}),s.jsxs("span",{className:"run-card__footer",children:[s.jsx("span",{className:"run-card__timing",children:t.elapsedLabel}),t.stageProgressLabel===""?null:s.jsx("span",{className:"run-card__footnote",children:t.stageProgressLabel}),s.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function qR(t,a){return t.selected?.runId===a.runId&&t.selected.runGeneration===a.runGeneration}function zu(t){return`${t.runId}:${t.runGeneration}`}function ty({cards:t,label:a,onMovePastBoundary:i,onSelect:r,rootRef:c,state:f}){const p=new Map(t.map(v=>[zu(v.row),v])),h=t.find(v=>qR(f,v.row));return s.jsx(ji,{ariaLabel:a,items:t.map(v=>({id:zu(v.row),label:v.availability==="unavailable"?`${v.row.runId} unreadable ${v.statusLabel}`:`${v.row.runId} ${v.statusLabel}`,content:s.jsx(zR,{card:v})})),...i===void 0?{}:{onMovePastBoundary:i},onSelect:v=>{const m=p.get(v);m!==void 0&&r(m.row)},...c===void 0?{}:{rootRef:c},selectedId:h===void 0?null:zu(h.row)})}function ny(t,a){const i=t?.querySelectorAll('[role="option"]:not([aria-disabled="true"])');i?.length&&i.item(a==="first"?0:i.length-1).focus()}function Rd(t){if(t.key!=="j"&&t.key!=="k")return;const a=Array.from(t.currentTarget.querySelectorAll('[role="option"]')).filter(f=>f.getAttribute("aria-disabled")!=="true");if(a.length===0)return;const i=a.findIndex(f=>f===document.activeElement),r=t.key==="j"?1:-1,c=i===-1?a[0]:a[(i+r+a.length)%a.length];c!==void 0&&c.focus(),t.preventDefault()}function Ed(t,a){if(a===null||t===null)return;const i=t.querySelector(`[role="option"][data-item-id="${CSS.escape(a)}"]`);i!==null&&typeof i.scrollIntoView=="function"&&i.scrollIntoView({block:"nearest"})}function UR({label:t}){return s.jsxs("div",{className:"run-list__placeholders",children:[s.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:t}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]})}function BR(t){const[a,i]=b.useState("all");b.useEffect(()=>{i("all")},[t.filterResetKey]);const r=rx(t.state),c=r.live.filter(N=>Wp(N,a)),f=r.history.filter(N=>Wp(N,a)),p=[...r.live,...r.history],h=N=>p.filter(I=>Wp(I,N)).length,v=a==="all"?String(r.live.length):`${String(c.length)}/${String(r.live.length)}`,m=a==="all"?String(r.history.length):`${String(f.length)}/${String(r.history.length)}`,x=["stale","offline","error"].includes(t.state.phase),y=b.useRef(null),A=b.useRef(null),w=b.useRef(null),C=b.useRef(null),T=t.state.selected===null?null:zu(t.state.selected);return b.useEffect(()=>{T!==C.current&&(C.current=T,Ed(w.current,T))},[T]),s.jsxs("section",{"aria-label":"Run monitor lanes",className:"run-list",onKeyDown:Rd,ref:w,children:[s.jsxs("div",{className:x?"run-list__recovery":"visually-hidden",role:"status",children:[s.jsxs("span",{children:[r.phaseLabel," · ",r.lastRefreshLabel]}),x?s.jsx("button",{onClick:t.onRetry,type:"button",children:"[ retry now ]"}):null]}),t.state.announcement===null?null:s.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:t.state.announcement}),s.jsxs("header",{className:"run-list__heading",children:[s.jsx("h2",{children:"Workflow runs"}),s.jsx("span",{className:"run-list__observed-age",children:r.observedAgeLabel??""}),s.jsxs("span",{className:"run-list__heading-count",children:["[ live ",v," ]"]})]}),s.jsx(tc,{groupLabel:"Filter runs by status",selected:a,onSelect:i,chips:LR.map(N=>({id:N,label:N,count:h(N)}))}),p.length===0&&t.state.phase==="initial_loading"?s.jsx(UR,{label:r.phaseLabel}):s.jsxs(s.Fragment,{children:[s.jsxs("section",{"aria-label":"Live runs",className:"run-list__lane",children:[s.jsxs("div",{className:"run-list__lane-heading run-list__lane-heading--live",children:[s.jsx("h2",{children:"Live"}),s.jsx("span",{className:"run-list__observed-age",children:r.observedAgeLabel??""}),s.jsxs("span",{className:"run-list__heading-count",children:["[ live ",v," ]"]})]}),r.live.length===0?s.jsx("p",{className:"run-list__empty",children:"No runs are currently reported pending or running."}):c.length===0?s.jsxs("p",{className:"run-list__empty",children:["No loaded live runs match ",a,"."]}):s.jsx(ty,{cards:c,label:"Live runs",...f.length===0?{}:{onMovePastBoundary:N=>{N===1&&ny(A.current,"first")}},onSelect:t.onSelect,rootRef:y,state:t.state})]}),s.jsxs("section",{"aria-label":"Settled runs",className:"run-list__lane",children:[s.jsxs("div",{className:"run-list__lane-heading run-list__lane-heading--settled",children:[s.jsx("h2",{children:"Settled"}),s.jsxs("p",{children:["[ history ",m," ]"]})]}),r.history.length===0?s.jsx("p",{className:"run-list__empty",children:"No history runs are loaded on this page."}):f.length===0?s.jsxs("p",{className:"run-list__empty",children:["No loaded history runs match ",a,"."]}):s.jsx(ty,{cards:f,label:"History runs",...c.length===0?{}:{onMovePastBoundary:N=>{N===-1&&ny(y.current,"last")}},onSelect:t.onSelect,rootRef:A,state:t.state}),s.jsxs("nav",{"aria-label":"History pages",className:"run-list__pagination",children:[s.jsx("button",{disabled:!t.state.canGoNewer,onClick:t.onNewer,type:"button",children:"[ newer ]"}),s.jsx("button",{disabled:!t.state.canGoOlder,onClick:t.onOlder,type:"button",children:"[ older ]"})]}),t.state.canGoOlder?null:s.jsx("p",{className:"run-list__pagination-note",children:"end of retained history"})]})]}),s.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[s.jsx("kbd",{children:"↑"}),s.jsx("kbd",{children:"↓"}),s.jsx("kbd",{children:"j k"}),s.jsx("span",{children:"select run"})]})]})}function GR({activity:t,view:a}){return s.jsxs("div",{className:`run-card run-card--${a.cardModifier}`,children:[s.jsxs("span",{className:"run-card__header",children:[s.jsx("span",{"aria-hidden":"true",className:`run-card__status-dot run-card__status-dot--${a.cardModifier}`}),s.jsx("span",{className:"run-card__identity",children:s.jsxs("span",{className:"run-card__id",children:["activity ",t.activityId]})}),s.jsx("span",{className:"run-card__status",children:a.statusLabel})]}),s.jsx("span",{className:"run-card__workflow run-card__workflow--plain",children:s.jsx("span",{className:"run-card__workflow-name",children:t.kind})}),s.jsxs("span",{className:"run-card__meta-line",children:[t.adapter," / ",t.role]}),s.jsxs("span",{className:"run-card__footer",children:[s.jsx("span",{className:"run-card__timing",children:a.elapsedLabel}),s.jsx("span",{className:"run-card__footnote",children:a.statusFootnote}),s.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function HR({activities:t,announcement:a,filterResetKey:i,hasSnapshot:r,onRetry:c,onSelect:f,phase:p,selected:h,nowMs:v}){const[m,x]=b.useState("all");b.useEffect(()=>{x("all")},[i]);const y=t.filter(I=>ey(I,m)),A=new Map(t.map(I=>[I.activityId,I])),w=["stale","offline","error"].includes(p),C=b.useRef(null),T=b.useRef(null),N=h?.activityId??null;return b.useEffect(()=>{N!==T.current&&(T.current=N,Ed(C.current,N))},[N]),s.jsxs("section",{"aria-label":"Single-call monitor",className:"run-list",onKeyDown:Rd,ref:C,children:[a===null?null:s.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:a}),["stale","offline","auth_expired","connection_changed","error"].includes(p)?s.jsxs("div",{className:"run-list__recovery",role:"status",children:[s.jsxs("span",{children:["Single-call feed ",p.replace("_"," "),"."]}),w?s.jsx("button",{onClick:c,type:"button",children:"[ retry calls ]"}):null]}):null,s.jsx(tc,{groupLabel:"Filter single calls by status",selected:m,onSelect:x,chips:AR.map(I=>({id:I,label:I,count:t.filter(k=>ey(k,I)).length}))}),s.jsxs("section",{"aria-labelledby":"activity-list-title",className:"run-list__lane",children:[s.jsxs("div",{className:"run-list__lane-heading",children:[s.jsx("h2",{id:"activity-list-title",children:"Single calls"}),m==="all"?null:s.jsxs("p",{children:["[ activity ",String(y.length),"/",String(t.length)," ]"]})]}),t.length===0&&p==="initial_loading"?s.jsxs("div",{className:"run-list__placeholders",children:[s.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:"Loading retained single calls…"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]}):t.length===0&&!r?s.jsx("p",{className:"run-list__empty",children:"No authoritative single-call snapshot is available."}):t.length===0?s.jsx("p",{className:"run-list__empty",children:"No retained direct or agent-session activity is available."}):y.length===0?s.jsxs("p",{className:"run-list__empty",children:["No loaded activities match ",m,"."]}):s.jsx(ji,{ariaLabel:"Single calls",items:y.map(I=>{const k=g0(I,v);return{id:I.activityId,label:`${I.activityId} ${I.kind} ${k.statusLabel}`,content:s.jsx(GR,{activity:I,view:k})}}),onSelect:I=>{const k=A.get(I);k!==void 0&&f(k)},selectedId:h?.activityId??null})]}),s.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[s.jsx("kbd",{children:"↑"}),s.jsx("kbd",{children:"↓"}),s.jsx("kbd",{children:"j k"}),s.jsx("span",{children:"select call"})]})]})}const VR=["standalone","refine","workflow_preflight","historical"],FR=["pending","running","succeeded","partial","failed","cancelled"],KR=["live","orphaned","unknown"],ZR=["resolving","cache_lookup","validating","scanning","searching","selecting","curating","finalizing","writing","materializing","committing","complete","terminal"],YR=["not_configured","disabled","pending","running","succeeded","failed","cancelled","skipped"],XR=["not_applicable","not_used","used","failed"],PR=["not_checked","miss","hit"],QR=["not_attempted","skipped","written"],JR=["satisfied","degraded","not_evaluated"],WR=["cache_disabled","cache_miss","cache_stale","delegate_disabled","delegate_failed","delegate_fallback","delegate_invalid","delegate_timeout","coverage_degraded","empty_selection","operation_cancelled","internal_failure","legacy_supported","legacy_unsupported","generation_replaced"];class qn extends Error{kind;status;constructor(a,i){super(`context run artifact fetch failed: ${a}`),this.name="ContextRunArtifactApiError",this.kind=a,this.status=i}}const eE=["current","legacy_synthesized","legacy_unsupported"],tE=["journal","historical_manifest"],_0=/^[A-Za-z0-9_-]{1,64}$/,nE=/^[A-Za-z0-9_-]{16,128}$/,aE=16;class sE extends Error{constructor(a){super(a),this.name="ContextRunParseError"}}function Ft(t){throw new sE(t)}function Ys(t,a){return(typeof t!="object"||t===null||Array.isArray(t))&&Ft(`${a} must be an object`),t}function Xs(t,a,i){const r=new Set(a),c=Object.keys(t).find(f=>!r.has(f));c!==void 0&&Ft(`${i}.${c} is unexpected`)}function Ma(t,a,i){return(typeof t!="string"||!a.includes(t))&&Ft(`${i} is not a recognized value`),t}function cs(t,a){return(typeof t!="number"||!Number.isSafeInteger(t)||t<0||t>25e7)&&Ft(`${a} must be a bounded non-negative integer`),t}function zo(t,a){return t===null?null:((typeof t!="string"||Number.isNaN(Date.parse(t)))&&Ft(`${a} must be null or an ISO timestamp`),t)}function ay(t,a){const i=Ys(t,a);Xs(i,["status","score"],a);const r=i.score;return r!==null&&(typeof r!="number"||!Number.isFinite(r)||r<0||r>10)&&Ft(`${a}.score must be null or a score from 0 through 10`),Object.freeze({status:Ma(i.status,YR,`${a}.status`),score:r})}function lE(t){const a=Ys(t,"lifecycle.counts");return Xs(a,["filesSeen","filesConsidered","filesSelected","filesOmitted","searchResults","bytesRead","bytesWritten"],"lifecycle.counts"),Object.freeze({filesSeen:cs(a.filesSeen,"lifecycle.counts.filesSeen"),filesConsidered:cs(a.filesConsidered,"lifecycle.counts.filesConsidered"),filesSelected:cs(a.filesSelected,"lifecycle.counts.filesSelected"),filesOmitted:cs(a.filesOmitted,"lifecycle.counts.filesOmitted"),searchResults:cs(a.searchResults,"lifecycle.counts.searchResults"),bytesRead:cs(a.bytesRead,"lifecycle.counts.bytesRead"),bytesWritten:cs(a.bytesWritten,"lifecycle.counts.bytesWritten")})}function iE(t){const a=Ys(t,"lifecycle.coverage");Xs(a,["policy","status","required","selected","missing"],"lifecycle.coverage"),a.policy!==null&&a.policy!=="review_deep_v1"&&Ft("lifecycle.coverage.policy is invalid");const i={policy:a.policy,status:Ma(a.status,JR,"lifecycle.coverage.status"),required:cs(a.required,"lifecycle.coverage.required"),selected:cs(a.selected,"lifecycle.coverage.selected"),missing:cs(a.missing,"lifecycle.coverage.missing")};return i.missing>i.required&&Ft("lifecycle.coverage.missing exceeds required"),Object.freeze(i)}function rE(t){(!Array.isArray(t)||t.length>aE)&&Ft("lifecycle.reasonCodes must be a bounded array");const a=t.map((i,r)=>Ma(i,WR,`lifecycle.reasonCodes[${String(r)}]`));return new Set(a).size!==a.length&&Ft("lifecycle.reasonCodes must be unique"),Object.freeze(a)}const oE=20,v0=["id","contextGeneration","source","compatibility","operationKind","lifecycle","projectFolders","orphaned","liveness"],cE=[...v0,"invocationAudit"];function uE(t){(!Array.isArray(t)||t.length>oE)&&Ft("contextRun.projectFolders must be a bounded array");const a=t.map((i,r)=>((typeof i!="string"||i.length===0)&&Ft(`contextRun.projectFolders[${String(r)}] must be a non-empty string`),i));return Object.freeze(a)}function dE(t){const a=Ys(t,"lifecycle");Xs(a,["status","phase","createdAt","updatedAt","startedAt","completedAt","durationMs","curator","finalizer","cache","fallback","counts","coverage","reasonCodes","artifactRunId"],"lifecycle");const i=Ys(a.cache,"lifecycle.cache");Xs(i,["lookup","write"],"lifecycle.cache");const r=Ys(a.fallback,"lifecycle.fallback");Xs(r,["status"],"lifecycle.fallback");const c=a.artifactRunId;c!==null&&(typeof c!="string"||!_0.test(c))&&Ft("lifecycle.artifactRunId is malformed");const f=a.durationMs;return f!==null&&(typeof f!="number"||!Number.isSafeInteger(f)||f<0)&&Ft("lifecycle.durationMs must be null or a non-negative integer"),Object.freeze({status:Ma(a.status,FR,"lifecycle.status"),phase:Ma(a.phase,ZR,"lifecycle.phase"),createdAt:zo(a.createdAt,"lifecycle.createdAt"),updatedAt:zo(a.updatedAt,"lifecycle.updatedAt"),startedAt:zo(a.startedAt,"lifecycle.startedAt"),completedAt:zo(a.completedAt,"lifecycle.completedAt"),durationMs:f,curator:ay(a.curator,"lifecycle.curator"),finalizer:ay(a.finalizer,"lifecycle.finalizer"),cache:Object.freeze({lookup:Ma(i.lookup,PR,"lifecycle.cache.lookup"),write:Ma(i.write,QR,"lifecycle.cache.write")}),fallback:Object.freeze({status:Ma(r.status,XR,"lifecycle.fallback.status")}),counts:lE(a.counts),coverage:iE(a.coverage),reasonCodes:rE(a.reasonCodes),artifactRunId:c})}function b0(t){const a=Ys(t,"contextRun");Xs(a,v0,"contextRun");const i=a.id;(typeof i!="string"||!_0.test(i)||i.startsWith("wfctx")||i.startsWith("wfpre"))&&Ft("contextRun.id is malformed");const r=a.contextGeneration;(typeof r!="string"||!nE.test(r))&&Ft("contextRun.contextGeneration is malformed");const c=Ma(a.compatibility,eE,"contextRun.compatibility"),f=a.lifecycle===null?null:dE(a.lifecycle);c==="legacy_unsupported"!=(f===null)&&Ft("only legacy_unsupported context runs omit lifecycle");const p=a.orphaned===void 0?!1:a.orphaned;typeof p!="boolean"&&Ft("contextRun.orphaned must be a boolean");const h=a.liveness===void 0?p?"orphaned":"unknown":Ma(a.liveness,KR,"contextRun.liveness");p!==(h==="orphaned")&&Ft("contextRun.orphaned must agree with liveness");const v=f?.status;return!(v==="pending"||v==="running")&&(p||h!=="unknown")&&Ft("terminal or unsupported context runs cannot carry live or orphaned liveness"),Object.freeze({id:i,contextGeneration:r,source:Ma(a.source,tE,"contextRun.source"),compatibility:c,operationKind:Ma(a.operationKind,VR,"contextRun.operationKind"),lifecycle:f,projectFolders:uE(a.projectFolders),orphaned:p,liveness:h})}function fE(t){const a=Ys(t,"contextRun");Xs(a,cE,"contextRun");const{invocationAudit:i,...r}=a,c=b0(r);if(i===void 0)return c;try{return Object.freeze({...c,invocationAudit:eR(i,"contextRun.invocationAudit")})}catch{return c}}function pE(t){const a=Ys(t,"response");Xs(a,["contextRuns","serverNow","truncated"],"response"),Array.isArray(a.contextRuns)||Ft("response.contextRuns must be an array"),typeof a.truncated!="boolean"&&Ft("response.truncated must be a boolean");const i=zo(a.serverNow,"response.serverNow");return i===null&&Ft("response.serverNow must not be null"),Object.freeze({contextRuns:Object.freeze(a.contextRuns.map(b0)),serverNow:i,truncated:a.truncated})}function eh(t){return t??new AbortController().signal}async function sy(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new je("aborted"):new je("offline")}if(r.status===401)throw new je("auth_expired",401,"unauthorized");if(!r.ok)throw new je("request_error",r.status);try{return await sa(r)}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):new je("request_error",r.status)}}async function hE(t,a,i){let r;try{r=await t(a,{signal:i})}catch(p){throw p instanceof jt?new qn("connection_changed",409):i.aborted||p instanceof DOMException&&p.name==="AbortError"?new qn("aborted"):new qn("offline")}if(r.status===401)throw new qn("auth_expired",401);if(r.status===404)throw new qn("missing",404);if(r.status===409)throw new qn("generation_changed",409);if(r.status===413)throw new qn("content_too_large",413);if(r.status===503)throw new qn("unavailable",503);if(!r.ok)throw new qn("request_error",r.status);const c=mE(r.headers.get("content-type"));let f;try{f=await r.text()}catch(p){throw p instanceof jt?new qn("connection_changed",409):new qn("request_error",r.status)}return{content:f,mediaType:c}}function mE(t){if(t===null)return"text/plain";const a=t.toLowerCase();return a.startsWith("application/json")?"application/json":a.startsWith("application/x-ndjson")?"application/x-ndjson":a.startsWith("text/markdown")?"text/markdown":"text/plain"}function y0(t=ms){return{async listContextRuns(a={}){const i=await sy(t,"/api/context-runs?limit=100",eh(a.signal));return pE(i)},async getContextRunDetail(a,i){const r=await sy(t,`/api/context-runs/${encodeURIComponent(a)}`,eh(i)),c=fE(r);if(c.id!==a)throw new je("request_error",502,"internal_error");return c},async getArtifact(a,i){const r=`/api/context-runs/${encodeURIComponent(a.contextRunId)}/artifacts/${encodeURIComponent(a.artifactKey)}?generation=${encodeURIComponent(a.contextGeneration)}`;return await hE(t,r,eh(i))}}}const gE=y0(),_E=["bundle_md","summary_json","selected_context_jsonl","tree_json","search_jsonl","slices_jsonl","codemap_jsonl","manifest_json"],th={bundle_md:"bundle.md",summary_json:"summary.json",selected_context_jsonl:"selected-context.jsonl",tree_json:"tree.json",search_jsonl:"search.jsonl",slices_jsonl:"slices.jsonl",codemap_jsonl:"codemap.jsonl",manifest_json:"manifest.json"},vE={bundle_md:"context packet",manifest_json:"receipt"};function bE(t,a){return[t.contextRunId,t.contextGeneration,a].join("\0")}function yE(t){switch(t){case"loading":return"Loading artifact…";case"ready":return null;case"missing":return"This artifact was not retained for this run.";case"content_too_large":return"This artifact exceeds the dashboard size limit and cannot be shown.";case"unavailable":return"Artifact storage is temporarily unavailable.";case"obsolete":return"The selected generation changed; the artifact view was discarded.";case"error":return"The artifact could not be loaded."}}function xE({api:t=gE,onGenerationChanged:a,scope:i,defaultArtifactKey:r="bundle_md"}){const[c,f]=b.useState(r),p=bE(i,c),h=b.useMemo(()=>({...i,artifactKey:c}),[p]),v=b.useRef(a),[m,x]=b.useState("loading"),[y,A]=b.useState(null);b.useEffect(()=>{v.current=a},[a]);const w=`${i.contextRunId}\0${i.contextGeneration}`;b.useEffect(()=>{f(r)},[w,r]),b.useEffect(()=>{const N=new AbortController;return x("loading"),A(null),t.getArtifact(h,N.signal).then(I=>{N.signal.aborted||(A(I),x("ready"))}).catch(I=>{N.signal.aborted||(I instanceof qn&&I.kind==="generation_changed"?(x("obsolete"),v.current?.()):I instanceof qn&&I.kind==="missing"?x("missing"):I instanceof qn&&I.kind==="content_too_large"?x("content_too_large"):I instanceof qn&&I.kind==="unavailable"?x("unavailable"):I instanceof qn&&I.kind==="aborted"||x("error"))}),()=>N.abort()},[t,p,h]);const C=yE(m),T=m==="ready"&&y!==null?[y.mediaType,...y.mediaType==="text/markdown"?["shown as plain text · markdown is not rendered"]:[]].join(" · "):void 0;return s.jsxs("section",{"aria-busy":m==="loading","aria-label":"Run artifacts panel",className:"context-run-artifacts-panel","data-phase":m,children:[s.jsx("div",{"aria-label":"Artifact",className:"context-run-artifacts-panel__chips",role:"group",children:_E.map(N=>{const I=vE[N];return s.jsx("button",{"aria-pressed":c===N,className:"context-run-artifacts-panel__chip",onClick:()=>f(N),title:I===void 0?th[N]:`${th[N]} · ${I}`,type:"button",children:th[N]},N)})}),C===null?null:s.jsx("p",{role:m==="error"?"alert":"status",children:C}),m==="ready"&&y!==null?s.jsx("div",{className:"context-run-artifacts-panel__body",title:T,children:s.jsx(Sd,{content:y.content,mediaType:jE(y.mediaType)})}):null]})}function jE(t){return t==="application/json"?"application/json":"text/plain"}function ly(t){return t.replaceAll("_"," ")}function nh({label:t,facts:a}){return s.jsx("dl",{className:"context-run-detail__facts","aria-label":t,children:a.map(i=>s.jsxs("div",{children:[s.jsx("dt",{children:i.label}),s.jsx("dd",{children:s.jsx(Cr,{children:i.value})})]},i.label))})}function wE(t){const a=t.lifecycle;return a===null?null:a.cache.lookup==="hit"?"This cache hit reused an earlier context bundle, so no curator or finalizer session conversation exists.":a.curator.status==="not_configured"&&a.finalizer.status==="not_configured"?"Curator and finalizer were not configured, so no delegate session conversation exists.":null}function SE(){const[t,a]=b.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 880px)").matches);return b.useEffect(()=>{if(typeof window.matchMedia!="function")return;const i=window.matchMedia("(max-width: 880px)"),r=()=>a(i.matches);return r(),i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}function NE({canRetry:t,detail:a,detailPhase:i,onBack:r,onGenerationChanged:c,onRetry:f,selectedId:p,sessionLogApi:h,contextRunsApi:v}){const[m,x]=b.useState(!1),y=SE();if(p===null)return s.jsxs("section",{className:"app-shell__view run-detail run-detail--empty",children:[s.jsx("h2",{className:"app-shell__title",children:"Context run detail"}),s.jsx("p",{className:"app-shell__note",children:"Select a context-builder run to inspect its lifecycle metadata."})]});const A=t===!0&&i==="error"&&f!==void 0?s.jsxs("section",{className:"run-detail__snapshot-unavailable",role:"status",children:[s.jsx("h3",{children:"Detail refresh is pending"}),s.jsx("p",{children:"The latest detail read did not complete. The retained snapshot may be stale until the selected generation is refreshed."}),s.jsx("button",{className:"run-detail__button",type:"button",onClick:f,children:"retry context run"})]}):null;if(a===null)return s.jsxs("section",{className:"app-shell__view run-detail","aria-busy":i==="loading",children:[s.jsx("button",{className:"run-detail__back",type:"button",onClick:r,children:"‹ back to context runs"}),s.jsx("h2",{className:"app-shell__title",children:"Context run detail"}),s.jsx("p",{className:"app-shell__note",children:i==="loading"?"Loading context run lifecycle…":i==="not_found"?"The selected context run is no longer retained.":"Context run lifecycle is unavailable."}),A]});const w=MS(a),C=wE(a),T=a.lifecycle!==null&&(a.lifecycle.status==="running"||a.lifecycle.status==="pending"),N=a.lifecycle,I=N===null?null:Gu(N.startedAt??N.createdAt??null),k=N===null?"not reported":N.durationMs===null?T?"in progress":"not reported":Xa(N.durationMs),q=N===null?"not reported":ly(N.cache.lookup)+(N.cache.write==="not_attempted"?"":` · ${ly(N.cache.write)}`),E=[I===null?{label:"timing",value:"not reported"}:{label:N?.startedAt==null?"created":"started",value:I},{label:"duration",value:k},{label:"cache",value:q}],M=[...w.lifecycleFacts.filter(F=>F.label!=="duration"),...w.identityFacts,{label:"project folder",value:Fh(a.projectFolders)}],D=s.jsx("button",{"aria-expanded":m,className:"run-detail__fact-toggle",onClick:()=>x(F=>!F),type:"button",children:m?"[ hide details ]":"[ details ]"});return s.jsxs("section",{className:"app-shell__view run-detail",children:[s.jsxs(wi,{children:[s.jsx("span",{className:"detail-sticky-bar__id",children:w.contextRunId}),s.jsx("span",{className:"run-detail__status","data-state":w.statusState,children:w.statusLabel}),s.jsxs("span",{className:"detail-sticky-bar__name",children:["Context builder · ",w.operationKindLabel]}),s.jsx("span",{className:"detail-sticky-bar__spacer"}),s.jsxs("span",{className:"detail-sticky-bar__wide detail-sticky-bar__fact",children:[s.jsx("span",{className:"detail-sticky-bar__fact-k",children:"duration"}),s.jsx("span",{className:"detail-sticky-bar__fact-v",children:k})]})]}),s.jsxs("div",{className:"run-detail__mobile-nav",children:[s.jsx("button",{"aria-label":"back to context runs",className:"run-detail__back",type:"button",onClick:r,children:"‹ context runs"}),s.jsx("span",{className:"op-caption op-mono overflow-safe",children:w.contextRunId}),s.jsx("span",{className:"run-detail__status","data-state":w.statusState,children:w.statusLabel})]}),s.jsx("header",{className:"run-detail__header",children:s.jsxs("div",{className:"run-detail__header-identity",children:[s.jsxs("div",{className:"run-detail__identity-line",children:[s.jsx("span",{className:"op-caption op-mono overflow-safe",children:w.contextRunId}),s.jsx("span",{className:"run-detail__status","data-state":w.statusState,children:w.statusLabel}),w.isCacheHit?s.jsx("span",{className:"run-detail__mode",children:"cache hit"}):null]}),s.jsxs("div",{className:"run-detail__workflow-heading",children:[s.jsxs("h2",{className:"run-detail__title overflow-safe",children:["Context builder · ",w.operationKindLabel]}),T?s.jsxs("span",{className:"run-detail__phase",children:["phase ",w.phaseLabel]}):null]})]})}),s.jsxs("div",{className:"run-detail__facts",children:[s.jsxs("div",{className:"run-detail__facts-group",children:[E.map(F=>s.jsxs("span",{className:"run-detail__fact",children:[s.jsx("span",{className:"run-detail__fact-k",children:F.label}),s.jsx("span",{className:"run-detail__fact-v",children:F.value})]},F.label)),y?null:D]}),y?s.jsx("div",{className:"run-detail__facts-actions",children:D}):null]}),s.jsx("dl",{"aria-label":"Context run record",className:"run-detail__details",hidden:!m,children:M.map(F=>s.jsxs("div",{children:[s.jsx("dt",{children:F.label}),s.jsx("dd",{children:s.jsx(Cr,{children:F.value})})]},F.label))}),A,w.legacyNotice===null?null:s.jsxs("section",{className:"run-detail__failure","aria-labelledby":"context-legacy-title",children:[s.jsx("h3",{id:"context-legacy-title",children:"Legacy artifact set unsupported"}),s.jsx("p",{className:"overflow-safe",children:w.legacyNotice})]}),w.isCacheHit?s.jsxs("section",{className:"run-detail__snapshot-unavailable",role:"status",children:[s.jsx("h3",{children:"Cache-hit materialization"}),s.jsx("p",{children:"This run was served from the workflow context cache. Selection was materialized from a prior curated bundle; curator and finalizer did not re-execute for this operation."})]}):null,s.jsxs("section",{"aria-labelledby":"context-delegate-title",children:[s.jsx("h3",{className:"run-detail__section-note",id:"context-delegate-title",children:"Delegate"}),s.jsx(nh,{label:"Context run delegate",facts:w.delegateFacts})]}),s.jsxs("section",{"aria-labelledby":"context-coverage-title",children:[s.jsx("h3",{className:"run-detail__section-note",id:"context-coverage-title",children:"Coverage"}),s.jsx(nh,{label:"Context run coverage",facts:w.coverageFacts})]}),s.jsxs("section",{"aria-labelledby":"context-counts-title",children:[s.jsx("h3",{className:"run-detail__section-note",id:"context-counts-title",children:"Aggregate counts"}),s.jsx(nh,{label:"Context run counts",facts:w.countFacts})]}),w.fallbackLabel===null?null:s.jsx("p",{className:"run-detail__section-note",children:w.fallbackLabel}),w.reasonCodes.length===0?null:s.jsxs("section",{"aria-labelledby":"context-reasons-title",children:[s.jsx("h3",{className:"run-detail__section-note",id:"context-reasons-title",children:"Reason codes"}),s.jsx("ul",{className:"context-run-detail__modes",children:w.reasonCodes.map(F=>s.jsx("li",{className:"run-detail__mode",children:F},F))})]}),w.canViewArtifacts&&v!==void 0?s.jsxs("section",{children:[s.jsx("h3",{className:"run-detail__section-note",children:"Run artifacts"}),s.jsx("section",{className:"run-detail__card",children:s.jsx(xE,{api:v,...c===void 0?{}:{onGenerationChanged:c},scope:{contextRunId:a.id,contextGeneration:a.contextGeneration}})})]}):null,h===void 0?null:s.jsx("section",{className:"run-detail__card",children:C===null?s.jsx(wd,{api:h,...c===void 0?{}:{onGenerationChanged:c},refreshToken:N===null?"none":[N.status,N.phase,N.updatedAt??"",N.curator.status,N.finalizer.status].join(" "),scope:{family:"context",contextRunId:a.id,contextGeneration:a.contextGeneration}}):s.jsx("section",{"aria-label":"Session log panel",className:"session-log-panel",children:s.jsxs("section",{"aria-label":"Session log availability",className:"session-log-viewer__availability","data-availability":"not_executed",role:"status",children:[s.jsx("strong",{children:"Not executed"}),s.jsx("p",{children:C})]})})})]})}function kE({item:t,nowMs:a}){const i=Kh(t,a),r=i.durationFootnote===""?i.cacheFootnote:`${i.durationFootnote} · ${i.isCacheHit?"cache hit":i.cacheFootnote}`;return s.jsxs("div",{className:`run-card run-card--${i.statusState}`,children:[s.jsxs("span",{className:"run-card__header",children:[s.jsx("span",{"aria-hidden":"true",className:`run-card__status-dot run-card__status-dot--${i.statusState}`}),s.jsx("span",{className:"run-card__identity",children:s.jsx("span",{className:"run-card__id",children:i.contextRunId})}),s.jsx("span",{className:"run-card__status",children:i.statusLabel})]}),s.jsxs("span",{className:"run-card__workflow run-card__workflow--plain",children:[s.jsx("span",{className:"run-card__workflow-name",children:i.operationKindLabel}),i.compatChip===null?null:s.jsx("span",{className:"run-card__compat-chip",children:i.compatChip})]}),i.delegateFootnote===""?null:s.jsx("span",{className:"run-card__meta-line",children:i.delegateFootnote}),s.jsxs("span",{className:"run-card__footer",children:[s.jsx("span",{className:"run-card__timing",children:r}),i.coverageFootnote===""?null:s.jsx("span",{className:"run-card__footnote",children:i.coverageFootnote}),i.legacyUnsupported?s.jsx("span",{className:"run-card__footnote",children:"legacy unsupported"}):null,s.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function AE({announcement:t,filterResetKey:a,contextRuns:i,hasSnapshot:r,nowMs:c,onRetry:f,onSelect:p,phase:h,selectedId:v}){const[m,x]=b.useState("all");b.useEffect(()=>{x("all")},[a]);const y=i.filter(T=>ob(T,m)),A=["stale","offline","error"].includes(h),w=b.useRef(null),C=b.useRef(null);return b.useEffect(()=>{v!==C.current&&(C.current=v,Ed(w.current,v))},[v]),s.jsxs("section",{"aria-label":"Context run monitor",className:"run-list",onKeyDown:Rd,ref:w,children:[t===null?null:s.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:t}),["stale","offline","auth_expired","connection_changed","error"].includes(h)?s.jsxs("div",{className:"run-list__recovery",role:"status",children:[s.jsxs("span",{children:["Context run feed ",h.replace("_"," "),"."]}),A?s.jsx("button",{onClick:f,type:"button",children:"[ retry context runs ]"}):null]}):null,s.jsx(tc,{chips:$S.map(T=>({id:T,label:T,count:i.filter(N=>ob(N,T)).length})),groupLabel:"Filter context runs by status",onSelect:x,selected:m}),s.jsxs("section",{"aria-labelledby":"context-run-list-title",className:"run-list__lane",children:[s.jsxs("div",{className:"run-list__lane-heading",children:[s.jsx("h2",{id:"context-run-list-title",children:"Context runs"}),m==="all"?null:s.jsxs("p",{children:["[ context ",String(y.length),"/",String(i.length)," ]"]})]}),i.length===0&&h==="initial_loading"?s.jsxs("div",{className:"run-list__placeholders",children:[s.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:"Loading context-builder runs…"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]}):i.length===0&&!r?s.jsx("p",{className:"run-list__empty",children:"No authoritative context-run snapshot is available."}):i.length===0?s.jsx("p",{className:"run-list__empty",children:"No retained context-builder run is available."}):y.length===0?s.jsxs("p",{className:"run-list__empty",children:["No loaded context runs match ",m,"."]}):s.jsx(ji,{ariaLabel:"Context runs",items:y.map(T=>{const N=Kh(T,c);return{id:N.contextRunId,label:`${N.contextRunId} ${N.operationKindLabel} ${N.statusLabel}`,content:s.jsx(kE,{item:T,nowMs:c})}}),onSelect:p,selectedId:v})]}),s.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[s.jsx("kbd",{children:"↑"}),s.jsx("kbd",{children:"↓"}),s.jsx("kbd",{children:"j k"}),s.jsx("span",{children:"select context run"})]})]})}const RE=["all","running","paused","blocked","done","failed"];function iy(t,a){return a==="all"?!0:t.status===a}function EE({item:t,nowMs:a}){const i=bn(t.updatedAt,a),r=t.taskCounts===void 0?null:`${String(t.taskCounts.done)}/${String(t.taskCounts.total)} tasks`;return s.jsxs("div",{className:`run-card run-card--${t.status}`,children:[s.jsxs("span",{className:"run-card__header",children:[s.jsx("span",{className:"run-card__identity",children:s.jsx("span",{className:"run-card__id",children:t.title})}),s.jsx("span",{className:"run-card__status","data-state":t.status,children:t.status})]}),t.publishedStatus===void 0?null:s.jsxs("span",{className:"run-card__published-status",children:["agent published: ",t.publishedStatus]}),s.jsx("span",{className:"run-card__workflow run-card__workflow--plain",title:t.projectFolder,children:s.jsxs("span",{className:"run-card__workflow-name",children:[String(t.agentCount)," agent",t.agentCount===1?"":"s"]})}),s.jsxs("span",{className:"run-card__footer",children:[s.jsxs("span",{className:"run-card__timing",children:["updated ",i]}),s.jsx("span",{className:"run-card__footnote",children:r===null?"no task counts":r}),s.jsx("span",{className:"run-card__detail-hint",children:"detail ›"})]})]})}function TE({announcement:t,progressReports:a,hasSnapshot:i,nowMs:r,onRetry:c,onSelect:f,phase:p,progressReportsRoot:h,selectedId:v,truncated:m}){const[x,y]=b.useState("all"),A=a.filter(I=>iy(I,x)),w=I=>a.filter(k=>iy(k,I)).length,C=["stale","offline","error"].includes(p),T=b.useRef(null),N=b.useRef(null);return b.useEffect(()=>{v!==N.current&&(N.current=v,Ed(T.current,v))},[v]),s.jsxs("section",{"aria-label":"Progress report monitor",className:"run-list",onKeyDown:Rd,ref:T,children:[t===null?null:s.jsx("p",{className:"run-list__announcement","data-selection-loss-announcement":!0,role:"status",tabIndex:-1,children:t}),["stale","offline","auth_expired","connection_changed","error"].includes(p)?s.jsxs("div",{className:"run-list__recovery",role:"status",children:[s.jsxs("span",{children:["Progress report feed ",p.replace("_"," "),"."]}),C?s.jsx("button",{onClick:c,type:"button",children:"[ retry progress reports ]"}):null]}):null,s.jsx(tc,{chips:RE.map(I=>({id:I,label:I,count:w(I)})),groupLabel:"Filter progress reports by status",onSelect:y,selected:x}),s.jsxs("section",{"aria-labelledby":"progress-report-list-title",className:"run-list__lane",children:[s.jsxs("div",{className:"run-list__lane-heading",children:[s.jsx("h2",{id:"progress-report-list-title",tabIndex:-1,children:"Progress reports"}),x==="all"?null:s.jsxs("p",{children:["[ reports ",String(A.length),"/",String(a.length)," ]"]})]}),m?s.jsx("p",{className:"run-list__announcement",role:"status",children:"Partial results: additional progress reports may exist."}):null,a.length===0&&p==="initial_loading"?s.jsxs("div",{className:"run-list__placeholders",children:[s.jsx("p",{className:"run-list__placeholder-copy",role:"status",children:"Loading agent progress reports…"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"}),s.jsx("div",{className:"run-list__placeholder","aria-hidden":"true"})]}):a.length===0?s.jsxs("div",{className:"run-list__empty",children:[s.jsxs("p",{children:[i?"No agent progress reports are available":"No agent progress report snapshot is available yet",h===void 0?".":` under ${h}.`]}),s.jsxs("p",{children:["Reports appear once an agent opens one with the"," ",s.jsx("code",{children:"progress_report_start"})," tool."]})]}):A.length===0?s.jsxs("p",{className:"run-list__empty",children:["No loaded progress reports match ",x,"."]}):s.jsx(ji,{ariaLabel:"Progress reports",items:A.map(I=>({id:I.id,label:`${I.title} ${I.status}`,content:s.jsx(EE,{item:I,nowMs:r})})),onSelect:f,selectedId:v})]}),s.jsxs("p",{"aria-hidden":"true",className:"run-list__keyboard-hint",children:[s.jsx("kbd",{children:"↑"}),s.jsx("kbd",{children:"↓"}),s.jsx("kbd",{children:"j k"}),s.jsx("span",{children:"select report"}),s.jsx("span",{children:"·"}),s.jsx("kbd",{children:"enter"}),s.jsx("span",{children:"open detail"})]})]})}const vi=["running","paused","blocked","done","failed"],CE=["working","idle","blocked","done"],OE=["pending","active","done","blocked","failed"],$E=["info","success","warn","error"],ME=["added","modified","deleted"],x0=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,IE=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|([+-])(\d{2}):(\d{2}))$/;class LE extends Error{constructor(a){super(a),this.name="ProgressReportParseError"}}function la(t){throw new LE(t)}function va(t,a){return(typeof t!="object"||t===null||Array.isArray(t))&&la(`${a} must be an object`),t}function ba(t,a,i){const r=new Set(a),c=Object.keys(t).find(f=>!r.has(f));c!==void 0&&la(`${i}.${c} is unexpected`)}function om(t,a){return(typeof t!="string"||t.length===0)&&la(`${a} must be a non-empty string`),t}function Js(t,a,i){return(typeof t!="string"||!a.includes(t))&&la(`${i} is not a recognized value`),t}function Ll(t,a){return(typeof t!="number"||!Number.isSafeInteger(t)||t<0)&&la(`${a} must be a non-negative integer`),t}function Or(t,a){return(typeof t!="string"||!j0(t))&&la(`${a} must be an ISO timestamp`),t}function j0(t){const a=IE.exec(t);if(a===null)return!1;const i=Number(a[1]),r=Number(a[2]),c=Number(a[3]),f=Number(a[4]),p=Number(a[5]),h=Number(a[6]),v=a[8]===void 0?0:Number(a[8]),m=a[9]===void 0?0:Number(a[9]),y=[31,i%4===0&&(i%100!==0||i%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return i>=1&&i<=9999&&r>=1&&r<=12&&c>=1&&c<=(y[r-1]??0)&&f<=23&&p<=59&&h<=59&&v<=23&&m<=59&&Number.isFinite(Date.parse(t))}function w0(t,a){const i=om(t,a);return x0.test(i)||la(`${a} is malformed`),i}function Td(t,a){return(typeof t!="string"||!j0(t))&&la(`${a} must be an ISO timestamp`),t}const DE=50,zE=200,qE=200,UE=500,BE=50,GE=100,HE=100,VE=256,FE=300,KE=500,ZE=500,YE=200,XE=16;function PE(t,a){let i=0;const r=t[Symbol.iterator]();for(;!r.next().done;)if(i+=1,i>a)return!1;return!0}function QE(t){return t.startsWith("/")}function Cd(t,a,i,r){const c=om(t,a);return PE(c,i)||la(`${a} exceeds ${i} Unicode code points (${r} bound)`),c}function Bl(t,a){return Cd(t,a,VE,"id")}function Ir(t,a){return Cd(t,a,FE,"message")}function od(t,a){return Cd(t,a,KE,"title")}function S0(t,a){const i=Cd(t,a,ZE,"path");return QE(i)||la(`${a} must be an absolute path`),i}function Vs(t,a,i){return(!Array.isArray(t)||t.length>a)&&la(`${i} must be a bounded array`),t}function JE(t){const a=va(t,"taskCounts");return ba(a,["total","done"],"taskCounts"),Object.freeze({total:Ll(a.total,"taskCounts.total"),done:Ll(a.done,"taskCounts.done")})}function WE(t){const a=va(t,"progressReport");return ba(a,["id","title","status","projectFolder","startedAt","updatedAt","agentCount","taskCounts","publishedStatus"],"progressReport"),Object.freeze({id:w0(a.id,"progressReport.id"),title:od(a.title,"progressReport.title"),status:Js(a.status,vi,"progressReport.status"),projectFolder:S0(a.projectFolder,"progressReport.projectFolder"),startedAt:Or(a.startedAt,"progressReport.startedAt"),updatedAt:Or(a.updatedAt,"progressReport.updatedAt"),agentCount:Ll(a.agentCount,"progressReport.agentCount"),...a.taskCounts===void 0?{}:{taskCounts:JE(a.taskCounts)},...a.publishedStatus===void 0?{}:{publishedStatus:Js(a.publishedStatus,vi,"progressReport.publishedStatus")}})}function eT(t){const a=va(t,"response");ba(a,["progressReports","serverNow","truncated"],"response");const i=Vs(a.progressReports,YE,"response.progressReports");typeof a.truncated!="boolean"&&la("response.truncated must be a boolean");const r=Or(a.serverNow,"response.serverNow");return Object.freeze({progressReports:Object.freeze(i.map(WE)),serverNow:r,truncated:a.truncated})}function tT(t,a){const i=`session.agents[${String(a)}]`,r=va(t,i);return ba(r,["name","role","status","activity","updatedAt"],i),Object.freeze({name:Bl(r.name,`${i}.name`),role:Bl(r.role,`${i}.role`),status:Js(r.status,CE,`${i}.status`),activity:Ir(r.activity,`${i}.activity`),updatedAt:Td(r.updatedAt,`${i}.updatedAt`)})}function nT(t,a){const i=`session.tasks[${String(a)}]`,r=va(t,i);ba(r,["id","title","status","agent","note"],i);const c={id:Bl(r.id,`${i}.id`),title:od(r.title,`${i}.title`),status:Js(r.status,OE,`${i}.status`)};return r.agent!==void 0&&(c.agent=Bl(r.agent,`${i}.agent`)),r.note!==void 0&&(c.note=Ir(r.note,`${i}.note`)),Object.freeze(c)}function aT(t,a){const i=`session.log[${String(a)}]`,r=va(t,i);return ba(r,["t","agent","kind","msg"],i),Object.freeze({t:Td(r.t,`${i}.t`),agent:Bl(r.agent,`${i}.agent`),kind:Js(r.kind,$E,`${i}.kind`),msg:Ir(r.msg,`${i}.msg`)})}function sT(t,a){const i=`session.files[${String(a)}]`,r=va(t,i);return ba(r,["path","change","adds","dels"],i),Object.freeze({path:Bl(r.path,`${i}.path`),change:Js(r.change,ME,`${i}.change`),adds:Ll(r.adds,`${i}.adds`),dels:Ll(r.dels,`${i}.dels`)})}function lT(t){const a=va(t,"session.tests");ba(a,["passed","failed","skipped","failing","lastRun"],"session.tests");const i=Vs(a.failing,HE,"session.tests.failing");return Object.freeze({passed:Ll(a.passed,"session.tests.passed"),failed:Ll(a.failed,"session.tests.failed"),skipped:Ll(a.skipped,"session.tests.skipped"),failing:Object.freeze(i.map((r,c)=>Ir(r,`session.tests.failing[${String(c)}]`))),lastRun:Td(a.lastRun,"session.tests.lastRun")})}function iT(t,a){const i=`session.blockers[${String(a)}]`,r=va(t,i);return ba(r,["msg","raisedBy","needsHuman"],i),typeof r.needsHuman!="boolean"&&la(`${i}.needsHuman must be a boolean`),Object.freeze({msg:Ir(r.msg,`${i}.msg`),raisedBy:Bl(r.raisedBy,`${i}.raisedBy`),needsHuman:r.needsHuman})}function rT(t,a){const i=`session.decisions[${String(a)}]`,r=va(t,i);return ba(r,["t","by","msg"],i),Object.freeze({t:Td(r.t,`${i}.t`),by:Bl(r.by,`${i}.by`),msg:Ir(r.msg,`${i}.msg`)})}function oT(t){const a=va(t,"progressReport");ba(a,["schemaVersion","session","agents","tasks","log","files","tests","blockers","decisions"],"progressReport"),a.schemaVersion!=="progress-report-v1"&&la("progressReport.schemaVersion must be progress-report-v1");const i=va(a.session,"session.session");ba(i,["id","title","goal","status","startedAt","updatedAt","projectFolder"],"session.session");const r=Object.freeze({id:w0(i.id,"session.session.id"),title:od(i.title,"session.session.title"),goal:od(i.goal,"session.session.goal"),status:Js(i.status,vi,"session.session.status"),startedAt:Or(i.startedAt,"session.session.startedAt"),updatedAt:Or(i.updatedAt,"session.session.updatedAt"),projectFolder:S0(i.projectFolder,"session.session.projectFolder")});return Object.freeze({session:r,...a.agents===void 0?{}:{agents:Object.freeze(Vs(a.agents,DE,"session.agents").map(tT))},...a.tasks===void 0?{}:{tasks:Object.freeze(Vs(a.tasks,zE,"session.tasks").map(nT))},...a.log===void 0?{}:{log:Object.freeze(Vs(a.log,qE,"session.log").map(aT))},...a.files===void 0?{}:{files:Object.freeze(Vs(a.files,UE,"session.files").map(sT))},...a.tests===void 0?{}:{tests:lT(a.tests)},...a.blockers===void 0?{}:{blockers:Object.freeze(Vs(a.blockers,BE,"session.blockers").map(iT))},...a.decisions===void 0?{}:{decisions:Object.freeze(Vs(a.decisions,GE,"session.decisions").map(rT))}})}function N0(t){const a=va(t,"response");ba(a,["progressReport","serverNow","omittedSections","publishedSessionStatus"],"response");const r=Vs(a.omittedSections,XE,"response.omittedSections").map((c,f)=>om(c,`response.omittedSections[${String(f)}]`));return Object.freeze({progressReport:oT(a.progressReport),serverNow:Or(a.serverNow,"response.serverNow"),omittedSections:Object.freeze(r),...a.publishedSessionStatus===void 0?{}:{publishedSessionStatus:Js(a.publishedSessionStatus,vi,"response.publishedSessionStatus")}})}function cT(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.prototype.hasOwnProperty.call(t,"progressReport")?Object.freeze({kind:"detail",...N0(t)}):Object.freeze({kind:"ack"})}function uT(t){return t.action==="set"?{action:"set",status:Js(t.status,vi,"status")}:{action:"revert"}}function ry(t){if(t instanceof je){if(t.code==="progress_report_malformed")return"malformed";if(t.code==="content_too_large_for_dashboard")return"oversized";if(t.status===404)return"removed";if(t.status===413)return"oversized"}}function oy(t){return t??new AbortController().signal}const cy=16*1024,dT=new Set(["invalid_request","method_not_allowed","agent_instance_changed","not_found","dashboard_busy","scan_byte_budget_exceeded","content_too_large_for_dashboard","progress_report_malformed","progress_report_overrides_unavailable","internal_error"]);async function fT(t){Fs(t);const a=Number(t.headers.get("content-length"));if(Number.isFinite(a)&&a>cy){await t.body?.cancel(),Fs(t);return}if(t.body===null)return;const i=t.body.getReader(),r=new TextDecoder;let c=0,f="";try{for(;;){const p=await i.read();if(p.done)break;if(c+=p.value.byteLength,c>cy){await i.cancel(),Fs(t);return}f+=r.decode(p.value,{stream:!0})}f+=r.decode()}finally{i.releaseLock()}Fs(t);try{const h=JSON.parse(f).error?.code;return typeof h=="string"&&dT.has(h)?h:void 0}catch{return}}async function k0(t,a){let i;try{i=await t()}catch(r){throw r instanceof jt?new je("connection_changed",409,"agent_instance_changed"):a?.aborted===!0||r instanceof DOMException&&r.name==="AbortError"?new je("aborted"):new je("offline")}if(i.status===401)throw new je("auth_expired",401,"unauthorized");if(!i.ok){let r;try{r=await fT(i)}catch(c){if(c instanceof jt)throw new je("connection_changed",409,"agent_instance_changed")}throw r==="agent_instance_changed"?new je("connection_changed",i.status,r):new je("request_error",i.status,r)}if(i.status===204){await i.body?.cancel();return}try{return await sa(i)}catch(r){throw r instanceof jt?new je("connection_changed",409,"agent_instance_changed"):new je("request_error",i.status)}}async function uy(t,a,i){return k0(()=>t(a,{signal:i}),i)}function pT(t=ms,a=kx){return{async listProgressReports(i={}){const r=await uy(t,"/api/progress-reports",oy(i.signal));return eT(r)},async getProgressReportDetail(i,r){const c=await uy(t,`/api/progress-reports/${encodeURIComponent(i)}/data`,oy(r)),f=N0(c);if(f.progressReport.session.id!==i)throw new je("request_error",502,"internal_error");return f},async setStatusOverride(i,r){if(!x0.test(i))throw new je("request_error",400,"invalid_request");const c=await k0(()=>a(`/api/progress-reports/${i}/status-override`,uT(r))),f=cT(c);if(f.kind==="detail"&&f.progressReport.session.id!==i)throw new je("request_error",502,"internal_error");return f}}}function pi(t){const a=Date.parse(t);return Number.isNaN(a)?null:a}function wu(t,a){const i=pi(t);if(i===null)return"—";const r=Math.max(0,Math.floor((a-i)/1e3));return r<60?`${String(r)}s ago`:r<3600?`${String(Math.floor(r/60))}m ago`:r<86400?`${String(Math.floor(r/3600))}h ${String(Math.floor(r%3600/60))}m ago`:`${String(Math.floor(r/86400))}d ago`}function hT(t,a){const i=Math.min(.03,.9/Math.max(1,a));return Number((.25+t*i).toFixed(2))*1e3}function mT(t){const a=pi(t);return a===null?"—":new Date(a).toISOString().slice(11,16)}function ah(t){const a=pi(t);if(a===null)return"";const i=new Date(a);return`${["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"][i.getUTCMonth()]??""} ${String(i.getUTCDate())}`.trim()}function gT(t,a){const i=pi(t);if(i===null)return"—";const r=Math.max(0,Math.floor((a-i)/1e3));return r<60?`${String(r)}s`:r<3600?`${String(Math.floor(r/60))}m`:`${String(Math.floor(r/3600))}h ${String(Math.floor(r%3600/60))}m`}function _T(t,a,i){const r=t.tasks??[],c=t.agents??[],f=r.filter(E=>E.status==="done").length,p=r.filter(E=>E.status==="active").length,h=r.filter(E=>E.status==="blocked"||E.status==="failed").length,v=E=>(i.agentFilter===null||E.agent===i.agentFilter)&&(i.statusFilter===null||E.status===i.statusFilter),m=r.filter(v),x=(t.log??[]).filter(E=>(i.agentFilter===null||E.agent===i.agentFilter)&&(!i.issuesOnly||E.kind==="warn"||E.kind==="error")),y=x.slice(-25).reverse(),A=new Set(y.map(E=>ah(E.t)).filter(Boolean)),w=[...t.files??[]].sort((E,M)=>M.adds+M.dels-(E.adds+E.dels)),C=(i.filesExpanded?w:w.slice(0,8)).map(E=>({...E,displayPath:E.path.replaceAll("/","/")})),T=(t.files??[]).reduce((E,M)=>({adds:E.adds+M.adds,dels:E.dels+M.dels}),{adds:0,dels:0}),N=i.agentFilter!==null||i.statusFilter!==null,I=[`${String(m.length)} of ${String(r.length)} shown`,i.agentFilter,i.statusFilter==="pending"?"queued":i.statusFilter].filter(E=>E!==null),q=t.session.status==="done"||t.session.status==="failed"?pi(t.session.updatedAt)??a:a;return{agents:c.map(E=>({...E,updatedLabel:wu(E.updatedAt,a)})),decisions:(t.decisions??[]).map(E=>({...E,relativeLabel:wu(E.t,a)})),elapsedLabel:gT(t.session.startedAt,q),files:C,filesToggleLabel:w.length>8?i.filesExpanded?"[ show fewer ]":"[ show all ]":null,fileTotals:T,logs:y.map((E,M)=>{const D=ah(E.t),F=M===0?null:ah(y[M-1]?.t??"");return{...E,clockLabel:pi(E.t)===null?"—":new Date(pi(E.t)??0).toISOString().slice(11,19),dayLabel:D,showDay:A.size>1&&D.length>0&&D!==F}}),logTotal:x.length,notice:(t.blockers??[]).find(E=>E.needsHuman)??null,progress:{active:p,activeWidthPercent:r.length===0?0:p/r.length*100,blocked:h,done:f,donePercent:r.length===0?0:Math.round(f/r.length*100),doneWidthPercent:r.length===0?0:f/r.length*100,total:r.length},startedClock:`${mT(t.session.startedAt)} utc`,taskFilterLabel:N?I.join(" · "):null,tasks:m,testsLastRunLabel:t.tests===void 0?null:wu(t.tests.lastRun,a),updatedLabel:wu(t.session.updatedAt,a),workingAgentCount:c.filter(E=>E.status==="working").length}}const A0={active:{glyph:"◐",label:"active"},blocked:{glyph:"⊘",label:"blocked"},done:{glyph:"●",label:"done"},failed:{glyph:"✕",label:"failed"},pending:{glyph:"○",label:"queued"}},vT=["done","active","pending","blocked","failed"],bT={blocked:"⊘",done:"●",idle:"○",working:"◐"},yT={error:"✕",info:"·",success:"✓",warn:"!"},dy={auth_expired:{label:"auth expired",terminal:!0},connection_changed:{label:"connection changed",terminal:!0},current:{label:"live · 3s",terminal:!1},error:{label:"error · retrying",terminal:!1},initial_loading:{label:"connecting · 3s",terminal:!1},offline:{label:"offline · retrying",terminal:!1},stale:{label:"stale · retrying",terminal:!1}};function sh(t){return`${t.t}|${t.agent}|${t.msg}`}function Ho({children:t}){return s.jsxs("span",{className:"progress-report-page__axis",children:["[ ",t," ]"]})}function ui({children:t,label:a}){return s.jsxs("section",{className:"progress-report-page__card",children:[s.jsx("h3",{className:"progress-report-page__card-label",children:a}),s.jsx("div",{className:"progress-report-page__card-body",children:t})]})}function xT(){const[t,a]=b.useState(tx),i=sx(t),r=()=>{a(i),nx(i),ax(i)};return s.jsxs("button",{"aria-pressed":t==="dark",className:"progress-report-page__text-control",onClick:r,title:`switch to ${i} theme · saved in this browser`,type:"button",children:["[ ",i," mode ]"]})}function jT(t){switch(t){case"removed":return"This progress report is no longer available. It may have been rotated or removed.";case"malformed":return"This progress report could not be parsed. The document may be corrupted or from an incompatible version.";case"oversized":return"This progress report is too large to display in the dashboard."}}function lh({backRef:t,busy:a=!1,children:i,onBack:r}){return s.jsx("main",{"aria-busy":a,className:"progress-report-page progress-report-page--state",children:s.jsxs("div",{className:"progress-report-page__state-wrap",children:[s.jsx("button",{"aria-label":"back to progress reports",className:"progress-report-page__tag progress-report-page__back-tag",onClick:r,ref:t,type:"button",children:"progress reports"}),s.jsx(ui,{label:"PROGRESS REPORT",children:i})]})})}function wT({onLocate:t,presentation:a,setStatusFilter:i,tasks:r}){const c=b.useRef(new WeakSet),f=b.useRef(new Set),p=b.useRef(null);p.current===null&&typeof window.matchMedia=="function"&&(p.current=window.matchMedia("(prefers-reduced-motion: reduce)"));const h=r.slice(0,60),v=h.length<=14;return b.useEffect(()=>{const m=()=>{f.current.forEach(A=>A.cancel()),f.current.clear()},x=p.current,y=()=>{x?.matches===!0&&m()};return x?.addEventListener("change",y),()=>{x?.removeEventListener("change",y),m()}},[]),s.jsxs("div",{className:"progress-report-page__timeline",children:[s.jsxs("div",{className:"progress-report-page__timeline-meta",children:[s.jsx("span",{children:"task completion · one node per task"}),s.jsx("div",{className:"progress-report-page__legend",children:vT.map(m=>{const x=A0[m],y=a.statusFilter===m;return s.jsxs("button",{"aria-pressed":y,className:"progress-report-page__legend-button","data-state":m,onClick:()=>i(m),title:y?`showing ${x.label} only — click to clear`:`filter tasks: ${x.label}`,type:"button",children:[s.jsx("span",{className:"progress-report-page__legend-dot",children:m==="failed"?"✕":""}),x.label]},m)})})]}),s.jsxs("div",{"aria-label":"Task completion timeline",className:"progress-report-page__timeline-chart",role:"group",children:[s.jsx("span",{"aria-hidden":"true",className:"progress-report-page__timeline-line"}),s.jsx("div",{className:"progress-report-page__timeline-nodes","data-single":h.length===1||void 0,children:h.map((m,x)=>{const y=hT(x,h.length),A=(a.agentFilter!==null||a.statusFilter!==null)&&!((a.agentFilter===null||m.agent===a.agentFilter)&&(a.statusFilter===null||m.status===a.statusFilter));return s.jsx("span",{className:"progress-report-page__node-slot",children:s.jsxs("button",{"aria-label":`${m.id} — ${m.title} · ${m.status}${m.note===void 0?"":` · ${m.note}`} · locate task`,className:"progress-report-page__node","data-dimmed":A||void 0,"data-entrance-delay":`${(y/1e3).toFixed(2)}s`,"data-state":m.status,onClick:()=>t(m),ref:w=>{if(w===null||c.current.has(w)||(c.current.add(w),p.current?.matches===!0||typeof w.animate!="function"))return;const T=w.animate([{opacity:0},{opacity:1}],{delay:y,duration:350,easing:"ease-out",fill:"backwards"});f.current.add(T);const N=()=>{f.current.delete(T)};T.finished.then(N,N)},title:`${m.id} — ${m.title} · ${m.status}${m.note===void 0?"":` · ${m.note}`}`,type:"button",children:[s.jsx("span",{className:"progress-report-page__node-dot",children:m.status==="failed"?"✕":""}),v?s.jsx("span",{className:"progress-report-page__node-label",children:m.id}):null]})},`${m.id}-${String(x)}`)})})]}),s.jsxs("div",{className:"progress-report-page__timeline-axis",children:[s.jsx(Ho,{children:h[0]?.id??"T1"}),s.jsx(Ho,{children:h.at(-1)?.id??`T${String(r.length)}`})]})]})}function ST({agent:t,pressed:a,toggle:i}){return s.jsxs("button",{"aria-pressed":a,className:"progress-report-page__agent-row","data-selected":a||void 0,"data-state":t.status,onClick:i,title:a?"filtering by this agent — click to clear":"filter tasks and log to this agent",type:"button",children:[s.jsx("span",{className:"progress-report-page__glyph",children:bT[t.status]}),s.jsxs("span",{className:"progress-report-page__agent-name",children:[t.name," ",s.jsxs("span",{children:["· ",t.role]})]}),s.jsx("span",{className:"progress-report-page__agent-activity",children:t.activity}),s.jsx("span",{className:"progress-report-page__state-word",children:t.status}),s.jsx("span",{className:"progress-report-page__relative",children:t.updatedLabel})]})}function NT({flash:t,highlighted:a,task:i}){const r=A0[i.status];return s.jsxs("div",{className:"progress-report-page__task-row","data-flash":t??void 0,"data-highlighted":a||void 0,"data-state":i.status,"data-task-id":i.id,children:[s.jsx("span",{className:"progress-report-page__glyph",children:r.glyph}),s.jsx("span",{className:"progress-report-page__task-id",title:i.id,children:i.id}),s.jsxs("span",{className:"progress-report-page__task-copy",children:[s.jsx("span",{children:i.title}),i.note===void 0?null:s.jsx("span",{children:i.note})]}),s.jsx("span",{className:"progress-report-page__task-agent",children:i.agent??""}),s.jsx("span",{className:"progress-report-page__state-word",children:i.status})]})}function kT({entry:t,flash:a}){return s.jsxs(s.Fragment,{children:[t.showDay?s.jsxs("div",{className:"progress-report-page__day-separator",children:[s.jsx("span",{children:t.dayLabel}),s.jsx("span",{})]}):null,s.jsxs("div",{className:"progress-report-page__log-row","data-flash":a??void 0,"data-kind":t.kind,title:t.t,children:[s.jsx("span",{children:t.clockLabel}),s.jsx("span",{children:t.agent}),s.jsxs("span",{className:"progress-report-page__log-message",children:[s.jsx("span",{children:yT[t.kind]}),s.jsx("span",{children:t.msg})]})]})]})}function AT({blockers:t}){const a=t.findIndex(i=>i.needsHuman);return s.jsx(ui,{label:"BLOCKERS",children:s.jsx("div",{className:"progress-report-page__blockers",children:t.map((i,r)=>s.jsxs("div",{children:[i.needsHuman?s.jsx("span",{className:"progress-report-page__human-stamp","data-primary":r===a||void 0,children:"NEEDS HUMAN"}):null,s.jsx("span",{children:i.msg}),s.jsxs("span",{children:["raised by ",i.raisedBy]})]},`${i.raisedBy}-${String(r)}`))})})}function RT({onSet:t,status:a}){const[i,r]=b.useState(!1),c=b.useId(),f=b.useRef(null),p=b.useRef(null),h=b.useRef(new Map);b.useEffect(()=>{if(!i)return;h.current.get(a)?.focus();const y=A=>{A.target instanceof Node&&!f.current?.contains(A.target)&&r(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[i,a]);const v=()=>{r(!1),p.current?.focus()},m=y=>{r(!1),p.current?.focus(),y!==a&&t(y)},x=y=>{if(y.key==="Escape"){y.preventDefault(),v();return}if(y.key==="Tab"){r(!1);return}if(y.key==="Home"||y.key==="End"||y.key==="ArrowDown"||y.key==="ArrowUp"){y.preventDefault();const A=vi.map(T=>h.current.get(T)).filter(T=>T!==void 0);if(A.length===0)return;const w=A.indexOf(document.activeElement),C=y.key==="Home"?0:y.key==="End"?A.length-1:w===-1?0:(w+(y.key==="ArrowDown"?1:-1)+A.length)%A.length;A[C]?.focus()}};return s.jsxs("div",{className:"progress-report-page__status-menu",ref:f,children:[s.jsxs("button",{"aria-controls":i?c:void 0,"aria-expanded":i,"aria-haspopup":"listbox","aria-label":"session status",className:"progress-report-page__tag progress-report-page__status-trigger","data-state":a,onClick:()=>r(y=>!y),ref:p,type:"button",children:[s.jsx("span",{children:a}),s.jsx("span",{"aria-hidden":"true",className:"progress-report-page__status-chevron",children:i?"⌃":"⌄"})]}),i?s.jsx("div",{"aria-label":"session status",className:"progress-report-page__status-panel",id:c,onKeyDown:x,role:"listbox",children:vi.map(y=>s.jsxs("button",{"aria-selected":y===a,className:"progress-report-page__status-option","data-state":y,onClick:()=>m(y),ref:A=>{A===null?h.current.delete(y):h.current.set(y,A)},role:"option",type:"button",children:[s.jsx("span",{children:y}),y===a?s.jsx("span",{"aria-hidden":"true",className:"progress-report-page__status-current",children:"current"}):null]},y))}):null]})}function ET({expanded:t,files:a,label:i,onToggle:r,totals:c,totalCount:f}){return s.jsx(ui,{label:"FILES CHANGED",children:s.jsxs("div",{className:"progress-report-page__files",children:[a.map((p,h)=>s.jsxs("span",{className:"progress-report-page__file-row","data-change":p.change,children:[s.jsx("span",{children:p.change[0]?.toUpperCase()}),s.jsx("span",{"aria-label":p.path,children:p.displayPath}),s.jsx("span",{children:p.adds===0?"":`+${String(p.adds)}`}),s.jsx("span",{children:p.dels===0?"":`−${String(p.dels)}`})]},`${p.path}-${String(h)}`)),s.jsxs("div",{className:"progress-report-page__file-summary",children:[s.jsxs("span",{children:[i===null||t?`${String(f)} ${f===1?"file":"files"}`:`top 8 of ${String(f)} by churn`,i===null?null:s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{className:"progress-report-page__text-control",onClick:r,type:"button",children:i})]})]}),s.jsxs("span",{children:[s.jsxs("strong",{children:["+",String(c.adds)]})," · −",String(c.dels)]})]})]})})}function fy({detail:t,detailPhase:a,nowMs:i,onBack:r,onRetry:c,onSetStatusOverride:f,omittedSections:p,pollingPhase:h="current",publishedSessionStatus:v,selectedId:m,unreadableReason:x}){const y=b.useRef(null),A=b.useRef(null),w=b.useRef(null),C=b.useRef(null),T=b.useRef(0),N=b.useRef(null),[I,k]=b.useState(()=>window.innerWidth<=880),[q,E]=b.useState({agentFilter:null,filesExpanded:!1,issuesOnly:!1,statusFilter:null}),[M,D]=b.useState(null),[F,te]=b.useState(null),oe=x!==null?"unreadable":t===null?"empty":"detail";if(b.useEffect(()=>{const B=()=>k(window.innerWidth<=880);return window.addEventListener("resize",B),()=>window.removeEventListener("resize",B)},[]),b.useEffect(()=>{if(m===null||!I){A.current=null;return}const B=`${m}:${oe}`;A.current!==B&&(A.current=B,y.current?.focus())},[oe,I,m]),b.useEffect(()=>()=>{w.current!==null&&window.clearTimeout(w.current),N.current!==null&&window.clearTimeout(N.current)},[]),b.useEffect(()=>{if(t===null){C.current=null,te(null),N.current!==null&&window.clearTimeout(N.current);return}const B=C.current;if(C.current=t,B===null||B.session.id!==t.session.id){te(null),N.current!==null&&window.clearTimeout(N.current);return}T.current+=1;const Q=new Map((B.tasks??[]).map(Re=>[Re.id,Re.status])),me=new Set((t.tasks??[]).filter(Re=>Q.get(Re.id)!==Re.status).map(Re=>Re.id)),H=new Set((B.log??[]).map(sh)),pe=new Set((t.log??[]).map(sh).filter(Re=>!H.has(Re))),Be=B.session.updatedAt!==t.session.updatedAt;if(!Be&&me.size===0&&pe.size===0){te(null),N.current!==null&&window.clearTimeout(N.current);return}const Se=T.current%2===1?"a":"b";te({generation:Se,logKeys:pe,taskIds:me,wrote:Be}),N.current!==null&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>te(null),2600)},[t]),m===null)return s.jsx(lh,{backRef:y,onBack:r,children:s.jsx("p",{children:"Select an agent progress report to inspect its narrative."})});if(x!==null)return s.jsxs(lh,{backRef:y,onBack:r,children:[s.jsx("h1",{children:"Progress report unavailable"}),s.jsx("p",{children:jT(x)}),s.jsx("button",{className:"progress-report-page__action",onClick:c,type:"button",children:"retry progress report"})]});if(t===null){const B=a==="error";return s.jsxs(lh,{backRef:y,busy:a==="loading",onBack:r,children:[s.jsx("h1",{children:"Progress report"}),s.jsx("p",{children:a==="loading"?"Loading progress report…":a==="not_found"?"The selected progress report is no longer available.":B?"The progress report could not be loaded.":"Progress report is unavailable."}),B?s.jsx("button",{className:"progress-report-page__action",onClick:c,type:"button",children:"retry progress report"}):null]})}const P=_T(t,i,q),ue=a==="stale",_e=dy[h],ge=ue||!["current","initial_loading"].includes(h),be=ue&&h==="current"?dy.stale.label:_e.label,ve=t.tasks??[],$=B=>{E(Q=>({...Q,statusFilter:Q.statusFilter===B?null:B}))},ae=()=>{E(B=>({...B,agentFilter:null,statusFilter:null}))},ce=B=>{P.tasks.some(me=>me===B)||ae(),D(B.id),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>D(null),2200),window.setTimeout(()=>{document.querySelector(`[data-task-id="${CSS.escape(B.id)}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},60)},de=t.blockers??[],ye=de.filter(B=>B.needsHuman).length,S=t.tests,L=t.files??[];return s.jsxs("main",{className:"progress-report-page",children:[s.jsxs("span",{"aria-hidden":"true",className:"progress-report-page__stamp",children:[t.session.id," · started ",P.startedClock," · operate terminal"]}),s.jsxs("div",{className:"progress-report-page__wrap",children:[s.jsxs("div",{className:"progress-report-page__stack",children:[s.jsxs("header",{className:"progress-report-page__header",children:[s.jsxs("div",{className:"progress-report-page__meta-row",children:[s.jsxs("div",{className:"progress-report-page__tags",children:[s.jsx("button",{"aria-label":"back to progress reports",className:"progress-report-page__tag progress-report-page__back-tag",onClick:r,ref:y,title:"back to progress reports",type:"button",children:t.session.id}),f===void 0?s.jsx("span",{className:"progress-report-page__tag","data-state":t.session.status,children:t.session.status}):s.jsx(RT,{onSet:B=>{f({action:"set",status:B})},status:t.session.status}),s.jsx("button",{className:"progress-report-page__text-control",onClick:()=>{f?.({action:"revert"})},type:"button",children:"[ revert ]"}),ue?s.jsx("span",{className:"progress-report-page__tag","data-variant":"outline",children:"stale"}):null]}),s.jsxs("span",{className:"progress-report-page__header-controls",children:[s.jsxs("span",{className:"progress-report-page__updated","data-flash":F?.wrote?F.generation:void 0,"data-stale":ue||void 0,title:`last write ${t.session.updatedAt}`,children:[ue?"last write":"updated"," ",P.updatedLabel]}),s.jsx(xT,{})]})]}),v===void 0?null:s.jsxs("span",{className:"progress-report-page__published-status",children:["agent published: ",v]}),s.jsx("h1",{children:t.session.title}),s.jsx("p",{children:t.session.goal}),s.jsxs("span",{className:"progress-report-page__session-line",children:["started ",P.startedClock," · elapsed ",P.elapsedLabel," · ",String(P.agents.length)," agents · ",String(P.progress.total)," tasks"]}),P.notice===null?null:s.jsxs("div",{className:"progress-report-page__notice",children:[s.jsx("span",{className:"progress-report-page__tag","data-variant":"outline",children:"needs human"}),s.jsx("span",{children:P.notice.msg.length>140?`${P.notice.msg.slice(0,139).trimEnd()}…`:P.notice.msg}),s.jsxs("span",{children:["raised by ",P.notice.raisedBy,ye>1?` · +${String(ye-1)} more`:""]}),s.jsxs("button",{className:"progress-report-page__text-control",onClick:()=>document.querySelector("[data-progress-blockers]")?.scrollIntoView({behavior:"smooth"}),type:"button",children:["[ view ",de.filter(B=>B.needsHuman).length>1?"blockers":"blocker"," ]"]})]})]}),ue?s.jsxs("section",{className:"progress-report-page__truth-state",role:"status",children:[s.jsx("strong",{children:"Showing a stale snapshot."})," ",_e.terminal?`The last verified report remains visible; polling stopped because ${_e.label}.`:"The live read failed; the last verified report remains visible while polling retries."]}):null,ve.length===0?null:s.jsxs("section",{className:"progress-report-page__hero",children:[s.jsx(wT,{onLocate:ce,presentation:q,setStatusFilter:$,tasks:ve}),s.jsx("div",{className:"progress-report-page__progress-card",children:s.jsxs(ui,{label:"COMPLETE",children:[s.jsxs("div",{className:"progress-report-page__progress-value",children:[String(P.progress.donePercent),"%"]}),s.jsxs("svg",{"aria-hidden":"true",className:"progress-report-page__bar",preserveAspectRatio:"none",viewBox:"0 0 100 4",children:[s.jsx("rect",{className:"progress-report-page__bar-track",height:"4",width:"100"}),s.jsx("rect",{className:"progress-report-page__bar-done",height:"4",width:P.progress.doneWidthPercent}),s.jsx("rect",{className:"progress-report-page__bar-active",height:"4",width:P.progress.activeWidthPercent,x:P.progress.doneWidthPercent})]}),s.jsxs("span",{className:"progress-report-page__caption",children:[String(P.progress.done)," of ",String(P.progress.total)," tasks done · ",String(P.progress.active)," active · ",String(P.progress.blocked)," blocked"]})]})})]}),P.agents.length===0?null:s.jsxs("section",{className:"progress-report-page__agents","aria-labelledby":"progress-agents-title",children:[s.jsxs("div",{className:"progress-report-page__section-heading",children:[s.jsx(Ho,{children:s.jsx("span",{id:"progress-agents-title",children:"Agents"})}),s.jsxs("span",{children:[String(P.workingAgentCount)," working"]})]}),P.agents.map((B,Q)=>s.jsx(ST,{agent:B,pressed:q.agentFilter===B.name,toggle:()=>E(me=>({...me,agentFilter:me.agentFilter===B.name?null:B.name}))},`${B.name}-${String(Q)}`))]}),s.jsxs("section",{className:"progress-report-page__main",children:[s.jsx("div",{className:"progress-report-page__blocker-slot","data-progress-blockers":!0,children:de.length===0?null:s.jsx(AT,{blockers:de})}),s.jsxs("div",{className:"progress-report-page__left",children:[ve.length===0?null:s.jsxs("section",{"aria-labelledby":"progress-tasks-title",children:[s.jsxs("div",{className:"progress-report-page__section-heading",children:[s.jsx(Ho,{children:s.jsx("span",{id:"progress-tasks-title",children:"Tasks"})}),P.taskFilterLabel===null?s.jsxs("span",{children:[String(P.progress.done)," done · ",String(P.progress.active)," active · ",String(P.progress.blocked)," blocked"]}):s.jsxs("span",{children:[P.taskFilterLabel," · ",s.jsx("button",{className:"progress-report-page__text-control",onClick:ae,type:"button",children:"[ clear ]"})]})]}),P.tasks.map((B,Q)=>s.jsx(NT,{flash:F?.taskIds.has(B.id)===!0?F.generation:null,highlighted:M===B.id,task:B},`${B.id}-${String(Q)}`)),P.tasks.length===0?s.jsxs("div",{className:"progress-report-page__empty-filter",children:["no tasks match the current filter · ",s.jsx("button",{className:"progress-report-page__text-control",onClick:ae,type:"button",children:"[ clear ]"})]}):null]}),(t.log??[]).length===0?null:s.jsxs("section",{"aria-labelledby":"progress-log-title",children:[s.jsxs("div",{className:"progress-report-page__section-heading",children:[s.jsx(Ho,{children:s.jsx("span",{id:"progress-log-title",children:"Activity log"})}),s.jsxs("span",{children:["newest first · showing ",P.logs.length<P.logTotal?`${String(P.logs.length)} of ${String(P.logTotal)}`:String(P.logTotal),q.agentFilter===null?"":` · ${q.agentFilter}`,(t.log??[]).some(B=>B.kind==="warn"||B.kind==="error")?s.jsxs(s.Fragment,{children:[" · ",s.jsx("button",{"aria-pressed":q.issuesOnly,className:"progress-report-page__text-control",onClick:()=>E(B=>({...B,issuesOnly:!B.issuesOnly})),type:"button",children:q.issuesOnly?"[ show all ]":"[ issues only ]"})]}):null]})]}),P.logs.map((B,Q)=>s.jsx(kT,{entry:B,flash:F?.logKeys.has(sh(B))===!0?F.generation:null},`${B.t}-${String(Q)}`)),P.logs.length===0?s.jsx("div",{className:"progress-report-page__empty-filter",children:"no entries match the current filter"}):null]})]}),s.jsxs("aside",{className:"progress-report-page__rail",children:[S===void 0?null:s.jsxs(ui,{label:"TESTS",children:[s.jsxs("div",{className:"progress-report-page__test-counts",children:[s.jsxs("span",{children:[s.jsx("strong",{children:String(S.passed)}),s.jsx("small",{children:"passed"})]}),s.jsxs("span",{children:[s.jsx("strong",{"data-failed":S.failed>0||void 0,children:String(S.failed)}),s.jsx("small",{children:"failed"})]}),s.jsxs("span",{children:[s.jsx("strong",{children:String(S.skipped)}),s.jsx("small",{children:"skipped"})]})]}),S.passed+S.failed+S.skipped===0?null:s.jsxs("svg",{"aria-hidden":"true",className:"progress-report-page__bar",preserveAspectRatio:"none",viewBox:"0 0 100 4",children:[s.jsx("rect",{className:"progress-report-page__bar-track",height:"4",width:"100"}),s.jsx("rect",{className:"progress-report-page__bar-pass",height:"4",width:S.passed/(S.passed+S.failed+S.skipped)*100}),s.jsx("rect",{className:"progress-report-page__bar-fail",height:"4",width:S.failed/(S.passed+S.failed+S.skipped)*100,x:S.passed/(S.passed+S.failed+S.skipped)*100})]}),S.failing.length===0?null:s.jsx("div",{className:"progress-report-page__failing",children:S.failing.map((B,Q)=>s.jsxs("span",{children:[s.jsx("span",{"aria-hidden":"true",children:"✕ "}),s.jsx("span",{children:B})]},`${B}-${String(Q)}`))}),s.jsx("span",{className:"progress-report-page__caption",children:S.passed+S.failed+S.skipped===0?"no results recorded yet":`${String(S.passed)} of ${String(S.passed+S.failed)} passing · last run ${P.testsLastRunLabel??"—"}`})]}),L.length===0?null:s.jsx(ET,{expanded:q.filesExpanded,files:P.files,label:P.filesToggleLabel,onToggle:()=>E(B=>({...B,filesExpanded:!B.filesExpanded})),totalCount:L.length,totals:P.fileTotals}),P.decisions.length===0?null:s.jsx(ui,{label:"DECISIONS",children:s.jsx("div",{className:"progress-report-page__decisions",children:P.decisions.map((B,Q)=>s.jsxs("div",{children:[s.jsx("span",{children:B.msg}),s.jsxs("span",{children:[B.by," · ",B.relativeLabel]})]},`${B.by}-${String(Q)}`))})}),p.length===0?null:s.jsx(ui,{label:"PARTIALLY OMITTED",children:s.jsxs("p",{className:"progress-report-page__omitted",children:["The server omitted these sections: ",p.join(", "),"."]})})]})]})]}),s.jsxs("footer",{className:"progress-report-page__footer",children:[s.jsx("span",{}),s.jsxs("div",{children:[s.jsx("span",{children:"native projection · poll every 3s · times utc"}),s.jsx("span",{children:"[ authenticated · strict csp ]"})]})]})]}),s.jsxs("p",{className:"progress-report-page__live-chip","data-degraded":ge||void 0,title:_e.terminal?`${_e.label} — reconnect from the dashboard`:void 0,children:[s.jsx("span",{}),be]})]})}const R0=`Invoke your run-workflow skill via the clinkx mcp server with the following inputs.
|
|
28
|
+
|
|
29
|
+
Only <user_request> is required. The skill infers the council from intent, derives
|
|
30
|
+
the context anchors itself, and launches async or sync with a full-mode
|
|
31
|
+
context_builder preflight (curator + finalizer, failure_policy:fail). An async run
|
|
32
|
+
is polled to completion; a sync run returns inline. Either way it reports the
|
|
33
|
+
chairman's synthesis. Add any optional tag below only to override a default;
|
|
34
|
+
delete the tags you don't use.
|
|
35
|
+
|
|
36
|
+
Per-seat model and effort are structured, never read out of prose. The
|
|
37
|
+
deterministic path is <members_json> for council seats, the scalar curator and
|
|
38
|
+
finalizer tags (<curator_role>, <curator_model>, <curator_effort>,
|
|
39
|
+
<finalizer_role>, <finalizer_model>, <finalizer_effort>) for the preflight
|
|
40
|
+
seats, and <roster> for a named preset. Every model value is REQUESTED: omit a
|
|
41
|
+
tag or JSON field and the adapter's own default applies. The skill echoes the
|
|
42
|
+
resolved roster before launch; the engine returns resolved_roster after
|
|
43
|
+
admission. Effort vocabularies are adapter-specific; low, medium and high work
|
|
44
|
+
everywhere. An undeclared value is rejected up front, before anything runs,
|
|
45
|
+
with the allowed values named in the error.
|
|
46
|
+
|
|
47
|
+
Which repo gets scanned is <roots>. Set it and the skill scans exactly that
|
|
48
|
+
tree. Leave it empty and the skill falls back to a path named in your prose, and
|
|
49
|
+
failing that to the server's own working directory — which is whatever repo the
|
|
50
|
+
session that started the server happened to be in, so it may not be yours. The
|
|
51
|
+
skill always prints the roots it resolved in its pre-launch echo; check that line.
|
|
52
|
+
|
|
53
|
+
There is no tag for the anchors themselves; the skill derives them from <user_request>. A request naming nothing concrete may get one clarifying question before launch.`;function TT(t){const a=[];for(const i of t.split(/\n{2,}/)){const r=i.replace(/[ \t]*\n[ \t]*/g," ").replace(/ {2,}/g," ").trim();r.length>0&&a.push(r)}return a}const CT=["workflow","sync_mode","members_json","chairman","chairman_model","chairman_effort","curator","curator_model","curator_effort","finalizer","finalizer_model","finalizer_effort","user_request"],E0="Is the retry/backoff logic in src/pipeline.ts correct for transient child failures? Look at classifyFailureClass and the ExecutionError path, and say whether a permanent panic class can be reclassified transient.";function OT(t,a){return`${t}
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
${a}
|
|
58
|
+
`}const cm=/^[^\s\0-][^\s\0]*$/,um=/^[a-z0-9][a-z0-9_-]*$/,$r=128,cd=32,ud=200,qu=10,$T={codex:["none","minimal","low","medium","high","xhigh","max"],claude:["low","medium","high","xhigh","max"],glm:["low","medium","high","xhigh","max"],grok:["low","medium","high","xhigh"],agy:["low","medium","high"]},dm={codex:["gpt-5.5","gpt-5-codex"],claude:["claude-fable-5-1"],glm:["glm-5.3[1m]","glm-4.7"],grok:[],agy:[]},fm=["security reviewer: attack surface, trust boundaries, secrets handling","correctness reviewer: edge cases, error paths, invariants, retries","performance reviewer: hot paths, allocations, I/O and concurrency costs","maintainability reviewer: naming, module boundaries, coupling, test coverage","operator's view: production failure modes, observability, rollback"],pm=[{name:"retry-backoff-review",text:E0},{name:"retry-ledger-migration",text:"Review the retry-ledger migration: are attemptsConsumed and max_retries reconciled the same way in src/pipeline.ts and the ledger reader, and does a run resumed after a crash double-count attempts? Name every call site that writes the ledger."},{name:"symlink-containment-audit",text:"Audit contained-file symlink handling across packages: does every read of a curated path resolve links (O_NOFOLLOW or an lstat check) before the containment test, and can a link created between selection and read escape the root? Start from the context_builder curator's read path."}];function MT(t){return t.filter(a=>a.name.startsWith("council-")).flatMap(a=>{const i=a.stages??[],r=i[0],c=i[3];if(r===void 0||c===void 0)return[];const f=r.calls.map(h=>h.cliName??"").filter(h=>h!==""),p=c.calls[0]?.cliName??"";return f.length===0||p===""?[]:[{name:a.name,description:a.description.replace(/\s*\(1-10 members\)/,"").replace(/\.\s*$/,""),seats:f,chairCli:p}]})}function py(t){return t.filter(a=>a.workflowEligible===!0).map(a=>a.name)}function IT(t){const a=new Map(t.map(i=>[i.name,i]));return i=>{const r=a.get(i);return r?.capabilities!==void 0?r.capabilities.effortAllowedValues:$T[i]??[]}}const LT=["codex","codex","claude"];function Od(t){return(t?.seats??LT).map(a=>({cli:a,model:"",effort:"",stance:""}))}function T0(){return{workflow:"",seats:Od(null),chair:{cli:"",model:"",effort:""},curator:{cli:"",model:"",effort:""},finalizer:{cli:"",model:"",effort:""},sync:"",request:"",preset:"",advOpen:!0}}function jr(t){return t?.chairCli??"codex"}function DT(t,a){const i=Od(a);return t.length===i.length&&t.every((r,c)=>r.cli===i[c]?.cli)}function ih(t){const a=t??{};return{cli:typeof a.cli=="string"?a.cli:"",model:typeof a.model=="string"?a.model:"",effort:typeof a.effort=="string"?a.effort:""}}function zT(t){const a=t??{};return{cli:typeof a.cli=="string"?a.cli:"",model:typeof a.model=="string"?a.model:"",effort:typeof a.effort=="string"?a.effort:"",stance:typeof a.stance=="string"?a.stance:""}}function hy(t,a){if(t==null||typeof t!="object")return T0();const i=t,r=typeof i.workflow=="string"?i.workflow:"";return{workflow:r,seats:Array.isArray(i.seats)&&i.seats.length>0?i.seats.map(zT):Od(a(r)),chair:ih(i.chair),curator:ih(i.curator),finalizer:ih(i.finalizer),sync:i.sync==="sync"?"sync":"",request:typeof i.request=="string"?i.request:"",preset:typeof i.preset=="string"?i.preset:"",advOpen:i.advOpen==null?!0:i.advOpen!==!1}}function qT(t){return`[
|
|
59
|
+
${t.map(a=>{const i={cli_name:a.cli},r=a.stance.trim();return r!==""&&(i.stance=r.replace(/\s+/g," ")),a.model!==""&&(i.model=a.model.trim()),a.effort!==""&&(i.effort=a.effort),` ${JSON.stringify(i).replace(/","/g,'", "').replace(/":"/g,'": "')}`}).join(`,
|
|
60
|
+
`)}
|
|
61
|
+
]`}function UT(t){return t==="workflow"||t==="user_request"?"required":/_(model|effort)$/.test(t)?"adapter default":""}function rh(t,a,i){const r=[],c=(k,q,E,M)=>{r.push({field:k,sub:q,kind:"missing",short:E,message:M})},f=(k,q,E)=>{r.push({field:k,sub:q,kind:"invalid",message:E})},p=(k,q,E)=>{k.model===""&&c(q,"model",`${E} model`,`${E} needs a model id`),k.effort===""&&c(q,"effort",`${E} effort`,`${E} needs an effort`)},h=(k,q,E)=>{k!==""&&(k.length>$r||!cm.test(k))&&f(q,"model",`${E} model id: no whitespace, no leading “-”, at most ${$r} characters`)},v=(k,q,E,M)=>{if(k==="")return;if(k.length>cd||!um.test(k)){f(E,"effort",`${M} effort has an invalid format (lowercase, digits, _ -)`);return}const D=i(q);D.length>0&&!D.includes(k)&&f(E,"effort",`${M}: ${q} has no effort “${k}” — allowed: ${D.join(" · ")}`)},m=new Map,x=(k,q)=>{q!==""&&m.set(k,q)};t.workflow!==""?x("workflow",t.workflow):c("workflow","","workflow","pick a workflow"),t.sync==="sync"&&x("sync_mode","sync"),t.seats.length===0&&c("seats","","a seat","add at least one seat"),t.seats.length>qu&&f("seats","","a council has at most 10 seats"),t.seats.forEach((k,q)=>{const E=`seat:${q}`,M=`seat ${q+1}`;k.cli===""&&c(E,"cli",`${M} cli`,`${M} needs a cli_name`),h(k.model,E,M),v(k.effort,k.cli,E,M),p(k,E,M);const D=k.stance.trim().replace(/\s+/g," ");q>=3&&D===""?c(E,"stance",`${M} stance`,`${M} needs a stance (required from seat 4)`):D.includes("{{")||D.includes("}}")?f(E,"stance",`${M} stance must not contain {{ or }}`):D.length>ud&&f(E,"stance",`${M} stance: at most ${ud} characters`)}),t.seats.length>0&&x("members_json",qT(t.seats));const y=t.chair.cli||jr(a);x("chairman",t.chair.cli),x("chairman_model",t.chair.model),x("chairman_effort",t.chair.effort),h(t.chair.model,"chair","chairman"),v(t.chair.effort,y,"chair","chairman"),p(t.chair,"chair","chairman");for(const k of["curator","finalizer"]){const q=t[k];x(k,q.cli),x(`${k}_model`,q.model),x(`${k}_effort`,q.effort),h(q.model,k,k),v(q.effort,q.cli||"codex",k,k),p(q,k,k)}const A=t.request.trim();A===""&&c("request","","request","the request is empty — <user_request> is the one required tag"),x("user_request",A);const w=new Map([["sync_mode","async"],["chairman",jr(a)],["curator","codex"],["finalizer","codex"]]),C=CT.map(k=>{const q=m.get(k)??"",E=q!=="",M=w.get(k)??"";return{tag:k,value:E?q:M,isSet:E,isDefault:!E&&M!=="",ghost:!E&&M==="",why:UT(k)}}),T=C.filter(k=>k.value!==""),N=C.filter(k=>k.value===""&&/_(model|effort)$/.test(k.tag)),I=T.map(k=>`<${k.tag}>
|
|
62
|
+
${k.value}
|
|
63
|
+
</${k.tag}>`).join(`
|
|
64
|
+
|
|
65
|
+
`);return{every:C,written:T,omitted:N,issues:r,text:OT(R0,I)}}function BT(t){return t==="workflow"?0:t==="curator"||t==="finalizer"?1:t.startsWith("seat")||t==="chair"||t==="seats"?2:3}function my(t){return t==="workflow"?"workflow":t==="sync_mode"?"sync":t==="members_json"?"seats":t.startsWith("chairman")?"chair":t.startsWith("curator")?"curator":t.startsWith("finalizer")?"finalizer":t==="user_request"?"request":""}const C0=`## Task
|
|
66
|
+
|
|
67
|
+
Use the \`chief-of-staff\` skill to execute the request below.
|
|
68
|
+
|
|
69
|
+
## Invocation Policy
|
|
70
|
+
|
|
71
|
+
- Run in supervised mode. First perform a bounded, read-only readiness preflight. Resolve questions from repository evidence, available OpenViking context, and discovery before asking me anything.
|
|
72
|
+
- Report READY or BLOCKED, including consequential unresolved decisions, proposed execution routes, and integration target. Then ask for my explicit go-ahead before implementation, durable-task or automation creation, or task curation.
|
|
73
|
+
- After approval, create durable isolated-worktree implementation tasks. Select model and effort according to the skill's capability-aware routing; report the selected profiles and any necessary fallback.
|
|
74
|
+
- Prefer compatible ClinkX routes for bounded scouts, advice, and independent verification, honoring the tier XML. Do not silently substitute XML-selected adapters.
|
|
75
|
+
- Maintain up to three non-overlapping writers when safe and useful, accounting for live capacity and verification needs. Never manufacture work merely to fill capacity.
|
|
76
|
+
- Use manager and worker goals when goal tools are exposed.
|
|
77
|
+
- After approval, create or update a matching portfolio heartbeat when scheduling is exposed. Monitor workers through accepted integration and completion, or until a genuine blocker requires me. Notify only on meaningful changes or required action.
|
|
78
|
+
- Publish and maintain a progress report via ClinkX.
|
|
79
|
+
- Prioritize independent source implementation over qualification-only gates. Preserve schema, safety, authorization, and runtime prerequisites. Prefer running-app QA when available and authorized.
|
|
80
|
+
- If \`.ai/\` inputs are ignored, copy only the relevant non-secret inputs into isolated worker worktrees.
|
|
81
|
+
- Do not stage, commit, push, merge, rebase, reset, stash, clean, or rewrite Git state without my explicit authorization for that action.`,GT="## ClinkX Profiles",HT="## Request",Nr="tier_1_agents_json",kr="tier_2_agents_json",Po="user_request";function VT(t,a,i){const r=[C0];return(t!==null||a!==null)&&(r.push(`
|
|
82
|
+
|
|
83
|
+
`,GT),t!==null&&r.push(`
|
|
84
|
+
|
|
85
|
+
`,`<${Nr}>
|
|
86
|
+
`,t,`
|
|
87
|
+
</${Nr}>`),a!==null&&r.push(`
|
|
88
|
+
|
|
89
|
+
`,`<${kr}>
|
|
90
|
+
`,a,`
|
|
91
|
+
</${kr}>`)),r.push(`
|
|
92
|
+
|
|
93
|
+
`,HT,`
|
|
94
|
+
|
|
95
|
+
`,`<${Po}>
|
|
96
|
+
`,i,`
|
|
97
|
+
</${Po}>
|
|
98
|
+
`),r.join("")}function FT(t){const a="## Task",i="## Invocation Policy",r=t.slice(t.indexOf(a)+a.length,t.indexOf(i)).trim(),c=t.slice(t.indexOf(i)+i.length).split(`
|
|
99
|
+
`).map(f=>f.trim()).filter(f=>f.startsWith("- ")).map(f=>f.slice(2));return{task:r,bullets:c}}const dd={tier1:[{cli:"codex",model:"gpt-5.6-luna",effort:"max"},{cli:"codex",model:"gpt-5.6-sol",effort:"medium"}],tier2:[{cli:"glm",model:"glm-5.3[1m]",effort:"max"},{cli:"agy",model:"gemini-3.8-flash",effort:"high"}]},gy=64;function O0(){return{tier1:dd.tier1.map(t=>({...t})),tier2:dd.tier2.map(t=>({...t})),request:"",preset:""}}function KT(t){const a=t??{};return{cli:typeof a.cli=="string"?a.cli:"",model:typeof a.model=="string"?a.model:"",effort:typeof a.effort=="string"?a.effort:""}}function _y(t,a){return t===null?null:Array.isArray(t)?t.map(KT):a.map(i=>({...i}))}function vy(t){if(t==null||typeof t!="object")return O0();const a=t;return{tier1:_y(a.tier1,dd.tier1),tier2:_y(a.tier2,dd.tier2),request:typeof a.request=="string"?a.request:"",preset:typeof a.preset=="string"?a.preset:""}}function oh(t){return t.length===0?"[]":`[
|
|
100
|
+
${t.map(a=>{const i={cli_name:a.cli};return a.model!==""&&(i.model=a.model.trim()),a.effort!==""&&(i.effort=a.effort),` ${JSON.stringify(i).replace(/","/g,'", "').replace(/":"/g,'": "')}`}).join(`,
|
|
101
|
+
`)}
|
|
102
|
+
]`}function $0(t){return t.startsWith("-")||/\s/.test(t)||/[\x00-\x1f\x7f]/.test(t)||t.length>gy?`no whitespace, no leading “-”, no control characters, at most ${gy} characters`:""}function ZT(t,a){const i=[],r=(m,x,y,A)=>{i.push({field:m,sub:x,kind:"missing",short:y,message:A})},c=(m,x,y)=>{i.push({field:m,sub:x,kind:"invalid",message:y})},f=(m,x,y)=>{i.push({field:m,sub:x,kind:"warning",message:y})},p=(m,x,y,A)=>{(m.includes("{{")||m.includes("}}")||m.includes("Example:")||/^YOUR_[A-Z0-9_]+$/.test(m))&&c(x,y,`${A} ${y}: unfilled placeholder from the template Example — replace it`)},h=[];["tier1","tier2"].forEach((m,x)=>{const y=x+1,A=t[m];A!==null&&(h.push({tag:y===1?Nr:kr,value:oh(A)}),A.forEach((w,C)=>{const T=`tier${y}:${C}`,N=`tier ${y} profile ${C+1}`;if(w.cli==="")r(T,"cli",`t${y}·${C+1} cli`,`${N} needs a cli_name`);else{const I=$0(w.cli);I!==""&&c(T,"cli",`${N} cli_name: ${I}`),p(w.cli,T,"cli",N)}if(w.model!==""&&(p(w.model,T,"model",N),(w.model.length>$r||!cm.test(w.model))&&c(T,"model",`${N} model id: no whitespace, no leading “-”, at most ${$r} characters`)),w.effort!=="")if(p(w.effort,T,"effort",N),w.effort.length>cd||!um.test(w.effort))c(T,"effort",`${N} effort has an invalid format (lowercase, digits, _ -)`);else{const I=a(w.cli);I.length>0&&!I.includes(w.effort)&&f(T,"effort",`${N}: ${w.cli} does not declare effort “${w.effort}” — passed through verbatim; admission decides`)}}))});const v=t.request.trim();return v===""&&r("request","","request","the request is empty — the user request is the one required fill point"),h.push({tag:Po,value:v}),{issues:i,text:VT(t.tier1===null?null:oh(t.tier1),t.tier2===null?null:oh(t.tier2),v),written:h}}function YT(t){return t==="request"?1:0}const XT="/api/prompt-builder/library",PT="/api/prompt-builder/library/save",Uh="prompt-builder-library-v1",QT="prompt-builder-library-response-v1";function Uu(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function JT(t){if(!Uu(t)||t.schemaVersion!==Uh||typeof t.updatedAt!="string"||!Uu(t.models)||!Array.isArray(t.requests)||!Array.isArray(t.stances))return null;const a={};for(const[r,c]of Object.entries(t.models)){if(!Array.isArray(c)||!c.every(f=>typeof f=="string"))return null;a[r]=c}const i=[];for(const r of t.requests){if(!Uu(r)||typeof r.name!="string"||typeof r.text!="string")return null;i.push({name:r.name,text:r.text})}return t.stances.every(r=>typeof r=="string")?{schemaVersion:Uh,updatedAt:t.updatedAt,models:a,requests:i,stances:t.stances}:null}function WT(t){if(!Uu(t)||t.schemaVersion!==QT)return null;if(t.state==="absent"||t.state==="unreadable")return{state:t.state};if(t.state==="present"){const a=JT(t.library);return a===null?null:{state:"present",library:a}}return null}async function eC(t){const a=await ms(XT,t===void 0?void 0:{signal:t});if(!a.ok)throw new Error(`prompt-builder library GET failed: ${String(a.status)}`);const i=WT(await sa(a));if(i===null)throw new Error("prompt-builder library GET response was invalid");return i}async function tC(t){const a=await kx(PT,t);if(a.status!==204&&!a.ok)throw new Error(`prompt-builder library save failed: ${String(a.status)}`)}const M0="clinkx-pb-form",I0="clinkx-pb-cos-form",L0="clinkx-pb-history",hm="clinkx-pb-models",mm="clinkx-pb-requests",gm="clinkx-pb-stances",_m="clinkx-pb-library-dirty",D0="clinkx-pb-active-target",z0=12,nC=110,by=32,yy=64,xy=64,jy=64,wy=40,Oo=16e3;function oi(t,a){try{const i=(t??window.localStorage).getItem(a);return i===null?null:JSON.parse(i)}catch{return null}}function Dl(t,a,i){try{(t??window.localStorage).setItem(a,JSON.stringify(i))}catch{}}function ch(t,a){Dl(t,hm,a.models),Dl(t,mm,a.requests),Dl(t,gm,a.stances)}function Sy(t){try{return(t??window.localStorage).getItem(_m)==="1"}catch{return!1}}function Ny(t){try{(t??window.localStorage).setItem(_m,"1")}catch{}}function aC(t){try{(t??window.localStorage).removeItem(_m)}catch{}}function sC(t){const a=oi(t,D0);return a==="chief-of-staff"||a==="verified-repair"?a:"workflow"}function ky(t,a){Dl(t,D0,a)}function lC(t){return Array.isArray(t)?t.flatMap(a=>{if(a==null||typeof a!="object")return[];const i=a;return typeof i.at!="number"||typeof i.form!="object"?[]:[{at:i.at,workflow:typeof i.workflow=="string"?i.workflow:"",council:typeof i.council=="string"?i.council:"",head:typeof i.head=="string"?i.head:"",form:i.form,...i.target==="chief-of-staff"&&i.cosForm!=null&&typeof i.cosForm=="object"&&!Array.isArray(i.cosForm)?{target:"chief-of-staff",cosForm:i.cosForm}:{}}]}).slice(0,z0):[]}function q0(t){return Array.isArray(t)?t.flatMap(a=>{if(a==null||typeof a!="object")return[];const i=a;return typeof i.name!="string"||typeof i.text!="string"?[]:[{name:i.name,text:i.text}]}):null}function U0(t){if(t==null||typeof t!="object")return{};const a={};for(const[i,r]of Object.entries(t))Array.isArray(r)&&r.every(c=>typeof c=="string")&&(a[i]=r);return a}function B0(t){return Array.isArray(t)?t.filter(a=>typeof a=="string"):null}function iC(t){const a=q0(oi(t,mm)),i=B0(oi(t,gm));return{form:oi(t,M0),cosForm:oi(t,I0),history:lC(oi(t,L0)),models:{...dm,...U0(oi(t,hm))},requests:a??pm,stances:i??[...fm]}}function _r(t){return JSON.stringify(t)}function rC(t){return _r(t.models)===_r({...dm})&&_r(t.requests)===_r(pm)&&_r(t.stances)===_r([...fm])}function oC(t){const a=typeof window>"u"?void 0:window.localStorage;if(a===void 0)return null;let i,r,c;try{i=a.getItem(hm),r=a.getItem(mm),c=a.getItem(gm)}catch{return null}if(i===null&&r===null&&c===null)return null;const f=i===null?{}:U0(uh(i)),p=r===null?[]:q0(uh(r))??[],h=c===null?[]:B0(uh(c))??[],v={models:f,requests:p,stances:h};return rC({models:{...dm,...f},requests:r===null?pm:p,stances:c===null?[...fm]:h})?null:v}function uh(t){try{return JSON.parse(t)}catch{return null}}function Ay(t){return t.trim().replace(/\s+/g," ").slice(0,nC)}let fd=0,$o=0,dh=!1,qo=null,Bh=null;function Ry(){return fd}function Su(){return fd+=1,fd}function Ey(t){Bh=t}function fh(t,a){qo={snapshot:t,gen:a},G0()}async function G0(){if(dh)return;dh=!0;const t=$o;try{for(;qo!==null;){const a=qo;qo=null;try{await tC({schemaVersion:Uh,models:a.snapshot.models,requests:a.snapshot.requests,stances:a.snapshot.stances}),a.gen===fd&&(aC(),Bh?.onSynced())}catch{Bh?.onUnsynced()}}}finally{dh=!1,qo!==null&&t===$o&&G0()}}function H0({config:t,phone:a,addText:i,highlight:r,applyAllOn:c,onAddTextChange:f,onHighlight:p,onApplyAllToggle:h,onPick:v,onAdd:m,onRemove:x,onClose:y}){const A=b.useRef(null),w=b.useId();b.useEffect(()=>{A.current?.focus({preventScroll:!0})},[]);const C=t.addable===void 0?"":i.trim().toLowerCase(),T=t.noneLabel===void 0?t.options:[{value:"",label:t.noneLabel},...t.options],N=C===""?T:T.filter(D=>D.label.toLowerCase().includes(C)),I=N.findIndex(D=>D.value===t.current),k=N.length===0?0:r===null?Math.max(0,I):Math.min(r,N.length-1),q=D=>{N.length>0&&p((k+D+N.length)%N.length)},E=()=>{const D=i.trim();if(r!==null&&N[k]!==void 0){v(N[k].value);return}if(D==="")return;const F=T.find(te=>te.value!==""&&te.value.toLowerCase()===D.toLowerCase());if(F!==void 0){v(F.value);return}t.addable!==void 0&&t.addable.addError(D)===""&&m(D)},M=t.addable===void 0?"":t.addable.addError(i.trim());return s.jsxs("div",{"aria-activedescendant":N.length>0?`${w}-opt-${k}`:void 0,"aria-label":t.title,className:"pb-picker__options","data-phone":a?"true":void 0,onKeyDown:D=>{D.key==="ArrowDown"||D.key==="ArrowUp"?(D.preventDefault(),D.stopPropagation(),q(D.key==="ArrowDown"?1:-1)):D.key==="Enter"?(D.preventDefault(),D.stopPropagation(),N.length>0&&v(N[k].value)):D.key==="Escape"&&(D.preventDefault(),D.stopPropagation(),y())},ref:A,role:"listbox",tabIndex:-1,children:[N.map((D,F)=>s.jsxs("div",{"aria-selected":D.value===t.current,className:`pb-picker__option${F===k&&!a?" pb-picker__option--hi":""}${D.value===""?" pb-picker__option--none":""}`,id:`${w}-opt-${F}`,onClick:()=>v(D.value),role:"option",children:[s.jsxs("span",{className:"pb-picker__option-text",children:[s.jsx("span",{className:"pb-picker__option-label",children:D.label}),D.desc!==void 0&&D.desc!==""?s.jsx("span",{className:"pb-picker__option-desc",children:D.desc}):null]}),D.value===t.current?s.jsx("span",{"aria-hidden":"true",className:"pb-picker__option-mark",children:"✓"}):null,D.removable===!0&&D.value!==""?s.jsx("button",{"aria-label":t.removeLabel??"remove from the curated list",className:"pb-picker__option-remove",onClick:te=>{te.stopPropagation(),x(D.value)},title:t.removeLabel??"remove from the curated list",type:"button",children:"×"}):null]},D.value===""?"—":D.value)),N.length===0?s.jsx("div",{className:"pb-picker__empty",children:C!==""?`nothing matches “${i.trim()}” — [ add ] saves it`:t.emptyText??"nothing to pick yet"}):null,t.applyAll!==void 0?s.jsxs("button",{"aria-checked":c,className:"pb-picker__apply",onClick:D=>{D.stopPropagation(),h()},role:"checkbox",type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:"pb-picker__apply-box","data-on":c?"true":void 0,children:c?"✓":""}),t.applyAll.label]}):null,t.addable!==void 0?s.jsxs("div",{className:"pb-picker__add",children:[s.jsx("span",{"aria-hidden":"true",className:"pb-picker__add-plus",children:"+"}),s.jsx("input",{"aria-label":"new option",className:"pb-picker__add-input",onChange:D=>{f(D.target.value),p(null)},onKeyDown:D=>{D.stopPropagation(),D.key==="Enter"?(D.preventDefault(),E()):D.key==="ArrowDown"||D.key==="ArrowUp"?(D.preventDefault(),q(D.key==="ArrowDown"?1:-1)):D.key==="Escape"&&y()},placeholder:t.addable.placeholder,type:"text",value:i}),s.jsx("button",{className:"pb-picker__add-submit",onClick:D=>{D.stopPropagation(),E()},type:"button",children:"[ add ]"})]}):null,M!==""?s.jsx("div",{className:"pb-picker__add-err",role:"alert",children:M}):null]})}function cC(t){const{anchor:a,config:i,onClose:r}=t,c=b.useRef(null),f=p=>{c.current=p,!(p===null||a===null)&&(p.style.setProperty("--pb-pop-left",`${a.left}px`),p.style.setProperty("--pb-pop-top",`${a.top}px`),p.style.setProperty("--pb-pop-row-w",`${a.rowW}px`),p.style.setProperty("--pb-pop-w",`${Math.min(i.width,a.rowW)}px`))};return s.jsxs("div",{className:"pb-pop","data-pbpop":"1",onClick:p=>p.stopPropagation(),ref:f,children:[s.jsxs("div",{className:"pb-pop__head",children:[s.jsx("span",{className:"pb-pop__title",children:i.title}),s.jsx("span",{className:"pb-pop__sub",children:i.sub}),s.jsx("button",{"aria-label":"close",className:"pb-pop__close",onClick:r,type:"button",children:"×"})]}),s.jsx(H0,{...t})]})}function uC(t){const{config:a,onClose:i}=t,r=b.useId();return s.jsx(vd,{applicationRootId:"root",labelledBy:r,onClose:i,open:!0,panelClassName:"accessible-dialog--sheet pb-sheet",children:s.jsxs("div",{className:"pb-sheet__inner",children:[s.jsx("button",{"aria-label":"close",className:"pb-sheet__handle",onClick:i,type:"button",children:s.jsx("span",{"aria-hidden":"true",className:"pb-sheet__handle-pill"})}),s.jsxs("div",{className:"pb-sheet__head",children:[s.jsx("span",{className:"pb-sheet__title",id:r,children:a.title}),s.jsx("span",{className:"pb-sheet__sub",children:a.sub})]}),s.jsx(H0,{...t})]})})}function Ty(t){return t.phone?s.jsx(uC,{...t}):s.jsx(cC,{...t})}const dC=`Use the verified-repair skill to prepare a reviewed repair contract and native check manifests for the request below, then launch ClinkX's native verified-repair workflow and poll it to completion. Preparation and the scoped in-place repair are authorized; preserve unrelated changes and let the native host perform capture, replacements and verification.
|
|
103
|
+
|
|
104
|
+
Treat the single repair_request_json object as task data. Read the skill's native contract reference, verify the MCP host paths and capabilities, and preserve the requested routes and optional model/effort values. Stop with an actionable blocker if authority, exclusive ownership, host access, native capability or bounded complete inputs cannot be established.
|
|
105
|
+
|
|
106
|
+
Report repair qualification, applied paths, actual checks and causal proof, independent findings, gaps and retained evidence. Owner acceptance remains separate. Do not stage, commit, push, resume, retry, roll back or substitute providers automatically.`;function fC(t){const a=JSON.stringify(t,null,2).replace(/[<>&]/g,i=>`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`);return`${dC}
|
|
107
|
+
|
|
108
|
+
<repair_request_json>
|
|
109
|
+
${a}
|
|
110
|
+
</repair_request_json>
|
|
111
|
+
`}const V0="clinkx-pb-repair-form";function vm(){return{defect:"",expectedBehavior:"",projectPath:"",evidenceParent:"",copyParent:"",investigator:"codex",author:"codex",verifier:"claude",exclusiveOwnership:!1}}function pC(t){const a=vm();if(t===null||typeof t!="object"||Array.isArray(t))return a;const i=t;return Object.fromEntries(Object.entries(a).map(([r,c])=>[r,typeof i[r]==typeof c?i[r]:c]))}function hC(t,a){const i=[];for(const[f,p]of[["Defect",t.defect],["Expected behavior",t.expectedBehavior]])p?.trim()?p.length>6e3&&i.push(`${f} must be at most 6000 characters.`):i.push(`${f} is required.`);const r=[["Project path",t.projectPath],["Evidence parent",t.evidenceParent],["Verification-copy parent",t.copyParent]],c=r.map(([,f])=>f.trim().replace(/\\/g,"/").replace(/\/+$/,""));r.forEach(([f,p])=>{(!/^(\/|[A-Za-z]:[\\/])/.test(p.trim())||/[\u0000-\u001f\u007f]/.test(p)||p.length>4096||p.trim().split(/[\\/]/).some(h=>h==="."||h===".."))&&i.push(`${f} must be a canonical absolute path on the MCP host.`)}),c.forEach((f,p)=>{c.some((h,v)=>v!==p&&(f===h||f.startsWith(`${h}/`)))&&i.push("Project, evidence and verification-copy locations must not overlap.")});for(const[f,p]of[["Investigator",t.investigator],["Repair author",t.author],["Verifier",t.verifier]])(!p||!a.includes(p))&&i.push(`${f} must use an available workflow-eligible CLI.`);return t.exclusiveOwnership||i.push("Confirm exclusive write ownership of the repair paths."),{issues:[...new Set(i)],text:fC({project_path:t.projectPath.trim(),evidence_parent:t.evidenceParent.trim(),verification_copy_parent:t.copyParent.trim(),defect:{description:t.defect.trim(),expected_behavior:t.expectedBehavior.trim()},routes:{investigator:{cli_name:t.investigator},repair_author:{cli_name:t.author},verifier:{cli_name:t.verifier}},exclusive_write_ownership:t.exclusiveOwnership})}}function mC(){try{return pC(JSON.parse(window.localStorage.getItem(V0)??"null"))}catch{return vm()}}function gC({targets:t,clis:a,available:i,retry:r}){const[c,f]=b.useState(mC),[p,h]=b.useState(!1),[v,m]=b.useState(""),x=b.useRef(null),y=sm(),A=hC(c,a),w=i?A.issues:["Current catalogs must expose verified-repair and its provider routes before copy.",...A.issues];b.useEffect(()=>{Dl(void 0,V0,c)},[c]);const C=(M,D)=>{f(F=>({...F,[M]:D})),m("")},T=w.length===0,N=b.useCallback(async()=>{if(T)try{if(navigator.clipboard?.writeText===void 0)throw new Error("clipboard unavailable");await navigator.clipboard.writeText(A.text),m("Copied. Paste this prompt into Claude Code or Codex connected to ClinkX.")}catch{h(!0),m("Clipboard unavailable. Select and copy the prompt below.")}},[T,A.text]),I=b.useRef(N);b.useEffect(()=>{I.current=N},[N]),b.useEffect(()=>{const M=D=>{(D.ctrlKey||D.metaKey)&&D.key==="Enter"&&(D.preventDefault(),I.current())};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]),b.useEffect(()=>{if(!v.startsWith("Clipboard unavailable")||x.current===null)return;const M=document.createRange();M.selectNodeContents(x.current);const D=window.getSelection();D?.removeAllRanges(),D?.addRange(M)},[v,p]);const k=(M,D,F=!1)=>s.jsxs("div",{className:"pb-repair-field",children:[s.jsx("label",{htmlFor:`pb-repair-${M}`,children:D}),F?s.jsx("textarea",{id:`pb-repair-${M}`,maxLength:6e3,rows:4,value:c[M],onChange:te=>C(M,te.target.value)}):s.jsx("input",{id:`pb-repair-${M}`,autoComplete:"off",maxLength:4096,placeholder:"/absolute/host/path",value:c[M],onChange:te=>C(M,te.target.value)})]},M),q=s.jsxs("section",{className:"pb-form-view pb-repair-form","aria-label":"Verified repair form",children:[s.jsx("h1",{className:"visually-hidden",id:"dashboard-page-title",children:"Prompt builder"}),s.jsxs("div",{className:"pb-form-head",children:[s.jsx("span",{className:"pb-specimen",children:"Prompt builder"}),t]}),s.jsx("h2",{className:"pb-h1",children:"Verified repair"}),s.jsx("p",{className:"pb-sub",children:"Invoke the verified-repair skill from your agent. The skill inspects the project, prepares the contract and manifests, then invokes ClinkX."}),s.jsx("p",{className:"pb-sub",children:"All paths are on the MCP server host. Project and copy parent need source access; evidence may use an artifact-only root. The agent checks these prerequisites before execution."}),k("defect","Defect and reproduction",!0),k("expectedBehavior","Expected behavior",!0),k("projectPath","Project path"),k("evidenceParent","Evidence parent"),k("copyParent","Verification-copy parent"),s.jsxs("fieldset",{className:"pb-repair-routes",children:[s.jsx("legend",{children:"Provider routes"}),[["investigator","Investigator"],["author","Repair author"],["verifier","Independent verifier"]].map(([M,D])=>s.jsxs("div",{className:"pb-repair-field",children:[s.jsx("label",{htmlFor:`pb-repair-${M}`,children:D}),s.jsxs("select",{id:`pb-repair-${M}`,value:c[M],onChange:F=>C(M,F.target.value),children:[s.jsx("option",{value:"",children:"Select a provider"}),c[M]!==""&&!a.includes(c[M])?s.jsxs("option",{value:c[M],disabled:!0,children:[c[M]," (unavailable)"]}):null,a.map(F=>s.jsx("option",{value:F,children:F},F))]})]},M)),s.jsx("p",{className:"pb-sub",children:"Model and effort use configured adapter defaults. The verifier receives fresh context."})]}),s.jsxs("label",{className:"pb-repair-ownership",children:[s.jsx("input",{type:"checkbox",checked:c.exclusiveOwnership,onChange:M=>C("exclusiveOwnership",M.target.checked)}),"I authorize preparation and scoped repair, with no other writers on the declared repair paths during the run."]}),s.jsx("p",{className:"pb-sub",children:"This builder copies a skill invocation. It does not write contracts or launch repairs. Failed repairs retain edits and evidence; verification does not record owner acceptance."}),s.jsx("button",{type:"button",className:"pb-fact-btn",onClick:()=>{f(vm()),m("")},children:"[ reset repair draft ]"}),i?null:s.jsx("button",{type:"button",className:"pb-fact-btn",onClick:r,children:"[ retry catalogs ]"})]}),E=s.jsxs("section",{className:"pb-prompt-view",children:[y?s.jsx("button",{className:"pb-fact-btn",type:"button",onClick:()=>h(!1),children:"‹ builder"}):null,s.jsxs("div",{className:"pb-h1-row",children:[s.jsx("h2",{className:"pb-h1",children:"verified-repair"}),s.jsx("button",{className:"pb-cta",type:"button",disabled:w.length>0,onClick:()=>{N()},children:"copy prompt"})]}),w.length>0?s.jsxs("div",{className:"pb-before",role:"status",children:[s.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"Before copy"}),s.jsx("ul",{children:w.map(M=>s.jsx("li",{children:M},M))})]}):null,s.jsx("div",{className:"pb-card",children:s.jsx("pre",{className:"pb-raw","aria-label":"the prompt exactly as copied",ref:x,tabIndex:0,children:A.text})}),s.jsx("p",{role:"status",children:v})]});return s.jsxs("div",{className:"prompt-builder pb-repair-builder",children:[s.jsx(Hs,{runList:q,detail:E,listAriaLabel:"Prompt builder form",detailAriaLabel:"Assembled prompt",mobileView:p?"detail":"list"}),y&&!p?s.jsxs("div",{className:"pb-action-bar",children:[s.jsx("button",{type:"button",className:"pb-fact-btn",onClick:()=>h(!0),children:"preview prompt ›"}),s.jsx("button",{type:"button",className:"pb-cta",disabled:w.length>0,onClick:()=>{N()},children:"copy prompt"}),s.jsx("span",{role:"status",children:v})]}):null]})}const _C=["Workflow","Context preflight","Council","Request"],vC=["workflow","preflight","council","request"],bC=["Profiles","Request"],yC=["profiles","request"],xC=[{keys:["curator_role"],value:"json"},{keys:["finalizer_role"],value:"json-codereviewer"},{keys:["roots"],value:"derived from the request by the skill — check the pre-launch echo"}];function Cy(t,a){const i=new Date(t),r=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,c=new Date(a);return i.toDateString()===c.toDateString()?r:`${i.getMonth()+1}/${i.getDate()} ${r}`}function jC(){if(typeof window<"u")try{const t=new URLSearchParams(window.location.search).get("mode");if(t==="chief-of-staff"||t==="verified-repair")return t}catch{}return sC()}function wC(t){return t===null?"unspecified — tag omitted":t.length===0?"empty pool — writes []":`${t.length} profile${t.length===1?"":"s"}`}function SC({workflows:t,adapters:a}){const i=sm(),c=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘":"ctrl+",[f]=b.useState(()=>iC()),[p]=b.useState(()=>oC()),[h,v]=b.useState(()=>hy(f.form,()=>null)),[m,x]=b.useState(f.history),[y,A]=b.useState(()=>p?.models??f.models),[w,C]=b.useState(()=>p?.requests??f.requests),[T,N]=b.useState(()=>p?.stances??f.stances),[I,k]=b.useState(()=>vy(f.cosForm)),[q,E]=b.useState(jC);b.useEffect(()=>{ky(void 0,q)},[q]),b.useEffect(()=>{Dl(void 0,M0,h)},[h]),b.useEffect(()=>{Dl(void 0,L0,m)},[m]),b.useEffect(()=>{Dl(void 0,I0,I)},[I]);const[M,D]=b.useState("loading"),[F,te]=b.useState(0),oe=b.useRef({models:p?.models??f.models,requests:p?.requests??f.requests,stances:p?.stances??f.stances}),P=b.useRef(null),ue=b.useRef(!0);oe.current={models:y,requests:w,stances:T};const _e=b.useCallback(g=>{oe.current=g,A(g.models),C(g.requests),N(g.stances)},[]),ge=b.useCallback((g,R)=>{P.current=null,fh(g,R)},[]),be=b.useCallback(g=>{const R=oe.current,V=g(R);if(V===R)return;_e(V),ch(void 0,V),Ny(),D("unsynced");const W=Su();P.current={gen:W,snapshot:V},te(W)},[_e]);b.useEffect(()=>(ue.current=!0,Ey({onSynced:()=>{ue.current&&D("synced")},onUnsynced:()=>{ue.current&&D("unsynced")}}),()=>{ue.current=!1,Ey(null)}),[]),b.useEffect(()=>{const g=new AbortController,R=p;return(async()=>{const V=Ry();try{const W=await eC(g.signal);if(g.signal.aborted)return;if(Sy()){D("unsynced");const ne=P.current;P.current=null;const Oe=ne?.snapshot??oe.current,Ge=ne?.gen??Su();ge(Oe,Ge);return}if(Ry()!==V)return;if(W.state==="present"){const ne={models:W.library.models,requests:W.library.requests,stances:[...W.library.stances]};_e(ne),ch(void 0,ne),D("synced");return}if(W.state==="absent"){if(R!==null){_e(R),ch(void 0,R),Ny(),D("unsynced"),ge(R,Su());return}D("local");return}D("unsynced")}catch{if(g.signal.aborted)return;if(Sy()){D("unsynced");const W=P.current;P.current=null,ge(W?.snapshot??oe.current,W?.gen??Su());return}D("unsynced")}})(),()=>g.abort()},[_e,p,ge]),b.useEffect(()=>{if(F===0)return;const g=window.setTimeout(()=>{const R=P.current;R!==null&&(P.current=null,fh(R.snapshot,R.gen))},400);return()=>window.clearTimeout(g)},[F]),b.useEffect(()=>()=>{const g=P.current;g!==null&&(P.current=null,fh(g.snapshot,g.gen))},[]);const[ve,$]=b.useState(null),[ae,ce]=b.useState(null),[de,ye]=b.useState(""),[S,L]=b.useState(!1),[B,Q]=b.useState(null),[me,H]=b.useState(!1),[pe,Be]=b.useState(0),[Se,Re]=b.useState(!1),[Qe,Vt]=b.useState(!1),[Kt,Tt]=b.useState(!1),[Qt,Dt]=b.useState(null),[Jt,Wt]=b.useState({}),[Zt,rn]=b.useState(null),[Ln,on]=b.useState(!1),[en,rt]=b.useState(""),[Ue,le]=b.useState(null),[Ae,Ie]=b.useState(0),qe=b.useRef(null),ot=b.useRef(null),$t=b.useRef(null),pt=b.useRef(null),Je=b.useRef(null),ht=b.useRef(null),kt=b.useRef(null),Mt=b.useRef(null),mn=b.useMemo(()=>MT(t.rows),[t.rows]),Rn=b.useCallback(g=>mn.find(R=>R.name===g)??null,[mn]),gn=Rn(h.workflow),tn=b.useMemo(()=>py(a.rows),[a.rows]),_t=b.useMemo(()=>IT(a.rows),[a.rows]),nn=b.useMemo(()=>rh(h,gn,_t),[h,gn,_t]),Ct=nn.issues,Dn=Ct.filter(g=>g.kind==="missing"),Ut=Ct.filter(g=>g.kind!=="missing"),ct=(g,R)=>Ut.filter(V=>V.field===g&&(R===void 0||V.sub===R)).map(V=>V.message).join(" · "),Bt=(g,R)=>Dn.some(V=>V.field===g&&(R===void 0||V.sub===R)),Hn=b.useMemo(()=>ZT(I,_t),[I,_t]),ia=b.useMemo(()=>FT(C0),[]),Xn=new Map(Hn.written.map(g=>[g.tag,g.value])),za=Hn.issues.filter(g=>g.kind==="invalid"),qa=Hn.issues.filter(g=>g.kind==="warning"),Ua=(g,R)=>za.filter(V=>V.field===g&&(R===void 0||V.sub===R)).map(V=>V.message).join(" · "),Ja=g=>qa.filter(R=>R.field===g).map(R=>R.message).join(" · "),ra=I.request.trim(),z=`tier1 ${I.tier1===null?"—":String(I.tier1.length)} · tier2 ${I.tier2===null?"—":String(I.tier2.length)}`,xe=[];["tier1","tier2"].forEach((g,R)=>{I[g]?.forEach((W,fe)=>{const ne=[...W.model===""?["model"]:[],...W.effort===""?["effort"]:[]];ne.length>0&&xe.push(`t${R+1}:${fe+1} ${ne.join(" + ")}`)})});const we=[...I.tier1===null?[{keys:[Nr],value:"omitted (unspecified); the skill inspects exposed tools"}]:[],...I.tier2===null?[{keys:[kr],value:"omitted (unspecified); the skill inspects exposed tools"}]:[],...xe.length===0?[]:[{keys:["model","effort"],value:`adapter default applies — empty on ${xe.join(" · ")}`}]],ke=q==="workflow"?nn:Hn,$e=q==="workflow"?Ct:Hn.issues.filter(g=>g.kind!=="warning"),Ye=$e.filter(g=>g.kind!=="missing"),We=$e.filter(g=>g.kind==="missing"),It=q==="workflow"?_C:bC,yn=q==="workflow"?vC:yC,Xe=q==="workflow"?g=>BT(g):g=>YT(g),Gt=q==="workflow"?4:2,En=b.useRef(h),_n=b.useCallback(g=>{En.current=g,v(g)},[]),Lt=b.useCallback(g=>{const R=En.current,V=g(R),W=rh(R,Rn(R.workflow),_t),fe=rh(V,Rn(V.workflow),_t),ne=Date.now();Wt(Oe=>{const Ge={...Oe};for(const tt of fe.every){if(tt.tag==="user_request")continue;const Ns=W.every.find(qi=>qi.tag===tt.tag);(Ns===void 0||Ns.value!==tt.value||Ns.isSet!==tt.isSet)&&(Ge[tt.tag]=ne)}return Ge}),Re(!1),_n(V)},[_n,Rn,_t]),cn=b.useCallback(g=>{k(R=>g(R)),Re(!1)},[]),xn=b.useCallback(()=>({form:h,cosForm:I,target:q,history:m,models:y,requests:w,stances:T}),[h,I,q,m,y,w,T]),mt=b.useCallback((g,R)=>{kt.current!==null&&window.clearTimeout(kt.current),ht.current=R,rn({key:Date.now(),message:g,undoable:R!==null}),kt.current=window.setTimeout(()=>rn(null),R===null?3400:7e3)},[]);b.useEffect(()=>()=>{kt.current!==null&&window.clearTimeout(kt.current),Mt.current!==null&&window.clearTimeout(Mt.current)},[]);const _s=()=>{const g=ht.current;if(g===null)return;kt.current!==null&&window.clearTimeout(kt.current),ht.current=null,Wa(g.target),_n(g.form),k(g.cosForm),x(g.history),JSON.stringify({models:oe.current.models,requests:oe.current.requests,stances:oe.current.stances})!==JSON.stringify({models:g.models,requests:g.requests,stances:g.stances})?be(()=>({models:g.models,requests:g.requests,stances:g.stances})):_e({models:g.models,requests:g.requests,stances:g.stances}),rn(null),$(null),Re(!1)},Wa=b.useCallback(g=>{E(g),ky(void 0,g);try{const R=new URLSearchParams(window.location.search);R.delete("mode"),g!=="workflow"&&R.set("mode",g);const V=R.toString();window.history.replaceState(null,"",`${window.location.pathname}${V===""?"":`?${V}`}${window.location.hash}`)}catch{}},[]),ya=b.useCallback(g=>{if(g===q)return;Wa(g),$(null),ce(null),Re(!1),Tt(!1);const R=g==="workflow"?"run-workflow mode":`${g} mode`;le({key:`target-${g}-${Date.now()}`,message:R})},[Wa,q]),jn=b.useCallback(()=>{const g=qe.current;if(qe.current=null,$(null),ye(""),Q(null),g instanceof HTMLElement&&document.body.contains(g))try{g.focus({preventScroll:!0})}catch{}},[]),Si=g=>R=>{R.stopPropagation&&R.stopPropagation();const V=R.currentTarget,W=V.closest("[data-pbpop]");let fe=null;if(W!==null){const ne=V.getBoundingClientRect(),Oe=W.getBoundingClientRect();fe={left:ne.left-Oe.left,top:ne.bottom-Oe.top,rowW:W.clientWidth}}qe.current=V,Q(fe),ce(null),ye(""),$(ne=>ne===g?null:g)},el=(g,R)=>R===""||(y[g]??[]).includes(R)?R:"",tl=g=>{Lt(R=>{if(DT(R.seats,Rn(R.workflow))){const V=Od(Rn(g));return{...R,workflow:g,seats:V.map((W,fe)=>({...W,model:R.seats[fe]?.model??"",effort:R.seats[fe]?.effort??""}))}}return{...R,workflow:g}})},vs=(g,R)=>{Lt(V=>({...V,seats:V.seats.map((W,fe)=>fe===g?{...W,...R}:W)}))},bs=(g,R)=>{cn(V=>g===1?{...V,tier1:R}:{...V,tier2:R})},es=(g,R,V)=>{cn(W=>{const fe=g===1?W.tier1:W.tier2;if(fe===null)return W;const ne=fe.map((Oe,Ge)=>Ge===R?{...Oe,...V}:Oe);return g===1?{...W,tier1:ne}:{...W,tier2:ne}})},ie=g=>{cn(R=>{const V=g===1?R.tier1:R.tier2;if(V===null)return R;const W=[...V,{cli:"",model:"",effort:""}];return g===1?{...R,tier1:W}:{...R,tier2:W}})},Ee=(g,R)=>{cn(V=>{const W=g===1?V.tier1:V.tier2;if(W===null)return V;const fe=W.filter((ne,Oe)=>Oe!==R);return g===1?{...V,tier1:fe}:{...V,tier2:fe}})},he=(g,R)=>{Lt(V=>({...V,[g]:{...V[g],...R}}))},nl=(g,R,V)=>{Lt(W=>{const fe={chair:jr(Rn(W.workflow)),curator:"codex",finalizer:"codex"};return{...W,seats:W.seats.map(ne=>ne.cli===g?{...ne,[R]:V}:ne),chair:(W.chair.cli||fe.chair)===g?{...W.chair,[R]:V}:W.chair,curator:(W.curator.cli||fe.curator)===g?{...W.curator,[R]:V}:W.curator,finalizer:(W.finalizer.cli||fe.finalizer)===g?{...W.finalizer,[R]:V}:W.finalizer}})},ys=(g,R,V)=>{cn(W=>{const fe=ne=>ne===null?null:ne.map(Oe=>Oe.cli===g?R==="model"?{...Oe,model:V}:{...Oe,effort:V}:Oe);return{...W,tier1:fe(W.tier1),tier2:fe(W.tier2)}})},xa=b.useCallback(()=>{if($e.length>0)return;const g=ke.text,R=()=>{Re(!0),Mt.current!==null&&window.clearTimeout(Mt.current),Mt.current=window.setTimeout(()=>Re(!1),1600);const fe=q==="workflow"?{at:Date.now(),workflow:h.workflow,council:`${h.seats.length} seat${h.seats.length===1?"":"s"}`,head:Ay(h.request),form:h}:{at:Date.now(),workflow:"chief-of-staff",council:z,head:Ay(I.request),form:h,target:"chief-of-staff",cosForm:I};x(Oe=>[fe,...Oe].slice(0,z0));const ne=`copied · ${g.length.toLocaleString()} chars · paste it into your agent session`;mt(ne,null),le({key:`copy-${fe.at}`,message:ne})},V=()=>{H(!0),Be(ne=>ne+1);const fe=`clipboard blocked — the raw prompt is selected, press ${c}C`;mt(fe,null),le({key:`copy-blocked-${Date.now()}`,message:fe})},W=()=>{try{const fe=document.createElement("textarea");fe.value=g,fe.setAttribute("readonly",""),fe.className="pb-copy-fallback",document.body.appendChild(fe),fe.select();const ne=document.execCommand("copy");return document.body.removeChild(fe),ne}catch{return!1}};navigator.clipboard?.writeText!=null?navigator.clipboard.writeText(g).then(R,()=>W()?R():V()):W()?R():V()},[ke,$e.length,I,z,h,c,mt,q]),ts=b.useRef(xa);ts.current=xa,b.useEffect(()=>{if(!(pe===0||ot.current===null))try{const g=document.createRange();g.selectNodeContents(ot.current);const R=window.getSelection();R?.removeAllRanges(),R?.addRange(g)}catch{}},[pe]);const Ni=g=>{Je.current=g,/^(curator|finalizer)/.test(g)&&!h.advOpen&&Lt(W=>({...W,advOpen:!0}));const V=!/^(request|mode|h\d)|:stance$/.test(g);i&&Tt(!1),qe.current=null,ce(null),ye(""),Q(null),$(V?g:null),Ie(W=>W+1)};b.useEffect(()=>{const g=Je.current;if(g===null)return;Je.current=null;const R=pt.current?.closest(".dashboard-layout__run-list")??null,V=g.replace(/:(cli|model|effort|stance)$/,""),W=g==="request"?$t.current:R?.querySelector(`[data-pbrow="${V}"]`)??null;if(R!==null&&W!==null){const fe=W.getBoundingClientRect(),ne=R.getBoundingClientRect(),Oe=g.startsWith("h")?4:i?64:28;R.scrollTop+=fe.top-ne.top-Oe}if(g==="request")try{$t.current?.focus({preventScroll:!0})}catch{}if(/:stance$/.test(g)){const fe=R?.querySelector(`[data-pbstance="${V}"]`);try{fe?.focus({preventScroll:!0})}catch{}}},[Ae,i]),b.useEffect(()=>{const g=V=>{if(q!=="verified-repair"){if((V.metaKey||V.ctrlKey)&&V.key==="Enter"){V.preventDefault(),ts.current();return}V.key==="Escape"&&ve!==null&&jn()}},R=V=>{ve!==null&&!(V.target instanceof Element&&V.target.closest("[data-pbpop]"))&&jn()};return window.addEventListener("keydown",g),window.addEventListener("pointerdown",R),()=>{window.removeEventListener("keydown",g),window.removeEventListener("pointerdown",R)}},[jn,ve,q]);const Vn=(g,R)=>{if(R==="")return"";if(R.length>$r||!cm.test(R))return`a model id has no whitespace, no leading “-” and at most ${$r} characters`;const V=y[g]??[];return V.includes(R)?"":V.length>=yy?`a library holds at most ${yy} model ids per CLI`:y[g]===void 0&&Object.keys(y).length>=by?`a library holds at most ${by} CLI model lists`:""},ki=g=>g===""?"":/\{\{|\}\}/.test(g)||g.replace(/\s+/g," ").length>ud?`a stance has no {{ }} and at most ${ud} characters`:!T.includes(g)&&T.length>=jy?`a library holds at most ${jy} stances`:"",nc=g=>{const R={chair:h.chair.cli||jr(gn),curator:h.curator.cli||"codex",finalizer:h.finalizer.cli||"codex"};return h.seats.filter(V=>V.cli===g).length+Object.values(R).filter(V=>V===g).length},al=(g,R)=>{const V=nc(g);if(!(V<2))return{label:`set on all ${V} ${g} seats`,cli:g,field:R}},xs=(g,R)=>{if(g==="")return;const V=["tier1","tier2"].reduce((W,fe)=>W+(I[fe]??[]).filter(ne=>ne.cli===g).length,0);if(!(V<2))return{label:`set on all ${V} ${g} profiles`,cli:g,field:R}},Lr=(g,R,V,W)=>({key:g,title:"CLI adapter",sub:"workflow-eligible · conf/adapters/*.json",width:300,current:R,...W===""?{}:{noneLabel:`Workflow default — ${W}`},options:tn.map(fe=>({value:fe,label:fe,desc:`effort ${_t(fe).join(" · ")}`})),pick:V}),ac=g=>{if(g==="")return"";const R=$0(g);return R!==""?`a cli_name has ${R}`:g.includes("{{")||g.includes("}}")||g.includes("Example:")||/^YOUR_[A-Z0-9_]+$/.test(g)?"that looks like an unfilled template placeholder — replace it":""},sl=(g,R,V)=>({key:g,title:"CLI adapter",sub:"any adapter · free text allowed",width:300,current:R,options:tn.map(W=>({value:W,label:W,desc:`effort ${_t(W).join(" · ")}`})),pick:V,emptyText:"no catalog match — type a cli_name below",addable:{placeholder:"type to filter, or add any cli_name…",addError:ac},add:W=>{ye(""),V(W)}}),Dr=(g,R,V,W,fe)=>({key:g,title:"Reasoning effort",sub:`${R} · invocation_overrides.effort.allowed_values`,width:300,current:V,options:_t(R).map(ne=>({value:ne,label:ne})),pick:W,...fe===void 0?{}:{applyAll:fe},emptyText:`${R} declares no effort override`}),Ai=(g,R,V,W,fe)=>({key:g,title:"Model id",sub:`${R} · curated list`,width:380,current:V,options:(y[R]??[]).map(ne=>({value:ne,label:ne,removable:!0})),pick:W,...fe===void 0?{}:{applyAll:fe},emptyText:`no curated model ids for ${R} yet — type one below`,addable:{placeholder:"type to filter, or add a new model id…",addError:ne=>Vn(R,ne)},add:ne=>{be(Oe=>{const Ge=Oe.models[R]??[];return Ge.includes(ne)||Vn(R,ne)!==""?Oe:{...Oe,models:{...Oe.models,[R]:[...Ge,ne]}}}),ye(""),W(ne)},remove:ne=>{const Oe=xn();be(Ge=>({...Ge,models:{...Ge.models,[R]:(Ge.models[R]??[]).filter(tt=>tt!==ne)}})),mt(`removed ${ne} from the ${R} list`,Oe)}}),sc=g=>g===""?"":!um.test(g)||g.length>cd?`an effort is lowercase, digits, _ and -, at most ${cd} characters`:"",zr=(g,R,V,W,fe)=>({...Ai(g,R,V,W,fe),noneLabel:"None — adapter default"}),Id=(g,R,V,W,fe)=>({...Dr(g,R,V,W,fe),sub:`${R} · any well-formed effort — admission decides`,noneLabel:"None — adapter default",addable:{placeholder:"type to filter, or add any effort…",addError:sc},add:ne=>{ye(""),W(ne)}}),Ld=(g,R,V)=>({key:g,title:"Stance",sub:"curated list · free text allowed",width:440,current:R,options:T.map(W=>({value:W,label:W,removable:!0})),pick:V,emptyText:"no curated stances yet — type one below",addable:{placeholder:"type to filter, or add a stance…",addError:ki},add:W=>{be(fe=>fe.stances.includes(W)||ki(W)!==""?fe:{...fe,stances:[...fe.stances,W]}),ye(""),V(W)},remove:W=>{const fe=xn();be(ne=>({...ne,stances:ne.stances.filter(Oe=>Oe!==W)})),mt("removed a curated stance",fe)}}),Ri=g=>{if(g==="workflow")return{key:g,title:"Workflow",sub:"<workflow> · one of the shipped councils",width:440,current:h.workflow,options:mn.map(fe=>({value:fe.name,label:fe.name,desc:fe.description})),pick:tl};if(g==="preset"){const fe=q==="workflow"?h.preset:I.preset;return{key:g,title:"Request preset",sub:"saved requests · this dashboard",width:440,current:w.find(ne=>ne.name===fe)?.name??"",noneLabel:"None — start blank",removeLabel:"remove this preset",options:w.map(ne=>({value:ne.name,label:ne.name,desc:ne.text.replace(/\s+/g," ").slice(0,96)+(ne.text.length>96?"…":""),removable:!0})),pick:ne=>{const Oe=w.find(tt=>tt.name===ne),Ge=Oe===void 0?{request:"",preset:""}:{request:Oe.text,preset:Oe.name};q==="workflow"?Lt(tt=>({...tt,...Ge})):cn(tt=>({...tt,...Ge}))},remove:ne=>{const Oe=xn();be(Ge=>({...Ge,requests:Ge.requests.filter(tt=>tt.name!==ne)})),Lt(Ge=>Ge.preset===ne?{...Ge,preset:""}:Ge),k(Ge=>Ge.preset===ne?{...Ge,preset:""}:Ge),mt(`removed preset ${ne}`,Oe)},emptyText:"no saved requests yet — type one below and save it"}}const R=/^(chair|curator|finalizer):(cli|model|effort)$/.exec(g);if(R!==null){const fe=R[1],ne=h[fe],Oe=fe==="chair"?jr(gn):"codex",Ge=ne.cli||Oe;return R[2]==="cli"?Lr(g,ne.cli,tt=>{he(fe,{cli:tt,model:el(tt||Oe,ne.model)})},Oe):R[2]==="model"?Ai(g,Ge,ne.model,tt=>he(fe,{model:tt}),al(Ge,"model")):Dr(g,Ge,ne.effort,tt=>he(fe,{effort:tt}),al(Ge,"effort"))}const V=/^seat:(\d+):(cli|model|effort|stancepick)$/.exec(g);if(V!==null){const fe=Number(V[1]),ne=h.seats[fe];return ne===void 0?null:V[2]==="cli"?Lr(g,ne.cli,Oe=>{vs(fe,{cli:Oe,model:el(Oe,ne.model)})},""):V[2]==="model"?Ai(g,ne.cli,ne.model,Oe=>vs(fe,{model:Oe}),al(ne.cli,"model")):V[2]==="effort"?Dr(g,ne.cli,ne.effort,Oe=>vs(fe,{effort:Oe}),al(ne.cli,"effort")):Ld(g,ne.stance,Oe=>vs(fe,{stance:Oe}))}const W=/^t([12]):(\d+):(cli|model|effort)$/.exec(g);if(W!==null){const fe=W[1]==="1"?1:2,ne=Number(W[2]),Oe=fe===1?I.tier1:I.tier2,Ge=Oe===null?void 0:Oe[ne];return Ge===void 0?null:W[3]==="cli"?sl(g,Ge.cli,tt=>es(fe,ne,{cli:tt,model:el(tt,Ge.model)})):W[3]==="model"?zr(g,Ge.cli,Ge.model,tt=>es(fe,ne,{model:tt}),xs(Ge.cli,"model")):Id(g,Ge.cli,Ge.effort,tt=>es(fe,ne,{effort:tt}),xs(Ge.cli,"effort"))}return null},ja=(g,R)=>{S&&g.applyAll!==void 0?q==="chief-of-staff"?ys(g.applyAll.cli,g.applyAll.field,R):nl(g.applyAll.cli,g.applyAll.field,R):g.pick(R),jn()},Ei=(g,R)=>{g.add?.(R),jn()},Ti=(g,R)=>{g.remove?.(R)},wn=ve===null?null:Ri(ve),ns=(...g)=>i||wn===null||!g.includes(wn.key)?null:s.jsx(Ty,{addText:de,anchor:B,applyAllOn:S,config:wn,highlight:ae,phone:!1,onAdd:R=>Ei(wn,R),onAddTextChange:ye,onApplyAllToggle:()=>L(R=>!R),onClose:jn,onHighlight:ce,onPick:R=>ja(wn,R),onRemove:R=>Ti(wn,R)}),lc=i&&wn!==null?s.jsx(Ty,{addText:de,anchor:null,applyAllOn:S,config:wn,highlight:ae,phone:!0,onAdd:g=>Ei(wn,g),onAddTextChange:ye,onApplyAllToggle:()=>L(g=>!g),onClose:jn,onHighlight:ce,onPick:g=>ja(wn,g),onRemove:g=>Ti(wn,g)}):null,ll=Array.from({length:Gt},(g,R)=>We.filter(V=>Xe(V.field)===R).length),Ci=Array.from({length:Gt},(g,R)=>Ye.filter(V=>Xe(V.field)===R).length),il=g=>h[g].cli!==""||h[g].model!==""||h[g].effort!=="",oa=Array.from({length:Gt},(g,R)=>Ci[R]!==0?"issue":ll[R]!==0?"pending":q==="workflow"&&R===1&&!il("curator")&&!il("finalizer")?"default":"set"),Oi=oa.map(g=>g==="set"||g==="default"),js=Array.from({length:Gt-1},(g,R)=>Oi.slice(0,R+1).every(Boolean)),Ba=g=>{const R=oa[g];return R==="issue"?`${Ci[g]} issue${Ci[g]===1?"":"s"}`+(ll[g]!==0?` · ${ll[g]} to fill`:""):R==="pending"?`${ll[g]} to fill`:R==="default"?"defaults":"set"},qr=Oi.filter(Boolean).length,Ga=Ye.length!==0?`${Ye.length} issue${Ye.length===1?"":"s"}`+(We.length!==0?` · ${We.length} to fill`:""):We.length!==0?`${We.length} to fill`:"ready to copy",$i=q==="workflow"?h.workflow!==""?h.workflow:"run-workflow · pick a workflow":"chief-of-staff",Mi=nn.written.filter(g=>g.isSet).length,Ii=nn.written.filter(g=>g.isDefault).length,ic=`${h.seats.length} seat${h.seats.length===1?"":"s"}`,Sn=Se?"copied ✓":"copy prompt",Ha=$e.length!==0?`finish the checklist first · ${Ga}`:`copy the assembled prompt · ${c}↵`,Gl=Date.now(),ws=g=>q==="workflow"?g.field==="request"?"request":g.field==="seats"?"h03":g.sub!==""?`${g.field}:${g.sub}`:g.field:g.field==="request"?"h02":"h01",rc=Ye.map(g=>({issue:g,jump:ws(g)})),Li=Array.from({length:Gt},(g,R)=>({section:R,chips:We.filter(V=>Xe(V.field)===R)})).filter(g=>g.chips.length>0),Di=Ye[0]??We[0]??null,an=(g,R,V,W,fe)=>({key:g,label:R,value:V,empty:W,on:ve===g,go:Si(g),title:[fe.err===void 0?"":fe.err,fe.miss===!0?"required · pick one":"",fe.tip??""].filter(Boolean).join(" · "),aria:fe.aria,cellLabel:fe.cellLabel??R,state:(fe.err!==void 0&&fe.err!==""?"err":"")||(ve===g?"open":"")||(fe.miss===!0?"miss":"")||"",isDefault:V===""}),wa=g=>({onMouseEnter:()=>{!i&&Qt!==g&&Dt(g)},onMouseLeave:()=>{!i&&Qt!==null&&Dt(null)}}),Hl=g=>{const R=!i&&Qt===g.field;return s.jsx("div",{className:`pb-row__content pb-knob${R?" pb-knob--hl":""}`,"data-pbpop":"1","data-pbrow":g.key,...wa(g.field),children:i?s.jsxs("div",{className:"pb-knob-card",children:[s.jsxs("div",{className:"pb-knob-card__row",children:[s.jsx(ph,{cell:g.cli}),g.del!==void 0?s.jsx("button",{"aria-label":g.del.title,className:"pb-knob-card__del",onClick:g.del.run,title:g.del.title,type:"button",children:"×"}):null]}),s.jsxs("div",{className:"pb-knob-card__row pb-knob-card__row--split",children:[s.jsx(ph,{cell:g.model}),s.jsx("span",{"aria-hidden":"true",className:"pb-knob-card__divider"}),s.jsx(ph,{cell:g.effort})]}),g.stance!==void 0?s.jsxs("div",{className:"pb-knob-card__stance",children:[s.jsx("input",{"aria-label":"seat stance",className:`pb-stance-input pb-stance-input--phone${g.stance.err?" pb-stance-input--err":""}${g.stance.miss&&!g.stance.err?" pb-stance-input--miss":""}`,"data-pbstance":g.stance.key,onChange:V=>g.stance?.onChange(V.target.value),placeholder:"stance · type, or pick ▾",type:"text",value:g.stance.value}),s.jsx(ri,{caretOnly:!0,phone:!0,pill:g.stance.pick})]}):null,g.sub!==void 0&&g.sub!==""?s.jsx("span",{className:"pb-sub pb-sub--phone",children:g.sub}):null,g.err!==void 0&&g.err!==""?s.jsx("div",{className:"pb-err pb-err--phone",role:"alert",children:g.err}):null,g.warn!==void 0&&g.warn!==""?s.jsx("div",{className:"pb-warn-line pb-warn-line--phone",role:"status",children:g.warn}):null]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"pb-knob__label",children:g.label}),s.jsx(ri,{pill:g.cli}),s.jsxs("div",{className:"pb-knob__knobs",children:[s.jsx(ri,{pill:g.model}),s.jsx(ri,{pill:g.effort})]}),g.del!==void 0?s.jsx("button",{"aria-label":g.del.title,className:"pb-knob__del",onClick:g.del.run,title:g.del.title,type:"button",children:"×"}):null,g.stance!==void 0?s.jsxs("div",{className:"pb-knob__stance",children:[s.jsx("input",{"aria-label":"seat stance",className:`pb-stance-input${g.stance.err?" pb-stance-input--err":""}${g.stance.miss&&!g.stance.err?" pb-stance-input--miss":""}`,"data-pbstance":g.stance.key,onChange:V=>g.stance?.onChange(V.target.value),placeholder:"stance · type, or pick ▾",type:"text",value:g.stance.value}),s.jsx(ri,{caretOnly:!0,pill:g.stance.pick})]}):null,g.sub!==void 0&&g.sub!==""?s.jsx("span",{className:"pb-sub",children:g.sub}):null,g.err!==void 0&&g.err!==""?s.jsx("div",{className:"pb-err",role:"alert",children:g.err}):null,g.warn!==void 0&&g.warn!==""?s.jsx("div",{className:"pb-warn-line",role:"status",children:g.warn}):null,ns(`${g.key}:cli`,`${g.key}:model`,`${g.key}:effort`,`${g.key}:stancepick`)]})})},Dd=(()=>{const R=(q==="workflow"?[{kind:"workflow",phase:t.phase},{kind:"adapter",phase:a.phase}]:[{kind:"adapter",phase:a.phase}]).find(Oe=>Oe.phase!=="current");if(R===void 0)return null;const{kind:V,phase:W}=R,fe=W==="loading"?`Loading ${V} catalog…`:W==="auth_expired"?`Authentication expired; the ${V} catalog was not loaded.`:W==="connection_changed"?`Connection changed; rebootstrap before loading the ${V} catalog.`:W==="offline"?`Offline; the ${V} catalog could not be loaded.`:`The ${V} catalog request failed.`,ne=W!=="auth_expired"&&W!=="connection_changed";return s.jsxs("div",{className:"pb-catalog-banner",role:W==="loading"?"status":"alert",children:[s.jsx("span",{children:fe}),ne?s.jsxs("button",{className:"pb-fact-btn",onClick:V==="workflow"?t.retry:a.retry,type:"button",children:["[ retry ",V," catalog ]"]}):null]})})(),zd=m.map(g=>({entry:g,time:Cy(g.at,Gl),reopen:()=>{const R=xn();g.target==="chief-of-staff"?(Wa("chief-of-staff"),k(vy(g.cosForm))):(Wa("workflow"),_n(hy(g.form,Rn))),$(null),Re(!1),Tt(!1);const V=pt.current?.closest(".dashboard-layout__run-list")??null;V!==null&&(V.scrollTop=0),mt(`reopened the ${Cy(g.at,Date.now())} prompt`,R)}})),oc=(g,R)=>s.jsx("div",{"aria-hidden":R?void 0:!0,className:"pb-row__gutter",children:R?s.jsxs(s.Fragment,{children:[g>0?s.jsx("div",{className:`pb-track pb-track--top${js[g-1]?" pb-track--solid":""}`}):null,g<Gt-1?s.jsx("div",{className:`pb-track pb-track--bot${js[g]?" pb-track--solid":""}`}):null,s.jsx("button",{"aria-label":`0${g+1} ${It[g]} · ${Ba(g)}`,className:"pb-node",onClick:()=>Ni(`h0${g+1}`),title:`0${g+1} ${It[g]} · ${Ba(g)}`,type:"button",children:s.jsx("span",{className:`pb-node__dot pb-node__dot--${oa[g]}`})})]}):s.jsx("div",{className:g<Gt-1?`pb-track pb-track--full${js[g]?" pb-track--solid":""}`:"pb-track pb-track--none"})}),as=(g,R,V)=>s.jsxs("div",{className:"pb-row",children:[oc(g,!0),s.jsxs("div",{className:"pb-row__content pb-head","data-pbrow":`h0${g+1}`,children:[s.jsxs("span",{className:"pb-head__num",children:["0",g+1]}),s.jsx("span",{className:"pb-head__label",children:It[g]}),s.jsx("span",{className:"pb-head__spacer"}),R!==void 0?s.jsx("button",{className:"pb-fact-btn pb-head__btn",onClick:R.run,type:"button",children:R.label}):null,V!==void 0&&V!==""?s.jsx("span",{className:"pb-head__sub",children:V}):null]})]}),Tn=(g,R)=>s.jsxs("div",{className:"pb-row",children:[oc(g,!1),R]}),cc=g=>{const R=g===1?"tier1":"tier2",V=I[R],W=g===1?Nr:kr;return s.jsxs(s.Fragment,{children:[Tn(0,s.jsxs("div",{className:"pb-row__content pb-tier-head","data-pbrow":`t${g}`,children:[s.jsx("span",{className:"pb-tier-head__label",children:`Tier ${g}`}),s.jsx("span",{className:"pb-tier-head__state",children:wC(V)}),s.jsx("span",{className:"pb-form-head__spacer"}),V!==null?s.jsx("button",{className:"pb-fact-btn",onClick:()=>bs(g,null),title:`omit <${W}> entirely — the skill inspects exposed tools and inherits`,type:"button",children:"[ omit tag ]"}):null,V===null||V.length>0?s.jsx("button",{className:"pb-fact-btn",onClick:()=>bs(g,[]),title:`write an explicit empty pool — <${W}>[]`,type:"button",children:"[ write empty ]"}):null]})),V===null?Tn(0,s.jsx("div",{className:"pb-row__content",children:s.jsx("div",{className:"pb-tier-null",children:"unspecified — the skill inspects exposed tools and inherits"})})):s.jsxs(s.Fragment,{children:[V.map((fe,ne)=>Tn(0,Hl({key:`t${g}:${ne}`,field:R,label:`T${g} · ${String(ne+1).padStart(2,"0")}`,cli:an(`t${g}:${ne}:cli`,"",fe.cli,"cli",{aria:`tier ${g} profile ${ne+1} cli`,cellLabel:`T${g}·${ne+1}`,err:Ua(`tier${g}:${ne}`,"cli"),miss:fe.cli===""}),model:an(`t${g}:${ne}:model`,"model",fe.model,"—",{aria:`tier ${g} profile ${ne+1} model`,err:Ua(`tier${g}:${ne}`,"model"),tip:"empty keeps the adapter default"}),effort:an(`t${g}:${ne}:effort`,"effort",fe.effort,"—",{aria:`tier ${g} profile ${ne+1} effort`,err:Ua(`tier${g}:${ne}`,"effort"),tip:"empty keeps the adapter default"}),del:{title:`remove tier ${g} profile ${ne+1}`,run:()=>{const Oe=xn();Ee(g,ne),mt(`tier ${g} profile ${ne+1} removed`,Oe)}},err:Ua(`tier${g}:${ne}`),warn:Ja(`tier${g}:${ne}`)}))),Tn(0,s.jsxs("div",{className:"pb-row__content pb-add-seat","data-pbrow":`t${g}:add`,children:[s.jsx("button",{className:"pb-fact-btn",onClick:()=>ie(g),type:"button",children:"[ + add profile ]"}),s.jsx("span",{className:"pb-add-seat__meta",children:`${V.length} profile${V.length===1?"":"s"} · no cap — a tier is an eligible pool`})]}))]})]})},Pn=q==="workflow"?h.request:I.request,uc=q==="workflow"?h.preset:I.preset,Ur=q==="workflow"?3:1,dc=g=>{q==="workflow"?Lt(R=>({...R,request:g})):cn(R=>({...R,request:g}))},Ss=w.find(g=>g.name===uc)??null,Br=Ss!==null&&Ss.text!==Pn,qd=an("preset","preset",Ss===null?"":Ss.name+(Br?" · edited":""),"none · type your own",{aria:"request preset"}),Vl=en.trim(),zi=w.find(g=>g.name.toLowerCase()===Vl.toLowerCase()),Gr=!Ln||Vl===""?"":Vl.length>wy?`keep the name under ${wy} characters`:zi!==void 0?`a preset named ${zi.name} already exists`:Pn.trim()===""?"type the request first":Pn.length>Oo?`keep the request under ${Oo} characters`:w.length>=xy?`a library holds at most ${xy} request presets`:"",fc=!Ln&&Br&&Ss!==null&&Pn.trim()!==""&&Pn.length>Oo?`keep the request under ${Oo} characters`:"",pc=Vl!==""&&Gr===""&&Pn.trim()!=="",Hr=()=>{if(!pc)return;const g=Vl;be(R=>({...R,requests:[...R.requests,{name:g,text:Pn}]})),on(!1),rt(""),q==="workflow"?Lt(R=>({...R,preset:g})):cn(R=>({...R,preset:g}))},hc=s.jsx("div",{"aria-label":"prompt target",className:"pb-seg",role:"group",children:[["workflow","run-workflow"],["chief-of-staff","chief-of-staff"],["verified-repair","verified-repair"]].map(([g,R])=>s.jsx("button",{"aria-pressed":q===g,className:"pb-seg__opt",onClick:()=>ya(g),type:"button",children:R},g))}),Ud=s.jsxs("section",{"aria-label":"Prompt builder",className:"pb-form-view",children:[s.jsx("h1",{className:"visually-hidden",id:"dashboard-page-title",children:"Prompt builder"}),s.jsxs("div",{className:"pb-form-head",children:[s.jsx("span",{className:"pb-specimen",title:"assembles the invocation prompt · only the tags you set are emitted, the agent infers the rest",children:"Prompt builder"}),hc,s.jsx("span",{className:"pb-form-head__spacer"}),s.jsx("span",{className:"pb-form-head__sub",title:"models, request presets, and stances",children:M==="synced"?"library on this dashboard":M==="unsynced"?"library saved in this browser only":M==="loading"?"library…":"library local"}),s.jsx("button",{className:"pb-fact-btn",onClick:()=>{const g=xn();q==="workflow"?(Wt({}),_n(T0())):k(O0()),$(null),Re(!1),on(!1),rt(""),mt("form cleared",g)},title:"clear every field",type:"button",children:"[ reset ]"})]}),Dd,s.jsxs("div",{className:"pb-form-scroll",ref:pt,children:[s.jsxs("div",{className:"pb-rows",children:[q==="workflow"?s.jsxs(s.Fragment,{children:[as(0),Tn(0,s.jsxs("div",{className:"pb-row__content pb-single","data-pbpop":"1","data-pbrow":"workflow",...wa("workflow"),children:[s.jsx(ri,{pill:an("workflow","workflow",h.workflow,"pick a workflow",{aria:"workflow",err:ct("workflow"),miss:h.workflow===""}),phone:i}),gn!==null?s.jsx("span",{className:"pb-sub",children:gn.description}):null,ct("workflow")!==""?s.jsx("div",{className:"pb-err",role:"alert",children:ct("workflow")}):null,ns("workflow")]})),Tn(0,s.jsxs("div",{className:"pb-row__content pb-seg-row","data-pbrow":"sync",children:[s.jsx("span",{className:"pb-row-label",children:"launch"}),s.jsxs("div",{"aria-label":"launch mode",className:"pb-seg",role:"group",children:[s.jsx("button",{"aria-pressed":h.sync==="",className:"pb-seg__opt",onClick:()=>Lt(g=>({...g,sync:""})),title:"async",type:"button",children:"async"}),s.jsx("button",{"aria-pressed":h.sync==="sync",className:"pb-seg__opt",onClick:()=>Lt(g=>({...g,sync:"sync"})),title:"sync",type:"button",children:"sync"})]}),h.sync==="sync"?s.jsx("span",{className:"pb-sub",children:"blocks until the council finishes"}):null]})),as(1,{label:h.advOpen?"[ hide ]":"[ show ]",run:()=>Lt(g=>({...g,advOpen:!g.advOpen}))},"curator · finalizer"),h.advOpen?[["curator","role json"],["finalizer","role json-codereviewer"]].map(([g,R])=>Tn(1,Hl({key:g,field:g,label:g,cli:an(`${g}:cli`,"",h[g].cli,"codex",{aria:`${g} cli`,cellLabel:g}),model:an(`${g}:model`,"model",h[g].model,"—",{aria:`${g} model`,err:ct(g,"model"),miss:Bt(g,"model")}),effort:an(`${g}:effort`,"effort",h[g].effort,"—",{aria:`${g} effort`,err:ct(g,"effort"),miss:Bt(g,"effort")}),sub:R,err:ct(g)}))):Tn(1,s.jsx("div",{className:"pb-row__content pb-folded",children:s.jsx("span",{className:"pb-sub",children:`curator ${Oy(h.curator,"codex")} · finalizer ${Oy(h.finalizer,"codex")}`})})),as(2,void 0,"seats · chairman"),h.seats.map((g,R)=>Tn(2,Hl({key:`seat:${R}`,field:"seats",label:`seat ${R+1}`,cli:an(`seat:${R}:cli`,"",g.cli,"cli",{aria:`seat ${R+1} cli`,cellLabel:`seat ${R+1}`}),model:an(`seat:${R}:model`,"model",g.model,"—",{aria:`seat ${R+1} model`,err:ct(`seat:${R}`,"model"),miss:Bt(`seat:${R}`,"model"),tip:"also applies to this seat’s reviewer seat"}),effort:an(`seat:${R}:effort`,"effort",g.effort,"—",{aria:`seat ${R+1} effort`,err:ct(`seat:${R}`,"effort"),miss:Bt(`seat:${R}`,"effort"),tip:"also applies to this seat’s reviewer seat"}),del:{title:`remove seat ${R+1}`,run:()=>{const V=xn();Lt(W=>({...W,seats:W.seats.filter((fe,ne)=>ne!==R)})),mt(`seat ${R+1} removed`,V)}},stance:R>=3?{key:`seat:${R}`,value:g.stance,err:ct(`seat:${R}`,"stance")!=="",miss:Bt(`seat:${R}`,"stance"),onChange:V=>vs(R,{stance:V}),pick:an(`seat:${R}:stancepick`,"","","",{aria:`seat ${R+1} curated stances`})}:void 0,err:ct(`seat:${R}`)}))),Tn(2,s.jsxs("div",{className:"pb-row__content pb-add-seat","data-pbrow":"addseat",children:[h.seats.length>=qu?s.jsx("span",{className:"pb-add-seat__full",children:"10 of 10 seats"}):s.jsx("button",{className:"pb-fact-btn",onClick:()=>Lt(g=>g.seats.length>=qu?g:{...g,seats:[...g.seats,{cli:"codex",model:"",effort:"",stance:""}]}),type:"button",children:"[ + add seat ]"}),s.jsx("span",{className:"pb-add-seat__meta",children:`${h.seats.length} / 10`+(h.seats.length>=3&&h.seats.length<qu?" · a stance is required from seat 4":"")})]})),Tn(2,Hl({key:"chair",field:"chair",label:"chairman",cli:an("chair:cli","",h.chair.cli,jr(gn),{aria:"chairman cli",cellLabel:"chairman"}),model:an("chair:model","model",h.chair.model,"—",{aria:"chairman model",err:ct("chair","model"),miss:Bt("chair","model")}),effort:an("chair:effort","effort",h.chair.effort,"—",{aria:"chairman effort",err:ct("chair","effort"),miss:Bt("chair","effort")}),err:ct("chair")})),as(3,void 0,"required")]}):s.jsxs(s.Fragment,{children:[as(0,void 0,"tier 1 · tier 2"),cc(1),cc(2),Tn(0,s.jsx("div",{className:"pb-row__content pb-single",children:s.jsx("span",{className:"pb-sub",children:"A tier is an eligible pool, not a fan-out count — listing four adapters does not create four workers. Omitted tag = unspecified; [] = no eligible profiles; empty model/effort keep the adapter default."})})),as(1,void 0,"required")]}),Tn(Ur,s.jsxs("div",{className:"pb-row__content pb-single","data-pbpop":"1","data-pbrow":"preset",...wa("request"),children:[s.jsx(ri,{pill:qd,phone:i}),ns("preset")]})),Tn(Ur,s.jsxs("div",{className:"pb-row__content pb-request","data-pbrow":"request",...wa("request"),children:[s.jsx("textarea",{"aria-label":"user request",className:"pb-request-input",onChange:g=>dc(g.target.value),placeholder:E0,ref:$t,rows:Math.min(16,Math.max(i?6:7,Pn.split(`
|
|
112
|
+
`).length+1)),value:Pn}),s.jsx("span",{className:"pb-request-hint",children:`Name files, symbols or error text — and the repo path if it is not the server’s.${i?"":` ${c}↵ copies.`}`})]})),Tn(Ur,s.jsxs("div",{className:"pb-row__content pb-save","data-pbrow":"reqsave",children:[s.jsx("button",{"aria-expanded":Ln,className:"pb-fact-btn",onClick:()=>{on(g=>!g),rt("")},type:"button",children:Ln?"[ cancel ]":"[ save as preset ]"}),!Ln&&Br&&Pn.trim()!==""&&Ss!==null?s.jsxs("button",{className:"pb-fact-btn",onClick:()=>{Pn.length>Oo||be(g=>({...g,requests:g.requests.map(R=>R.name===uc?{name:R.name,text:Pn}:R)}))},type:"button",children:["[ update ",Ss.name," ]"]}):null,Ln?s.jsxs(s.Fragment,{children:[s.jsx("input",{"aria-label":"preset name",className:"pb-save-input",onChange:g=>rt(g.target.value),onKeyDown:g=>{g.key==="Enter"&&Hr(),g.key==="Escape"&&(on(!1),rt(""))},placeholder:"preset name · e.g. retry-review",spellCheck:!1,type:"text",value:en}),s.jsx("button",{className:`pb-fact-btn${pc?"":" pb-fact-btn--off"}`,onClick:Hr,type:"button",children:"[ save preset ]"})]}):null,Gr!==""?s.jsx("div",{className:"pb-err",role:"alert",children:Gr}):fc!==""?s.jsx("div",{className:"pb-err",role:"alert",children:fc}):null,s.jsx("span",{className:"pb-save-sub",children:M==="synced"?"saved on this dashboard":"this browser only"})]}))]}),s.jsxs("div",{className:"pb-history",children:[s.jsxs("div",{className:"pb-history__head",children:[s.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"History"}),m.length>0?s.jsxs("span",{className:"pb-history__count",children:["[ ",m.length," ]"]}):null,s.jsx("span",{className:"pb-form-head__spacer"}),m.length>0?s.jsx("button",{className:"pb-fact-btn",onClick:()=>{const g=xn();x([]),mt("history cleared",g)},type:"button",children:"[ clear ]"}):null]}),m.length===0?s.jsx("p",{className:"pb-history__empty",children:"Copied prompts land here · this browser, last 12."}):zd.map(g=>s.jsxs("button",{className:"pb-history__row",onClick:g.reopen,title:"reopen this prompt in the form",type:"button",children:[s.jsx("span",{className:"pb-history__time",children:g.time}),s.jsx("span",{className:"pb-history__wf",children:g.entry.workflow===""?"inferred":g.entry.workflow}),s.jsx("span",{className:"pb-history__council",children:g.entry.council}),s.jsx("span",{className:"pb-history__head-text",children:g.entry.head===""?"(empty request)":g.entry.head}),s.jsx("span",{className:"pb-history__reopen",children:"reopen ›"})]},g.entry.at))]})]})]}),Bd=s.jsxs("div",{className:"pb-prompt-body",children:[i?null:s.jsxs("div",{className:"pb-eyebrow",children:[s.jsx("span",{className:"pb-eyebrow__label",children:"prompt"}),s.jsx("span",{className:"pb-eyebrow__chip",title:q==="workflow"?"the skill's input template · prompt.md":"the skill's input template · CHIEF-OF-STAFF-PROMPT.md",children:q==="workflow"?"run-workflow · prompt.md":"chief-of-staff · CHIEF-OF-STAFF-PROMPT.md"})]}),s.jsxs("div",{className:"pb-h1-row",children:[s.jsx("h2",{className:"pb-h1",children:$i}),i?null:s.jsx("button",{className:"pb-cta",disabled:$e.length>0,onClick:xa,title:Ha,type:"button",children:Sn})]}),s.jsxs("div",{className:"pb-facts",children:[s.jsxs("span",{className:"pb-fact",children:["sections ",qr," / ",Gt," ready"]}),q==="workflow"?s.jsx("span",{className:"pb-fact",children:`tags ${Mi} set · ${Ii} default`+(nn.omitted.length>0?` · ${nn.omitted.length} omitted`:"")}):s.jsx("span",{className:"pb-fact",children:`tags ${Hn.written.length} written`}),s.jsxs("span",{className:"pb-fact",children:["chars ",ke.text.length.toLocaleString()]}),q==="workflow"?s.jsxs("span",{className:"pb-fact",children:["council ",ic]}):s.jsx("span",{className:"pb-fact",children:z}),s.jsx("span",{className:"pb-fact",children:s.jsx("span",{className:`pb-status pb-status--${Nu(Ye.length,We.length)}`,children:Ga})})]}),$e.length>0?s.jsxs("div",{className:"pb-before",role:"status",children:[s.jsxs("div",{className:"pb-before__head",children:[s.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"Before copy"}),s.jsx("span",{className:`pb-status pb-status--${Nu(Ye.length,We.length)}`,children:Ga})]}),rc.length>0?s.jsx("div",{className:"pb-before__errors",children:rc.map(({issue:g,jump:R})=>s.jsxs("button",{className:"pb-issue-line",onClick:()=>Ni(R),type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:"pb-issue-line__dot"}),s.jsx("span",{className:"pb-issue-line__msg",children:g.message}),s.jsx("span",{"aria-hidden":"true",className:"pb-issue-line__go",children:"›"})]},`${g.field}:${g.sub}:${g.message}`))}):null,Li.length>0?s.jsx("div",{className:"pb-before__groups",children:Li.map(g=>s.jsxs("div",{className:"pb-before__group",children:[s.jsxs("span",{className:"pb-before__group-label",children:["0",g.section+1," ",yn[g.section]]}),s.jsx("div",{className:"pb-before__chips",children:g.chips.map((R,V)=>s.jsxs("button",{className:"pb-chip",onClick:()=>Ni(ws(R)),title:"jump to this field",type:"button",children:[s.jsx("span",{"aria-hidden":"true",className:"pb-chip__dot"}),R.short]},`${R.field}:${R.sub}:${V}`))})]},g.section))}):null]}):null,s.jsxs("div",{className:`pb-card${Se?" pb-card--flash":""}`,children:[s.jsxs("div",{className:"pb-card__head",children:[me?s.jsxs("span",{className:"pb-card__note",children:["exact copy · ",ke.text.length.toLocaleString()," chars"]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{"aria-expanded":Qe,className:"pb-fact-btn",onClick:()=>Vt(g=>!g),type:"button",children:[Qe?"[ hide ]":"[ show ]"," ",q==="workflow"?"preamble":"policy"]}),s.jsx("span",{className:"pb-card__note",children:q==="workflow"?"preamble · verbatim from prompt.md":"invocation policy · verbatim from the template"})]}),s.jsx("span",{className:"pb-form-head__spacer"}),s.jsx("button",{"aria-pressed":me,className:"pb-fact-btn",onClick:()=>H(g=>!g),title:me?"back to the annotated view":"the exact text that is copied, selectable",type:"button",children:me?"[ formatted ]":"[ raw ]"})]}),me?s.jsx("pre",{"aria-label":"the prompt exactly as copied",className:"pb-raw",ref:ot,tabIndex:0,children:ke.text}):q==="workflow"?s.jsxs(s.Fragment,{children:[Qe?s.jsx("div",{className:"pb-card__preamble",children:TT(R0).map(g=>s.jsx("p",{children:g},g))}):null,s.jsx("div",{className:"pb-card__divider",children:"---"}),s.jsx("div",{className:"pb-card__tags",children:nn.every.map((g,R)=>{const V=my(g.tag),W=Jt[g.tag]!==void 0&&Gl-Jt[g.tag]<1200,fe=!i&&V!==""&&Qt===V,ne=R===0?"":my(nn.every[R-1].tag),Oe=V!==ne,Ge=g.tag==="members_json"&&!g.ghost?g.value.split(`
|
|
113
|
+
`).slice(1,-1).map(tt=>({line:tt,parts:tt.trim().split(", ")})):[];return s.jsxs("div",{className:`pb-tag${Oe?"":" pb-tag--tight"}${fe?" pb-tag--hl":""}${W?" pb-tag--pulse":""}`,...V===""?{}:wa(V),children:[s.jsx("span",{className:g.ghost?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`<${g.tag}>`}),(g.isDefault||g.ghost)&&!me?s.jsx("span",{className:"pb-tag__stamp",title:g.ghost?"the template has this tag; the builder leaves it out so the adapter or skill default applies (an empty tag is rejected at admission)":"effective default — written so the run is explicit; change it in the form",children:g.ghost?`not written · ${g.why}`:"default"}):null,g.tag==="members_json"&&!g.ghost?s.jsxs("span",{className:"pb-tag__seats",children:[s.jsx("span",{className:"pb-tag__seat-line",children:"["}),Ge.map((tt,Ns)=>s.jsx("span",{className:"pb-tag__seat-line",children:tt.parts.map((qi,Vr)=>s.jsx("span",{className:"pb-tag__seat-part",children:qi+(Vr<tt.parts.length-1?",":"")},`${Ns}:${Vr}`))},Ns)),s.jsx("span",{className:"pb-tag__seat-line",children:"]"})]}):g.ghost?null:s.jsx("span",{className:"pb-tag__value","data-default":g.isSet?void 0:"true",children:g.value}),s.jsx("span",{className:g.ghost?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`</${g.tag}>`})]},`${g.tag}:${Jt[g.tag]??0}`)})})]}):s.jsxs(s.Fragment,{children:[Qe?s.jsxs("div",{className:"pb-card__preamble pb-card__policy",children:[s.jsx("span",{className:"pb-card__h",children:"Task"}),s.jsx("p",{children:ia.task}),s.jsx("span",{className:"pb-card__h",children:"Invocation policy"}),s.jsx("ul",{className:"pb-card__list",children:ia.bullets.map(g=>s.jsx("li",{children:g},g))})]}):null,s.jsxs("div",{className:"pb-card__tags",children:[s.jsx("span",{className:"pb-card__h",children:"ClinkX profiles"}),[1,2].map(g=>{const R=g===1?Nr:kr,V=Xn.get(R),W=V===void 0?"pb-tag__name pb-tag__name--ghost":"pb-tag__name";return s.jsxs("div",{className:"pb-tag",...wa(g===1?"tier1":"tier2"),children:[s.jsx("span",{className:W,children:`<${R}>`}),V===void 0?s.jsx("span",{className:"pb-tag__stamp",title:"the tier is unspecified; the skill inspects exposed tools and inherits",children:"not written · unspecified"}):s.jsx("span",{className:"pb-tag__value",children:V}),s.jsx("span",{className:W,children:`</${R}>`})]},R)}),s.jsx("span",{className:"pb-card__h",children:"Request"}),s.jsxs("div",{className:"pb-tag",...wa("request"),children:[s.jsx("span",{className:ra===""?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`<${Po}>`}),ra===""?s.jsx("span",{className:"pb-tag__stamp",title:"the user request is the one required fill point",children:"empty · required"}):s.jsx("span",{className:"pb-tag__value",children:ra}),s.jsx("span",{className:ra===""?"pb-tag__name pb-tag__name--ghost":"pb-tag__name",children:`</${Po}>`})]})]})]})]}),s.jsxs("div",{className:"pb-ledger",children:[s.jsxs("div",{className:"pb-ledger__head",children:[s.jsx("span",{className:"pb-specimen pb-specimen--sm",children:"Left to defaults"}),s.jsx("span",{className:"pb-ledger__note",children:"never written here · what resolves them"})]}),s.jsx("div",{className:"pb-ledger__card",children:(q==="workflow"?xC:we).map(g=>s.jsxs("div",{className:"pb-ledger__row",children:[s.jsx("span",{className:"pb-ledger__keys",children:g.keys.map(R=>s.jsx("span",{className:"pb-ledger__key",children:R},R))}),s.jsx("span",{className:"pb-ledger__value",children:g.value})]},g.keys.join("|")))})]}),i?s.jsx("div",{"aria-hidden":"true",className:"pb-preview-spacer"}):null]}),Gd=s.jsxs("section",{"aria-label":"Assembled prompt",className:"pb-prompt-view",children:[i?s.jsxs("div",{className:"pb-preview-bar",children:[s.jsx("button",{className:"pb-preview-back",onClick:()=>Tt(!1),type:"button",children:"‹ builder"}),s.jsx("span",{className:"pb-preview-bar-title",children:$i})]}):s.jsxs(wi,{children:[s.jsx("span",{className:"pb-sticky__id",children:"prompt"}),s.jsx("span",{className:"pb-sticky__name",children:$i}),s.jsx("span",{className:`pb-sticky__status pb-status--${Nu(Ye.length,We.length)}`,children:Ga}),s.jsx("span",{className:"pb-form-head__spacer"}),s.jsx("button",{className:"pb-fact-btn",disabled:$e.length>0,onClick:xa,title:Ha,type:"button",children:Se?"copied ✓":"[ copy prompt ]"})]}),Bd,i?s.jsxs("div",{className:"pb-preview-foot",children:[s.jsx("span",{className:`pb-preview-foot-status pb-status--${Nu(Ye.length,We.length)}`,children:Ga}),s.jsx("button",{className:"pb-cta pb-cta--md",disabled:$e.length>0,onClick:xa,title:Ha,type:"button",children:Sn})]}):null]});return q==="verified-repair"?s.jsx(gC,{targets:hc,clis:py(a.rows.filter(g=>g.roleNames.includes("json"))),available:t.phase==="current"&&a.phase==="current"&&t.rows.some(g=>g.name==="verified-repair"),retry:()=>{t.retry(),a.retry()}}):s.jsxs("div",{className:"prompt-builder",children:[s.jsx(Hs,{detail:Gd,detailAriaLabel:"Assembled prompt",listAriaLabel:"Prompt builder form",mobileView:Kt?"detail":"list",runList:Ud}),i&&!Kt?s.jsxs("div",{className:"pb-action-bar","data-screen-label":"Builder action bar",children:[s.jsx("button",{className:"pb-action-bar__status",onClick:()=>{Di!==null?Ni(ws(Di)):Tt(!0)},type:"button",children:$e.length>0?`${Ga} · tap to fix`:`ready · ${ke.text.length.toLocaleString()} chars · preview ›`}),s.jsx("button",{className:`pb-cta pb-cta--md${$e.length>0?" pb-cta--outline":""}`,onClick:()=>{$e.length>0?Tt(!0):xa()},type:"button",children:$e.length>0?"preview ›":Sn})]}):null,lc,Zt!==null?s.jsx("div",{className:`pb-toast${Kt?" pb-toast--preview":""}${i?" pb-toast--phone":""}`,"data-screen-label":"Builder toast",children:s.jsxs("div",{className:"pb-toast__pill",role:"status",children:[s.jsx("span",{className:"pb-toast__msg",children:Zt.message}),Zt.undoable?s.jsx("button",{className:"pb-toast__undo",onClick:_s,title:"undo · 7 seconds",type:"button",children:"undo"}):null,s.jsx("button",{"aria-label":"dismiss",className:"pb-toast__dismiss",onClick:()=>{kt.current!==null&&window.clearTimeout(kt.current),rn(null)},type:"button",children:"×"})]})}):null,s.jsx(Hh,{announcement:Ue})]})}function Nu(t,a){return t>0?"err":a>0?"pending":"ready"}function Oy(t,a){return t.cli===""&&t.model===""&&t.effort===""?a:(t.cli||a)+(t.model!==""?` ${t.model}`:"")+(t.effort!==""?` @${t.effort}`:"")}function ri({pill:t,phone:a=!1,caretOnly:i=!1}){const r=t.value!==""?t.value:t.empty,c=t.state==="err"?" pb-pill--err":t.state==="open"?" pb-pill--open":t.state==="miss"?" pb-pill--miss":"";return s.jsxs("button",{"aria-expanded":t.on,"aria-haspopup":"listbox","aria-label":t.aria,className:`${a?"pb-cell":"pb-pill"}${c}${i?" pb-pill--caret":""}`,onClick:t.go,title:t.title===""?void 0:t.title,type:"button",children:[i?null:s.jsxs(s.Fragment,{children:[t.label!==""?s.jsx("span",{className:"pb-pill__label",children:t.label}):null,s.jsx("span",{className:"pb-pill__value","data-default":t.isDefault?"true":void 0,children:r})]}),s.jsx("span",{"aria-hidden":"true",className:"pb-pill__caret",children:"▾"})]})}function ph({cell:t}){const a=t.value!==""?t.value:t.empty,i=t.state==="err"?" pb-cell--err":t.state==="open"?" pb-cell--open":t.state==="miss"?" pb-cell--miss":"";return s.jsxs("button",{"aria-expanded":t.on,"aria-haspopup":"listbox","aria-label":t.aria,className:`pb-cell pb-cell--flow${i}`,onClick:t.go,title:t.title===""?void 0:t.title,type:"button",children:[s.jsx("span",{className:"pb-cell__label",children:t.cellLabel}),s.jsx("span",{className:"pb-cell__value","data-default":t.isDefault?"true":void 0,children:a}),s.jsx("span",{"aria-hidden":"true",className:"pb-cell__caret",children:"▾"})]})}const NC=t=>(document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}),$y=()=>document.visibilityState==="visible";function F0(){return b.useSyncExternalStore(NC,$y,$y)}function $d(t,a,i,r){const c=F0(),p=a||i&&!r&&c;b.useEffect(()=>{if(!p)return;let h=!1;return t.start().finally(()=>{!h&&!a&&t.stop()}),()=>{h=!0,t.stop()}},[a,t,p])}function kC(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return $d(t,a,i,r.lastRefreshAtMs!==null),r}function AC(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return $d(t,a,i,r.lastRefreshAtMs!==null),r}function RC(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return $d(t,a,i,r.lastRefreshAtMs!==null),r}function EC(t,a=!0,i=!1){const r=b.useSyncExternalStore(t.subscribe,t.getState,t.getState);return $d(t,a,i,r.lastRefreshAtMs!==null),r}const TC=/%(?:2f|5c|00)/i,CC=/%[0-9a-f]{2}/i,Ar=/^[A-Za-z0-9_-]{1,64}$/,aa=/^[A-Za-z0-9_-]{1,128}$/,OC=/^ctxop_\d{8}T\d{6}Z_[0-9a-f]{12}$/,$C=/^[A-Za-z0-9_-]{1,64}$/,MC=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function IC(t){if(t==="/")return Object.freeze({kind:"runs"});if(!t.startsWith("/")||t.includes("?")||t.includes("#")||t.endsWith("/"))return;const a=LC(t);if(a!==void 0){if(a.length===1)switch(a[0]){case"runs":case"activities":case"workflows":case"adapters":case"artifacts":return Object.freeze({kind:a[0]});case"context-runs":return Object.freeze({kind:"context_runs"});case"progress-reports":return Object.freeze({kind:"progress_reports"});case"prompt-builder":return Object.freeze({kind:"prompt_builder"});default:return}if(a.length===2){const[i,r]=a;return i==="runs"&&r!==void 0&&Ar.test(r)?Object.freeze({kind:"run_detail",runId:r}):i==="activities"&&r!==void 0&&aa.test(r)?Object.freeze({kind:"activity_detail",activityId:r}):i==="context-runs"&&r!==void 0&&K0(r)?Object.freeze({kind:"context_run_detail",contextRunId:r}):i==="progress-reports"&&r!==void 0&&Z0(r)?Object.freeze({kind:"progress_report_detail",progressReportId:r}):i==="workflows"&&r!==void 0&&aa.test(r)?Object.freeze({kind:"workflow_detail",workflowName:r}):i==="adapters"&&r!==void 0&&aa.test(r)?Object.freeze({kind:"adapter_detail",adapterName:r}):void 0}if(a.length===6&&a[0]==="runs"&&Ar.test(a[1]??"")&&a[2]==="stages"&&aa.test(a[3]??"")&&a[4]==="calls"&&aa.test(a[5]??""))return Object.freeze({kind:"run_call",runId:a[1],stageId:a[3],callId:a[5]});if(a.length===4&&a[0]==="artifacts"&&Ar.test(a[1]??"")&&aa.test(a[2]??"")&&aa.test(a[3]??""))return Object.freeze({kind:"artifact_reference",runId:a[1],stageId:a[2],callId:a[3]})}}function pd(t){switch(t.kind){case"runs":return"/runs";case"run_detail":return`/runs/${$a(t.runId,Ar,"runId")}`;case"run_call":return["/runs",$a(t.runId,Ar,"runId"),"stages",$a(t.stageId,aa,"stageId"),"calls",$a(t.callId,aa,"callId")].join("/");case"activities":return"/activities";case"activity_detail":return`/activities/${$a(t.activityId,aa,"activityId")}`;case"context_runs":return"/context-runs";case"context_run_detail":return`/context-runs/${$a(t.contextRunId,{test:K0},"contextRunId")}`;case"progress_reports":return"/progress-reports";case"progress_report_detail":return`/progress-reports/${$a(t.progressReportId,{test:Z0},"progressReportId")}`;case"workflows":return"/workflows";case"workflow_detail":return`/workflows/${$a(t.workflowName,aa,"workflowName")}`;case"adapters":return"/adapters";case"adapter_detail":return`/adapters/${$a(t.adapterName,aa,"adapterName")}`;case"artifacts":return"/artifacts";case"prompt_builder":return"/prompt-builder";case"artifact_reference":return["/artifacts",$a(t.runId,Ar,"runId"),$a(t.stageId,aa,"stageId"),$a(t.callId,aa,"callId")].join("/")}}function LC(t){const a=[];for(const i of t.slice(1).split("/")){if(i.length===0||i.includes("\\")||i.includes("\0")||TC.test(i))return;let r;try{r=decodeURIComponent(i)}catch{return}if(r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")||CC.test(r))return;a.push(r)}return Object.freeze(a)}function $a(t,a,i){if(!a.test(t))throw new TypeError(`invalid dashboard browser route ${i}`);return encodeURIComponent(t)}function K0(t){if(!$C.test(t)||t.startsWith("wfctx")||t.startsWith("wfpre"))return!1;if(!OC.test(t))return!0;const a=t.slice(6,22),i=[a.slice(0,4),"-",a.slice(4,6),"-",a.slice(6,8),"T",a.slice(9,11),":",a.slice(11,13),":",a.slice(13,15),".000Z"].join(""),r=new Date(i);return!Number.isNaN(r.getTime())&&r.toISOString()===i}function Z0(t){return MC.test(t)}function DC(t){switch(t.kind){case"runs":case"run_detail":case"run_call":return"runs";case"activities":case"activity_detail":return"activities";case"context_runs":case"context_run_detail":return"context_runs";case"progress_reports":case"progress_report_detail":return"progress_reports";case"workflows":case"workflow_detail":return"workflows";case"adapters":case"adapter_detail":return"adapters";case"artifacts":case"artifact_reference":return"artifacts";case"prompt_builder":return"prompt_builder"}}function zC(t){switch(t){case"runs":return{kind:"runs"};case"activities":return{kind:"activities"};case"context_runs":return{kind:"context_runs"};case"progress_reports":return{kind:"progress_reports"};case"workflows":return{kind:"workflows"};case"adapters":return{kind:"adapters"};case"artifacts":return{kind:"artifacts"};case"prompt_builder":return{kind:"prompt_builder"}}}function qC(t){return pd(zC(t))}function UC(t){switch(t.kind){case"run_detail":return{kind:"run",runId:t.runId};case"run_call":return{kind:"run_call",runId:t.runId,stageId:t.stageId,callId:t.callId};case"activity_detail":return{kind:"activity",activityId:t.activityId};case"context_run_detail":return{kind:"context_run",contextRunId:t.contextRunId};case"progress_report_detail":return{kind:"progress_report",progressReportId:t.progressReportId};case"workflow_detail":return{kind:"workflow",workflowName:t.workflowName};case"adapter_detail":return{kind:"adapter",adapterName:t.adapterName};case"artifact_reference":return{kind:"artifact_reference",runId:t.runId,stageId:t.stageId,callId:t.callId};default:return null}}function Mo(t){const a=IC(t);return a===void 0?{kind:"not_found",rawPath:t}:{kind:"resolved",route:a,destination:DC(a),canonicalPath:pd(a),selection:UC(a)}}function ku(t){return{kind:"run_detail",runId:t}}function My(t,a,i){return{kind:"run_call",runId:t,stageId:a,callId:i}}function hh(t){return{kind:"activity_detail",activityId:t}}function Iy(t){return{kind:"context_run_detail",contextRunId:t}}function Ly(t){return{kind:"progress_report_detail",progressReportId:t}}function Dy(t){return{kind:"workflow_detail",workflowName:t}}function mh(t){return{kind:"adapter_detail",adapterName:t}}function BC(t,a,i){return{kind:"artifact_reference",runId:t,stageId:a,callId:i}}function Au(){return window.location.pathname}function zy(t){return{clinkxRoute:t}}function GC(){const[t,a]=b.useState(()=>Mo(Au())),i=b.useRef(t);i.current=t,b.useEffect(()=>{const h=Au(),v=Mo(h);v.kind==="resolved"&&v.canonicalPath!==h&&window.history.replaceState(zy(v.canonicalPath),"",v.canonicalPath),a(v)},[]),b.useEffect(()=>{const h=()=>{a(Mo(Au()))};return window.addEventListener("popstate",h),()=>window.removeEventListener("popstate",h)},[]);const r=b.useCallback((h,v)=>{if(h===Au()){a(Mo(h));return}const m=zy(h);v==="push"?window.history.pushState(m,"",h):window.history.replaceState(m,"",h),a(Mo(h))},[]),c=b.useCallback(h=>{r(qC(h),"push")},[r]),f=b.useCallback(h=>{r(pd(h),"push")},[r]),p=b.useCallback(h=>{r(pd(h),"replace")},[r]);return{resolution:t,navigateToDestination:c,pushRoute:f,replaceRoute:p}}function qy(t){return t??new AbortController().signal}async function Uy(t,a,i){let r;try{r=await t(a,{signal:i})}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new je("aborted"):new je("offline")}if(r.status===401)throw new je("auth_expired",401,"unauthorized");if(!r.ok)throw new je("request_error",r.status);try{return await sa(r)}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):new je("request_error",r.status)}}function HC(t=ms){return{async listWorkflows(a){return await Uy(t,"/api/workflows",qy(a))},async listAdapters(a){return await Uy(t,"/api/adapters",qy(a))}}}const VC=2e3;function FC(t){return{phase:"initial_loading",live:[],history:[],nextBefore:void 0,historyPage:0,canGoNewer:!1,canGoOlder:!1,selected:null,detail:null,lastRefreshAtMs:null,displayNowMs:t,serverOffsetMs:0,announcement:null}}function By(t,a){const i=t instanceof je?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function KC(t){let a=FC(Date.now()),i=null,r=null,c=!1,f=!1,p=0,h=[void 0],v=0,m=0;const x=new Set,y=yr(),A=M=>{a=M;for(const D of x)D()},w=()=>{i!==null&&clearTimeout(i),i=null},C=()=>{w(),!(c||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(i=setTimeout(()=>{I()},VC))},T=M=>({runId:M.runId,runGeneration:M.runGeneration,stateRevision:M.stateRevision}),N=async(M,D=!1)=>{const F=y.begin(M);try{const te=D&&t.getRunDetailForPolling!==void 0?await t.getRunDetailForPolling(M,F.signal):await t.getRunDetail(M,F.signal);return y.acceptsDetail(F.identity,te)?te:null}catch(te){if(!y.isActive(F.identity))return null;throw te}},I=async(M=h)=>{if(c||document.visibilityState!=="visible")return!1;w(),r?.abort(),y.cancel();const D=++p,F=v,te=++m,oe=new AbortController;r=oe;const P=Date.now(),ue=[...M];try{let _e=ue[ue.length-1],ge=await t.listRuns(_e===void 0?{signal:oe.signal}:{before:_e,signal:oe.signal}),be=!1;for(;ge.history.length===0&&ue.length>1;)ue.pop(),be=!0,_e=ue[ue.length-1],ge=await t.listRuns(_e===void 0?{signal:oe.signal}:{before:_e,signal:oe.signal});if(c||oe.signal.aborted||D!==p)return!1;const ve=Date.now(),$=Date.parse(ge.serverNow),ae=P+(ve-P)/2,ce=Number.isFinite($)?$-ae:a.serverOffsetMs,de=ve+ce,ye=[...ge.live,...ge.history];let S=a.selected,L=a.detail,B=!1,Q=be?"The previous page was pruned. Showing the nearest newer history page.":null;const me=a.selected!==null&&a.live.some(pe=>pe.runId===a.selected?.runId&&pe.runGeneration===a.selected.runGeneration);if(S!==null&&F===v){const pe=ye.find(Se=>Se.runId===S?.runId&&Se.runGeneration===S.runGeneration),Be=ye.find(Se=>Se.runId===S?.runId);if(pe!==void 0?S=T(pe):Be!==void 0&&(S=null,L=null,Q="Run generation changed. Select the replacement deliberately to inspect it."),S!==null)try{B=!0;const Se=await N(S,!0);if(Se===null||c||oe.signal.aborted||D!==p||te!==m)return!1;L=Se,S=T(Se);const Re=ge.live.some(Qe=>Qe.runId===Se.runId&&Qe.runGeneration===Se.runGeneration);me&&!Re&&Se.availability==="available"&&Se.status!=="pending"&&Se.status!=="running"&&(Q="Selected run moved to history.")}catch(Se){if(te!==m)return!1;if(Se instanceof je&&Se.code==="run_generation_changed")S=null,L=null,Q="Run generation changed. Select the replacement deliberately to inspect it.";else if(Se instanceof je&&Se.status===404)S=null,L=null,Q="The selected run is no longer available.";else throw Se}}if(c||oe.signal.aborted||D!==p||B&&te!==m)return!1;h=ue;const H=F!==v;return A({...a,phase:H?a.phase:"current",live:ge.live,history:ge.history,nextBefore:ge.nextBefore,canGoOlder:ge.nextBefore!==void 0,historyPage:ue.length-1,canGoNewer:ue.length>1,selected:H?a.selected:S,detail:H?a.detail:L,lastRefreshAtMs:de,displayNowMs:de,serverOffsetMs:ce,announcement:H?a.announcement:Q}),!0}catch(_e){return c||oe.signal.aborted||D!==p||te!==m||F!==v||A({...a,phase:By(_e,a.lastRefreshAtMs!==null)}),!1}finally{!c&&D===p&&C()}},k=()=>{document.visibilityState==="visible"?I():(w(),r?.abort(),m+=1,y.cancel())},q=()=>{document.visibilityState==="visible"&&I()},E=()=>{f&&(f=!1,p+=1,m+=1,w(),r?.abort(),r=null,y.cancel(),document.removeEventListener("visibilitychange",k),window.removeEventListener("focus",q))};return{async start(){f||c||(f=!0,document.addEventListener("visibilitychange",k),window.addEventListener("focus",q),await I())},stop:E,dispose(){c||(E(),c=!0,x.clear())},getState(){return a},subscribe(M){return x.add(M),()=>x.delete(M)},async retry(){await I()},runGenerationChanged(){c||a.selected===null||(v+=1,m+=1,y.cancel(),A({...a,phase:"current",selected:null,detail:null,announcement:"Run generation changed. Select the replacement deliberately to inspect it."}))},async select(M){if(c)return;v+=1;const D=++m,F=T(M);A({...a,selected:F,detail:null,announcement:null});try{const te=await N(F);te!==null&&!c&&D===m&&A({...a,selected:T(te),detail:te})}catch(te){if(c||D!==m||te instanceof je&&te.kind==="aborted")return;if(te instanceof je&&te.code==="run_generation_changed"){A({...a,phase:"current",selected:null,detail:null,announcement:"Run generation changed. Select the replacement deliberately to inspect it."});return}if(te instanceof je&&te.status===404){A({...a,phase:"current",selected:null,detail:null,announcement:"The selected run is no longer available."});return}A({...a,phase:By(te,a.lastRefreshAtMs!==null)})}},async older(){c||a.nextBefore===void 0||await I([...h,a.nextBefore])},async newer(){c||h.length<=1||await I(h.slice(0,-1))}}}function ZC(t){return t??new AbortController().signal}function Gy(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function El(t){if(typeof t!="string"||t.length===0)throw new je("request_error",200);return t}function YC(t){if(!Gy(t)||!Gy(t.childConfig))throw new je("request_error",200);const a=t.childConfig,i=a.source==="ambient"&&a.configured===!1?{source:"ambient",configured:!1}:a.source==="explicit"&&a.configured===!0?{source:"explicit",configured:!0,path:El(a.path)}:(()=>{throw new je("request_error",200)})();return{stateDir:El(t.stateDir),...t.activitiesRoot===void 0?{}:{activitiesRoot:El(t.activitiesRoot)},...t.progressReportsRoot===void 0?{}:{progressReportsRoot:El(t.progressReportsRoot)},runsRoot:El(t.runsRoot),workspaceRoot:El(t.workspaceRoot),workflowsPath:El(t.workflowsPath),templatesPath:El(t.templatesPath),childConfig:i}}function XC(t=ms){return{async getEnvironment(a){const i=ZC(a);let r;try{r=await t("/api/env",{signal:i})}catch(c){throw c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):i.aborted||c instanceof DOMException&&c.name==="AbortError"?new je("aborted"):new je("offline")}if(r.status===401)throw new je("auth_expired",401,"unauthorized");if(!r.ok)throw new je("request_error",r.status);try{return YC(await sa(r))}catch(c){throw c instanceof je?c:c instanceof jt?new je("connection_changed",409,"agent_instance_changed"):new je("request_error",r.status)}}}}const PC=2e3,QC=Object.freeze({phase:"current",detailPhase:"idle",activities:Object.freeze([]),selected:null,detail:null,lastRefreshAtMs:null,announcement:null,displayNowMs:0,serverOffsetMs:0});function JC(){return Object.freeze({async start(){},stop(){},dispose(){},getState:()=>QC,subscribe:()=>()=>{},async retry(){},async select(){},clearSelection(){}})}function Ru(t){return{activityId:t.activityId,activityGeneration:t.activityGeneration,stateRevision:t.stateRevision}}function Hy(t,a){const i=t instanceof je?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function WC(t){let a={phase:"initial_loading",detailPhase:"idle",activities:[],selected:null,detail:null,lastRefreshAtMs:null,announcement:null,displayNowMs:0,serverOffsetMs:0},i=!1,r=!1,c=0,f=0,p=null,h=null;const v=new Set,m=k=>{a=k;for(const q of v)q()},x=()=>{p!==null&&clearTimeout(p),p=null},y=()=>{x(),!(r||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(p=setTimeout(()=>{C()},PC))},A=(k,q)=>!r&&h===q&&!q.signal.aborted&&k===c,w=(k,q)=>!r&&h===q&&!q.signal.aborted&&k===f,C=async()=>{if(r||document.visibilityState!=="visible")return!1;x(),h?.abort();const k=++c,q=f,E=new AbortController;h=E;const M=Date.now();try{const D=await t.listActivities({signal:E.signal});if(!A(k,E))return!1;const F=Date.now();let te=a.selected,oe=a.detail,P=a.detailPhase,ue=null;if(te!==null&&q===f){const $=D.activities.find(ce=>ce.activityId===te?.activityId&&ce.activityGeneration===te.activityGeneration),ae=D.activities.find(ce=>ce.activityId===te?.activityId);if($===void 0&&ae!==void 0)te=null,oe=null,P="idle",ue="Activity generation changed. Select the replacement deliberately.";else{$!==void 0&&(te=Ru($));try{if(oe=await(t.getActivityDetailForPolling??t.getActivityDetail)(te,E.signal),!A(k,E))return!1;te=Ru(oe),P="loaded"}catch(ce){if(!A(k,E))return!1;if(ce instanceof je&&(ce.code==="activity_generation_changed"||ce.code==="activity_state_changed"||ce.status===404))te=null,oe=null,P="idle",ue="The selected activity changed or is no longer retained.";else throw ce}}}if(!A(k,E))return!1;const _e=Date.parse(D.serverNow),ge=M+(F-M)/2,be=Number.isFinite(_e)?_e-ge:a.serverOffsetMs,ve=F+be;return m({phase:"current",detailPhase:P,activities:D.activities,selected:te,detail:oe,lastRefreshAtMs:ve,displayNowMs:ve,serverOffsetMs:be,announcement:ue}),!0}catch(D){return A(k,E)&&m({...a,phase:Hy(D,a.lastRefreshAtMs!==null)}),!1}finally{!r&&k===c&&y()}},T=()=>{document.visibilityState==="visible"?C():(x(),h?.abort(),h=null)},N=()=>{document.visibilityState==="visible"&&C()},I=()=>{i&&(i=!1,c+=1,f+=1,x(),h?.abort(),h=null,document.removeEventListener("visibilitychange",T),window.removeEventListener("focus",N))};return{async start(){i||r||(i=!0,document.addEventListener("visibilitychange",T),window.addEventListener("focus",N),await C())},stop:I,dispose(){r||(I(),r=!0,v.clear())},getState(){return a},subscribe(k){return v.add(k),()=>v.delete(k)},async retry(){await C()},async select(k){if(r)return;h?.abort();const q=++f,E=new AbortController;h=E;const M=Ru(k);m({...a,selected:M,detail:null,detailPhase:"loading",announcement:null});try{const D=await t.getActivityDetail(M,E.signal);w(q,E)&&m({...a,selected:Ru(D),detail:D,detailPhase:"loaded"})}catch(D){if(!w(q,E)||D instanceof je&&D.kind==="aborted")return;if(D instanceof je&&(D.code==="activity_generation_changed"||D.code==="activity_state_changed"||D.status===404)){m({...a,selected:null,detail:null,detailPhase:"idle",announcement:"The selected activity changed or is no longer retained."});return}m({...a,phase:Hy(D,a.lastRefreshAtMs!==null),detailPhase:"error"})}},clearSelection(){f+=1,h?.abort(),h=null,m({...a,selected:null,detail:null,detailPhase:"idle",announcement:null})}}}const eO=3e3,tO=Object.freeze({phase:"current",detailPhase:"idle",contextRuns:Object.freeze([]),selectedId:null,detail:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null});function nO(){return Object.freeze({async start(){},stop(){},dispose(){},getState:()=>tO,subscribe:()=>()=>{},async retry(){},async select(){},clearSelection(){}})}function Vy(t,a){const i=t instanceof je?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function os(t,a){if(a!==null)return t.find(i=>i.id===a)}function Fy(t,a){return Za(t.lifecycle?.status)&&!Za(a.lifecycle?.status)?t:Object.freeze({...t,lifecycle:a.lifecycle,orphaned:a.orphaned,liveness:a.liveness})}function Ky(t,a,i){const r=t?.contextGeneration===i.contextGeneration?t.lifecycle?.status:a?.contextGeneration===i.contextGeneration?a.lifecycle?.status:void 0,c=i.lifecycle?.status;return hd(r)&&c!==void 0&&!hd(c)}function hd(t){return t==="pending"||t==="running"}function Za(t){return t!==void 0&&!hd(t)}function aO(t){let a={phase:"initial_loading",detailPhase:"idle",contextRuns:[],selectedId:null,detail:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null},i=!1,r=!1,c=0,f=0,p=null,h=null,v=null,m=0,x,y,A,w=!0;const C=new Set,T=F=>{a=F;for(const te of C)te()},N=()=>{p!==null&&clearTimeout(p),p=null},I=()=>{N(),!(r||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(p=setTimeout(()=>{q()},eO))},k=async(F,te,oe,P)=>{const ue=os(a.contextRuns,F),_e=f,ge=A,be=ue?.contextGeneration===te&&Za(ue?.lifecycle?.status)||oe?.contextGeneration===te&&Za(oe?.lifecycle?.status)||ge?.contextRunId===F&&ge.expectedGeneration===te&&ge.requiresTerminalAudit,ve=++m;v?.abort();const $=new AbortController;v=$;const ae=de=>{if(de===null||f<=_e)return de;const ye=os(a.contextRuns,F);return ye?.contextGeneration===de.contextGeneration?Fy(de,ye):de},ce=de=>{if(de===void 0)return!1;const ye=os(a.contextRuns,F),S=a.detail?.id===F?a.detail:null;return te===de&&be||ye?.contextGeneration===de&&Za(ye.lifecycle?.status)||S?.contextGeneration===de&&Za(S.lifecycle?.status)};try{const de=await t.getContextRunDetail(F,$.signal);if(r||$.signal.aborted||ve!==m||a.selectedId!==F)return;const S=os(a.contextRuns,F)?.contextGeneration??x??te;if(S!==void 0&&de.contextGeneration!==S){if(S!==te){const Q=a.detail?.id===F&&a.detail.contextGeneration===S?a.detail:null;if(x=S,A={contextRunId:F,expectedGeneration:S,requiresTerminalAudit:ce(S)},P&&w){w=!1,await k(F,S,Q,!1);return}T({...a,detail:Q,detailPhase:"error",announcement:"Context run generation changed again. Retry to inspect the current incarnation."});return}A={contextRunId:F,expectedGeneration:S,requiresTerminalAudit:ce(S)},T({...a,detail:null,detailPhase:"error",announcement:"Context run generation changed again. Retry to inspect the current incarnation."});return}const L=a.detail?.id===F&&a.detail.contextGeneration===de.contextGeneration?a.detail:oe?.contextGeneration===de.contextGeneration?oe:null;if(ce(de.contextGeneration)&&hd(de.lifecycle?.status)){if(x=de.contextGeneration,A={contextRunId:F,expectedGeneration:de.contextGeneration,requiresTerminalAudit:!0},!be&&P&&w){w=!1,await k(F,de.contextGeneration,oe,!1);return}T({...a,detail:ae(L),detailPhase:"error",announcement:"Context run reached a terminal state, but its audited detail is not available yet. Retry to inspect it."});return}const B=ae(de)??de;x=de.contextGeneration,y=void 0,A=void 0,w=!0,T({...a,selectedId:B.id,detail:B,detailPhase:"loaded",announcement:null})}catch(de){if($.signal.aborted||ve!==m||de instanceof je&&de.kind==="aborted")return;if(de instanceof je&&(de.code==="not_found"||de.status===404)){y=a.lastRefreshAtMs!==null&&os(a.contextRuns,F)===void 0?f:void 0,A=void 0,w=!0,T({...a,selectedId:F,detail:null,detailPhase:"not_found",announcement:"The selected context run is no longer retained."});return}const S=os(a.contextRuns,F)?.contextGeneration??x??te,L=oe!==null&&(S===void 0||oe.contextGeneration===S)?oe:null,B=a.detail?.id===F&&(S===void 0||a.detail.contextGeneration===S)?a.detail:L,Q=ae(B);A={contextRunId:F,expectedGeneration:S,requiresTerminalAudit:ce(S)},T({...a,phase:Vy(de,a.lastRefreshAtMs!==null),detail:Q,detailPhase:"error",announcement:null})}},q=async(F=!0)=>{if(r||document.visibilityState!=="visible")return!1;N(),h?.abort();const te=++c,oe=new AbortController;h=oe;try{const P=Date.now(),ue=await t.listContextRuns({signal:oe.signal});if(r||oe.signal.aborted||te!==c)return!1;f=te;const _e=Date.now(),ge=Date.parse(ue.serverNow),be=P+(_e-P)/2,ve=Number.isFinite(ge)?ge-be:a.serverOffsetMs,$=_e+ve;let ae=null,ce=a.detail,de=a.detailPhase;const ye=a.selectedId;let S;if(ye!==null){const L=os(ue.contextRuns,ye);if(L!==void 0){const B=os(a.contextRuns,ye),Q=ce?.contextGeneration??B?.contextGeneration??x;x=L.contextGeneration;const me=A;if(Za(L.lifecycle?.status)&&me?.contextRunId===ye&&(me.expectedGeneration===void 0||me.expectedGeneration===L.contextGeneration)&&(A={contextRunId:ye,expectedGeneration:L.contextGeneration,requiresTerminalAudit:!0}),de==="not_found")y!==void 0?te>y?(y=void 0,m+=1,v?.abort(),ce=null,de="loading",S={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Za(L.lifecycle?.status)}):te===y&&(y=void 0):Q!==void 0&&Q!==L.contextGeneration&&(m+=1,v?.abort(),ce=null,de="loading",S={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Za(L.lifecycle?.status)});else if(Q!==void 0&&Q!==L.contextGeneration)m+=1,v?.abort(),ce=null,de="loading",S={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Za(L.lifecycle?.status)},ae="Context run generation changed. Reloading the current incarnation.";else if(ce!==null&&ce.contextGeneration===L.contextGeneration){const H=de==="loaded"&&Ky(B,ce,L);ce=Fy(ce,L);const pe=A?.contextRunId===ye&&(A.expectedGeneration===void 0||A.expectedGeneration===L.contextGeneration);de=de==="loading"&&pe?"loading":pe?"error":"loaded",H&&(m+=1,v?.abort(),S={expectedGeneration:L.contextGeneration,retainedDetail:ce,requiresTerminalAudit:!0})}else ce===null&&de==="loading"&&(Ky(B,null,L)||B===void 0&&a.lastRefreshAtMs!==null)&&(m+=1,v?.abort(),S={expectedGeneration:L.contextGeneration,retainedDetail:null,requiresTerminalAudit:Za(L.lifecycle?.status)})}}if(S!==void 0&&ye!==null){const L=S;x=L.expectedGeneration,F&&w?(w=!1,A=void 0):(A={contextRunId:ye,expectedGeneration:L.expectedGeneration,requiresTerminalAudit:L.requiresTerminalAudit},ce=L.retainedDetail,de="error",ae="Context run detail changed. Retry to inspect the current incarnation.",S=void 0)}return T({phase:"current",detailPhase:de,contextRuns:ue.contextRuns,selectedId:ye,detail:ce,lastRefreshAtMs:$,displayNowMs:$,serverOffsetMs:ve,announcement:ae}),ye!==null&&a.selectedId===ye&&S!==void 0&&await k(ye,S.expectedGeneration,S.retainedDetail,!1),!0}catch(P){return r||oe.signal.aborted||te!==c||T({...a,phase:Vy(P,a.lastRefreshAtMs!==null)}),!1}finally{!r&&te===c&&I()}},E=()=>{document.visibilityState==="visible"?q():(N(),h?.abort())},M=()=>{document.visibilityState==="visible"&&q()},D=()=>{i&&(i=!1,c+=1,N(),h?.abort(),h=null,m+=1,v?.abort(),v=null,document.removeEventListener("visibilitychange",E),window.removeEventListener("focus",M))};return{async start(){i||r||(i=!0,document.addEventListener("visibilitychange",E),window.addEventListener("focus",M),await q())},stop:D,dispose(){r||(D(),r=!0,C.clear())},getState(){return a},subscribe(F){return C.add(F),()=>C.delete(F)},async retry(){if(!await q(!1))return;const F=A;if(F===void 0||a.selectedId!==F.contextRunId)return;const oe=os(a.contextRuns,F.contextRunId)?.contextGeneration??x??F.expectedGeneration,P=F.requiresTerminalAudit&&F.expectedGeneration===oe;x=oe,A={contextRunId:F.contextRunId,expectedGeneration:oe,requiresTerminalAudit:P};const ue=a.detail?.id===F.contextRunId&&(oe===void 0||a.detail.contextGeneration===oe)?a.detail:null;T({...a,detail:ue,detailPhase:"loading",announcement:null}),await k(F.contextRunId,oe,ue,!1)},async select(F){if(r)return;const te=a.selectedId,oe=a.detail?.id===F?a.detail:null,P=os(a.contextRuns,F)?.contextGeneration??oe?.contextGeneration??(te===F?x:void 0);(te!==F||x!==void 0&&P!==void 0&&x!==P)&&(A=void 0),x=P,y=void 0,w=!0,T({...a,selectedId:F,detail:oe,detailPhase:oe===null?"loading":"loaded",announcement:null}),await k(F,x,oe,!0)},clearSelection(){m+=1,v?.abort(),x=void 0,y=void 0,A=void 0,w=!0,T({...a,selectedId:null,detail:null,detailPhase:"idle",announcement:null})}}}const sO=3e3,lO=Object.freeze({phase:"current",progressReports:Object.freeze([]),truncated:!1,selectedId:null,detail:null,detailPhase:"idle",omittedSections:Object.freeze([]),publishedSessionStatus:null,unreadableReason:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null});function iO(){return Object.freeze({async start(){},stop(){},dispose(){},getState:()=>lO,subscribe:()=>()=>{},async retry(){},async select(){},clearSelection(){},async setStatusOverride(){}})}function Eu(t,a){const i=t instanceof je?t.kind:"request_error";return i==="auth_expired"?"auth_expired":i==="connection_changed"?"connection_changed":i==="offline"?"offline":a?"stale":"error"}function gh(t,a,i,r){const c=Date.parse(t),f=a+(i-a)/2,p=Number.isFinite(c)?c-f:r;return{serverOffsetMs:p,alignedNowMs:i+p}}function rO(t){let a={phase:"initial_loading",progressReports:[],truncated:!1,selectedId:null,detail:null,detailPhase:"idle",omittedSections:[],publishedSessionStatus:null,unreadableReason:null,lastRefreshAtMs:null,displayNowMs:0,serverOffsetMs:0,announcement:null},i=!1,r=!1,c=0,f=null,p=null;const h=new Set,v=k=>{a=k;for(const q of h)q()},m=()=>{f!==null&&clearTimeout(f),f=null},x=()=>{m(),!(r||a.phase==="auth_expired"||a.phase==="connection_changed"||a.phase==="error"||document.visibilityState!=="visible")&&(f=setTimeout(()=>{w()},sO))},y=async()=>{if(r||document.visibilityState!=="visible")return!1;m(),p?.abort();const k=++c,q=new AbortController;p=q;try{const E=Date.now(),M=await t.listProgressReports({signal:q.signal});if(r||q.signal.aborted||k!==c)return!1;const D=Date.now(),{serverOffsetMs:F,alignedNowMs:te}=gh(M.serverNow,E,D,a.serverOffsetMs);return v({phase:"current",progressReports:M.progressReports,truncated:M.truncated,selectedId:a.selectedId,detail:a.detail,detailPhase:a.detailPhase,omittedSections:a.omittedSections,publishedSessionStatus:a.publishedSessionStatus,unreadableReason:a.unreadableReason,lastRefreshAtMs:te,displayNowMs:te,serverOffsetMs:F,announcement:null}),!0}catch(E){return r||q.signal.aborted||k!==c||v({...a,phase:Eu(E,a.lastRefreshAtMs!==null)}),!1}finally{!r&&k===c&&x()}},A=async()=>{if(r||document.visibilityState!=="visible"||a.selectedId===null)return!1;m(),p?.abort();const k=++c,q=new AbortController;p=q;const E=a.selectedId;try{const M=Date.now(),D=await t.getProgressReportDetail(E,q.signal);if(r||q.signal.aborted||k!==c)return!1;const F=Date.now(),{serverOffsetMs:te,alignedNowMs:oe}=gh(D.serverNow,M,F,a.serverOffsetMs);return v({phase:"current",progressReports:a.progressReports,truncated:a.truncated,selectedId:D.progressReport.session.id,detail:D.progressReport,detailPhase:"loaded",omittedSections:D.omittedSections,publishedSessionStatus:D.publishedSessionStatus??null,unreadableReason:null,lastRefreshAtMs:oe,displayNowMs:oe,serverOffsetMs:te,announcement:null}),!0}catch(M){if(r||q.signal.aborted||k!==c)return!1;const D=ry(M);return D!==void 0?(v({...a,selectedId:E,detail:null,detailPhase:"not_found",unreadableReason:D,announcement:Zy(D)}),!1):(v({...a,phase:Eu(M,a.lastRefreshAtMs!==null),detailPhase:a.detail===null?"error":"stale"}),!1)}finally{!r&&k===c&&a.unreadableReason===null&&x()}},w=async()=>a.unreadableReason!==null?!1:a.selectedId===null?y():A(),C=()=>{document.visibilityState==="visible"?w():(m(),p?.abort())},T=()=>{document.visibilityState==="visible"&&w()},N=()=>{i&&(i=!1,c+=1,m(),p?.abort(),p=null,document.removeEventListener("visibilitychange",C),window.removeEventListener("focus",T))};return{async start(){i||r||(i=!0,(a.phase==="error"||a.phase==="offline")&&v({...a,phase:"initial_loading"}),document.addEventListener("visibilitychange",C),window.addEventListener("focus",T),await w())},stop:N,dispose(){r||(N(),r=!0,h.clear())},getState(){return a},subscribe(k){return h.add(k),()=>h.delete(k)},async retry(){a.unreadableReason!==null&&v({...a,detailPhase:a.selectedId===null?"idle":"loading",unreadableReason:null,announcement:null}),await w()},async select(k){if(r)return;m(),p?.abort(),c+=1;const q=++c,E=new AbortController;p=E,v({...a,selectedId:k,detail:null,detailPhase:"loading",omittedSections:[],publishedSessionStatus:null,unreadableReason:null,announcement:null});try{const M=Date.now(),D=await t.getProgressReportDetail(k,E.signal);if(!r&&!E.signal.aborted&&q===c){const F=Date.now(),{serverOffsetMs:te,alignedNowMs:oe}=gh(D.serverNow,M,F,a.serverOffsetMs);v({phase:"current",progressReports:a.progressReports,truncated:a.truncated,selectedId:D.progressReport.session.id,detail:D.progressReport,detailPhase:"loaded",omittedSections:D.omittedSections,publishedSessionStatus:D.publishedSessionStatus??null,unreadableReason:null,lastRefreshAtMs:oe,displayNowMs:oe,serverOffsetMs:te,announcement:null})}}catch(M){if(E.signal.aborted||q!==c||M instanceof je&&M.kind==="aborted")return;const D=ry(M);if(D!==void 0){v({...a,selectedId:k,detail:null,detailPhase:"not_found",unreadableReason:D,announcement:Zy(D)});return}v({...a,phase:Eu(M,a.lastRefreshAtMs!==null),detailPhase:"error"})}finally{!r&&q===c&&a.unreadableReason===null&&x()}},clearSelection(){c+=1,m(),p?.abort(),v({...a,selectedId:null,detail:null,detailPhase:"idle",omittedSections:[],publishedSessionStatus:null,unreadableReason:null,announcement:null}),!r&&document.visibilityState==="visible"&&y()},async setStatusOverride(k,q){if(!r){m(),p?.abort(),c+=1;try{const E=await t.setStatusOverride(k,q);if(r)return;E.kind==="detail"&&I(k,E),await w()}catch(E){if(r)return;v({...a,phase:Eu(E,a.lastRefreshAtMs!==null)}),a.unreadableReason===null&&x()}}}};function I(k,q){if(q.progressReport.session.id!==k)return;const E=q.publishedSessionStatus;v({...a,progressReports:a.progressReports.map(M=>M.id===k?oO(M,q.progressReport.session.status,E):M),...a.selectedId===k?{detail:q.progressReport,detailPhase:"loaded",omittedSections:q.omittedSections,publishedSessionStatus:E??null,unreadableReason:null}:{}})}}function oO(t,a,i){return Object.freeze({id:t.id,title:t.title,status:a,projectFolder:t.projectFolder,startedAt:t.startedAt,updatedAt:t.updatedAt,agentCount:t.agentCount,...t.taskCounts===void 0?{}:{taskCounts:t.taskCounts},...i===void 0?{}:{publishedStatus:i}})}function Zy(t){switch(t){case"removed":return"The selected progress report is no longer available.";case"malformed":return"The selected progress report could not be parsed.";case"oversized":return"The selected progress report is too large to display in the dashboard."}}const cO=3e3,vr={runs:"Run monitor",activities:"Single calls",context_runs:"Context runs",progress_reports:"Progress reports",workflows:"Workflows",adapters:"Adapters",artifacts:"Artifacts",prompt_builder:"Prompt builder"};function Yy(t,a){const[i,r]=b.useState(0),[c,f]=b.useState({phase:"loading",rows:[]}),p=b.useRef(!1);return b.useEffect(()=>{if(!a||p.current)return;const h=new AbortController;return f(v=>({phase:"loading",rows:v.rows})),t(h.signal).then(v=>{h.signal.aborted||(p.current=!0,f({phase:"current",rows:v.rows}))}).catch(v=>{if(h.signal.aborted)return;p.current=!0;const m=v instanceof je&&(v.kind==="auth_expired"||v.kind==="connection_changed"||v.kind==="offline")?v.kind:"error";f(x=>({phase:m,rows:x.rows}))}),()=>h.abort()},[a,i,t]),{state:c,retry:()=>{p.current=!1,r(h=>h+1)}}}function Xy({kind:t,phase:a,retry:i}){if(a==="current")return null;if(a==="loading")return s.jsx(id,{message:`Loading ${t} catalog…`,role:"status"});const r=a==="auth_expired"?`Authentication expired; the ${t} catalog was not loaded.`:a==="connection_changed"?`Connection changed; rebootstrap before loading the ${t} catalog.`:a==="offline"?`Offline; the ${t} catalog could not be loaded.`:`The ${t} catalog request failed.`,c=a==="auth_expired"||a==="connection_changed"?void 0:{label:`[ retry ${t} catalog ]`,run:i};return s.jsx(id,{message:r,...c===void 0?{}:{retry:c},role:"alert"})}function Y0({accountActions:t,applicationRootId:a="root",activityApi:i,activityController:r,artifactApi:c,catalogApi:f,contextRunsApi:p,contextRunsController:h,progressReportsApi:v,progressReportsController:m,controller:x,environmentApi:y,inspectorApi:A,resultApi:w,routeHydrationApi:C,sessionLogApi:T}){const N=GC(),I=N.resolution,k=I.kind==="not_found",q=I.kind==="resolved"?I:null,E=q?.destination??"runs",M=q?.selection??null,[D,F]=b.useState(!1),[te,oe]=b.useState(!1),[P,ue]=b.useState(!1),[_e,ge]=b.useState(!1),[be]=b.useState(()=>p0()),[ve]=b.useState(()=>KC(be)),[$]=b.useState(()=>WC(be)),[ae]=b.useState(()=>JC()),[ce]=b.useState(()=>p??y0()),[de]=b.useState(()=>aO(ce)),[ye]=b.useState(()=>nO()),[S]=b.useState(()=>v??pT()),[L]=b.useState(()=>rO(S)),[B]=b.useState(()=>iO()),[Q]=b.useState(()=>HC()),[me]=b.useState(()=>$1()),[H]=b.useState(()=>XC()),[pe]=b.useState(()=>Ux()),Be=y??H,[Se,Re]=b.useState(null),[Qe,Vt]=b.useState(0),[Kt,Tt]=b.useState(!1),Qt=F0(),Dt=x??ve,Jt=r??(x===void 0?$:ae),Wt=h??(x===void 0?de:ye),Zt=m??(x===void 0?L:B),rn=C??(x===void 0?be:void 0),Ln=i??be,on=T??(x===void 0&&r===void 0&&h===void 0&&m===void 0?pe:void 0),en=Se!==null,rt=ie=>en&&(ie.lastRefreshAtMs!==null||ie.phase==="error"||ie.phase==="offline"||ie.phase==="stale"),Ue=EC(Zt,E==="progress_reports",en),le=kC(Dt,E==="runs",rt(Ue)),Ae=AC(Jt,E==="activities",rt(le)),Ie=RC(Wt,E==="context_runs",rt(Ae)),qe=b.useRef(le.phase);b.useEffect(()=>{const ie=new AbortController;return Tt(!1),Be.getEnvironment(ie.signal).then(Ee=>{ie.signal.aborted||Re({stateDir:Ee.stateDir,...Ee.activitiesRoot===void 0?{}:{activitiesRoot:Ee.activitiesRoot},...Ee.progressReportsRoot===void 0?{}:{progressReportsRoot:Ee.progressReportsRoot},runsRoot:Ee.runsRoot,workspaceRoot:Ee.workspaceRoot,workflowsPath:Ee.workflowsPath,templatesPath:Ee.templatesPath,childConfig:Ee.childConfig.source==="explicit"?`explicit · ${Ee.childConfig.path}`:"ambient · not configured"})}).catch(()=>{ie.signal.aborted||Tt(!0)}),()=>ie.abort()},[Be,Qe]),b.useEffect(()=>{if(!Kt||!Qt)return;const ie=window.setTimeout(()=>{Vt(Ee=>Ee+1)},cO);return()=>window.clearTimeout(ie)},[Qt,Kt]),b.useEffect(()=>{const ie=qe.current;qe.current=le.phase,le.phase==="current"&&ie!=="current"&&Kt&&Vt(Ee=>Ee+1)},[le.phase,Kt]);const ot=f??Q,$t=x===void 0||f!==void 0,pt=Yy(b.useCallback(async ie=>({rows:(await ot.listWorkflows(ie)).workflows}),[ot]),E==="workflows"||E==="prompt_builder"||$t),Je=Yy(b.useCallback(async ie=>({rows:(await ot.listAdapters(ie)).adapters}),[ot]),E==="adapters"||E==="prompt_builder"||$t),[ht,kt]=b.useState(null),Mt=rx(le),mn=[...le.live,...le.history].reduce((ie,Ee)=>(Ee.availability!=="available"||(ie[Ee.workflowName]=(ie[Ee.workflowName]??0)+1),ie),{}),Rn=[...le.live,...le.history].reduce((ie,Ee)=>ie+(Ee.availability==="available"?Ee.reportedRunningCalls:0),0),gn=le.selected,tn=Ae.selected,_t=M?.kind==="run"||M?.kind==="run_call"?M.runId:null,nn=b.useRef(null);b.useEffect(()=>{if(E!=="runs")return;if(_t===null){nn.current=null;return}if(nn.current===_t||(nn.current=_t,le.selected?.runId===_t))return;const ie=[...le.live,...le.history].find(Ee=>Ee.availability==="available"&&Ee.runId===_t);if(ie!==void 0){Dt.select(ie);return}rn!==void 0&&rn.getRunDetailCurrent(_t).then(Ee=>{nn.current===_t&&Ee.availability==="available"&&Dt.select(Ee)}).catch(()=>{})},[E,rn,Dt,le.live,le.history,le.selected,_t]);const Ct=M?.kind==="activity"?M.activityId:null,Dn=b.useRef(null);b.useEffect(()=>{if(E!=="activities")return;if(Ct===null){Dn.current=null,oe(!1);return}if(Dn.current===Ct||(Dn.current=Ct,oe(!0),Ae.selected?.activityId===Ct))return;const ie=Ae.activities.find(Ee=>Ee.activityId===Ct);if(ie!==void 0){Jt.select(ie);return}rn!==void 0&&rn.getActivityDetailCurrent(Ct).then(Ee=>{Dn.current===Ct&&Jt.select(Ee)}).catch(()=>{})},[Jt,E,rn,Ae.activities,Ae.selected,Ct]);const Ut=M?.kind==="context_run"?M.contextRunId:null;b.useEffect(()=>{if(E!=="context_runs"){Ie.selectedId!==null&&Wt.clearSelection();return}if(Ut===null){oe(!1),Ie.selectedId!==null&&Wt.clearSelection();return}oe(!0),Ie.selectedId!==Ut&&Wt.select(Ut)},[Wt,E,Ie.selectedId,Ut]);const ct=M?.kind==="progress_report"?M.progressReportId:null,Bt=b.useRef(ct);b.useEffect(()=>{if(E==="progress_reports"){if(ct===null){oe(!1),Ue.selectedId!==null&&Zt.clearSelection();return}oe(!0),Ue.selectedId!==ct&&Zt.select(ct)}},[Zt,E,Ue.selectedId,ct]),b.useEffect(()=>{const ie=Bt.current;Bt.current=ct,!(E!=="progress_reports"||ie===null||ct!==null)&&window.setTimeout(()=>{const Ee=document.querySelector(`.dashboard-layout__run-list [role="option"][data-item-id="${CSS.escape(ie)}"]`),he=document.querySelector(".dashboard-layout__run-list #progress-report-list-title"),nl=document.querySelector('.dashboard-layout__run-list [role="option"]');(Ee??he??nl)?.focus()},0)},[E,ct]);const Hn=_t??le.selected?.runId??null,ia=M?.kind==="run_call"?{stageId:M.stageId,callId:M.callId}:null,Xn=M?.kind==="artifact_reference"?{runId:M.runId,stageId:M.stageId,callId:M.callId}:null,za=b.useRef(!1);b.useEffect(()=>{M?.kind!=="run_call"&&(za.current=!1)},[M]);const qa=b.useCallback((ie,Ee)=>{const he=Hn;he!==null&&(Ee==="open"&&ie!==null?(za.current=!0,N.pushRoute(My(he,ie.stageId,ie.callId))):Ee==="switch"&&ie!==null?N.replaceRoute(My(he,ie.stageId,ie.callId)):za.current?(za.current=!1,window.history.back()):N.replaceRoute(ku(he)))},[N,Hn]),Ua=b.useCallback(()=>{Dt.runGenerationChanged()},[Dt]),Ja=b.useCallback(()=>{Jt.clearSelection()},[Jt]),ra=b.useCallback(()=>{Wt.clearSelection(),N.replaceRoute({kind:"context_runs"})},[Wt,N.replaceRoute]),z=b.useRef(gn);b.useEffect(()=>{const ie=z.current;z.current=gn,!(E!=="runs"||!te||ie===null||gn!==null)&&(oe(!1),window.setTimeout(()=>{const Ee=document.querySelector(".dashboard-layout__run-list [data-selection-loss-announcement]"),he=document.querySelector('.dashboard-layout__run-list [role="option"]');(Ee??he)?.focus()},0))},[E,te,gn]);const xe=b.useRef(tn);b.useEffect(()=>{const ie=xe.current;xe.current=tn,!(E!=="activities"||!te||ie===null||tn!==null)&&(oe(!1),window.setTimeout(()=>{const Ee=document.querySelector(".dashboard-layout__run-list [data-selection-loss-announcement]"),he=document.querySelector('.dashboard-layout__run-list [role="option"]');(Ee??he)?.focus()},0))},[E,te,tn]);const we=M?.kind==="workflow"?M.workflowName:null,ke=M?.kind==="adapter"?M.adapterName:null;b.useEffect(()=>{E!=="adapters"&&(ue(!1),ge(!1))},[E]);const $e=b.useRef(null);b.useEffect(()=>{const ie=E==="runs"?gn?.runId??null:E==="activities"?tn?.activityId??null:E==="context_runs"?Ut:E==="progress_reports"?ct:E==="workflows"?we:E==="adapters"?ke:E==="artifacts"?Xn===null?null:`${Xn.runId}:${Xn.callId}`:null;ie===null||ie===$e.current||($e.current=ie,document.querySelector(".dashboard-layout__detail")?.scrollTo?.({top:0}))},[E,gn,tn,Ut,ct,we,ke,Xn]);const Ye=E==="activities"?Ae.phase:E==="context_runs"?Ie.phase:E==="progress_reports"?Ue.phase:le.phase,We=E==="runs"||E==="activities"||E==="context_runs"||E==="progress_reports",It=ie=>{ie==="artifacts"&&F(!0),oe(!1),N.navigateToDestination(ie)},yn=()=>{oe(!1),window.setTimeout(()=>{document.querySelector('.dashboard-layout__run-list [role="option"][aria-selected="true"]')?.focus()},0)},Xe=()=>{N.pushRoute({kind:"activities"}),yn()},Gt=()=>{N.pushRoute({kind:"workflows"}),yn()},En=()=>{N.pushRoute({kind:"adapters"}),yn()},_n=()=>{N.pushRoute({kind:"artifacts"}),yn()},Lt=()=>{N.pushRoute({kind:"progress_reports"})},cn=le.detail!==null&&le.detail.availability==="available"?le.detail:null,xn=cn!==null||Ae.lastRefreshAtMs!==null,mt=ie=>aA(ie,cn,Ae.activities),_s=xn&&Je.state.phase==="current"?Object.fromEntries(Je.state.rows.map(ie=>[ie.name,mt(ie.name).length])):void 0,Wa=sm(),ya=P&&!Wa,jn=s0(Je.state.rows,ke??void 0),Si=xn&&jn!==void 0?mt(jn.name):void 0,el={...le.lastRefreshAtMs===null?{}:{runs:le.live.length+le.history.length},...Ae.lastRefreshAtMs===null?{}:{activities:Ae.activities.length},...Ie.lastRefreshAtMs===null?{}:{context_runs:Ie.contextRuns.length},...Ue.lastRefreshAtMs===null?{}:{progress_reports:Ue.progressReports.length},...pt.state.phase==="current"?{workflows:pt.state.rows.length}:{},...Je.state.phase==="current"?{adapters:Je.state.rows.length}:{},...ht===null?{}:{artifacts:ht}},[tl,vs]=b.useState(0),bs=b.useMemo(()=>{const ie=(he,nl)=>{if(he===void 0)return"";const ys=Date.parse(he);if(!Number.isFinite(ys))return"";const xa=nl===void 0?Number.NaN:Date.parse(nl),ts=Number.isFinite(xa)?xa-ys:le.displayNowMs-ys;return ts>=0?Rr(ts):""},Ee=[];for(const he of le.live)he.availability==="available"&&Ee.push({group:"runs",id:`run:${he.runId}`,name:he.workflowName,sub:`run ${he.runId}`,meta:ie(he.startedAt,he.completedAt),status:he.status,searchTerms:[he.runId,he.workflowName,he.status,`v${he.workflowVersion}`],targetId:he.runId});for(const he of le.history)he.availability==="available"&&Ee.push({group:"runs",id:`run:${he.runId}`,name:he.workflowName,sub:`run ${he.runId}`,meta:ie(he.startedAt,he.completedAt),status:he.status,searchTerms:[he.runId,he.workflowName,he.status,`v${he.workflowVersion}`],targetId:he.runId});for(const he of Ae.activities)Ee.push({group:"calls",id:`call:${he.activityId}`,name:`${he.kind} · ${he.adapter} / ${he.role}`,sub:`activity ${he.activityId}`,meta:ie(he.startedAt,he.completedAt),status:he.status,searchTerms:[he.activityId,he.kind,he.adapter,he.role,he.status],targetId:he.activityId});for(const he of Ie.contextRuns)he.lifecycle!==null&&Ee.push({group:"context",id:`ctx:${he.id}`,name:he.operationKind,sub:he.id,meta:he.lifecycle.durationMs===null?"":Rr(he.lifecycle.durationMs),status:he.lifecycle.status,searchTerms:[he.id,he.operationKind,he.source,he.lifecycle.status],targetId:he.id});for(const he of Ue.progressReports)Ee.push({group:"progress",id:`report:${he.id}`,name:he.title,sub:he.id,meta:bn(he.updatedAt,Ue.displayNowMs),status:he.status,searchTerms:[he.id,he.title,he.status],targetId:he.id});if(pt.state.phase==="current")for(const he of pt.state.rows)Ee.push({group:"workflows",id:`workflow:${he.name}`,name:he.name,sub:`workflow · v${he.version}`,meta:`${String(he.stageCount)} stages · ${String(he.callCount)} calls`,status:"",searchTerms:[he.name,"workflow",`v${he.version}`,he.description],targetId:he.name});if(Je.state.phase==="current")for(const he of Je.state.rows)Ee.push({group:"adapters",id:`adapter:${he.name}`,name:he.name,sub:`adapter · $ ${he.command}`,meta:he.parser,status:"",searchTerms:[he.name,"adapter",he.parser,he.command,he.backend],targetId:he.name});return Ee},[le,Ae.activities,Ie.contextRuns,Ue,pt.state,Je.state]);if(!k&&E==="progress_reports"&&ct!==null)return s.jsx(fy,{detail:Ue.detail,detailPhase:Ue.detailPhase,nowMs:Ue.displayNowMs,onBack:Lt,onRetry:()=>{Zt.retry()},onSetStatusOverride:ie=>{Zt.setStatusOverride(ct,ie)},omittedSections:Ue.omittedSections,pollingPhase:Ue.phase,...Ue.publishedSessionStatus===null?{}:{publishedSessionStatus:Ue.publishedSessionStatus},selectedId:ct,unreadableReason:Ue.unreadableReason});const es=ie=>{switch(vs(Ee=>Ee+1),ie.group){case"runs":oe(!0),N.pushRoute(ku(ie.targetId));return;case"calls":oe(!0),N.pushRoute(hh(ie.targetId));return;case"context":N.pushRoute(Iy(ie.targetId));return;case"progress":N.pushRoute(Ly(ie.targetId));return;case"workflows":N.pushRoute(Dy(ie.targetId));return;case"adapters":N.pushRoute(mh(ie.targetId));return}};return s.jsxs(nS,{...t===void 0?{}:{accountActions:t},activeDestination:E,applicationRootId:a,environment:Se,jumpItems:bs,navigationCounts:el,observationAvailable:k?!1:We,onJumpOpen:es,onNavigate:It,pageTitle:k?"Not found":vr[E],pollingPhase:Ye,reportedRunningCalls:{count:le.lastRefreshAtMs===null?null:Rn,refreshedLabel:le.lastRefreshAtMs===null?null:Mt.lastRefreshLabel},children:[k?s.jsxs("section",{className:"app-shell__view","aria-labelledby":"dashboard-page-title",children:[s.jsx("h1",{id:"dashboard-page-title",className:"app-shell__title",children:"Page not found"}),s.jsxs("p",{className:"app-shell__note",role:"status",children:["No dashboard view matches ",s.jsx("code",{children:I.rawPath}),"."]}),s.jsx("button",{type:"button",onClick:()=>It("runs"),children:"Go to run monitor"})]}):null,!k&&E==="runs"?s.jsx(Hs,{detail:s.jsx(NR,{applicationRootId:a,...A===void 0?{}:{inspectorApi:A},onBack:yn,onInspectorRouteChange:qa,onRetry:()=>{Dt.retry()},onRunGenerationChanged:Ua,...le.detail?.availability!=="available"?{}:{contextPreflight:le.detail.contextPreflight??null},...w===void 0?{}:{resultApi:w},routeCall:ia,...on===void 0?{}:{sessionLogApi:on},state:le}),mobileView:gn!==null&&te?"detail":"list",runList:s.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[s.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:vr[E]}),s.jsx(BR,{filterResetKey:tl,onNewer:()=>{Dt.newer()},onOlder:()=>{Dt.older()},onRetry:()=>{Dt.retry()},onSelect:ie=>{oe(!0),nn.current=ie.runId,N.pushRoute(ku(ie.runId)),Dt.select(ie)},state:le})]})}):null,!k&&E==="activities"?s.jsx(Hs,{detailAriaLabel:"Single-call detail",listAriaLabel:"Single-call list",detail:s.jsx(IR,{api:Ln,detail:Ct===null?null:Ae.detail,detailPhase:Ct===null?"idle":Ae.detailPhase,nowMs:Ae.displayNowMs,onBack:Xe,onGenerationChanged:Ja,selection:Ct===null?null:tn,...on===void 0?{}:{sessionLogApi:on}},Ct===null||tn===null?"activity:none":[tn.activityId,tn.activityGeneration].join(":")),mobileView:tn!==null&&te?"detail":"list",runList:s.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[s.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:vr[E]}),s.jsx(HR,{filterResetKey:tl,activities:Ae.activities,announcement:Ae.announcement,hasSnapshot:Ae.lastRefreshAtMs!==null,onRetry:()=>{Jt.retry()},onSelect:ie=>{oe(!0),Dn.current=ie.activityId,N.pushRoute(hh(ie.activityId)),Jt.select(ie)},phase:Ae.phase,selected:Ae.selected,nowMs:Ae.displayNowMs})]})}):null,!k&&E==="context_runs"?s.jsx(Hs,{detailAriaLabel:"Context run detail",listAriaLabel:"Context run list",detail:s.jsx(NE,{canRetry:Ie.phase==="current"||Ie.phase==="stale"||Ie.phase==="offline"||Ie.phase==="error",detail:Ie.detail,detailPhase:Ie.detailPhase,onBack:()=>{N.pushRoute({kind:"context_runs"})},onGenerationChanged:ra,onRetry:()=>{Wt.retry()},selectedId:Ut,contextRunsApi:ce,...on===void 0?{}:{sessionLogApi:on}}),mobileView:Ut!==null?"detail":"list",runList:s.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[s.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:vr[E]}),s.jsx(AE,{filterResetKey:tl,announcement:Ie.announcement,contextRuns:Ie.contextRuns,hasSnapshot:Ie.lastRefreshAtMs!==null,nowMs:Ie.displayNowMs,onRetry:()=>{Wt.retry()},onSelect:ie=>{N.pushRoute(Iy(ie))},phase:Ie.phase,selectedId:Ie.selectedId})]})}):null,!k&&E==="progress_reports"?s.jsx(Hs,{detailAriaLabel:"Progress report detail",listAriaLabel:"Progress report list",detail:s.jsx(fy,{detail:Ue.detail,detailPhase:Ue.detailPhase,nowMs:Ue.displayNowMs,onBack:Lt,onRetry:()=>{Zt.retry()},onSetStatusOverride:ie=>{ct!==null&&Zt.setStatusOverride(ct,ie)},omittedSections:Ue.omittedSections,pollingPhase:Ue.phase,...Ue.publishedSessionStatus===null?{}:{publishedSessionStatus:Ue.publishedSessionStatus},selectedId:ct,unreadableReason:Ue.unreadableReason}),mobileView:ct!==null?"detail":"list",runList:s.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[s.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:vr[E]}),s.jsx(TE,{announcement:Ue.announcement,progressReports:Ue.progressReports,hasSnapshot:Ue.lastRefreshAtMs!==null,nowMs:Ue.displayNowMs,onRetry:()=>{Zt.retry()},onSelect:ie=>{N.pushRoute(Ly(ie))},phase:Ue.phase,...Se?.progressReportsRoot===void 0?{}:{progressReportsRoot:Se.progressReportsRoot},selectedId:Ue.selectedId,truncated:Ue.truncated})]})}):null,!k&&E==="workflows"?s.jsx(Hs,{detailAriaLabel:"Workflow detail",listAriaLabel:"Workflow index",detail:pt.state.phase==="current"?s.jsx(mA,{onBack:Gt,runCounts:mn,workflow:n0(pt.state.rows,we??void 0)}):null,mobileView:we!==null?"detail":"list",runList:s.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[s.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:vr[E]}),s.jsx(Xy,{kind:"workflow",phase:pt.state.phase,retry:pt.retry}),pt.state.phase==="current"?s.jsx(fA,{onSelect:ie=>N.pushRoute(Dy(ie)),...Se?.workflowsPath===void 0?{}:{sourcePath:Se.workflowsPath},runCounts:mn,...we===null?{}:{selectedName:we},workflows:pt.state.rows}):null]})}):null,!k&&E==="adapters"?s.jsx(Hs,{detailAriaLabel:"Adapter detail",listAriaLabel:"Adapter index",detail:Je.state.phase==="current"?ya?s.jsx(jA,{adapters:Je.state.rows,differencesOnly:_e,onClose:()=>ue(!1),onDifferencesToggle:()=>ge(ie=>!ie),onOpenAdapter:ie=>{ue(!1),N.pushRoute(mh(ie))},...ke===null?{}:{selectedName:ke},..._s===void 0?{}:{useCounts:_s}}):s.jsx(xA,{adapter:jn,adapters:Je.state.rows,onBack:En,onOpenUse:ie=>{ie.kind==="workflow"?N.pushRoute(ku(ie.runId)):N.pushRoute(hh(ie.activityId))},...Si===void 0?{}:{uses:Si}}):null,mobileView:ke!==null?"detail":"list",runList:s.jsxs("section",{className:"app-shell__view","aria-live":"off",children:[s.jsx("h1",{id:"dashboard-page-title",className:"visually-hidden",children:"Adapters"}),s.jsx(Xy,{kind:"adapter",phase:Je.state.phase,retry:Je.retry}),Je.state.phase==="current"?s.jsx(_A,{adapters:Je.state.rows,compareOn:ya,onCompareToggle:()=>ue(ie=>!ie),onSelect:ie=>N.pushRoute(mh(ie)),...ke===null?{}:{selectedName:ke},..._s===void 0?{}:{useCounts:_s}}):null]})}):null,!k&&(D||le.lastRefreshAtMs!==null&&(x===void 0||c!==void 0))?s.jsx("div",{className:"app-shell__catalog-frame",hidden:E!=="artifacts",children:s.jsx(CA,{active:E==="artifacts",api:c??me,mobileView:Xn!==null?"detail":"list",onBackToList:_n,onLoadedCount:kt,onSelectReference:ie=>{N.pushRoute(BC(ie.runId,ie.stageId,ie.callId))},runs:[...le.live,...le.history],selection:Xn,...Se?.runsRoot===void 0?{}:{runsRoot:Se.runsRoot}})}):null,!k&&E==="prompt_builder"?s.jsx(SC,{adapters:{phase:Je.state.phase,rows:Je.state.rows,retry:Je.retry},workflows:{phase:pt.state.phase,rows:pt.state.rows,retry:pt.retry}}):null]})}function us(t){const a=new Uint8Array(t);let i="";for(const c of a)i+=String.fromCharCode(c);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function md(t){const a=t.replace(/-/g,"+").replace(/_/g,"/"),i=(4-a.length%4)%4,r=a.padEnd(a.length+i,"="),c=atob(r),f=new ArrayBuffer(c.length),p=new Uint8Array(f);for(let h=0;h<c.length;h++)p[h]=c.charCodeAt(h);return f}function Md(){return uO.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential=="function")}const uO={stubThis:t=>t};function X0(t){const{id:a}=t;return{...t,id:md(a),transports:t.transports}}function P0(t){return t==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(t)}class In extends Error{constructor({message:a,code:i,cause:r,name:c}){super(a,{cause:r}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=c??r.name,this.code=i}}function dO({error:t,options:a}){const{publicKey:i}=a;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(a.signal instanceof AbortSignal)return new In({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(i.authenticatorSelection?.requireResidentKey===!0)return new In({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(a.mediation==="conditional"&&i.authenticatorSelection?.userVerification==="required")return new In({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(i.authenticatorSelection?.userVerification==="required")return new In({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new In({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new In({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(c=>c.type==="public-key").length===0?new In({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new In({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const r=globalThis.location.hostname;if(P0(r)){if(i.rp.id!==r)return new In({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new In({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new In({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new In({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return t}class fO{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){const i=new Error("Cancelling existing WebAuthn API call for new one");i.name="AbortError",this.controller.abort(i)}const a=new AbortController;return this.controller=a,a.signal}cancelCeremony(){if(this.controller){const a=new Error("Manually cancelling existing WebAuthn API call");a.name="AbortError",this.controller.abort(a),this.controller=void 0}}}const Q0=new fO,pO=["cross-platform","platform"];function J0(t){if(t&&!(pO.indexOf(t)<0))return t}async function hO(t){!t.optionsJSON&&t.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),t={optionsJSON:t});const{optionsJSON:a,useAutoRegister:i=!1}=t;if(!Md())throw new Error("WebAuthn is not supported in this browser");const r={...a,challenge:md(a.challenge),user:{...a.user,id:md(a.user.id)},excludeCredentials:a.excludeCredentials?.map(X0)},c={};i&&(c.mediation="conditional"),c.publicKey=r,c.signal=Q0.createNewAbortSignal();let f;try{f=await navigator.credentials.create(c)}catch(C){throw dO({error:C,options:c})}if(!f)throw new Error("Registration was not completed");const{id:p,rawId:h,response:v,type:m}=f;let x;typeof v.getTransports=="function"&&(x=v.getTransports());let y;if(typeof v.getPublicKeyAlgorithm=="function")try{y=v.getPublicKeyAlgorithm()}catch(C){_h("getPublicKeyAlgorithm()",C)}let A;if(typeof v.getPublicKey=="function")try{const C=v.getPublicKey();C!==null&&(A=us(C))}catch(C){_h("getPublicKey()",C)}let w;if(typeof v.getAuthenticatorData=="function")try{w=us(v.getAuthenticatorData())}catch(C){_h("getAuthenticatorData()",C)}return{id:p,rawId:us(h),response:{attestationObject:us(v.attestationObject),clientDataJSON:us(v.clientDataJSON),transports:x,publicKeyAlgorithm:y,publicKey:A,authenticatorData:w},type:m,clientExtensionResults:f.getClientExtensionResults(),authenticatorAttachment:J0(f.authenticatorAttachment)}}function _h(t,a){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${t}. You should report this error to them.
|
|
114
|
+
`,a)}function mO(){if(!Md())return vh.stubThis(new Promise(a=>a(!1)));const t=globalThis.PublicKeyCredential;return t?.isConditionalMediationAvailable===void 0?vh.stubThis(new Promise(a=>a(!1))):vh.stubThis(t.isConditionalMediationAvailable())}const vh={stubThis:t=>t};function gO({error:t,options:a}){const{publicKey:i}=a;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(a.signal instanceof AbortSignal)return new In({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new In({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=globalThis.location.hostname;if(P0(r)){if(i.rpId!==r)return new In({message:`The RP ID "${i.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new In({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new In({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return t}async function _O(t){!t.optionsJSON&&t.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),t={optionsJSON:t});const{optionsJSON:a,useBrowserAutofill:i=!1,verifyBrowserAutofillInput:r=!0}=t;if(!Md())throw new Error("WebAuthn is not supported in this browser");let c;a.allowCredentials?.length!==0&&(c=a.allowCredentials?.map(X0));const f={...a,challenge:md(a.challenge),allowCredentials:c},p={};if(i){if(!await mO())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');p.mediation="conditional",f.allowCredentials=[]}p.publicKey=f,p.signal=Q0.createNewAbortSignal();let h;try{h=await navigator.credentials.get(p)}catch(w){throw gO({error:w,options:p})}if(!h)throw new Error("Authentication was not completed");const{id:v,rawId:m,response:x,type:y}=h;let A;return x.userHandle&&(A=us(x.userHandle)),{id:v,rawId:us(m),response:{authenticatorData:us(x.authenticatorData),clientDataJSON:us(x.clientDataJSON),signature:us(x.signature),userHandle:A},type:y,clientExtensionResults:h.getClientExtensionResults(),authenticatorAttachment:J0(h.authenticatorAttachment)}}class Gn extends Error{status;code;constructor(a,i){super(i),this.name="DashboardAuthApiError",this.status=a,this.code=i}}const vO=`{"error":{"code":"not_found"}}
|
|
115
|
+
`,bO="no-store",yO="application/json; charset=utf-8",xO=/^[A-Za-z0-9_-]{43}$/,W0=new WeakSet;function jO(){const t=new Gn(404,"not_found");return W0.add(t),t}async function wO(t,a){try{return(await t.status()).mode}catch(i){if(a&&i instanceof Gn&&W0.has(i))return"bearer";throw i}}function Qo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ej(t,a){if(!t.ok){const i=Qo(a)&&Qo(a.error)&&typeof a.error.code=="string"?a.error.code:"request_failed";throw new Gn(t.status,i)}return a}async function tj(t){let a;try{a=await t.json()}catch{throw new Gn(t.status,"invalid_response")}return ej(t,a)}async function SO(t){if(t.status!==404)return tj(t);let a;try{a=await t.text()}catch{throw new Gn(t.status,"invalid_response")}if(a===vO&&t.headers.get("cache-control")===bO&&t.headers.get("content-type")===yO)throw jO();let i;try{i=JSON.parse(a)}catch{throw new Gn(t.status,"invalid_response")}return ej(t,i)}async function Io(t,a,i){const r=Yh(),c=await fetch(t,{method:"POST",credentials:"same-origin",redirect:"error",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/json",...i==null?{}:{"X-Enrollment-Code":i},...r==null?{}:{[Zu]:r}},body:JSON.stringify(a)});try{return await tj(c)}catch(f){throw f instanceof Gn&&f.status===401&&ps(),f}}function NO(t){if(!Qo(t))throw new Gn(200,"invalid_response");if(Object.keys(t).sort().join("\0")!==["authenticated","enrolled","mode"].sort().join("\0")||typeof t.enrolled!="boolean"||typeof t.authenticated!="boolean"||t.mode!=="passkey"&&t.mode!=="bearer"&&t.mode!=="none")throw new Gn(200,"invalid_response");return t}function Py(t){if(!Qo(t)||typeof t.challenge!="string")throw new Gn(200,"invalid_response");return t}function kO(t){if(!Qo(t))throw ps(),new Gn(200,"invalid_response");const a=Object.keys(t).sort().join("\0");if(Wo()){if(a!==["originProof","verified"].sort().join("\0")||t.verified!==!0||typeof t.originProof!="string"||!xO.test(t.originProof))throw ps(),new Gn(200,"invalid_response");try{eN(t.originProof)}catch{throw ps(),new Gn(200,"invalid_response")}return}if(a!=="verified"||t.verified!==!0)throw new Gn(200,"invalid_response")}function nj(){return{async status(t){try{const a=Yh(),i=await fetch("/api/auth/status",{method:"GET",credentials:"same-origin",redirect:"error",referrerPolicy:"no-referrer",...a==null?{}:{headers:{[Zu]:a}},...t==null?{}:{signal:t}}),r=NO(await SO(i));return r.authenticated||ps(),r}catch(a){throw Wo()&&a instanceof Gn&&ps(),a}},async registrationOptions(t){return Py(await Io("/api/auth/register/options",{},t))},async verifyRegistration(t,a,i){await Io("/api/auth/register/verify",{response:t,...i==null?{}:{label:i}},a)},async authenticationOptions(){return Py(await Io("/api/auth/login/options",{}))},async verifyAuthentication(t){kO(await Io("/api/auth/login/verify",{response:t}))},async logout(){try{await Io("/api/auth/logout",{})}finally{ps()}}}}const AO=/^[A-Za-z0-9_-]{32}$/,RO={supports:Md,register:async t=>hO({optionsJSON:t}),authenticate:async t=>_O({optionsJSON:t})};function bh(t){if(t instanceof Gn){if(t.status===401)return"Authorization was rejected.";if(t.code==="not_enrolled")return"Register a passkey before signing in.";if(t.code==="state_conflict")return"Enrollment changed. Refresh the status and try again."}return t instanceof DOMException&&t.name==="NotAllowedError"?"The passkey request was cancelled or timed out.":"The passkey request could not be completed."}function EO({api:t,webauthn:a,authenticatedContent:i}){const r=b.useMemo(()=>t??nj(),[t]),c=a??RO,[f,p]=b.useState(null),[h,v]=b.useState(""),m=b.useRef(""),x=b.useRef(!0),[y,A]=b.useState(null),[w,C]=b.useState(null);b.useEffect(()=>{x.current=!0,Xu("passkey");const k=new AbortController;r.status(k.signal).then(E=>{k.signal.aborted||p(E)},E=>{k.signal.aborted||C(bh(E))});const q=()=>{p(E=>E==null?E:{...E,authenticated:!1}),C("Your dashboard session expired. Sign in again.")};return window.addEventListener(Sh,q),()=>{x.current=!1,k.abort(),window.removeEventListener(Sh,q),m.current="",v("")}},[r]);const T=k=>{if(y!=null)return;const q=k?void 0:m.current.trim();if(!k&&!AO.test(q??"")){C("Enter the 32-character enrollment code from the launch output.");return}C(null),A("register"),r.registrationOptions(q).then(E=>c.register(E)).then(E=>r.verifyRegistration(E,k?void 0:m.current.trim()||void 0)).then(async()=>{if(m.current="",!x.current)return;v("");const E=await r.status();x.current&&p(E)}).catch(E=>{m.current="",x.current&&(v(""),C(bh(E)))}).finally(()=>{x.current&&A(null)})},N=()=>{y==null&&(C(null),A("login"),(async()=>{const k=await r.authenticationOptions();if(!x.current)return;const q=await c.authenticate(k);if(!x.current||(await r.verifyAuthentication(q),!x.current))return;const E=await r.status();x.current&&p(E)})().catch(k=>{x.current&&C(bh(k))}).finally(()=>{x.current&&A(null)}))},I=()=>{y==null&&(C(null),A("logout"),r.logout().then(async()=>{if(x.current){p(k=>k==null?k:{...k,authenticated:!1});try{const k=await r.status();x.current&&p(k)}catch{x.current&&C("Signed out locally, but authentication status could not be refreshed.")}}}).catch(()=>{x.current&&(p(k=>k==null?k:{...k,authenticated:!1}),C("Sign-out could not be confirmed. You were signed out locally."))}).finally(()=>{x.current&&A(null)}))};if(f===null)return s.jsx("main",{className:"auth-gate",children:s.jsxs("section",{className:"auth-gate__card","aria-live":"polite",children:[s.jsx("h1",{children:"ClinkX field station"}),s.jsx("p",{children:w??"Checking passkey status…"})]})});if(!c.supports())return s.jsx("main",{className:"auth-gate",children:s.jsxs("section",{className:"auth-gate__card",children:[s.jsx("h1",{children:"Passkeys unavailable"}),s.jsx("p",{children:"This browser does not support WebAuthn. Open the dashboard in a supported browser."})]})});if(f.authenticated){const k={error:w,onAddPasskey:()=>T(!0),onSignOut:I,pending:y==="register"||y==="logout"?y:null};return s.jsx("div",{className:"auth-gate__authenticated",children:i?.(k)??s.jsx(Y0,{accountActions:k})})}return s.jsx("main",{className:"auth-gate",children:s.jsxs("section",{className:"auth-gate__card","aria-labelledby":"auth-gate-title",children:[s.jsx("span",{"aria-hidden":"true",className:"auth-gate__mark"}),s.jsx("h1",{id:"auth-gate-title",children:"ClinkX field station"}),f.enrolled?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Use your passkey to open the run monitor."}),s.jsx("button",{type:"button",disabled:y!==null,onClick:N,children:y==="login"?"Waiting for passkey…":"Sign in"})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Register the first passkey with the one-time enrollment code."}),s.jsx("label",{htmlFor:"enrollment-code",children:"Enrollment code"}),s.jsx("input",{id:"enrollment-code",value:h,disabled:y!==null,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,onChange:k=>{m.current=k.target.value,v(k.target.value),w!=null&&C(null)}}),s.jsx("button",{type:"button",disabled:y!==null,onClick:()=>T(!1),children:y==="register"?"Waiting for passkey…":"Register this device"})]}),w==null?null:s.jsx("p",{className:"auth-gate__error",role:"alert",children:w})]})})}const TO=/^[A-Za-z0-9_-]{43}$/;function CO({onSubmit:t}){const[a,i]=b.useState(""),[r,c]=b.useState(null),[f,p]=b.useState(!1),h=b.useId(),v=b.useId(),m=x=>{if(x.preventDefault(),f)return;const y=a.trim();if(!TO.test(y)){c("Enter the 43-character access token from the launch output.");return}c(null),p(!0),t(y).then(A=>{A||(c("That token was rejected. Check the launch output and try again."),p(!1))},()=>{c("Could not reach the dashboard. Is it still running?"),p(!1)})};return s.jsx("main",{className:"login",children:s.jsxs("section",{className:"login__card","aria-labelledby":"login-title",children:[s.jsx("span",{"aria-hidden":"true",className:"login__mark",children:s.jsx("span",{className:"login__mark-dot"})}),s.jsx("h1",{className:"login__title",id:"login-title",children:"ClinkX field station"}),s.jsx("p",{className:"login__lede",children:"Paste the access token printed when the dashboard started to open the run monitor."}),s.jsxs("form",{className:"login__form",onSubmit:m,noValidate:!0,children:[s.jsx("label",{className:"login__label op-caption",htmlFor:h,children:"Access token"}),s.jsx("input",{id:h,className:"login__input",type:"password",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,autoFocus:!0,value:a,disabled:f,"aria-invalid":r!==null,...r===null?{}:{"aria-describedby":v},onChange:x=>{i(x.target.value),r!==null&&c(null)}}),r===null?null:s.jsx("p",{className:"login__error op-caption",id:v,role:"alert",children:r}),s.jsx("button",{className:"login__submit",type:"submit",disabled:f,children:f?"Opening…":"Open dashboard"})]})]})})}function OO(t,a=window.location.origin){return t.mode==="local"&&!t.authenticated&&Wo(a)}const aj=document.getElementById("root");if(!aj)throw new Error("Root element #root not found");const gd=Gw.createRoot(aj),$O=jx(),_d=()=>{gd.render(s.jsx(b.StrictMode,{children:s.jsx(Y0,{})}))},MO=async t=>{if(!oN(t))return!1;try{return(await Ax()).authenticated?(_d(),!0):(kh(),!1)}catch(a){const i=cN();if(kh(),i)throw a;return!1}},yh=()=>{gd.render(s.jsx(b.StrictMode,{children:s.jsx(CO,{onSubmit:MO})}))},xh=()=>OO(rN(),window.location.origin),IO=()=>{if(Xu("bearer"),xh()){yh();return}Ax().then(()=>xh()?yh():_d(),()=>xh()?yh():_d())},Qy=nj();wO(Qy,$O.mode==="remote").then(t=>{if(t==="passkey"){Xu("passkey"),gd.render(s.jsx(b.StrictMode,{children:s.jsx(EO,{api:Qy})}));return}if(t==="none"){Xu("none"),_d();return}IO()},()=>{gd.render(s.jsx(b.StrictMode,{children:s.jsx("main",{className:"auth-gate",children:s.jsxs("section",{className:"auth-gate__card",role:"alert",children:[s.jsx("h1",{children:"ClinkX field station"}),s.jsx("p",{children:"Could not load dashboard authentication status."})]})})}))});
|