@mcpjam/inspector 3.23.0 → 3.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{app-bootstrap-LFJyqXyJ.js → app-bootstrap-CQqrl4C7.js} +261 -261
- package/dist/client/assets/{chunk-D32TOXHM-BUV_xiWV.js → chunk-D32TOXHM-DVfEl7a2.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture-CxJBitTm.js → dead-clicks-autocapture-BMs5s_2R.js} +2 -2
- package/dist/client/assets/{error-reporting-DxIXZRUY.js → error-reporting-CblWFSJy.js} +3 -3
- package/dist/client/assets/{error-reporting-CVi5-krC.js → error-reporting-DOand_j6.js} +1 -1
- package/dist/client/assets/{exception-autocapture-Bg4q4N1V.js → exception-autocapture-CSwGNOGc.js} +2 -2
- package/dist/client/assets/{first-run-oauth-return-DwlOc8tB.js → first-run-oauth-return-BCNTs2GH.js} +2 -2
- package/dist/client/assets/{highlighted-body-KQOG7T2V-C7XGGDHW.js → highlighted-body-KQOG7T2V-CKM1-SzP.js} +2 -2
- package/dist/client/assets/{index-Bg3o2MnW.js → index-BOOlzn8y.js} +3 -3
- package/dist/client/assets/{jszip.min-Bvbvu43m.js → jszip.min-Cip-l759.js} +2 -2
- package/dist/client/assets/{mermaid-MCJ5UELQ-lcpM5A51.js → mermaid-MCJ5UELQ-Bb4-qZ6h.js} +1 -1
- package/dist/client/assets/{posthog-recorder-B6Kr_Wgg.js → posthog-recorder-D19wbsQ5.js} +2 -2
- package/dist/client/assets/{preload-helper-Ck6Mr4it.js → preload-helper-BerMOtKS.js} +2 -2
- package/dist/client/assets/{project-route-Cd8OyMXr.js → project-route-DPRRfvoQ.js} +2 -2
- package/dist/client/assets/{react-dom-SjTQD9U3.js → react-dom-Du9nuv92.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-C03pXr1T.js → rolldown-runtime-Dhvrsp_z.js} +1 -1
- package/dist/client/assets/{surveys-D0hPG0xq.js → surveys-D_UpP5nz.js} +2 -2
- package/dist/client/assets/telemetry-files-f95e29335ba26785.js +1 -0
- package/dist/client/assets/{trace-timeline-boAVWttK.js → trace-timeline-B7Z76l-t.js} +1 -1
- package/dist/client/assets/{trace-timeline-CZ0d0iER.js → trace-timeline-Dy5i1YGh.js} +2 -2
- package/dist/client/assets/{use-reduced-motion-C6Vd_wvn.js → use-reduced-motion-DdBQj6R3.js} +2 -2
- package/dist/client/assets/{web-vitals-BmkdweHF.js → web-vitals-BEx8xJAE.js} +2 -2
- package/dist/client/index.html +8 -8
- package/dist/server/harness-install-cli.js +3 -3
- package/dist/server/index.js +5 -5
- package/package.json +1 -1
- package/dist/client/assets/telemetry-files-0bf75a54db264a5a.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as Ox}from"./rolldown-runtime-C03pXr1T.js";import{At as Cr,Et as vr,It as ge,Pt as pl,Rt as Kh,_t as Dx,bt as Ye,kt as nt,pt as fo,vt as Qt,zt as Eu}from"./project-route-Cd8OyMXr.js";import{Bt as Pn,C as hg,Gt as wE,Ht as $n,Jo as SE,Q as kE,Tt as CE,Ut as AE,Vt as Yl,Wt as TE,X as Nx,Xo as Lx,Yo as _x,qo as EE,rt as fg,t as ME,v as RE,w as PE,wt as IE,zt as Gh}from"./error-reporting-DxIXZRUY.js";import{A as Pt,D as jx,F as as,I as OE,K as pp,M as Q,N as DE,O as NE,P as LE,R as Ce,V as Bx,W as _E,i as jE,k as xe,l as BE,n as FE,q as VE,r as zE,s as Pc,t as $E}from"./use-reduced-motion-C6Vd_wvn.js";import{n as HE,t as WE}from"./react-dom-SjTQD9U3.js";import{i as UE}from"./preload-helper-Ck6Mr4it.js";import{a as qE,c as KE,n as GE,o as QE}from"./chunk-D32TOXHM-BUV_xiWV.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.23.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4ce13e5f-687c-463f-8d2b-5c3da5fea84a",e._sentryDebugIdIdentifier="sentry-dbid-4ce13e5f-687c-463f-8d2b-5c3da5fea84a")}catch{}})();var m=Ox(HE(),1),oa=Ox(WE(),1),g=UE(),YE=Object.defineProperty,XE=(e,t)=>YE(e,"name",{value:t,configurable:!0}),Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=as(`Primitive.${t}`),r=m.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function mp(e,t){e&&oa.flushSync(()=>e.dispatchEvent(t))}XE(mp,"dispatchDiscreteCustomEvent");var JE=Object.defineProperty,ZE=(e,t)=>JE(e,"name",{value:t,configurable:!0}),eM=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tM=m.forwardRef(ZE(function(t,n){return(0,g.jsx)(Le.span,{...t,ref:n,style:{...eM,...t.style}})},"VisuallyHidden")),nM=tM,rM=Object.defineProperty,It=(e,t)=>rM(e,"name",{value:t,configurable:!0});function iM(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=It(s=>{const{children:o,...a}=s,l=m.useMemo(()=>a,Object.values(a));return(0,g.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=m.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return It(i,"useContext"),[r,i]}It(iM,"createContext");function or(e,t=[]){let n=[];function r(s,o){const a=m.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=It(h=>{const{scope:f,children:d,...p}=h,v=f?.[e]?.[l]||a,y=m.useMemo(()=>p,Object.values(p));return(0,g.jsx)(v.Provider,{value:y,children:d})},"Provider");c.displayName=s+"Provider";function u(h,f,d={}){const{optional:p=!1}=d,v=f?.[e]?.[l]||a,y=m.useContext(v);if(y)return y;if(o!==void 0)return o;if(!p)throw new Error(`\`${h}\` must be used within \`${s}\``)}return It(u,"useContext"),[c,u]}It(r,"createContext");const i=It(()=>{const s=n.map(o=>m.createContext(o));return It(function(a){const l=a?.[e]||s;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,Fx(i,...t)]}It(or,"createContextScope");function Fx(...e){const t=e[0];if(e.length===1)return t;const n=It(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return It(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}It(Fx,"composeContextScopes");var sM=Object.defineProperty,Je=(e,t)=>sM(e,"name",{value:t,configurable:!0});function gp(e){const t=e+"CollectionProvider",[n,r]=or(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Je(v=>{const{scope:y,children:x}=v,b=m.useRef(null),w=m.useRef(new Map).current;return(0,g.jsx)(i,{scope:y,itemMap:w,collectionRef:b,children:x})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=as(a),c=m.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),S=Ce(y,w.collectionRef);return(0,g.jsx)(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=as(u),d=m.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=m.useRef(null),C=Ce(y,S),A=s(u,x);return m.useEffect(()=>(A.itemMap.set(S,{ref:S,...w}),()=>{A.itemMap.delete(S)})),(0,g.jsx)(f,{[h]:"",ref:C,children:b})});d.displayName=u;function p(v){const y=s(e+"CollectionConsumer",v);return m.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((w,S)=>b.indexOf(w.ref.current)-b.indexOf(S.ref.current))},[y.collectionRef,y.itemMap])}return Je(p,"useCollection"),[{Provider:o,Slot:c,ItemSlot:d},p,r]}Je(gp,"createCollection");var dg=new WeakMap,Mu=class ur extends Map{static{Je(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],dg.set(this,!0)}set(t,n){return dg.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,n),this}insert(t,n,r){const i=this.has(n),s=this.#e.length,o=vp(t);let a=o>=0?o:s+o;const l=a<0||a>=s?-1:a;if(l===this.size||i&&l===this.size-1||l===-1)return this.set(n,r),this;const c=this.size+(i?0:1);o<0&&a++;const u=[...this.#e];let h,f=!1;for(let d=a;d<c;d++)if(a===d){let p=u[d];u[d]===n&&(p=u[d+1]),i&&this.delete(n),h=this.get(p),this.set(n,r)}else{!f&&u[d-1]===n&&(f=!0);const p=u[f?d:d-1],v=h;h=this.get(p),this.delete(p),this.set(p,v)}return this}with(t,n,r){const i=new ur(this);return i.insert(t,n,r),i}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i,n,r)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i+1,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){const n=super.delete(t);return n&&this.#e.splice(this.#e.indexOf(t),1),n}deleteAt(t){const n=this.keyAt(t);return n!==void 0?this.delete(n):!1}at(t){const n=ml(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=ml(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return ml(this.#e,t)}from(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return i;r++}}findIndex(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return r;r++}return-1}filter(t,n){const r=[];let i=0;for(const s of this)Reflect.apply(t,n,[s,i,this])&&r.push(s),i++;return new ur(r)}map(t,n){const r=[];let i=0;for(const s of this)r.push([s[0],Reflect.apply(t,n,[s,i,this])]),i++;return new ur(r)}reduce(...t){const[n,r]=t;let i=0,s=r??this.at(0);for(const o of this)i===0&&t.length===1?s=o:s=Reflect.apply(n,this,[s,o,i,this]),i++;return s}reduceRight(...t){const[n,r]=t;let i=r??this.at(-1);for(let s=this.size-1;s>=0;s--){const o=this.at(s);s===this.size-1&&t.length===1?i=o:i=Reflect.apply(n,this,[i,o,s,this])}return i}toSorted(t){const n=[...this.entries()].sort(t);return new ur(n)}toReversed(){const t=new ur;for(let n=this.size-1;n>=0;n--){const r=this.keyAt(n),i=this.get(r);t.set(r,i)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new ur(n)}slice(t,n){const r=new ur;let i=this.size-1;if(t===void 0)return r;t<0&&(t=t+this.size),n!==void 0&&n>0&&(i=n-1);for(let s=t;s<=i;s++){const o=this.keyAt(s),a=this.get(o);r.set(o,a)}return r}every(t,n){let r=0;for(const i of this){if(!Reflect.apply(t,n,[i,r,this]))return!1;r++}return!0}some(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return!0;r++}return!1}};function ml(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Vx(e,t);return n===-1?void 0:e[n]}Je(ml,"at");function Vx(e,t){const n=e.length,r=vp(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Je(Vx,"toSafeIndex");function vp(e){return e!==e||e===0?0:Math.trunc(e)}Je(vp,"toSafeInteger");function oM(e){const t=e+"CollectionProvider",[n,r]=or(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Mu,setItemMap:Je(()=>{},"setItemMap")}),o=Je(({state:b,...w})=>b?(0,g.jsx)(l,{...w,state:b}):(0,g.jsx)(a,{...w}),"CollectionProvider");o.displayName=t;const a=Je(b=>{const w=y();return(0,g.jsx)(l,{...b,state:w})},"CollectionInit");a.displayName=t+"Init";const l=Je(b=>{const{scope:w,children:S,state:C}=b,A=m.useRef(null),[k,T]=m.useState(null),E=Ce(A,T),[R,I]=C;return m.useEffect(()=>{if(!k)return;const M=Hx(()=>{});return M.observe(k,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[k]),(0,g.jsx)(i,{scope:w,itemMap:R,setItemMap:I,collectionRef:E,collectionRefObject:A,collectionElement:k,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=as(c),h=m.forwardRef((b,w)=>{const{scope:S,children:C}=b,A=s(c,S),k=Ce(w,A.collectionRef);return(0,g.jsx)(u,{ref:k,children:C})});h.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",p=as(f),v=m.forwardRef((b,w)=>{const{scope:S,children:C,...A}=b,k=m.useRef(null),[T,E]=m.useState(null),R=Ce(w,k,E),{setItemMap:I}=s(f,S),M=m.useRef(A);zx(M.current,A)||(M.current=A);const L=M.current;return m.useEffect(()=>{const N=L;return I(P=>T?P.has(T)?P.set(T,{...N,element:T}).toSorted(Qh):(P.set(T,{...N,element:T}),P.toSorted(Qh)):P),()=>{I(P=>!T||!P.has(T)?P:(P.delete(T),new Mu(P)))}},[T,L,I]),(0,g.jsx)(p,{[d]:"",ref:R,children:C})});v.displayName=f;function y(){return m.useState(new Mu)}Je(y,"useInitCollection");function x(b){const{itemMap:w}=s(e+"CollectionConsumer",b);return w}return Je(x,"useCollection"),[{Provider:o,Slot:h,ItemSlot:v},{createCollectionScope:r,useCollection:x,useInitCollection:y}]}Je(oM,"createCollection");function zx(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}Je(zx,"shallowEqual");function $x(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Je($x,"isElementPreceding");function Qh(e,t){return!e[1].element||!t[1].element?0:$x(e[1].element,t[1].element)?-1:1}Je(Qh,"sortByDocumentPosition");function Hx(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Je(Hx,"getChildListObserver");var aM=Object.defineProperty,Ts=(e,t)=>aM(e,"name",{value:t,configurable:!0}),Wx=!!(typeof window<"u"&&window.document&&window.document.createElement);function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return Ts(function(i){if(e?.(i),n===!1||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}Ts(ne,"composeEventHandlers");function lM(e){if(!Wx)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ts(lM,"getOwnerWindow");function Yh(e){if(!Wx)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ts(Yh,"getOwnerDocument");function Ux(e,t=!1){const{activeElement:n}=Yh(e);if(!n?.nodeName)return null;if(qx(n)&&n.contentDocument)return Ux(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=Yh(n).getElementById(r);if(i)return i}}return n}Ts(Ux,"getActiveElement");function qx(e){return e.tagName==="IFRAME"}Ts(qx,"isFrame");var Et=globalThis?.document?m.useLayoutEffect:()=>{},cM=Object.defineProperty,uM=(e,t)=>cM(e,"name",{value:t,configurable:!0}),pg=m[" useEffectEvent ".trim().toString()],mg=m[" useInsertionEffect ".trim().toString()];function Kx(e){if(typeof pg=="function")return pg(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof mg=="function"?mg(()=>{t.current=e}):Et(()=>{t.current=e}),m.useMemo(()=>((...n)=>t.current?.(...n)),[])}uM(Kx,"useEffectEvent");var hM=Object.defineProperty,aa=(e,t)=>hM(e,"name",{value:t,configurable:!0}),fM=m[" useInsertionEffect ".trim().toString()]||Et;function la({prop:e,defaultProp:t,onChange:n=aa(()=>{},"onChange"),caller:r}){const[i,s,o]=Gx({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:i,m.useCallback(c=>{if(a){const u=Qx(c)?c(e):c;u!==e&&o.current?.(u)}else s(c)},[a,e,s,o])]}aa(la,"useControllableState");function Gx({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),s=m.useRef(t);return fM(()=>{s.current=t},[t]),m.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}aa(Gx,"useUncontrolledState");function Qx(e){return typeof e=="function"}aa(Qx,"isFunction");var gg=Symbol("RADIX:SYNC_STATE");function dM(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=Kx(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=m.useReducer((y,x)=>{if(x.type===gg)return{...y,state:x.state};const b=e(y,x);return l&&!Object.is(b.state,y.state)&&c(b.state),b},...u),d=h.state,p=m.useRef(d);m.useEffect(()=>{p.current!==d&&(p.current=d,l||c(d))},[d,p,l]);const v=m.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return m.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:gg,state:i})},[i,h.state,l]),[v,f]}aa(dM,"useControllableStateReducer");var pM=Object.defineProperty,nr=(e,t)=>pM(e,"name",{value:t,configurable:!0});function Yx(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}nr(Yx,"useStateMachine");var Nn=nr(e=>{const{present:t,children:n}=e,r=Xx(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=Jx(r.ref,Zx(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:s}):null},"Presence");function Xx(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),s=m.useRef("none"),o=m.useRef(void 0),[a,l]=Yx(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{a==="mounted"?(s.current=o.current??Ni(r.current),o.current=void 0):s.current="none"},[a]),Et(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=Ni(c);e?(o.current=f,l("MOUNT")):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Et(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,h=nr(d=>{const p=Ni(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&p&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},"handleAnimationEnd"),f=nr(d=>{d.target===t&&(s.current=Ni(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=Ni(u)}else r.current=null;n(c)},[])}}nr(Xx,"usePresence");function Xh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}nr(Xh,"setRef");function Jx(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=Xh(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():Xh(r[o],null)}}},[])}nr(Jx,"useStableComposedRefs");function Ni(e){return e?.animationName||"none"}nr(Ni,"getAnimationName");function Zx(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}nr(Zx,"getElementRef");var mM=Object.defineProperty,gM=(e,t)=>mM(e,"name",{value:t,configurable:!0}),vM=m[" useId ".trim().toString()]||(()=>{}),yM=0;function ci(e){const[t,n]=m.useState(vM());return Et(()=>{e||n(r=>r??String(yM++))},[e]),e||(t?`radix-${t}`:"")}gM(ci,"useId");var xM=Object.defineProperty,bM=(e,t)=>xM(e,"name",{value:t,configurable:!0}),wM=m.createContext(void 0);function Ic(e){const t=m.useContext(wM);return e||t||"ltr"}bM(Ic,"useDirection");var SM=Object.defineProperty,kM=(e,t)=>SM(e,"name",{value:t,configurable:!0});function et(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>((...n)=>t.current?.(...n)),[])}kM(et,"useCallbackRef");var CM=Object.defineProperty,Xe=(e,t)=>CM(e,"name",{value:t,configurable:!0}),Jh="dismissableLayer.update",AM="dismissableLayer.pointerDownOutside",TM="dismissableLayer.focusOutside",vg,eb=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),tb=m.forwardRef(Xe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=m.useContext(eb),[f,d]=m.useState(null),p=f?.ownerDocument??globalThis?.document,[,v]=m.useState({}),y=Ce(n,d),x=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),w=b?x.indexOf(b):-1,S=f?x.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,A=S>=w,k=m.useRef(!1),T=nb(M=>{o?.(M),l?.(M),M.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(M=>{if(!(M instanceof Node))return!1;const L=[...h.branches].some(N=>N.contains(M));return A&&!L},[h.branches,A])}),E=rb(M=>{if(i&&k.current)return;const L=M.target;[...h.branches].some(N=>N.contains(L))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},p),R=f?S===x.length-1:!1,I=et(M=>{M.key==="Escape"&&(s?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return m.useEffect(()=>{if(R)return p.addEventListener("keydown",I,{capture:!0}),()=>p.removeEventListener("keydown",I,{capture:!0})},[p,R,I]),m.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(vg=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Zh(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=vg))}},[f,p,r,h]),m.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Zh())},[f,h]),m.useEffect(()=>{const M=Xe(()=>v({}),"handleUpdate");return document.addEventListener(Jh,M),()=>document.removeEventListener(Jh,M)},[]),(0,g.jsx)(Le.div,{...u,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:ne(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ne(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ne(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function EM(){const e=m.useContext(eb),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Xe(EM,"useDismissableLayerSurface");var MM=Xe(()=>!0,"IS_TRUE");function nb(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=MM}=t,a=et(e),l=m.useRef(!1),c=m.useRef(!1),u=m.useRef(new Map),h=m.useRef(()=>{});return m.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}Xe(f,"resetOutsideInteraction");function d(){return Array.from(u.current.values()).some(Boolean)}Xe(d,"isOutsideInteractionIntercepted");function p(w){if(!c.current)return;const S=w.target;S instanceof Node&&[...s].some(C=>C.contains(S))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}Xe(p,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}Xe(v,"handleInteractionBubble");const y=Xe(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const A=d();f(),A||yp(AM,a,C,{discrete:!0})};if(Xe(S,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const C={originalEvent:w};c.current=!0,i.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?S():(n.removeEventListener("click",h.current),h.current=S,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},"handlePointerDown"),x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,p,!0),n.addEventListener(w,v);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",y),n.removeEventListener("click",h.current);for(const w of x)n.removeEventListener(w,p,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:Xe(()=>l.current=!0,"onPointerDownCapture")}}Xe(nb,"usePointerDownOutside");function rb(e,t=globalThis?.document){const n=et(e),r=m.useRef(!1);return m.useEffect(()=>{const i=Xe(s=>{s.target&&!r.current&&yp(TM,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Xe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Xe(()=>r.current=!1,"onBlurCapture")}}Xe(rb,"useFocusOutside");function Zh(){const e=new CustomEvent(Jh);document.dispatchEvent(e)}Xe(Zh,"dispatchUpdate");function yp(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?mp(i,s):i.dispatchEvent(s)}Xe(yp,"handleAndDispatchCustomEvent");var RM=Object.defineProperty,ft=(e,t)=>RM(e,"name",{value:t,configurable:!0}),Ru="focusScope.autoFocusOnMount",Pu="focusScope.autoFocusOnUnmount",yg={bubbles:!1,cancelable:!0},PM=m.forwardRef(ft(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=m.useState(null),u=et(s),h=et(o),f=m.useRef(null),d=Ce(n,c),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(i){let y=function(S){if(p.paused||!l)return;const C=S.target;l.contains(C)?f.current=C:zn(f.current,{select:!0})},x=function(S){if(p.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||zn(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&zn(l)};ft(y,"handleFocusIn"),ft(x,"handleFocusOut"),ft(b,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),w.disconnect()}}},[i,l,p.paused]),m.useEffect(()=>{if(l){xg.add(p);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(Ru,yg);l.addEventListener(Ru,u),l.dispatchEvent(x),x.defaultPrevented||(ib(cb(xp(l)),{select:!0}),document.activeElement===y&&zn(l))}return()=>{l.removeEventListener(Ru,u),setTimeout(()=>{const x=new CustomEvent(Pu,yg);l.addEventListener(Pu,h),l.dispatchEvent(x),x.defaultPrevented||zn(y??document.body,{select:!0}),l.removeEventListener(Pu,h),xg.remove(p)},0)}}},[l,u,h,p]);const v=m.useCallback(y=>{if(!r&&!i||p.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,b=document.activeElement;if(x&&b){const w=y.currentTarget,[S,C]=sb(w);S&&C?!y.shiftKey&&b===C?(y.preventDefault(),r&&zn(S,{select:!0})):y.shiftKey&&b===S&&(y.preventDefault(),r&&zn(C,{select:!0})):b===w&&y.preventDefault()}},[r,i,p.paused]);return(0,g.jsx)(Le.div,{tabIndex:-1,...a,ref:d,onKeyDown:v})},"FocusScope"));function ib(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(zn(r,{select:t}),document.activeElement!==n)return}ft(ib,"focusFirst");function sb(e){const t=xp(e);return[ef(t,e),ef(t.reverse(),e)]}ft(sb,"getTabbableEdges");function xp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ft(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ft(xp,"getTabbableCandidates");function ef(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ob(r,{upTo:t})))return r}ft(ef,"findVisible");function ob(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}ft(ob,"isHidden");function ab(e){return e instanceof HTMLInputElement&&"select"in e}ft(ab,"isSelectableInput");function zn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ab(e)&&t&&e.select()}}ft(zn,"focus");var xg=lb();function lb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=tf(e,t),e.unshift(t)},remove(t){e=tf(e,t),e[0]?.resume()}}}ft(lb,"createFocusScopesStack");function tf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ft(tf,"arrayRemove");function cb(e){return e.filter(t=>t.tagName!=="A")}ft(cb,"removeLinks");var IM=Object.defineProperty,OM=(e,t)=>IM(e,"name",{value:t,configurable:!0}),ub=m.forwardRef(OM(function(t,n){const{container:r,...i}=t,[s,o]=m.useState(!1);Et(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?oa.createPortal((0,g.jsx)(Le.div,{...i,ref:n}),a):null},"Portal")),DM=Object.defineProperty,bp=(e,t)=>DM(e,"name",{value:t,configurable:!0}),Ia=0,Ci=null;function NM(e){return wp(),e.children}bp(NM,"FocusGuards");function wp(){m.useEffect(()=>{Ci||(Ci={start:nf(),end:nf()});const{start:e,end:t}=Ci;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ia++,()=>{Ia===1&&(Ci?.start.remove(),Ci?.end.remove(),Ci=null),Ia=Math.max(0,Ia-1)}},[])}bp(wp,"useFocusGuards");function nf(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}bp(nf,"createFocusGuard");var Sn=function(){return Sn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Sn.apply(this,arguments)};function hb(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function LM(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var gl="right-scroll-bar-position",vl="width-before-scroll-bar",_M="with-scroll-bars-hidden",jM="--removed-body-scroll-bar-size";function Iu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function BM(e,t){var n=(0,m.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var FM=typeof window<"u"?m.useLayoutEffect:m.useEffect,bg=new WeakMap;function VM(e,t){var n=BM(t||null,function(r){return e.forEach(function(i){return Iu(i,r)})});return FM(function(){var r=bg.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Iu(a,null)}),s.forEach(function(a){i.has(a)||Iu(a,o)})}bg.set(n,e)},[e]),n}function zM(e){return e}function $M(e,t){t===void 0&&(t=zM);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(o){return o!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var o=n;n=[],o.forEach(i),s=n}var a=function(){var c=s;s=[],c.forEach(i)},l=function(){return Promise.resolve().then(a)};l(),n={push:function(c){s.push(c),l()},filter:function(c){return s=s.filter(c),n}}}}}function HM(e){e===void 0&&(e={});var t=$M(null);return t.options=Sn({async:!0,ssr:!1},e),t}var fb=function(e){var t=e.sideCar,n=hb(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Sn({},n))};fb.isSideCarExport=!0;function WM(e,t){return e.useMedium(t),fb}var db=HM(),Ou=function(){},Oc=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Ou,onWheelCapture:Ou,onTouchMoveCapture:Ou}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,h=e.shards,f=e.sideCar,d=e.noRelative,p=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=hb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,A=VM([n,t]),k=Sn(Sn({},S),i);return m.createElement(m.Fragment,null,u&&m.createElement(C,{sideCar:db,removeScrollBar:c,shards:h,noRelative:d,noIsolation:p,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?m.cloneElement(m.Children.only(a),Sn(Sn({},k),{ref:A})):m.createElement(b,Sn({},k,{className:l,ref:A}),a))});Oc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Oc.classNames={fullWidth:vl,zeroRight:gl};var wg,UM=function(){if(wg)return wg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qM(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=UM();return t&&e.setAttribute("nonce",t),e}function KM(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function GM(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var QM=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qM())&&(KM(t,n),GM(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},YM=function(){var e=QM();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pb=function(){var e=YM(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},XM={left:0,top:0,right:0,gap:0},Du=function(e){return parseInt(e||"",10)||0},JM=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Du(n),Du(r),Du(i)]},ZM=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return XM;var t=JM(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},eR=pb(),po="data-scroll-locked",tR=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
1
|
+
import{o as Ox}from"./rolldown-runtime-Dhvrsp_z.js";import{At as Cr,Et as vr,It as ge,Pt as pl,Rt as Kh,_t as Dx,bt as Ye,kt as nt,pt as fo,vt as Qt,zt as Eu}from"./project-route-DPRRfvoQ.js";import{Bt as Pn,C as hg,Gt as wE,Ht as $n,Jo as SE,Q as kE,Tt as CE,Ut as AE,Vt as Yl,Wt as TE,X as Nx,Xo as Lx,Yo as _x,qo as EE,rt as fg,t as ME,v as RE,w as PE,wt as IE,zt as Gh}from"./error-reporting-CblWFSJy.js";import{A as Pt,D as jx,F as as,I as OE,K as pp,M as Q,N as DE,O as NE,P as LE,R as Ce,V as Bx,W as _E,i as jE,k as xe,l as BE,n as FE,q as VE,r as zE,s as Pc,t as $E}from"./use-reduced-motion-DdBQj6R3.js";import{n as HE,t as WE}from"./react-dom-Du9nuv92.js";import{i as UE}from"./preload-helper-BerMOtKS.js";import{a as qE,c as KE,n as GE,o as QE}from"./chunk-D32TOXHM-DVfEl7a2.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.23.1"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4ce13e5f-687c-463f-8d2b-5c3da5fea84a",e._sentryDebugIdIdentifier="sentry-dbid-4ce13e5f-687c-463f-8d2b-5c3da5fea84a")}catch{}})();var m=Ox(HE(),1),oa=Ox(WE(),1),g=UE(),YE=Object.defineProperty,XE=(e,t)=>YE(e,"name",{value:t,configurable:!0}),Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=as(`Primitive.${t}`),r=m.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,g.jsx)(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function mp(e,t){e&&oa.flushSync(()=>e.dispatchEvent(t))}XE(mp,"dispatchDiscreteCustomEvent");var JE=Object.defineProperty,ZE=(e,t)=>JE(e,"name",{value:t,configurable:!0}),eM=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tM=m.forwardRef(ZE(function(t,n){return(0,g.jsx)(Le.span,{...t,ref:n,style:{...eM,...t.style}})},"VisuallyHidden")),nM=tM,rM=Object.defineProperty,It=(e,t)=>rM(e,"name",{value:t,configurable:!0});function iM(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=It(s=>{const{children:o,...a}=s,l=m.useMemo(()=>a,Object.values(a));return(0,g.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=m.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return It(i,"useContext"),[r,i]}It(iM,"createContext");function or(e,t=[]){let n=[];function r(s,o){const a=m.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=It(h=>{const{scope:f,children:d,...p}=h,v=f?.[e]?.[l]||a,y=m.useMemo(()=>p,Object.values(p));return(0,g.jsx)(v.Provider,{value:y,children:d})},"Provider");c.displayName=s+"Provider";function u(h,f,d={}){const{optional:p=!1}=d,v=f?.[e]?.[l]||a,y=m.useContext(v);if(y)return y;if(o!==void 0)return o;if(!p)throw new Error(`\`${h}\` must be used within \`${s}\``)}return It(u,"useContext"),[c,u]}It(r,"createContext");const i=It(()=>{const s=n.map(o=>m.createContext(o));return It(function(a){const l=a?.[e]||s;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,Fx(i,...t)]}It(or,"createContextScope");function Fx(...e){const t=e[0];if(e.length===1)return t;const n=It(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return It(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}It(Fx,"composeContextScopes");var sM=Object.defineProperty,Je=(e,t)=>sM(e,"name",{value:t,configurable:!0});function gp(e){const t=e+"CollectionProvider",[n,r]=or(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Je(v=>{const{scope:y,children:x}=v,b=m.useRef(null),w=m.useRef(new Map).current;return(0,g.jsx)(i,{scope:y,itemMap:w,collectionRef:b,children:x})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=as(a),c=m.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),S=Ce(y,w.collectionRef);return(0,g.jsx)(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=as(u),d=m.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=m.useRef(null),C=Ce(y,S),A=s(u,x);return m.useEffect(()=>(A.itemMap.set(S,{ref:S,...w}),()=>{A.itemMap.delete(S)})),(0,g.jsx)(f,{[h]:"",ref:C,children:b})});d.displayName=u;function p(v){const y=s(e+"CollectionConsumer",v);return m.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((w,S)=>b.indexOf(w.ref.current)-b.indexOf(S.ref.current))},[y.collectionRef,y.itemMap])}return Je(p,"useCollection"),[{Provider:o,Slot:c,ItemSlot:d},p,r]}Je(gp,"createCollection");var dg=new WeakMap,Mu=class ur extends Map{static{Je(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],dg.set(this,!0)}set(t,n){return dg.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,n),this}insert(t,n,r){const i=this.has(n),s=this.#e.length,o=vp(t);let a=o>=0?o:s+o;const l=a<0||a>=s?-1:a;if(l===this.size||i&&l===this.size-1||l===-1)return this.set(n,r),this;const c=this.size+(i?0:1);o<0&&a++;const u=[...this.#e];let h,f=!1;for(let d=a;d<c;d++)if(a===d){let p=u[d];u[d]===n&&(p=u[d+1]),i&&this.delete(n),h=this.get(p),this.set(n,r)}else{!f&&u[d-1]===n&&(f=!0);const p=u[f?d:d-1],v=h;h=this.get(p),this.delete(p),this.set(p,v)}return this}with(t,n,r){const i=new ur(this);return i.insert(t,n,r),i}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i,n,r)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i+1,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){const n=super.delete(t);return n&&this.#e.splice(this.#e.indexOf(t),1),n}deleteAt(t){const n=this.keyAt(t);return n!==void 0?this.delete(n):!1}at(t){const n=ml(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=ml(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return ml(this.#e,t)}from(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return i;r++}}findIndex(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return r;r++}return-1}filter(t,n){const r=[];let i=0;for(const s of this)Reflect.apply(t,n,[s,i,this])&&r.push(s),i++;return new ur(r)}map(t,n){const r=[];let i=0;for(const s of this)r.push([s[0],Reflect.apply(t,n,[s,i,this])]),i++;return new ur(r)}reduce(...t){const[n,r]=t;let i=0,s=r??this.at(0);for(const o of this)i===0&&t.length===1?s=o:s=Reflect.apply(n,this,[s,o,i,this]),i++;return s}reduceRight(...t){const[n,r]=t;let i=r??this.at(-1);for(let s=this.size-1;s>=0;s--){const o=this.at(s);s===this.size-1&&t.length===1?i=o:i=Reflect.apply(n,this,[i,o,s,this])}return i}toSorted(t){const n=[...this.entries()].sort(t);return new ur(n)}toReversed(){const t=new ur;for(let n=this.size-1;n>=0;n--){const r=this.keyAt(n),i=this.get(r);t.set(r,i)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new ur(n)}slice(t,n){const r=new ur;let i=this.size-1;if(t===void 0)return r;t<0&&(t=t+this.size),n!==void 0&&n>0&&(i=n-1);for(let s=t;s<=i;s++){const o=this.keyAt(s),a=this.get(o);r.set(o,a)}return r}every(t,n){let r=0;for(const i of this){if(!Reflect.apply(t,n,[i,r,this]))return!1;r++}return!0}some(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return!0;r++}return!1}};function ml(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Vx(e,t);return n===-1?void 0:e[n]}Je(ml,"at");function Vx(e,t){const n=e.length,r=vp(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Je(Vx,"toSafeIndex");function vp(e){return e!==e||e===0?0:Math.trunc(e)}Je(vp,"toSafeInteger");function oM(e){const t=e+"CollectionProvider",[n,r]=or(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Mu,setItemMap:Je(()=>{},"setItemMap")}),o=Je(({state:b,...w})=>b?(0,g.jsx)(l,{...w,state:b}):(0,g.jsx)(a,{...w}),"CollectionProvider");o.displayName=t;const a=Je(b=>{const w=y();return(0,g.jsx)(l,{...b,state:w})},"CollectionInit");a.displayName=t+"Init";const l=Je(b=>{const{scope:w,children:S,state:C}=b,A=m.useRef(null),[k,T]=m.useState(null),E=Ce(A,T),[R,I]=C;return m.useEffect(()=>{if(!k)return;const M=Hx(()=>{});return M.observe(k,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[k]),(0,g.jsx)(i,{scope:w,itemMap:R,setItemMap:I,collectionRef:E,collectionRefObject:A,collectionElement:k,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=as(c),h=m.forwardRef((b,w)=>{const{scope:S,children:C}=b,A=s(c,S),k=Ce(w,A.collectionRef);return(0,g.jsx)(u,{ref:k,children:C})});h.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",p=as(f),v=m.forwardRef((b,w)=>{const{scope:S,children:C,...A}=b,k=m.useRef(null),[T,E]=m.useState(null),R=Ce(w,k,E),{setItemMap:I}=s(f,S),M=m.useRef(A);zx(M.current,A)||(M.current=A);const L=M.current;return m.useEffect(()=>{const N=L;return I(P=>T?P.has(T)?P.set(T,{...N,element:T}).toSorted(Qh):(P.set(T,{...N,element:T}),P.toSorted(Qh)):P),()=>{I(P=>!T||!P.has(T)?P:(P.delete(T),new Mu(P)))}},[T,L,I]),(0,g.jsx)(p,{[d]:"",ref:R,children:C})});v.displayName=f;function y(){return m.useState(new Mu)}Je(y,"useInitCollection");function x(b){const{itemMap:w}=s(e+"CollectionConsumer",b);return w}return Je(x,"useCollection"),[{Provider:o,Slot:h,ItemSlot:v},{createCollectionScope:r,useCollection:x,useInitCollection:y}]}Je(oM,"createCollection");function zx(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}Je(zx,"shallowEqual");function $x(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Je($x,"isElementPreceding");function Qh(e,t){return!e[1].element||!t[1].element?0:$x(e[1].element,t[1].element)?-1:1}Je(Qh,"sortByDocumentPosition");function Hx(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Je(Hx,"getChildListObserver");var aM=Object.defineProperty,Ts=(e,t)=>aM(e,"name",{value:t,configurable:!0}),Wx=!!(typeof window<"u"&&window.document&&window.document.createElement);function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return Ts(function(i){if(e?.(i),n===!1||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}Ts(ne,"composeEventHandlers");function lM(e){if(!Wx)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ts(lM,"getOwnerWindow");function Yh(e){if(!Wx)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ts(Yh,"getOwnerDocument");function Ux(e,t=!1){const{activeElement:n}=Yh(e);if(!n?.nodeName)return null;if(qx(n)&&n.contentDocument)return Ux(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=Yh(n).getElementById(r);if(i)return i}}return n}Ts(Ux,"getActiveElement");function qx(e){return e.tagName==="IFRAME"}Ts(qx,"isFrame");var Et=globalThis?.document?m.useLayoutEffect:()=>{},cM=Object.defineProperty,uM=(e,t)=>cM(e,"name",{value:t,configurable:!0}),pg=m[" useEffectEvent ".trim().toString()],mg=m[" useInsertionEffect ".trim().toString()];function Kx(e){if(typeof pg=="function")return pg(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof mg=="function"?mg(()=>{t.current=e}):Et(()=>{t.current=e}),m.useMemo(()=>((...n)=>t.current?.(...n)),[])}uM(Kx,"useEffectEvent");var hM=Object.defineProperty,aa=(e,t)=>hM(e,"name",{value:t,configurable:!0}),fM=m[" useInsertionEffect ".trim().toString()]||Et;function la({prop:e,defaultProp:t,onChange:n=aa(()=>{},"onChange"),caller:r}){const[i,s,o]=Gx({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:i,m.useCallback(c=>{if(a){const u=Qx(c)?c(e):c;u!==e&&o.current?.(u)}else s(c)},[a,e,s,o])]}aa(la,"useControllableState");function Gx({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),s=m.useRef(t);return fM(()=>{s.current=t},[t]),m.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}aa(Gx,"useUncontrolledState");function Qx(e){return typeof e=="function"}aa(Qx,"isFunction");var gg=Symbol("RADIX:SYNC_STATE");function dM(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=Kx(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=m.useReducer((y,x)=>{if(x.type===gg)return{...y,state:x.state};const b=e(y,x);return l&&!Object.is(b.state,y.state)&&c(b.state),b},...u),d=h.state,p=m.useRef(d);m.useEffect(()=>{p.current!==d&&(p.current=d,l||c(d))},[d,p,l]);const v=m.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return m.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:gg,state:i})},[i,h.state,l]),[v,f]}aa(dM,"useControllableStateReducer");var pM=Object.defineProperty,nr=(e,t)=>pM(e,"name",{value:t,configurable:!0});function Yx(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}nr(Yx,"useStateMachine");var Nn=nr(e=>{const{present:t,children:n}=e,r=Xx(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=Jx(r.ref,Zx(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:s}):null},"Presence");function Xx(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),s=m.useRef("none"),o=m.useRef(void 0),[a,l]=Yx(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{a==="mounted"?(s.current=o.current??Ni(r.current),o.current=void 0):s.current="none"},[a]),Et(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=Ni(c);e?(o.current=f,l("MOUNT")):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Et(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,h=nr(d=>{const p=Ni(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&p&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},"handleAnimationEnd"),f=nr(d=>{d.target===t&&(s.current=Ni(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=Ni(u)}else r.current=null;n(c)},[])}}nr(Xx,"usePresence");function Xh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}nr(Xh,"setRef");function Jx(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=Xh(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():Xh(r[o],null)}}},[])}nr(Jx,"useStableComposedRefs");function Ni(e){return e?.animationName||"none"}nr(Ni,"getAnimationName");function Zx(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}nr(Zx,"getElementRef");var mM=Object.defineProperty,gM=(e,t)=>mM(e,"name",{value:t,configurable:!0}),vM=m[" useId ".trim().toString()]||(()=>{}),yM=0;function ci(e){const[t,n]=m.useState(vM());return Et(()=>{e||n(r=>r??String(yM++))},[e]),e||(t?`radix-${t}`:"")}gM(ci,"useId");var xM=Object.defineProperty,bM=(e,t)=>xM(e,"name",{value:t,configurable:!0}),wM=m.createContext(void 0);function Ic(e){const t=m.useContext(wM);return e||t||"ltr"}bM(Ic,"useDirection");var SM=Object.defineProperty,kM=(e,t)=>SM(e,"name",{value:t,configurable:!0});function et(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>((...n)=>t.current?.(...n)),[])}kM(et,"useCallbackRef");var CM=Object.defineProperty,Xe=(e,t)=>CM(e,"name",{value:t,configurable:!0}),Jh="dismissableLayer.update",AM="dismissableLayer.pointerDownOutside",TM="dismissableLayer.focusOutside",vg,eb=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),tb=m.forwardRef(Xe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=m.useContext(eb),[f,d]=m.useState(null),p=f?.ownerDocument??globalThis?.document,[,v]=m.useState({}),y=Ce(n,d),x=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),w=b?x.indexOf(b):-1,S=f?x.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,A=S>=w,k=m.useRef(!1),T=nb(M=>{o?.(M),l?.(M),M.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(M=>{if(!(M instanceof Node))return!1;const L=[...h.branches].some(N=>N.contains(M));return A&&!L},[h.branches,A])}),E=rb(M=>{if(i&&k.current)return;const L=M.target;[...h.branches].some(N=>N.contains(L))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},p),R=f?S===x.length-1:!1,I=et(M=>{M.key==="Escape"&&(s?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return m.useEffect(()=>{if(R)return p.addEventListener("keydown",I,{capture:!0}),()=>p.removeEventListener("keydown",I,{capture:!0})},[p,R,I]),m.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(vg=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),Zh(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=vg))}},[f,p,r,h]),m.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),Zh())},[f,h]),m.useEffect(()=>{const M=Xe(()=>v({}),"handleUpdate");return document.addEventListener(Jh,M),()=>document.removeEventListener(Jh,M)},[]),(0,g.jsx)(Le.div,{...u,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:ne(t.onFocusCapture,E.onFocusCapture),onBlurCapture:ne(t.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ne(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function EM(){const e=m.useContext(eb),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Xe(EM,"useDismissableLayerSurface");var MM=Xe(()=>!0,"IS_TRUE");function nb(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=MM}=t,a=et(e),l=m.useRef(!1),c=m.useRef(!1),u=m.useRef(new Map),h=m.useRef(()=>{});return m.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}Xe(f,"resetOutsideInteraction");function d(){return Array.from(u.current.values()).some(Boolean)}Xe(d,"isOutsideInteractionIntercepted");function p(w){if(!c.current)return;const S=w.target;S instanceof Node&&[...s].some(C=>C.contains(S))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}Xe(p,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}Xe(v,"handleInteractionBubble");const y=Xe(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const A=d();f(),A||yp(AM,a,C,{discrete:!0})};if(Xe(S,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const C={originalEvent:w};c.current=!0,i.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?S():(n.removeEventListener("click",h.current),h.current=S,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},"handlePointerDown"),x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,p,!0),n.addEventListener(w,v);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",y),n.removeEventListener("click",h.current);for(const w of x)n.removeEventListener(w,p,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:Xe(()=>l.current=!0,"onPointerDownCapture")}}Xe(nb,"usePointerDownOutside");function rb(e,t=globalThis?.document){const n=et(e),r=m.useRef(!1);return m.useEffect(()=>{const i=Xe(s=>{s.target&&!r.current&&yp(TM,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Xe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Xe(()=>r.current=!1,"onBlurCapture")}}Xe(rb,"useFocusOutside");function Zh(){const e=new CustomEvent(Jh);document.dispatchEvent(e)}Xe(Zh,"dispatchUpdate");function yp(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?mp(i,s):i.dispatchEvent(s)}Xe(yp,"handleAndDispatchCustomEvent");var RM=Object.defineProperty,ft=(e,t)=>RM(e,"name",{value:t,configurable:!0}),Ru="focusScope.autoFocusOnMount",Pu="focusScope.autoFocusOnUnmount",yg={bubbles:!1,cancelable:!0},PM=m.forwardRef(ft(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=m.useState(null),u=et(s),h=et(o),f=m.useRef(null),d=Ce(n,c),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(i){let y=function(S){if(p.paused||!l)return;const C=S.target;l.contains(C)?f.current=C:zn(f.current,{select:!0})},x=function(S){if(p.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||zn(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&zn(l)};ft(y,"handleFocusIn"),ft(x,"handleFocusOut"),ft(b,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),w.disconnect()}}},[i,l,p.paused]),m.useEffect(()=>{if(l){xg.add(p);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(Ru,yg);l.addEventListener(Ru,u),l.dispatchEvent(x),x.defaultPrevented||(ib(cb(xp(l)),{select:!0}),document.activeElement===y&&zn(l))}return()=>{l.removeEventListener(Ru,u),setTimeout(()=>{const x=new CustomEvent(Pu,yg);l.addEventListener(Pu,h),l.dispatchEvent(x),x.defaultPrevented||zn(y??document.body,{select:!0}),l.removeEventListener(Pu,h),xg.remove(p)},0)}}},[l,u,h,p]);const v=m.useCallback(y=>{if(!r&&!i||p.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,b=document.activeElement;if(x&&b){const w=y.currentTarget,[S,C]=sb(w);S&&C?!y.shiftKey&&b===C?(y.preventDefault(),r&&zn(S,{select:!0})):y.shiftKey&&b===S&&(y.preventDefault(),r&&zn(C,{select:!0})):b===w&&y.preventDefault()}},[r,i,p.paused]);return(0,g.jsx)(Le.div,{tabIndex:-1,...a,ref:d,onKeyDown:v})},"FocusScope"));function ib(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(zn(r,{select:t}),document.activeElement!==n)return}ft(ib,"focusFirst");function sb(e){const t=xp(e);return[ef(t,e),ef(t.reverse(),e)]}ft(sb,"getTabbableEdges");function xp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ft(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ft(xp,"getTabbableCandidates");function ef(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ob(r,{upTo:t})))return r}ft(ef,"findVisible");function ob(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}ft(ob,"isHidden");function ab(e){return e instanceof HTMLInputElement&&"select"in e}ft(ab,"isSelectableInput");function zn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ab(e)&&t&&e.select()}}ft(zn,"focus");var xg=lb();function lb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=tf(e,t),e.unshift(t)},remove(t){e=tf(e,t),e[0]?.resume()}}}ft(lb,"createFocusScopesStack");function tf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ft(tf,"arrayRemove");function cb(e){return e.filter(t=>t.tagName!=="A")}ft(cb,"removeLinks");var IM=Object.defineProperty,OM=(e,t)=>IM(e,"name",{value:t,configurable:!0}),ub=m.forwardRef(OM(function(t,n){const{container:r,...i}=t,[s,o]=m.useState(!1);Et(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?oa.createPortal((0,g.jsx)(Le.div,{...i,ref:n}),a):null},"Portal")),DM=Object.defineProperty,bp=(e,t)=>DM(e,"name",{value:t,configurable:!0}),Ia=0,Ci=null;function NM(e){return wp(),e.children}bp(NM,"FocusGuards");function wp(){m.useEffect(()=>{Ci||(Ci={start:nf(),end:nf()});const{start:e,end:t}=Ci;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ia++,()=>{Ia===1&&(Ci?.start.remove(),Ci?.end.remove(),Ci=null),Ia=Math.max(0,Ia-1)}},[])}bp(wp,"useFocusGuards");function nf(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}bp(nf,"createFocusGuard");var Sn=function(){return Sn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Sn.apply(this,arguments)};function hb(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function LM(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var gl="right-scroll-bar-position",vl="width-before-scroll-bar",_M="with-scroll-bars-hidden",jM="--removed-body-scroll-bar-size";function Iu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function BM(e,t){var n=(0,m.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var FM=typeof window<"u"?m.useLayoutEffect:m.useEffect,bg=new WeakMap;function VM(e,t){var n=BM(t||null,function(r){return e.forEach(function(i){return Iu(i,r)})});return FM(function(){var r=bg.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Iu(a,null)}),s.forEach(function(a){i.has(a)||Iu(a,o)})}bg.set(n,e)},[e]),n}function zM(e){return e}function $M(e,t){t===void 0&&(t=zM);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(o){return o!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var o=n;n=[],o.forEach(i),s=n}var a=function(){var c=s;s=[],c.forEach(i)},l=function(){return Promise.resolve().then(a)};l(),n={push:function(c){s.push(c),l()},filter:function(c){return s=s.filter(c),n}}}}}function HM(e){e===void 0&&(e={});var t=$M(null);return t.options=Sn({async:!0,ssr:!1},e),t}var fb=function(e){var t=e.sideCar,n=hb(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Sn({},n))};fb.isSideCarExport=!0;function WM(e,t){return e.useMedium(t),fb}var db=HM(),Ou=function(){},Oc=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Ou,onWheelCapture:Ou,onTouchMoveCapture:Ou}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,h=e.shards,f=e.sideCar,d=e.noRelative,p=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=hb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,A=VM([n,t]),k=Sn(Sn({},S),i);return m.createElement(m.Fragment,null,u&&m.createElement(C,{sideCar:db,removeScrollBar:c,shards:h,noRelative:d,noIsolation:p,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?m.cloneElement(m.Children.only(a),Sn(Sn({},k),{ref:A})):m.createElement(b,Sn({},k,{className:l,ref:A}),a))});Oc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Oc.classNames={fullWidth:vl,zeroRight:gl};var wg,UM=function(){if(wg)return wg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qM(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=UM();return t&&e.setAttribute("nonce",t),e}function KM(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function GM(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var QM=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qM())&&(KM(t,n),GM(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},YM=function(){var e=QM();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},pb=function(){var e=YM(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},XM={left:0,top:0,right:0,gap:0},Du=function(e){return parseInt(e||"",10)||0},JM=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Du(n),Du(r),Du(i)]},ZM=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return XM;var t=JM(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},eR=pb(),po="data-scroll-locked",tR=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
2
2
|
.`.concat(_M,` {
|
|
3
3
|
overflow: hidden `).concat(r,`;
|
|
4
4
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
@@ -70,4 +70,4 @@ import{o as Ox}from"./rolldown-runtime-C03pXr1T.js";import{At as Cr,Et as vr,It
|
|
|
70
70
|
|
|
71
71
|
`),r=t.startsWith("ÿØÿ");if(!n&&!r)throw new Error("PLUGIN_REPLAY_IMAGE_INVALID");return`data:image/${n?"png":"jpeg"};base64,${e}`}function Y4(e,t){e!==void 0&&og(e);const n=t?uE(t):void 0;return`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-src 'none'; connect-src 'none'"><meta name="referrer" content="no-referrer"><style>html,body{margin:0}img{display:block;max-width:100%;height:auto}</style></head><body>${n?`<img alt="Captured workspace" src="${n}">`:"<p>No captured image available.</p>"}</body></html>`}function kx({recording:e,screenshotBase64:t}){let n;try{n=Y4(e,t)}catch{return(0,g.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Unsupported workspace capture."})}return(0,g.jsx)("iframe",{title:"Recorded plugin workspace",sandbox:"",referrerPolicy:"no-referrer",srcDoc:n,className:"h-96 w-full rounded-md border border-border bg-background"})}function X4({recording:e,screenshotUrl:t}){const n=tg(t??void 0),[r,i]=(0,m.useState)();let s=!1;try{e!==void 0&&og(e),s=!0}catch{}return(0,m.useEffect)(()=>{if(!s||!n)return;const o=new AbortController;return(async()=>{try{if(!Ca(n))throw new Error("Owned screenshot link unavailable");const a=await o4(n,{signal:o.signal,credentials:"omit",redirect:"error"});if(!a.ok||!a.body)throw new Error("Screenshot unavailable");const l=a.body.getReader(),c=[];let u=0;try{for(;;){const{done:v,value:y}=await l.read();if(v)break;if(u+=y.byteLength,u>1048576)throw new Error("Screenshot too large");c.push(y)}}finally{await l.cancel().catch(()=>{}),l.releaseLock()}const h=new Uint8Array(u);let f=0;for(const v of c)h.set(v,f),f+=v.length;let d="";for(let v=0;v<h.length;v+=8192)d+=String.fromCharCode(...h.subarray(v,v+8192));const p=btoa(d);uE(p),o.signal.aborted||i({url:n,base64:p})}catch{o.signal.aborted||i({url:n,failed:!0})}})(),()=>o.abort()},[n,s]),s?n&&r?.url!==n?(0,g.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading captured workspace…"}):(0,g.jsxs)("div",{className:"space-y-2",children:[r?.failed?(0,g.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Captured image unavailable."}):null,(0,g.jsx)(kx,{recording:e,screenshotBase64:n?r?.base64:void 0})]}):(0,g.jsx)(kx,{recording:e})}var J4=500,Z4={ok:"border-success/30 bg-success/10 text-success",error:"border-destructive/30 bg-destructive/10 text-destructive",unknown:"border-border/50 bg-muted/40 text-muted-foreground"};function hE(e){switch(e){case"left_click":return"Click";case"double_click":return"Double-click";case"right_click":return"Right-click";case"mouse_move":return"Move";case"type":return"Type";case"key":return"Key";case"scroll":return"Scroll";case"wait":return"Wait";case"screenshot":return"Assert";default:return e}}function Cs(e){const t=hE(e.action),n=e.locatorLabel?.trim();return n?`Interact · ${t} ${n}`:`Interact · ${t}`}function Rc(e){return e.assertion?e.assertion.passed?"ok":"error":e.ok===!0?"ok":e.ok===!1?"error":"unknown"}function Ys(e){return`${e.toolCallId}:${e.stepIndex}`}function eU(e){if(!e)return[];const t=[];return typeof e.durationMs=="number"&&e.durationMs>0&&t.push({key:"duration",label:tU(e.durationMs),...typeof e.distinctFrames=="number"?{title:`${e.distinctFrames.toLocaleString()} distinct frames — identical frames are dropped, so an idle page costs none`}:{}}),typeof e.fps=="number"&&e.fps>0&&t.push({key:"fps",label:`${e.fps} fps`}),t}function tU(e){const t=Math.round(e/1e3),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),s=String(r).padStart(i>0?2:1,"0");return i>0?`${i}:${s}:${String(n).padStart(2,"0")}`:`${s}:${String(n).padStart(2,"0")}`}function fE(e){return typeof e=="string"&&e.length>0?e:null}function q6(e){return(e.widgetRenderObservations?.length??0)>0||(e.browserInteractionSteps?.length??0)>0||fE(e.videoUrl)!==null}function nU(e){return e==="ok"?"OK":e==="error"?"Failed":"Unknown"}function dE({step:e,leading:t,className:n}){const r=Rc(e),i=e.widgetToolCalls??[],s=e.coordinateX!=null&&e.coordinateY!=null?`(${e.coordinateX}, ${e.coordinateY})`:null;return(0,g.jsxs)("div",{"data-testid":"browser-step-detail",className:Q("flex flex-col gap-4",n),children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[t,(0,g.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,g.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:Cs(e)}),(0,g.jsxs)("p",{className:"text-xs text-muted-foreground",children:["App interaction · ",e.elapsedMs,"ms",s?` · ${s}`:""]})]}),(0,g.jsx)("span",{className:Q("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[11px] font-medium",Z4[r]),children:nU(r)})]}),e.assertion&&!e.assertion.passed&&e.assertion.reason?(0,g.jsx)("p",{className:"text-xs text-destructive",children:e.assertion.reason}):null,e.pluginWorkspace?(0,g.jsx)(X4,{recording:e.pluginWorkspace,screenshotUrl:e.screenshotUrl}):e.screenshotUrl?(0,g.jsx)(HT,{src:e.screenshotUrl,alt:Cs(e),className:"max-h-72 w-full rounded-md border border-border/50 object-contain"}):null,i.length>0?(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Widget tool calls"}),i.map((o,a)=>(0,g.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,g.jsx)("span",{className:Q("inline-block h-1.5 w-1.5 shrink-0 rounded-full",o.ok?"bg-success":"bg-destructive"),"aria-hidden":!0}),(0,g.jsx)("span",{className:"font-mono text-foreground",children:o.name}),o.error?(0,g.jsx)("span",{className:"truncate text-destructive",children:o.error}):null]},`${o.name}-${a}`))]}):null,e.followUps&&e.followUps.length>0?(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Sent message to chat"}),e.followUps.map((o,a)=>(0,g.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,g.jsx)("span",{"aria-hidden":!0,children:"↳"}),(0,g.jsx)("span",{className:"truncate text-foreground",children:o})]},a))]}):null]})}function rU(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,"0")}`}function iU(e,t){let n=null;for(const r of e)if(r.videoOffsetMs!=null)if(r.videoOffsetMs<=t)n=r;else break;return n}function K6({steps:e,videoUrl:t,videoMeta:n,isRunning:r=!1,className:i}){const s=(0,m.useRef)(null),[o,a]=(0,m.useState)(null),[l,c]=(0,m.useState)(null),u=(0,m.useRef)(null),[h,f]=(0,m.useState)(!1),[d,p]=(0,m.useState)(null),v=tg(fE(t)),y=(0,m.useMemo)(()=>eU(n),[n]),x=(0,m.useMemo)(()=>[...e].sort((E,R)=>(E.videoOffsetMs??Number.POSITIVE_INFINITY)-(R.videoOffsetMs??Number.POSITIVE_INFINITY)||E.promptIndex-R.promptIndex||E.ts-R.ts),[e]),b=o??l??null,w=(0,m.useMemo)(()=>x.find(E=>Ys(E)===b)??null,[x,b]),S=v!=null&&!h,C=x.some(E=>E.screenshotUrl),A=(0,m.useCallback)(E=>{a(Ys(E));const R=s.current;if(!R||!S||E.videoOffsetMs==null)return;const I=E.videoOffsetMs/1e3;u.current=I,R.currentTime=I},[S]),k=(0,m.useCallback)(()=>{u.current=null},[]),T=(0,m.useCallback)(()=>{const E=s.current;if(!E)return;const R=iU(x,E.currentTime*1e3);if(c(R?Ys(R):null),u.current==null){if(o!=null){const I=x.find(M=>Ys(M)===o);if(I?.videoOffsetMs!=null){const M=I.videoOffsetMs-E.currentTime*1e3;if(M>0&&M<J4)return}}a(null)}},[x,o]);return(0,m.useEffect)(()=>{f(!1)},[v]),(0,m.useEffect)(()=>{if(!d||d.url!==v)return;const E=setTimeout(()=>{p(null),f(!1)},d.delayMs);return()=>clearTimeout(E)},[d,v]),x.length===0&&!v?(0,g.jsx)("div",{className:"flex items-center justify-center rounded-md border border-dashed border-border/40 py-8 text-xs text-muted-foreground","data-testid":"browser-filmstrip-empty",children:r?"Finalizing replay…":"No app interactions were recorded."}):(0,g.jsxs)("section",{className:Q("flex min-w-0 flex-col gap-3",i),"data-testid":"browser-step-filmstrip",children:[(0,g.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,g.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Replay",(0,g.jsx)("span",{className:"ml-1.5 font-normal normal-case text-muted-foreground/70",children:"screen recording of the app interactions in this run"})]}),v&&!h&&(y.length>0||n?.truncated)?(0,g.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground","data-testid":"browser-replay-video-meta",children:[y.map(E=>(0,g.jsx)("span",{title:E.title,children:E.label},E.key)),n?.truncated?(0,g.jsx)("span",{className:"rounded-sm border border-warning/30 bg-warning/10 px-1.5 py-px font-medium text-warning-foreground","data-testid":"browser-replay-truncated-badge",title:"The recorder stopped at its size limit, so this video covers the beginning of the run and not the end of it.",children:"Stopped at the size limit"}):null]}):null,v&&!h?(0,g.jsx)("video",{ref:s,src:v,controls:!0,preload:"metadata",onTimeUpdate:T,onSeeked:k,onError:()=>{const E=zT(v);f(!0),p(E!==null&&E>0?{url:v,delayMs:E}:null)},onLoadedMetadata:()=>$T(v),className:"w-full rounded-md border border-border/60 bg-black","data-testid":"browser-replay-video"}):(0,g.jsx)("p",{className:"rounded-md border border-dashed border-border/50 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground","data-testid":"browser-replay-video-unavailable",children:r?"Finalizing replay — the recording is written when the run ends.":h?C?"Recording failed to load — screenshots preserved.":"Recording failed to load, and no screenshots were captured.":C?"Video unavailable — screenshots preserved.":"Partial capture — no recording, and no screenshots survived."})]}),x.length>0?(0,g.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,g.jsx)("div",{className:"flex min-w-0 gap-2 overflow-x-auto pb-1","data-testid":"browser-filmstrip-track",children:x.map(E=>{const R=Ys(E),I=Rc(E),M=R===b;return(0,g.jsxs)("button",{type:"button",onClick:()=>A(E),"aria-pressed":M,title:Cs(E),"data-testid":"browser-filmstrip-frame","data-step-key":R,"data-active":M?"true":"false",className:Q("flex w-28 shrink-0 flex-col gap-1 rounded-md border p-1 text-left transition-colors",M?"border-primary bg-primary/5":"border-border/50 hover:border-border"),children:[E.pluginWorkspace?(0,g.jsx)("span",{className:"text-xs text-muted-foreground",children:"Workspace capture"}):E.screenshotUrl?(0,g.jsx)(HT,{src:E.screenshotUrl,alt:Cs(E),loading:"lazy",className:"h-16 w-full rounded-sm border border-border/40 bg-background object-cover object-top"}):(0,g.jsx)("div",{className:"flex h-16 w-full items-center justify-center rounded-sm border border-dashed border-border/50 bg-muted/20 text-[10px] text-muted-foreground",children:"No frame"}),(0,g.jsx)("span",{className:"truncate text-[10px] font-medium text-foreground",children:hE(E.action)}),(0,g.jsx)("span",{className:Q("truncate text-[10px]",I==="error"?"text-destructive":"text-muted-foreground"),children:E.videoOffsetMs!=null?rU(E.videoOffsetMs):`turn ${E.promptIndex+1}`})]},R)})}),w?(0,g.jsx)(dE,{step:w,className:"rounded-lg bg-muted/5 px-4 py-4"}):(0,g.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Select a frame to see the interaction that produced it."})]}):null]})}var sU={[-32700]:"Parse error",[-32600]:"Invalid request",[-32601]:"Method not found",[-32602]:"Invalid params",[-32603]:"Internal error",[-32e3]:"Connection closed",[-32001]:"Request timeout",[-32042]:"URL elicitation required"};function oU(e){const t=sU[e];return t?`${e} · ${t}`:String(e)}var aU=Cr({id:ge(),parentId:ge().optional(),name:ge(),category:fo(["step","llm","tool","error","connection","discovery"]),startMs:nt(),endMs:nt(),promptIndex:nt().optional(),stepIndex:nt().optional(),authoredStepId:ge().optional(),status:fo(["ok","error"]).optional(),toolCallId:ge().optional(),toolName:ge().optional(),toolOrigin:fo(["mcp","native","builtin","unknown"]).optional(),serverId:ge().optional(),connectionId:ge().optional(),modelId:ge().optional(),inputTokens:nt().optional(),outputTokens:nt().optional(),totalTokens:nt().optional(),messageStartIndex:nt().optional(),messageEndIndex:nt().optional(),finishReason:ge().optional(),provider:ge().optional(),responseId:ge().optional(),responseTimestamp:ge().optional(),ttfcMs:nt().optional(),mcpErrorCode:nt().optional(),outputSource:Kh([vr("narration"),vr("evidence"),vr("reconstructed")]).optional(),wireCorroborated:Ye().optional(),evidenceRequestId:ge().optional(),evidenceStatus:Kh([vr("complete"),vr("incomplete")]).optional()}),qr=Cr({toolName:ge(),arguments:pl(ge(),Dx())}),lU=Cr({promptIndex:nt(),prompt:ge(),expectedToolCalls:Qt(qr),actualToolCalls:Qt(qr),expectedOutput:ge().optional(),passed:Ye(),missing:Qt(qr),unexpected:Qt(qr),argumentMismatches:Qt(Cr({expected:qr,actual:qr,mismatchedArguments:Qt(ge())})),retries:Qt(qr.extend({actualIndex:nt().int().nonnegative(),retriedByIndex:nt().int().nonnegative()})).optional()}),cU=Cr({toolCallId:ge(),toolName:ge(),protocol:Kh([vr("mcp-apps"),vr("openai-apps")]),serverId:ge(),resourceUri:ge().optional(),toolMetadata:pl(ge(),Eu()),widgetCsp:pl(ge(),Eu()).nullable().optional(),widgetPermissions:pl(ge(),Eu()).nullable().optional(),widgetPermissive:Ye().optional(),prefersBorder:Ye().optional(),widgetHtmlBlobId:ge().optional(),widgetHtmlUrl:ge().nullable().optional(),injectedOpenAiCompat:Ye().optional(),injectedOpenAiCompatCapabilities:Cr({callTool:Ye().optional(),sendFollowUpMessage:Ye().optional(),setWidgetState:Ye().optional(),requestDisplayMode:fo(["all","fullscreen-only","none"]).optional(),notifyIntrinsicHeight:Ye().optional(),openExternal:Ye().optional(),setOpenInAppUrl:Ye().optional(),requestModal:Ye().optional(),uploadFile:Ye().optional(),selectFiles:Ye().optional(),getFileDownloadUrl:Ye().optional(),requestCheckout:Ye().optional(),requestClose:Ye().optional()}).optional()}),uU=Cr({source:fo(["hosted","widget"]),fps:nt().optional(),durationMs:nt().optional(),distinctFrames:nt().optional(),truncated:Ye().optional()}),G6=Cr({traceVersion:vr(1),messages:Qt(Dx()),widgetSnapshots:Qt(cU).optional(),spans:Qt(aU).optional(),prompts:Qt(lU).optional(),videoBlobId:ge().optional(),videoMeta:uU.optional()});function hU(e,t){const n=[],r=new Map;return t.forEach((i,s)=>{if(i.role==="user"&&n.push(s),!!Array.isArray(i.content))for(const o of i.content){if(typeof o!="object"||o===null||o.type!=="tool-call"&&o.type!=="tool-result"||typeof o.toolCallId!="string")continue;const a=r.get(o.toolCallId)??[];a.push(s),r.set(o.toolCallId,a)}}),{userIndices:n,spans:e.map(i=>{const s=n[i.promptIndex??0],o=n[(i.promptIndex??0)+1]??t.length,a=s!==void 0&&i.category==="tool"&&i.toolCallId?r.get(i.toolCallId)?.filter(l=>l>=s&&l<o):void 0;return{...i,messageStartIndex:a?.[0],messageEndIndex:a?.at(-1)}})}}function fU({recording:e}){let t;try{t=og(e)}catch{return null}return(0,g.jsxs)("section",{"aria-label":"Workspace events",className:"mt-4 space-y-2 text-xs",children:[(0,g.jsx)("p",{className:"font-medium",children:"Workspace events"}),t.droppedEvents>0&&(0,g.jsxs)("p",{className:"text-muted-foreground",children:[t.droppedEvents," earlier events omitted."]}),t.events.map(n=>(0,g.jsxs)("div",{className:"flex gap-2 border-b border-border py-2",children:[(0,g.jsx)("span",{className:"tabular-nums text-muted-foreground",children:n.sequence}),(0,g.jsxs)("span",{children:[n.kind,"feature"in n&&n.feature?` · ${n.feature} (${n.fidelity})`:"","outcome"in n&&n.outcome?` · ${n.outcome}`:"","display"in n&&n.display?` · ${n.display.displayMode??"unavailable"} · cursor ${n.display.interactionCursor}`:""]})]},n.sequence))]})}function Q6(e){return e==="schedule"?"Schedule owner":e==="api"||e==="sdk"?"Key owner":null}function hp(e){return e.kind==="xaa"&&e.xaaSubject?.trim()||e.name}function Y6(e){const t=[];for(const n of e){const r=hp(n),i=t.find(s=>s.serverId===n.serverId);i?i.names.includes(r)||i.names.push(r):t.push({serverId:n.serverId,names:[r]})}return t}function pE(e,t){if(e.category!=="tool"||!t?.length)return;if(e.connectionId){const r=t.find(i=>i.connectionId===e.connectionId);return r?hp(r):void 0}const n=e.serverId?t.filter(r=>r.serverId===e.serverId):[];return n.length===1?hp(n[0]):void 0}function dU(e,t){const n=new Map;for(const r of e??[]){const i=r.toolCallId?pE(r,t):void 0;r.toolCallId&&i&&n.set(r.toolCallId,i)}return n}var ag=(0,m.createContext)(void 0);function X6({accounts:e,children:t}){const n=l4();return(0,g.jsx)(ag.Provider,{value:n?e:void 0,children:t})}function mE(){const e=(0,m.useContext)(ag);return(0,m.useCallback)(t=>pE(t,e),[e])}function J6({spans:e,children:t}){const n=(0,m.useContext)(ag),r=(0,m.useMemo)(()=>dU(e,n),[e,n]);return(0,g.jsx)(L1.Provider,{value:r,children:t})}var pU=1024;function mU(e){const[t,n]=(0,m.useState)(null),[r,i]=(0,m.useState)(!1);return(0,m.useLayoutEffect)(()=>{if(e!=="auto"||!t)return;const s=()=>i(t.getBoundingClientRect().width>=pU);if(s(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(s);return o.observe(t),()=>o.disconnect()},[e,t]),{containerRef:n,direction:e==="auto"&&r?"horizontal":"vertical"}}var gU=["all","connection","discovery","llm","tool","error"];function Wh(e){switch(e){case"all":return"All";case"connection":return"Connect";case"discovery":return"Discovery";case"llm":return"LLM";case"tool":return"Tool";case"error":return"Error"}}function vU({filter:e,onFilterChange:t,isFullyExpanded:n,expandDisabled:r,onToggleExpandAll:i,zoomControls:s,showBottomBorder:o=!0}){return(0,g.jsxs)("div",{className:Q("flex min-h-7 min-w-0 flex-1 flex-row flex-nowrap items-center gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",o&&"border-b border-border/30 pb-2"),children:[(0,g.jsxs)(ru,{children:[(0,g.jsx)(iu,{asChild:!0,children:(0,g.jsxs)(Pt,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 gap-1.5 border-border/50 px-2 text-[10px] font-medium text-foreground","aria-label":`Filter timeline rows: ${Wh(e)}`,children:[(0,g.jsx)(kD,{className:"size-3.5 shrink-0 opacity-80","aria-hidden":!0}),Wh(e)]})}),(0,g.jsx)(Mm,{align:"start",className:"min-w-[8rem]",children:(0,g.jsx)(lV,{value:e,onValueChange:a=>t(a),children:gU.map(a=>(0,g.jsx)(cV,{value:a,className:"text-xs",children:Wh(a)},a))})})]}),(0,g.jsx)(Pt,{type:"button",variant:"outline",size:"icon",disabled:r,className:"h-7 w-7 shrink-0 border-border/50 text-muted-foreground hover:text-foreground disabled:opacity-40",title:n?"Collapse all":"Expand all","aria-label":n?"Collapse all":"Expand all","aria-pressed":n,onClick:i,children:n?(0,g.jsx)(OD,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0}):(0,g.jsx)(xD,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0})}),s?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"bg-border hidden h-3 w-px shrink-0 md:block","aria-hidden":!0}),(0,g.jsx)("div",{className:"flex shrink-0 items-center gap-0.5",children:s})]}):null]})}var Cx=[0,25,50,75,100],yU=54,xU=120;function bU(e){if(!Number.isFinite(e))return[0,100];if(e<=0)return[0,100];const t=Math.max(2,Math.floor(e/yU));return t>=Cx.length?[...Cx]:t<=2?[0,100]:t===3?[0,50,100]:[0,25,75,100]}function wU(e){return e<=0?"left-0 top-1/2 -translate-x-0 -translate-y-1/2 text-left":e>=100?"left-0 top-1/2 -translate-x-full -translate-y-1/2 text-right":"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center"}function Ax(e){return e<=0?Ql(0):`${Ql(0)}–${Ql(e)}`}function SU(e){const t=e.filter(l=>l.category==="llm");let n=0,r=0,i=0,s=0,o=0,a=0;for(const l of t)typeof l.inputTokens=="number"&&(n+=l.inputTokens,r++),typeof l.outputTokens=="number"&&(i+=l.outputTokens,s++),typeof l.totalTokens=="number"&&(o+=l.totalTokens,a++);return{...r?{inputTokens:n}:{},...s?{outputTokens:i}:{},...a?{totalTokens:o}:{}}}function ku(e,t){return t}function Tx(e){switch(e){case"connection":return-2;case"discovery":return-1;case"step":return 0;case"llm":return 1;case"tool":return 2;case"error":return 3;default:return ku(e,9)}}function kU(e,t){if(e.startMs!==t.startMs)return e.startMs-t.startMs;const n=Tx(e.category)-Tx(t.category);return n!==0?n:e.endMs!==t.endMs?e.endMs-t.endMs:e.name.localeCompare(t.name)}function CU(e,t){return typeof e!="number"||t<50?null:e/(t/1e3)}function Mo(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:`${Math.round(e)}ms`}function Ql(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`}function Qn(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ia(e){const t=e.toolName??e.name;return typeof t=="string"&&t.trim()?t:void 0}function Aa(e){return Array.isArray(e.content)?e.content.filter(t=>Qn(t)&&typeof t.type=="string"):typeof e.content=="string"?[{type:"text",text:e.content}]:[]}function gE(e){if(e==null)return"None";if(typeof e=="string")return e.length>180?`${e.slice(0,177)}...`:e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`${e.length} item${e.length===1?"":"s"}`;if(Qn(e)){const t=Object.keys(e);return t.length>0?`{ ${t.slice(0,4).join(", ")}${t.length>4?", ...":""} }`:"{}"}return String(e)}function AU(e){const t=Aa(e);if(t.length===0)return typeof e.content=="string"?e.content:"No content";const n=t.slice(0,3).map(r=>r.type==="text"&&typeof r.text=="string"?r.text:r.type==="tool-call"?`Tool call: ${ia(r)??"Tool"}`:r.type==="tool-result"?`Tool result: ${ia(r)??"Tool"}`:typeof r.type=="string"?r.type:"content").join(" | ");return n.length>220?`${n.slice(0,217)}...`:n}function TU(e){return!Qn(e)||!("type"in e)||!("value"in e)?e:e.value}function EU(e){return e.result!==void 0?e.result:TU(e.output)}function MU(e){const t=EU(e);if(typeof e.error=="string"&&e.error.trim())return e.error.trim();if(Qn(e.error)&&typeof e.error.message=="string")return e.error.message;if(Qn(e.output)&&e.output.type==="error-text")return typeof e.output.value=="string"?e.output.value:"Tool error";if(Qn(e.result)&&e.result.isError===!0||Qn(e.output)&&Qn(e.output.value)&&e.output.value.isError===!0||e.isError===!0)return Hh(t)??"Tool error"}function Cu(e,t,n,r){if(!t&&!n)return{};if(r){if(!t||r.messageStartIndex===void 0||r.messageEndIndex===void 0)return{};e=e.slice(r.messageStartIndex,r.messageEndIndex+1)}let i,s,o;for(const a of e)for(const l of Aa(a)){const c=typeof t=="string"&&l.toolCallId===t,u=!t&&typeof n=="string"&&ia(l)===n;if(!(!c&&!u)&&(l.type==="tool-call"&&(i=l.input??l.parameters??l.args),l.type==="tool-result")){s=l.result??(Qn(l.output)&&"value"in l.output?l.output.value:l.output);const h=MU(l);h&&(o=h)}}return{input:i,output:s,errorText:o}}function Yi(e,t,n=!1){return e.category==="error"||e.status==="error"?!0:e.category==="tool"?!!Cu(t,e.toolCallId,e.toolName??e.name,n?e:void 0).errorText:!1}function Ns(e,t){if(typeof e!="number"&&typeof t!="number")return;const n=e??t??0,r=t??e??n;return{startIndex:Math.min(n,r),endIndex:Math.max(n,r)}}function RU(e){return Ns(e.messageStartIndex,e.messageEndIndex)}function PU(e){return Ns(e.span.messageStartIndex,e.span.messageEndIndex)}function vE(e){if(!e||e.startIndex<0)return[];const t=[];for(let n=e.startIndex;n<=e.endIndex;n+=1)t.push(n);return t}function yE(e,t,n){if(t)for(let r=t.startIndex;r<=t.endIndex;r+=1){const i=e[r];if(i&&n(i))return r}}function lg(e,t,n){if(!e.length)return;const r=Ns(t,n);if(!r){const s=e.findIndex(o=>o.role==="user");return s>=0?s:void 0}const i=yE(e,r,s=>s.role==="user");if(typeof i=="number")return i;if(!(r.startIndex>=e.length)&&r.startIndex>0)for(let s=r.startIndex-1;s>=0;s-=1){const o=e[s];if(o){if(o.role==="user")return s;if(o.role==="assistant")break}}}function IU(e,t){if(e.kind==="prompt")return"trace-waterfall-bar-prompt";if(e.kind==="interaction")return e.status==="error"?"trace-waterfall-bar-error":"trace-waterfall-bar-tool";if(e.kind==="span"&&t)return"trace-waterfall-bar-error";if(e.kind!=="span")return"trace-waterfall-bar-step";const n=e.span.category;switch(n){case"llm":return"trace-waterfall-bar-llm";case"tool":return"trace-waterfall-bar-tool";case"step":case"connection":case"discovery":return"trace-waterfall-bar-step";case"error":return"trace-waterfall-bar-error";default:return ku(n,"trace-waterfall-bar-step")}}function OU(e){switch(e){case"prompt":return"trace-waterfall-glyph-prompt";case"step":return"trace-waterfall-glyph-step";case"llm":return"trace-waterfall-glyph-llm";case"tool":case"interaction":return"trace-waterfall-glyph-tool";case"error":return"trace-waterfall-glyph-error";case"connection":case"discovery":return"trace-waterfall-glyph-step";default:return ku(e,"text-muted-foreground")}}function DU(e,t){if(e.kind==="prompt")return"trace-waterfall-row-accent-prompt";if(e.kind==="interaction")return e.status==="error"?"trace-waterfall-row-accent-error":"trace-waterfall-row-accent-tool";const n=t?"error":e.span.category;switch(n){case"llm":return"trace-waterfall-row-accent-llm";case"tool":return"trace-waterfall-row-accent-tool";case"error":return"trace-waterfall-row-accent-error";case"step":case"connection":case"discovery":return"trace-waterfall-row-accent-step";default:return ku(n,"border-l-muted-foreground")}}function NU(e){const t=new Map;for(const n of e){const r=typeof n.promptIndex=="number"?n.promptIndex:0,i=t.get(r);i?i.push(n):t.set(r,[n])}return[...t.entries()].sort(([n],[r])=>n-r).map(([n,r])=>{const i=new Map;r.forEach(c=>{i.set(c.id,{span:c,children:[]})});const s=[];r.forEach(c=>{const u=i.get(c.id),h=typeof c.parentId=="string"?i.get(c.parentId):void 0;if(h){h.children.push(u);return}s.push(u)});const o=c=>{c.sort((u,h)=>kU(u.span,h.span)),c.forEach(u=>o(u.children))};o(s);const a=r.flatMap(c=>{const u=[];return typeof c.messageStartIndex=="number"&&u.push(c.messageStartIndex),typeof c.messageEndIndex=="number"&&u.push(c.messageEndIndex),u}),l={step:0,llm:0,tool:0,error:0,connection:0,discovery:0};for(const c of r)c.category in l&&l[c.category]++;return{key:`prompt-${n}`,promptIndex:n,label:`Prompt ${n+1}`,spans:r,roots:s,startMs:Math.min(...r.map(c=>c.startMs)),endMs:Math.max(...r.map(c=>c.endMs)),messageStartIndex:a.length>0?Math.min(...a):void 0,messageEndIndex:a.length>0?Math.max(...a):void 0,counts:l}})}function Ex(e){const t=new Set;function n(r){for(const i of r)i.span.category==="step"&&i.children.length>0&&t.add(i.span.id),n(i.children)}for(const r of e)n(r.roots);return t}function Uh(e){return{role:e.role,content:e.content}}function xE(e,t,n){const r=Ns(t,n);if(!r)return[];const i=e.slice(r.startIndex,r.endIndex+1);if(i.length===0)return[];let s=-1;for(let a=0;a<i.length;a++)if(i[a].role==="assistant"){s=a;break}if(s<0)return e.slice(0,r.endIndex+1);const o=r.startIndex+s;return o===0?[]:e.slice(0,o)}function LU(e,t,n){const r=Ns(t,n);if(!r)return{input:null,output:null};const i=e.slice(r.startIndex,r.endIndex+1);if(i.length===0)return{input:[],output:null};let s=-1;for(let l=i.length-1;l>=0;l-=1)if(i[l].role==="assistant"){s=l;break}if(s<0)return{input:i.map(Uh),output:null};const o=xE(e,t,n),a=i[s];return{input:o.length>0?o.map(Uh):null,output:Uh(a)}}var _U=96;function Zt(e,t=_U){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function sa(e){return typeof e.content=="string"?e.content.trim():Aa(e).map(t=>t.type==="text"&&typeof t.text=="string"?t.text.trim():"").filter(Boolean).join(" ")}function jU(e){const t=Aa(e),n=[];for(const r of t)r.type==="tool-call"&&n.push(ia(r)??"tool");return n}function BU(e,t){if(!e.length)return;const n=xE(e,t.messageStartIndex,t.messageEndIndex);if(n.length!==0){for(let r=n.length-1;r>=0;r--){const i=n[r];if(i.role==="user"){const s=sa(i);if(s)return Zt(s)}}for(const r of n)if(r.role==="system"){const i=sa(r);if(i)return Zt(i)}for(let r=n.length-1;r>=0;r--){const i=n[r];if(i.role==="tool"){const s=AU(i);if(s&&s!=="No content")return Zt(s)}}}}function FU(e,t){if(!e.length)return;const n=Ns(t.messageStartIndex,t.messageEndIndex);if(!n)return;const r=e.slice(n.startIndex,n.endIndex+1);for(let i=r.length-1;i>=0;i--){const s=r[i];if(s.role!=="assistant")continue;const o=sa(s);if(o)return{kind:"text",preview:Zt(o)};const a=jU(s);if(a.length>0)return{kind:"tools",preview:Zt(`Calling ${a.join(", ")}`)}}}function VU(e,t,n){const r=lg(e,t,n);if(typeof r!="number")return;const i=sa(e[r]);return i?Zt(i):void 0}function zU(e,t,n){const r=lg(e,t,n);if(typeof r=="number")return sa(e[r])||void 0}function Mx(e,t){if(typeof t.toolCallId=="string"&&e.toolCallId===t.toolCallId)return!0;const n=t.toolName?.trim()||t.name?.trim();return!!(!t.toolCallId&&n&&ia(e)===n)}function $U(e,t,n){if(n)for(let r=n.startIndex;r<=n.endIndex;r+=1){const i=e[r];if(!i)continue;const s=Aa(i);if(s.some(o=>o.type==="tool-call"&&Mx(o,t))||s.some(o=>o.type==="tool-result"&&Mx(o,t)))return r}}function HU(e,t){const n=lg(t,e.messageStartIndex,e.messageEndIndex);if(typeof n=="number")return{focusSourceIndex:n,highlightSourceIndices:[n]};const r=vE(RU(e));if(r.length!==0)return{focusSourceIndex:r[0],highlightSourceIndices:r}}function WU(e,t){const n=PU(e),r=vE(n);if(r.length===0)return;const i=yE(t,n,s=>s.role==="assistant");return{focusSourceIndex:(e.span.category==="tool"?$U(t,e.span,n):void 0)??i??r[0],highlightSourceIndices:r}}function UU(e,t,n=!1){const r=Cu(e,t.toolCallId,t.toolName??t.name,n?t:void 0);if(r.input==null)return;const i=gE(r.input);if(!(!i||i==="None"))return Zt(i)}function As({category:e,size:t="sm"}){const n=Q(t==="lg"?"h-5 w-5 shrink-0":"h-3.5 w-3.5 shrink-0",OU(e));switch(e){case"prompt":return(0,g.jsx)(_D,{className:n,"aria-hidden":!0});case"llm":return(0,g.jsx)(vD,{className:n,"aria-hidden":!0});case"tool":return(0,g.jsx)(jD,{className:n,"aria-hidden":!0});case"interaction":return(0,g.jsx)(MD,{className:n,"aria-hidden":!0});case"error":return(0,g.jsx)(yD,{className:n,"aria-hidden":!0});case"connection":case"discovery":case"step":return(0,g.jsx)(Fg,{className:n,"aria-hidden":!0});default:return(0,g.jsx)(Fg,{className:n,"aria-hidden":!0})}}function qU(e,t){const n=t.promptIndex,r=t.stepIndex;if(typeof n!="number"||typeof r!="number")return{};const i=e.find(s=>s.category==="llm"&&s.promptIndex===n&&s.stepIndex===r);return i?{...typeof i.inputTokens=="number"?{inputTokens:i.inputTokens}:{},...typeof i.outputTokens=="number"?{outputTokens:i.outputTokens}:{},...typeof i.totalTokens=="number"?{totalTokens:i.totalTokens}:{}}:{}}function KU(e,t){if(e.kind==="prompt")return{inputTokens:e.aggregatedInputTokens,outputTokens:e.aggregatedOutputTokens,totalTokens:e.aggregatedTotalTokens};if(e.kind==="interaction")return{};const n={inputTokens:e.span.inputTokens,outputTokens:e.span.outputTokens,totalTokens:e.span.totalTokens};if(typeof n.inputTokens=="number"||typeof n.outputTokens=="number"||typeof n.totalTokens=="number"||!t?.length||e.span.category!=="llm"&&e.span.category!=="step")return n;const r=qU(t,e.span);return typeof r.inputTokens=="number"||typeof r.outputTokens=="number"||typeof r.totalTokens=="number"?r:n}function qh(e){return typeof e=="number"?e.toLocaleString():"—"}function Rx(e){return typeof e=="number"&&Number.isFinite(e)?new Date(e).toLocaleString():"—"}function GU({traceStartedAtMs:e,traceEndedAtMs:t,traceDurationMs:n}){return typeof e=="number"&&Number.isFinite(e)?e:typeof t=="number"&&Number.isFinite(t)?t-n:null}function fp(e,t,n=!1,r){const{span:i,promptIndex:s}=e,o=i.modelId?.trim()?Zt(i.modelId.trim(),56):void 0,a=i.name?.trim()??"";if(i.category==="step"){const l=typeof i.stepIndex=="number"?i.stepIndex+1:void 0,c=typeof l=="number"?`Step ${l}`:a||"Step",u=typeof l=="number"&&(a===`Step ${l}`||a.toLowerCase()===`step ${l}`),h=a&&!u?Zt(a,64):c,f=BU(t,i);return f?{title:h,subtitle:f}:o?{title:h,subtitle:o}:{title:h,subtitle:`Prompt ${s+1}`}}if(i.category==="llm"){const l=FU(t,i),c=!a||/^assistant$/i.test(a)||/^llm$/i.test(a)||/^model$/i.test(a)||a==="Model response"||/·\s*response$/i.test(a)?"Agent":Zt(a,64);return l?.kind==="text"?{title:`${c}: "${l.preview}"`,subtitle:o}:l?.kind==="tools"?{title:`${c} · ${l.preview}`,subtitle:o}:{title:c,subtitle:o}}if(i.category==="tool"){const l=`Tool · ${(i.toolName??i.name).trim()||"tool"}${r?` · ${r}`:""}`,c=UU(t,i,n),u=!c||c==="{}"||c==="None";if(c&&!u)return{title:l,subtitle:c};if(u){const h=Cu(t,i.toolCallId,i.toolName??i.name,n?i:void 0);if(h.output!=null){const f=gE(h.output);if(f&&f!=="None"&&f!=="{}")return{title:l,subtitle:Zt(f)}}}return typeof i.stepIndex=="number"?{title:l,subtitle:o?`${o} · step ${i.stepIndex+1}`:`step ${i.stepIndex+1}`}:{title:l,subtitle:o}}return{title:i.name,subtitle:typeof i.stepIndex=="number"?o?`${o} · step ${i.stepIndex+1}`:`step ${i.stepIndex+1}`:o}}function dp(e){const t=e.kind==="span"?e.span.startMs:e.startMs,n=e.kind==="span"?e.span.endMs:e.endMs;return{startMs:t,endMs:n,durationMs:n-t}}function QU({format:e,onFormatChange:t}){return(0,g.jsx)("div",{className:"flex flex-wrap gap-1",children:["plain","markdown"].map(n=>(0,g.jsx)(Pt,{type:"button",size:"sm",variant:e===n?"secondary":"outline",className:"h-7 text-[10px] capitalize",onClick:()=>t(n),children:n==="plain"?"Plain":"Markdown"},n))})}function Px({value:e}){const[t,n]=(0,m.useState)("plain");return(0,m.useEffect)(()=>{typeof e=="string"&&n("plain")},[e]),e==null?(0,g.jsx)("div",{className:"rounded-md border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:"None"}):typeof e=="string"?(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)(QU,{format:t,onFormatChange:n}),t==="markdown"?(0,g.jsx)("div",{className:"max-h-44 overflow-auto rounded-md border border-border/60 bg-muted/10 p-3 text-xs leading-relaxed text-foreground",children:(0,g.jsx)(NT,{content:e})}):(0,g.jsx)("pre",{className:"max-h-44 overflow-auto rounded-md border border-border/60 bg-muted/20 p-3 text-xs whitespace-pre-wrap break-words",children:e})]}):(0,g.jsx)(_W,{value:e,containerClassName:"max-h-56 rounded-md border border-border/60 bg-background"})}function YU({row:e}){return(0,g.jsxs)("div",{"data-testid":"trace-detail-pane",className:"min-h-[280px] rounded-lg bg-muted/5 px-5 py-5",children:[(0,g.jsx)(dE,{step:e.step,leading:(0,g.jsx)(As,{category:"interaction",size:"lg"})}),e.step.pluginWorkspace&&(0,g.jsx)(fU,{recording:e.step.pluginWorkspace})]})}function Ix(e){return e.split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function XU(e){return e.engine==="harness"?e.harness?Ix(e.harness):"Harness":e.engine==="emulated"?"Emulated":e.harness?Ix(e.harness):"Unknown"}function JU({row:e,projectedMessages:t,transcriptMessages:n,onRevealInTranscript:r,turnRuntimeByPromptIndex:i}){const s=mE();if(!e)return(0,g.jsxs)("div",{"data-testid":"trace-detail-pane",className:"flex min-h-[280px] flex-col items-center justify-center gap-3 rounded-lg bg-muted/5 px-6 py-12 text-center",children:[(0,g.jsx)("div",{className:"flex h-14 w-14 items-center justify-center rounded-full border border-border/50 bg-background shadow-sm",children:(0,g.jsx)(SD,{className:"h-7 w-7 text-muted-foreground","aria-hidden":!0})}),(0,g.jsxs)("div",{className:"space-y-1",children:[(0,g.jsx)("p",{className:"text-sm font-medium text-foreground",children:"No span selected"}),(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click a row or use arrow keys"})]})]});if(e.kind==="interaction")return(0,g.jsx)(YU,{row:e});const o=e.kind==="prompt"?HU(e,n):WU(e,n),a=e.kind==="span"?Cu(n,e.span.toolCallId,e.span.toolName??e.span.name,t?e.span:void 0):{},{durationMs:l}=dp(e),c=e.kind==="span"?fp(e,n,t,s(e.span)):null,u=e.kind==="prompt"?e.label:c.title,h=e.kind==="prompt"?e.hasAnyFailure?"error":"ok":Yi(e.span,n,t)?"error":"ok",f=e.kind==="prompt"?"prompt":e.span.category==="tool"&&Yi(e.span,n,t)?"error":e.span.category,d=i?.get(e.promptIndex),p=e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?LU(n,e.span.messageStartIndex,e.span.messageEndIndex):{input:null,output:null},v=e.kind==="span"&&e.span.category==="tool"&&(!!e.span.toolCallId||!!(e.span.toolName?.trim()||e.span.name?.trim())),y=e.kind==="prompt"?null:v?a.input:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?p.input:(e.kind==="span"&&e.span.category==="error",null),x=e.kind==="prompt"?null:v?a.output:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?p.output:e.kind==="span"&&e.span.category==="error"?e.span.name:null,b=e.kind==="prompt"?zU(n,e.messageStartIndex,e.messageEndIndex):void 0,w=e.kind==="span"&&(typeof e.span.inputTokens=="number"||typeof e.span.outputTokens=="number"||typeof e.span.totalTokens=="number"),S=e.kind==="prompt"&&(typeof e.aggregatedInputTokens=="number"||typeof e.aggregatedOutputTokens=="number"||typeof e.aggregatedTotalTokens=="number"),C=e.kind==="span"&&a.errorText?a.errorText:null,A=!!(o&&r);return(0,g.jsxs)("div",{"data-testid":"trace-detail-pane",className:"space-y-4 bg-background p-4",children:[(0,g.jsxs)("div",{className:Q("border-b border-border/40 pb-3",A?"flex flex-col gap-3 min-[400px]:flex-row min-[400px]:items-start":""),children:[(0,g.jsxs)("div",{className:Q("flex gap-3",A?"min-w-0 min-[400px]:flex-1":""),children:[(0,g.jsx)("div",{className:"shrink-0 pt-0.5",children:e.kind==="prompt"?(0,g.jsx)(As,{category:"prompt",size:"lg"}):(0,g.jsx)(As,{category:f,size:"lg"})}),(0,g.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,g.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,g.jsx)("h3",{className:"text-sm font-bold leading-tight text-foreground",children:u}),d?(0,g.jsxs)(E1,{className:"border-border/60 bg-muted/30 px-1.5 py-0 text-[10px] font-medium text-muted-foreground","data-testid":"trace-turn-runtime-badge",title:d.engine==="harness"?"This turn ran through the harness adapter.":d.engine==="emulated"?"This turn ran through MCPJam's emulated chat engine.":d.harness?"This turn ran through the harness adapter.":"Runtime engine was not recorded for this turn.",children:["Engine: ",XU(d)]}):null,h==="error"?(0,g.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]}),(0,g.jsxs)("div",{className:"text-xs tabular-nums text-muted-foreground",children:[(0,g.jsx)("span",{className:"font-medium text-foreground",children:Mo(l)}),e.kind==="prompt"&&S?(0,g.jsxs)(g.Fragment,{children:[typeof e.aggregatedInputTokens=="number"?` · ${e.aggregatedInputTokens} in`:"",typeof e.aggregatedOutputTokens=="number"?` → ${e.aggregatedOutputTokens} out`:"",typeof e.aggregatedTotalTokens=="number"?` (${e.aggregatedTotalTokens} total)`:""]}):e.kind==="span"&&w?(0,g.jsxs)(g.Fragment,{children:[typeof e.span.inputTokens=="number"?` · ${e.span.inputTokens} in`:"",typeof e.span.outputTokens=="number"?` → ${e.span.outputTokens} out`:"",typeof e.span.totalTokens=="number"?` (${e.span.totalTokens} total)`:""]}):null]}),e.kind==="span"?(()=>{const k=e.span,T=k.category==="llm"?CU(k.outputTokens,l):null,E=[];return k.provider&&E.push({label:"Provider",value:k.provider}),k.finishReason&&E.push({label:"Finish",value:k.finishReason}),typeof k.ttfcMs=="number"&&E.push({label:"TTFC",value:Mo(k.ttfcMs)}),T!==null&&E.push({label:"Throughput",value:`${T.toFixed(1)} tok/s`}),k.responseId&&E.push({label:"Response ID",value:k.responseId}),E.length===0?null:(0,g.jsx)("div",{"data-testid":"trace-span-metadata",className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:E.map(R=>(0,g.jsxs)("span",{className:"truncate",children:[(0,g.jsxs)("span",{className:"text-muted-foreground/70",children:[R.label,":"," "]}),(0,g.jsx)("span",{className:"font-medium text-foreground",children:R.value})]},R.label))})})():null]})]}),A?(0,g.jsx)("div",{className:"flex min-w-0 min-[400px]:flex-1 min-[400px]:justify-end min-[400px]:pt-0.5",children:(0,g.jsxs)(Pt,{type:"button",size:"sm",variant:"outline",className:"w-full shrink-0 justify-center whitespace-nowrap min-[400px]:w-auto",onClick:()=>{o&&r&&r(o)},children:[(0,g.jsx)(AD,{className:"h-3.5 w-3.5"}),"Reveal in Chat"]})}):null]}),e.kind==="prompt"&&b?(0,g.jsx)("div",{className:"min-h-0 max-h-[min(60vh,28rem)] flex-1 overflow-auto rounded-md border border-border/50 bg-muted/10 px-3 py-2 text-xs leading-relaxed text-foreground",children:b}):null,t&&e.kind==="span"&&e.span.messageStartIndex===void 0?(0,g.jsx)("p",{className:"text-xs text-muted-foreground",children:"Message details are unavailable for this span. Read the conversation in Chat."}):e.kind==="span"?(0,g.jsxs)("div",{className:"space-y-4",children:[(0,g.jsxs)("div",{className:"space-y-2",children:[(0,g.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Input"}),(0,g.jsx)(Px,{value:y??void 0})]}),(0,g.jsxs)("div",{className:Q("space-y-2",e.span.category==="error"||C?"rounded-md border border-destructive/50 bg-destructive/50 p-2":""),children:[(0,g.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Output"}),(0,g.jsx)(Px,{value:x??void 0}),C?(0,g.jsx)("pre",{className:"max-h-40 overflow-auto rounded-md border border-destructive/50 bg-destructive/50 p-3 text-xs whitespace-pre-wrap break-words text-foreground",children:C}):null,typeof e.span.mcpErrorCode=="number"?(0,g.jsxs)("div",{"data-testid":"trace-mcp-error-code",className:"text-[11px] tabular-nums text-muted-foreground",title:"MCP-layer error code. -32602/-32601 etc. are server JSON-RPC errors; -32000 (connection closed) / -32001 (request timeout) are transport/client failures, not server faults.",children:[(0,g.jsx)("span",{className:"text-muted-foreground/70",children:"MCP error: "}),(0,g.jsx)("span",{className:"font-medium text-foreground",children:oU(e.span.mcpErrorCode)})]}):null]})]}):null]})}function Z6({recordedSpans:e,projectedMessages:t=!1,interactionSteps:n,estimatedDurationMs:r,transcriptMessageCount:i=0,transcriptMessages:s=[],traceStartedAtMs:o=null,traceEndedAtMs:a=null,onRevealInTranscript:l,hideToolbar:c=!1,timelineFilter:u,onTimelineFilterChange:h,expandedPromptIds:f,onExpandedPromptIdsChange:d,expandedStepIds:p,onExpandedStepIdsChange:v,viewportMaxMs:y,turnRuntimeByPromptIndex:x,fillContent:b=!1,detailPlacement:w="below"}){const{containerRef:S,direction:C}=mU(w),A=C==="horizontal",k=(0,m.useMemo)(()=>t?hU(e??[],s):void 0,[t,e,s]),T=k?.spans??e,E=$E(),R=mE(),I=T&&T.length>0?"recorded":(r??0)>0?"estimated":"none",M=(0,m.useMemo)(()=>T?.length?NU(T).map(O=>k?{...O,messageStartIndex:k.userIndices[O.promptIndex]??-1,messageEndIndex:k.userIndices[O.promptIndex]??-1}:O):[],[T,k]),L=(0,m.useMemo)(()=>{const O=new Map;for(const le of n??[]){const de=O.get(le.toolCallId);de?de.push(le):O.set(le.toolCallId,[le])}for(const le of O.values())le.sort((de,Ie)=>de.stepIndex-Ie.stepIndex);return O},[n]),N=T?.length?T.reduce((O,le)=>Math.max(O,le.endMs),1):Math.max(r??0,1),P=(0,m.useMemo)(()=>T?.map(O=>`${O.id}:${O.startMs}:${O.endMs}`).join("|")??I,[I,T]),[_,B]=(0,m.useState)(1);(0,m.useEffect)(()=>{y===void 0&&B(N)},[N,P,y]);const $=Math.max(1,y!==void 0?y:_),F=Math.max(1,Math.round(N/50)),D=(0,m.useMemo)(()=>GU({traceStartedAtMs:o,traceEndedAtMs:a,traceDurationMs:N}),[N,a,o]),[ae,oe]=(0,m.useState)("all"),j=u!==void 0?u:ae,q=h??oe,[Y,K]=(0,m.useState)(new Set),[H,ee]=(0,m.useState)(new Set),te=f!==void 0?f:Y,he=d??K,re=p!==void 0?p:H,_e=v??ee,[Pe,je]=(0,m.useState)(null),[Me,Ge]=(0,m.useState)(null),[wi,$e]=(0,m.useState)(null),Ft=(0,m.useRef)(null),Si=(0,m.useRef)(null),[Qe,X]=(0,m.useState)(-1);(0,m.useLayoutEffect)(()=>{const O=Si.current;if(!O)return;const le=()=>{const Ie=O.getBoundingClientRect().width;X(Number.isFinite(Ie)?Ie:0)};if(le(),typeof ResizeObserver>"u")return;const de=new ResizeObserver(le);return de.observe(O),()=>de.disconnect()},[C]);const ve=(0,m.useMemo)(()=>bU(Qe),[Qe]),Be=(0,m.useMemo)(()=>ve.length!==2?!1:Qe<0||Qe===0?!0:Qe<xU,[Qe,ve]);(0,m.useEffect)(()=>{c||(K(new Set(M.map(O=>O.key))),ee(Ex(M)))},[c,M]);const Re=(0,m.useMemo)(()=>{if(I!=="recorded")return[];const O=[],le=new Set;function de(ie){return j==="all"?!0:j==="error"?Yi(ie,s,t):ie.category===j}function Ie(ie,zt,hn){const zr=ie.span.category==="step",$t=zr?hn:hn+1,fn=ie.children.map(bt=>Ie(bt,zt,$t)),Ls=fn.flatMap(bt=>bt.rows),_s=fn.some(bt=>bt.hasVisibleContent);if(zr)return{hasVisibleContent:_s||ie.children.length>0,rows:Ls};if(ie.span.category==="llm"&&typeof ie.span.totalTokens!="number"&&typeof ie.span.inputTokens!="number"&&typeof ie.span.outputTokens!="number"&&ie.span.endMs-ie.span.startMs<50)return{hasVisibleContent:!1,rows:[]};const Ln=ie.span.toolCallId,js=ie.span.category==="tool"&&!!Ln&&!le.has(Ln);js&&Ln&&le.add(Ln);const Ra=js&&Ln?(L.get(Ln)??[]).filter(bt=>j==="all"||j==="tool"?!0:j==="error"?Rc(bt)==="error":!1).map((bt,Au)=>({kind:"interaction",key:`interaction-${ie.span.id}-${bt.stepIndex}-${Au}`,promptIndex:zt,depth:hn+1,step:bt,startMs:ie.span.startMs,endMs:ie.span.endMs,status:Rc(bt)})):[];if(!(de(ie.span)||_s||Ra.length>0))return{hasVisibleContent:_s,rows:Ls};const Bs={kind:"span",key:ie.span.id,promptIndex:zt,depth:hn,span:ie.span,hasChildren:ie.children.length>0,isExpanded:re.has(ie.span.id)};return{hasVisibleContent:!0,rows:[Bs,...Bs.hasChildren&&Bs.isExpanded?Ls:[],...Ra]}}for(const ie of M){const zt=ie.roots.map(fn=>Ie(fn,ie.promptIndex,0)).flatMap(fn=>fn.rows);if(!(zt.length>0||j==="all"&&ie.spans.length>0))continue;const hn=ie.spans.some(fn=>Yi(fn,s,t)),zr=VU(s,ie.messageStartIndex,ie.messageEndIndex),$t=SU(ie.spans);O.push({kind:"prompt",key:ie.key,promptIndex:ie.promptIndex,label:ie.label,conversationLabel:zr?`User: "${zr}"`:void 0,startMs:ie.startMs,endMs:ie.endMs,messageStartIndex:ie.messageStartIndex,messageEndIndex:ie.messageEndIndex,counts:ie.counts,hasAnyFailure:hn,isExpanded:te.has(ie.key),aggregatedInputTokens:$t.inputTokens,aggregatedOutputTokens:$t.outputTokens,aggregatedTotalTokens:$t.totalTokens}),te.has(ie.key)&&O.push(...zt)}return O},[te,re,j,M,L,I,s,t]),at=(0,m.useMemo)(()=>Ex(M),[M]),Fr=(0,m.useMemo)(()=>{if(M.length===0)return!1;for(const O of M)if(!te.has(O.key))return!1;for(const O of at)if(!re.has(O))return!1;return!0},[M,te,re,at]);(0,m.useEffect)(()=>{if(Re.length===0){je(null);return}(!Pe||!Re.some(O=>O.key===Pe))&&je(Re[0].key)},[Re,Pe]);const Vt=Re.find(O=>O.key===Pe),ke=Me?Re.find(O=>O.key===Me):void 0,Ta=Me?Re.findIndex(O=>O.key===Me):-1;(0,m.useEffect)(()=>{Me&&!Re.some(O=>O.key===Me)&&(Ge(null),$e(null),Ft.current=null)},[Me,Re]);const ki=(0,m.useCallback)(O=>{const le=(O.querySelector('[data-testid="trace-row-glyph"]')??O).getBoundingClientRect();return{anchorX:le.left+le.width/2,anchorY:le.top,anchorBottom:le.bottom}},[]);(0,m.useEffect)(()=>{if(!Me)return;const O=()=>{const le=Ft.current;le&&$e(ki(le))};return window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[Me,ki]);const Ea=(0,m.useMemo)(()=>{if(!ke)return null;const{startMs:O,endMs:le}=dp(ke),de=ke.kind==="span"&&Yi(ke.span,s,t),Ie=ke.kind==="span"?fp(ke,s,t,R(ke.span)):null,ie=ke.kind==="prompt"?ke.conversationLabel??ke.label:ke.kind==="interaction"?Cs(ke.step):Ie.title,zt=KU(ke,T),hn=ke.kind==="prompt"?"prompt":ke.kind==="interaction"?"interaction":ke.span.category==="tool"&&de?"error":ke.span.category;return{label:ie,spanShowsFailure:de,tokenStats:zt,rowStartTimestamp:D!==null?D+O:null,rowEndTimestamp:D!==null?D+le:null,glyphCategory:hn}},[ke,T,D,s,t,R]),Vr=(0,m.useCallback)(O=>{if(Re.length===0)return;const le=Re.findIndex(de=>de.key===Pe);if(O.key==="ArrowDown"){O.preventDefault();const de=le<0?0:Math.min(Re.length-1,le+1);je(Re[de].key);return}if(O.key==="ArrowUp"){O.preventDefault();const de=le<=0?0:le-1;je(Re[de].key);return}if(O.key==="Enter"&&le>=0){const de=Re[le];if(de.kind==="prompt"){O.preventDefault();const Ie=new Set(te);Ie.has(de.key)?Ie.delete(de.key):Ie.add(de.key),he(Ie);return}if(de.kind==="span"&&de.hasChildren){O.preventDefault();const Ie=new Set(re);Ie.has(de.key)?Ie.delete(de.key):Ie.add(de.key),_e(Ie)}}},[te,re,Re,Pe,he,_e]);if(I==="none")return(0,g.jsx)("div",{className:"text-xs text-muted-foreground",children:"No timing data recorded for this iteration."});if(I==="estimated")return(0,g.jsxs)("div",{className:"space-y-3",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsx)(E1,{className:"border-warning/50 bg-warning/50 text-foreground",children:"Estimated total only"}),(0,g.jsx)("span",{className:"text-xs text-muted-foreground",children:Mo(r??0)})]}),(0,g.jsxs)("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[(0,g.jsx)("p",{children:"Per-step timing was not recorded for this run."}),i>0?(0,g.jsxs)("p",{children:["Conversation detail is in the Chat tab. Open"," ",(0,g.jsx)("span",{className:"font-medium text-foreground/80",children:"Raw"})," to inspect the stored trace and confirm whether a"," ",(0,g.jsx)("code",{className:"rounded border border-border/50 bg-muted/40 px-1 py-px font-mono text-[10px] text-foreground/90",children:"spans"})," ","array exists; only new runs that persist spans show a per-step timeline here."]}):null]})]});const Ma=y===void 0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(Pt,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom in timeline","aria-label":"Zoom in timeline",disabled:_<=F,onClick:()=>B(O=>Math.max(F,Math.round(O*.8))),children:(0,g.jsx)(PD,{className:"size-3.5","aria-hidden":!0})}),(0,g.jsx)(Pt,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom out timeline","aria-label":"Zoom out timeline",disabled:_>=N*4,onClick:()=>B(O=>Math.min(N*4,Math.round(O*1.25))),children:(0,g.jsx)(ED,{className:"size-3.5","aria-hidden":!0})})]}):null;return(0,g.jsxs)("div",{className:Q("space-y-2",b&&"flex min-h-0 flex-1 flex-col"),children:[c?null:(0,g.jsxs)("div",{className:b?"shrink-0":void 0,children:[(0,g.jsx)(vU,{filter:j,onFilterChange:q,isFullyExpanded:Fr,expandDisabled:M.length===0,zoomControls:Ma,onToggleExpandAll:()=>{Fr?(he(new Set),_e(new Set)):(he(new Set(M.map(O=>O.key))),_e(new Set(at)))}}),(0,g.jsx)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 px-1 text-xs text-muted-foreground",children:[{label:"User",cls:"trace-waterfall-bar-prompt"},{label:"Connect",cls:"trace-waterfall-bar-step"},{label:"Discovery",cls:"trace-waterfall-bar-step"},{label:"LLM",cls:"trace-waterfall-bar-llm"},{label:"Tool",cls:"trace-waterfall-bar-tool"},{label:"Step",cls:"trace-waterfall-bar-step"},{label:"Error",cls:"trace-waterfall-bar-error"}].map(({label:O,cls:le})=>(0,g.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,g.jsx)("span",{className:Q("h-2 w-2.5 rounded-sm",le)}),O]},O))})]}),(0,g.jsx)("div",{ref:S,className:Q("@container/trace-timeline min-w-0",b&&"flex min-h-0 flex-1 flex-col"),children:(0,g.jsxs)(V4,{direction:C,className:Q("rounded-lg border border-border/50 bg-background",b?"min-h-0 flex-1 overflow-hidden":"min-h-[min(25rem,calc(100dvh-8rem))]"),style:b?void 0:{height:"auto"},children:[(0,g.jsx)(up,{defaultSize:A?62:65,minSize:0,className:"min-h-0 min-w-0 overflow-hidden",children:(0,g.jsx)(U4,{className:Q(b?"h-full min-h-0 overflow-hidden":"max-h-[calc(100vh-8rem)] min-h-0"),children:(0,g.jsx)("div",{tabIndex:0,role:"region","aria-label":"Trace timeline. Use arrow keys to change selection, Enter to expand.",onKeyDown:Vr,className:"relative min-h-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:(0,g.jsxs)("div",{className:"grid pr-4",style:{gridTemplateColumns:"minmax(140px, 260px) minmax(0, 1fr) minmax(5.25rem, max-content)",gridTemplateRows:`auto repeat(${Re.length}, minmax(48px, auto))`},children:[(0,g.jsx)("div",{className:"sticky top-0 z-20 border-b border-border/50 bg-background/95 px-4 py-1.5 backdrop-blur",style:{gridColumn:"1 / 3",gridRow:1},children:(0,g.jsxs)("div",{className:"flex min-h-6 min-w-0 items-center gap-3",children:[(0,g.jsx)("div",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:"Trace"}),(0,g.jsx)("div",{className:"min-h-6 min-w-0 flex-1",children:(0,g.jsx)("div",{ref:Si,className:"relative h-6 min-w-0",children:Be?(0,g.jsx)("div",{className:"flex h-full min-w-0 items-center justify-center",children:(0,g.jsx)("span",{className:"min-w-0 max-w-full truncate text-center text-[10px] tabular-nums text-muted-foreground",title:Ax($),children:Ax($)})}):ve.map(O=>{const le=O>=100?"100%":`${O}%`;return(0,g.jsx)("div",{className:"pointer-events-none absolute inset-y-0",style:{left:le},children:(0,g.jsx)("div",{className:Q("absolute text-[10px] tabular-nums text-muted-foreground",wU(O)),children:Ql($*O/100)})},O)})})})]})}),(0,g.jsx)("div",{className:"sticky top-0 z-20 flex min-h-0 items-center border-b border-l border-border/50 bg-background/95 px-3 py-1.5 pl-4 backdrop-blur",style:{gridColumn:3,gridRow:1},children:(0,g.jsxs)("div",{className:"flex h-6 w-full min-w-0 items-center justify-start gap-1.5",children:[(0,g.jsx)(Bg,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,g.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Latency"})]})}),Re.length>0?(0,g.jsx)("div",{className:"pointer-events-none relative z-0 bg-transparent",style:{gridColumn:2,gridRow:`2 / ${Re.length+2}`},children:ve.map(O=>(0,g.jsx)("div",{className:"absolute top-0 bottom-0 w-px bg-border/40",style:{left:O>=100?"100%":`${O}%`}},O))}):null,Re.map((O,le)=>{const de=O.key===Pe,{startMs:Ie,endMs:ie,durationMs:zt}=dp(O),hn=Ie/$*100,zr=Math.max((ie-Ie)/$*100,.45),$t=O.kind==="span"&&Yi(O.span,s,t),fn=O.kind==="prompt"?"prompt":O.kind==="interaction"?"interaction":O.span.category==="tool"&&$t?"error":O.span.category,Ls=O.kind==="interaction"&&O.status==="error",_s=O.kind==="span"?fp(O,s,t):null,Ln=O.kind==="prompt"?O.conversationLabel??O.label:O.kind==="interaction"?Cs(O.step):_s.title,js=Mo(zt),Ra=O.kind==="prompt"?!0:O.kind==="interaction"?!1:O.hasChildren||O.span.category==="llm",Bs=le+2,bt=DU(O,$t),Au=IU(O,$t),cg=()=>{Vf("trace_span_clicked",{location:"trace_timeline",span_kind:O.kind}),je(O.key)},Tu=wt=>{wt.stopPropagation(),cg()},bE=de?Q("bg-transparent",bt):"border-l-transparent bg-background group-hover:bg-muted/20 hover:bg-muted/20",ug=de?"bg-transparent":"bg-background group-hover:bg-muted/20 hover:bg-muted/20";return(0,g.jsxs)(Fk.div,{"data-testid":"trace-row","data-state":de?"selected":void 0,onClick:cg,onMouseEnter:wt=>{Ge(O.key);const St=wt.currentTarget;Ft.current=St,$e(ki(St))},onMouseLeave:()=>{Ge(wt=>wt===O.key?null:wt),$e(null),Ft.current=null},onFocus:wt=>{Ge(O.key);const St=wt.currentTarget;Ft.current=St,$e(ki(St))},onBlur:wt=>{wt.currentTarget.contains(wt.relatedTarget)||(Ge(St=>St===O.key?null:St),$e(null),Ft.current=null)},initial:E||le>=20?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:E||le>=20?{duration:0}:{duration:.15,delay:le*.03+.05,ease:[.16,1,.3,1]},style:{gridColumn:"1 / 4",gridRow:Bs,display:"grid",gridTemplateColumns:"subgrid"},className:Q("group min-h-0 min-w-0 cursor-pointer items-stretch",de&&"trace-waterfall-row-selected ring-1 ring-inset ring-ring/40"),children:[(0,g.jsxs)("div",{className:Q("flex items-center gap-2 border-b border-border/40 px-4 py-2 transition-all duration-150 border-l-2",bE),children:[(0,g.jsx)("div",{className:"flex shrink-0 items-center",style:{paddingLeft:O.kind==="prompt"?0:O.depth*16},children:Ra?(0,g.jsx)("button",{type:"button",className:"mr-1 inline-flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted/30 hover:text-foreground",onClick:wt=>{if(wt.stopPropagation(),O.kind==="prompt"){const Pa=new Set(te);Pa.has(O.key)?Pa.delete(O.key):Pa.add(O.key),he(Pa);return}const St=new Set(re);St.has(O.key)?St.delete(O.key):St.add(O.key),_e(St)},"aria-label":O.kind==="prompt"?`${O.isExpanded?"Collapse":"Expand"} ${O.label}`:`${"isExpanded"in O&&O.isExpanded?"Collapse":"Expand"} ${Ln}`,children:"isExpanded"in O&&O.isExpanded?(0,g.jsx)(Dw,{className:"h-3.5 w-3.5"}):(0,g.jsx)(us,{className:"h-3.5 w-3.5"})}):(0,g.jsx)("span",{className:"mr-1 h-5 w-5"})}),(0,g.jsx)("button",{type:"button","data-testid":"trace-row-label-button",className:"min-w-0 flex-1 text-left",onClick:Tu,children:(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,g.jsx)("span",{"data-testid":"trace-row-glyph",className:"inline-flex shrink-0 items-center",children:O.kind==="prompt"?(0,g.jsx)(As,{category:"prompt"}):(0,g.jsx)(As,{category:fn})}),(0,g.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:Ln}),(0,g.jsx)(PV,{name:O.kind==="span"?R(O.span):void 0}),O.kind==="prompt"&&O.hasAnyFailure?(0,g.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Contains errors","aria-label":"Contains errors"}):null,O.kind==="span"&&$t||Ls?(0,g.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]})})]}),(0,g.jsx)("button",{type:"button","data-testid":"trace-row-bar-hit","data-state":de?"selected":void 0,className:Q("relative z-[1] flex min-h-[48px] w-full items-center overflow-hidden border-b border-border/40 border-l-2 border-l-transparent px-4 py-2 text-left transition-all duration-150",ug),"aria-label":`Select on timeline (${Mo(zt)})`,onClick:Tu,children:(0,g.jsx)("div",{"data-testid":O.kind==="span"&&$t?"trace-row-bar-error":"trace-row-bar",className:Q("absolute top-1/2 z-[1] h-4 min-w-0 -translate-y-1/2 rounded-[3px] transition-[left,width] duration-150",Au),style:{left:`${hn}%`,width:`max(${zr}%, 3px)`}})}),(0,g.jsxs)("button",{type:"button","data-testid":"trace-row-duration-hit","data-state":de?"selected":void 0,className:Q("flex min-h-[48px] items-center justify-start gap-1.5 whitespace-nowrap border-b border-l border-border/40 px-3 py-2 pl-4 text-[11px] tabular-nums text-muted-foreground transition-all duration-150",ug),"aria-label":`Select row duration (${js})`,onClick:Tu,children:[(0,g.jsx)(Bg,{className:"size-3 shrink-0 opacity-80","aria-hidden":!0}),js]})]},O.key)})]})})})}),(0,g.jsx)(z4,{withHandle:!0}),(0,g.jsx)(up,{defaultSize:A?38:35,minSize:A?25:20,className:"min-h-0 min-w-0 overflow-hidden",children:(0,g.jsx)("div",{"data-testid":"trace-timeline-detail-sticky",className:"h-full min-h-0 min-w-0 max-h-full overflow-y-auto",children:(0,g.jsx)(JU,{projectedMessages:t,row:Vt,transcriptMessages:s,onRevealInTranscript:l,turnRuntimeByPromptIndex:x})})})]},C)}),ke&&Ea&&wi?(0,g.jsx)(ZU,{hoverPos:wi,info:Ea,placement:Ta===0?"bottom":"top",reduceMotion:E??!1,rowKey:ke.key}):null]})}function ZU({hoverPos:e,info:t,placement:n,reduceMotion:r,rowKey:i}){if(typeof document>"u")return null;const s=304,o=12,a=8,l=s/2,c=typeof window<"u"?window.innerWidth:e.anchorX+l+o,u=164,h=Math.max(u,c-l-o),f=Math.min(Math.max(e.anchorX,u),h),d={position:"fixed",top:n==="top"?e.anchorY-a:e.anchorBottom+a,left:f,transform:n==="top"?"translate(-50%, -100%)":"translateX(-50%)",zIndex:9999};return(0,oa.createPortal)((0,g.jsx)("div",{className:"pointer-events-none",style:d,children:(0,g.jsx)(Fk.div,{"data-placement":n,"data-testid":"trace-row-hover-content",initial:r?!1:{opacity:0,y:6,filter:"blur(2px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},transition:{duration:.16,ease:[.16,1,.3,1]},className:"w-[19rem] overflow-hidden rounded-md border border-border/60 bg-popover text-popover-foreground shadow-xl",children:(0,g.jsxs)("div",{"data-testid":"trace-row-hover-card",className:"space-y-3 p-3",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,g.jsx)(As,{category:t.glyphCategory}),(0,g.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-semibold text-popover-foreground",children:t.label})]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Time"}),(0,g.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,g.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Start"}),(0,g.jsx)("span",{"data-testid":"trace-row-hover-start",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:Rx(t.rowStartTimestamp)})]}),(0,g.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,g.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"End"}),(0,g.jsx)("span",{"data-testid":"trace-row-hover-end",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:Rx(t.rowEndTimestamp)})]})]})]}),(0,g.jsxs)("div",{className:"space-y-1.5",children:[(0,g.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Tokens"}),(0,g.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,g.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,g.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Input"}),(0,g.jsx)("span",{"data-testid":"trace-row-hover-input-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:qh(t.tokenStats.inputTokens)})]}),(0,g.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,g.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Output"}),(0,g.jsx)("span",{"data-testid":"trace-row-hover-output-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:qh(t.tokenStats.outputTokens)})]}),(0,g.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,g.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Total"}),(0,g.jsx)("span",{"data-testid":"trace-row-hover-total-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:qh(t.tokenStats.totalTokens)})]})]})]})]})},i)}),document.body)}export{wV as $,Cq as $n,Bc as $r,Vf as $t,tg as A,jq as An,ED as Ar,Wf as At,PV as B,Mq as Bn,yD as Br,Am as Bt,l4 as C,$q as Cn,LD as Cr,x6 as Ct,t4 as D,Iq as Dn,PD as Dr,rV as Dt,o4 as E,_q as En,DD as Er,f6 as Et,_W as F,rB as Fn,SD as Fr,qF as Ft,P6 as G,pq as Gn,dw as Gr,tu as Gt,N1 as H,Fj as Hn,Dw as Hr,s6 as Ht,DW as I,ds as In,wD as Ir,c6 as It,E0 as J,Gj as Jn,Wb as Jr,n6 as Jt,R6 as K,zk as Kn,rI as Kr,i6 as Kt,MW as L,Zj as Ln,bD as Lr,KF as Lt,NT as M,Lt as Mn,AD as Mr,l6 as Mt,$6 as N,Nq as Nn,CD as Nr,a6 as Nt,W6 as O,Oq as On,RD as Or,d6 as Ot,BW as P,vm as Pn,kD as Pr,u6 as Pt,pr as Q,qj as Qn,Mp as Qr,e6 as Qt,iz as R,Pq as Rn,Ji as Rr,pt as Rt,V4 as S,Vq as Sn,_D as Sr,b6 as St,eg as T,Dq as Tn,Uc as Tr,h6 as Tt,I6 as U,Vj as Un,cs as Ur,a1 as Ut,D6 as V,Xj as Vn,us as Vr,HB as Vt,O6 as W,dq as Wn,vD as Wr,_B as Wt,E6 as X,Tq as Xn,$P as Xr,IB as Xt,kV as Y,Sq as Yn,jb as Yr,PB as Yt,fr as Z,Kj as Zn,Bb as Zr,t6 as Zt,q4 as _,eM as _i,Wq as _n,HD as _r,uV as _t,vU as a,PM as ai,Uq as an,gq as ar,S6 as at,z4 as b,Hq as bn,Xs as br,v6 as bt,Q6 as c,et as ci,km as cn,yq as cr,gs as ct,uU as d,Nn as di,Qq as dn,P_ as dr,S1 as dt,bb as ei,AB as en,Eq as er,dr as et,K6 as f,la as fi,Xq as fn,Ek as fr,gV as ft,U4 as g,or as gi,Kq as gn,zg as gr,Pl as gt,X4 as h,gp as hi,t1 as hn,$p as hr,Mm as ht,bU as i,ub as ii,s1 as in,xq as ir,k6 as it,H6 as j,Lq as jn,TD as jr,JF as jt,s4 as k,Fq as kn,MD as kr,p6 as kt,Y6 as l,Ic as li,qq as ln,Jc as lr,w6 as lt,fE as m,ne as mi,bm as mn,we as mr,g6 as mt,NU as n,yb as ni,Jq as nn,Aq as nr,T6 as nt,X6 as o,tb as oi,e1 as on,bq as or,C6 as ot,q6 as p,Et as pi,mB as pn,tL as pr,ru as pt,M6 as q,mq as qn,nI as qr,r6 as qt,Ex as r,wp as ri,SB as rn,wq as rr,E1 as rt,J6 as s,EM as si,n1 as sn,vq as sr,A6 as st,Z6 as t,bR as ti,Zq as tn,kq as tr,SV as tt,aU as u,ci as ui,Gq as un,Fk as ur,vV as ut,U6 as v,Le as vi,Yq as vn,sS as vr,lV as vt,HT as w,Bq as wn,ND as wr,iu as wt,up as x,zq as xn,jD as xr,y6 as xt,Gs as y,yB as yn,uq as yr,cV as yt,ZV as z,Rq as zn,Bg as zr,Em as zt};
|
|
72
72
|
|
|
73
|
-
//# sourceMappingURL=trace-timeline-
|
|
73
|
+
//# sourceMappingURL=trace-timeline-Dy5i1YGh.js.map
|