@mcpjam/inspector 3.25.0 → 3.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/client/assets/{app-bootstrap-B0ohyOMl.js → app-bootstrap-1nvCvKTu.js} +354 -351
  2. package/dist/client/assets/{chunk-D32TOXHM-MneJPvPC.js → chunk-D32TOXHM-oQ9_W5Z_.js} +5 -5
  3. package/dist/client/assets/{dead-clicks-autocapture-DC9Z9VB5.js → dead-clicks-autocapture-4b8CtYsH.js} +2 -2
  4. package/dist/client/assets/{error-reporting-DsDKfNVF.js → error-reporting-BSiw4y1I.js} +9 -9
  5. package/dist/client/assets/{error-reporting-hY9lyoJJ.js → error-reporting-Dtp0I_co.js} +1 -1
  6. package/dist/client/assets/{exception-autocapture-w_j-Oyq-.js → exception-autocapture-B7NhdXJS.js} +2 -2
  7. package/dist/client/assets/{first-run-oauth-return-D0E8fVKg.js → first-run-oauth-return-Ctdtlees.js} +16 -16
  8. package/dist/client/assets/first-run-oauth-return-DS6OM0jO.css +2 -0
  9. package/dist/client/assets/{highlighted-body-KQOG7T2V-BD6yPYrW.js → highlighted-body-KQOG7T2V-Bkm2yeWV.js} +2 -2
  10. package/dist/client/assets/{index-I96JP9uw.js → index-BJZmdbiq.js} +3 -3
  11. package/dist/client/assets/{jszip.min-BZVJMp2E.js → jszip.min-BMhd-tDN.js} +2 -2
  12. package/dist/client/assets/{mermaid-MCJ5UELQ-DG05h9Xg.js → mermaid-MCJ5UELQ-BH89GBNu.js} +1 -1
  13. package/dist/client/assets/{posthog-recorder-CZEu8Y9o.js → posthog-recorder-BYAtjhGv.js} +2 -2
  14. package/dist/client/assets/{preload-helper-UqNYLmmu.js → preload-helper-SIk4t7Ze.js} +2 -2
  15. package/dist/client/assets/{project-route-C2WvAoxe.js → project-route-CVSc0mXZ.js} +3 -3
  16. package/dist/client/assets/{react-dom-CU8BLdi6.js → react-dom-CeQ1Kv3m.js} +2 -2
  17. package/dist/client/assets/{rolldown-runtime-CYCouw1w.js → rolldown-runtime-COoCppmG.js} +1 -1
  18. package/dist/client/assets/{surveys-Cewj4cwA.js → surveys-CS6JUc-z.js} +2 -2
  19. package/dist/client/assets/telemetry-files-fac3cc064e66cb1e.js +1 -0
  20. package/dist/client/assets/{trace-timeline-B70MN4E4.js → trace-timeline-CKGcby6S.js} +2 -2
  21. package/dist/client/assets/{trace-timeline-B-KwRgHD.js → trace-timeline-b3f1aE0g.js} +1 -1
  22. package/dist/client/assets/{use-reduced-motion-BzX6z0LV.js → use-reduced-motion-iJQiY9UT.js} +2 -2
  23. package/dist/client/assets/{web-vitals-Czc_9TLY.js → web-vitals-p0pJml2T.js} +2 -2
  24. package/dist/client/index.html +9 -9
  25. package/dist/server/harness-install-cli.js +45 -446
  26. package/dist/server/index.js +2 -2
  27. package/package.json +3 -2
  28. package/dist/client/assets/first-run-oauth-return-CiDazsMV.css +0 -2
  29. package/dist/client/assets/telemetry-files-aebfc22a23a94012.js +0 -1
@@ -1,4 +1,4 @@
1
- import{o as Xx}from"./rolldown-runtime-CYCouw1w.js";import{Dt as Ge,Gt as lf,It as nt,Kt as yo,Lt as Mr,Nt as br,Tt as Qt,Ut as ve,Vt as Sl,bt as xo,ft as zc,mt as GE,wt as Jx}from"./project-route-C2WvAoxe.js";import{Dt as QE,Gt as Wn,Ht as cf,Jt as YE,Kt as XE,Ot as JE,T as ZE,Ut as In,Wt as sc,Z as Zx,Zi as eM,c as tM,ds as nM,et as rM,fs as iM,ms as eb,ot as Mg,ps as tb,qt as sM,t as oM,w as Rg,y as aM}from"./error-reporting-DsDKfNVF.js";import{A as cs,C as lM,D as G,H as cM,I as nb,N as Ce,O as uM,S as hM,T as Ot,V as Mp,i as fM,j as dM,k as pM,n as mM,r as gM,t as vM,w as xe,z as yM}from"./use-reduced-motion-BzX6z0LV.js";import{n as xM,t as bM}from"./react-dom-CU8BLdi6.js";import{i as wM}from"./preload-helper-UqNYLmmu.js";import{a as SM,c as kM,n as CM,o as AM}from"./chunk-D32TOXHM-MneJPvPC.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.25.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c80ceb55-37e6-46cf-9417-4ede68dcfb2b",e._sentryDebugIdIdentifier="sentry-dbid-c80ceb55-37e6-46cf-9417-4ede68dcfb2b")}catch{}})();var g=Xx(xM(),1),pa=Xx(bM(),1),p=wM(),TM=Object.defineProperty,EM=(e,t)=>TM(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=cs(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,p.jsx)(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rp(e,t){e&&pa.flushSync(()=>e.dispatchEvent(t))}EM(Rp,"dispatchDiscreteCustomEvent");var MM=Object.defineProperty,RM=(e,t)=>MM(e,"name",{value:t,configurable:!0}),PM=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"}),IM=g.forwardRef(RM(function(t,n){return(0,p.jsx)(Le.span,{...t,ref:n,style:{...PM,...t.style}})},"VisuallyHidden")),OM=IM,DM=Object.defineProperty,Dt=(e,t)=>DM(e,"name",{value:t,configurable:!0});function NM(e,t){const n=g.createContext(t);n.displayName=e+"Context";const r=Dt(s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return(0,p.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=g.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Dt(i,"useContext"),[r,i]}Dt(NM,"createContext");function cr(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=Dt(h=>{const{scope:f,children:d,...m}=h,v=f?.[e]?.[l]||a,y=g.useMemo(()=>m,Object.values(m));return(0,p.jsx)(v.Provider,{value:y,children:d})},"Provider");c.displayName=s+"Provider";function u(h,f,d={}){const{optional:m=!1}=d,v=f?.[e]?.[l]||a,y=g.useContext(v);if(y)return y;if(o!==void 0)return o;if(!m)throw new Error(`\`${h}\` must be used within \`${s}\``)}return Dt(u,"useContext"),[c,u]}Dt(r,"createContext");const i=Dt(()=>{const s=n.map(o=>g.createContext(o));return Dt(function(a){const l=a?.[e]||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,rb(i,...t)]}Dt(cr,"createContextScope");function rb(...e){const t=e[0];if(e.length===1)return t;const n=Dt(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Dt(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Dt(rb,"composeContextScopes");var LM=Object.defineProperty,Ye=(e,t)=>LM(e,"name",{value:t,configurable:!0});function Pp(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Ye(v=>{const{scope:y,children:x}=v,b=g.useRef(null),w=g.useRef(new Map).current;return(0,p.jsx)(i,{scope:y,itemMap:w,collectionRef:b,children:x})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=cs(a),c=g.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),S=Ce(y,w.collectionRef);return(0,p.jsx)(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=cs(u),d=g.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=g.useRef(null),C=Ce(y,S),A=s(u,x);return g.useEffect(()=>(A.itemMap.set(S,{ref:S,...w}),()=>{A.itemMap.delete(S)})),(0,p.jsx)(f,{[h]:"",ref:C,children:b})});d.displayName=u;function m(v){const y=s(e+"CollectionConsumer",v);return g.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 Ye(m,"useCollection"),[{Provider:o,Slot:c,ItemSlot:d},m,r]}Ye(Pp,"createCollection");var Pg=new WeakMap,$u=class dr extends Map{static{Ye(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],Pg.set(this,!0)}set(t,n){return Pg.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=Ip(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 m=u[d];u[d]===n&&(m=u[d+1]),i&&this.delete(n),h=this.get(m),this.set(n,r)}else{!f&&u[d-1]===n&&(f=!0);const m=u[f?d:d-1],v=h;h=this.get(m),this.delete(m),this.set(m,v)}return this}with(t,n,r){const i=new dr(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=kl(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=kl(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return kl(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 dr(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 dr(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 dr(n)}toReversed(){const t=new dr;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 dr(n)}slice(t,n){const r=new dr;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 kl(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=ib(e,t);return n===-1?void 0:e[n]}Ye(kl,"at");function ib(e,t){const n=e.length,r=Ip(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Ye(ib,"toSafeIndex");function Ip(e){return e!==e||e===0?0:Math.trunc(e)}Ye(Ip,"toSafeInteger");function _M(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new $u,setItemMap:Ye(()=>{},"setItemMap")}),o=Ye(({state:b,...w})=>b?(0,p.jsx)(l,{...w,state:b}):(0,p.jsx)(a,{...w}),"CollectionProvider");o.displayName=t;const a=Ye(b=>{const w=y();return(0,p.jsx)(l,{...b,state:w})},"CollectionInit");a.displayName=t+"Init";const l=Ye(b=>{const{scope:w,children:S,state:C}=b,A=g.useRef(null),[k,E]=g.useState(null),T=Ce(A,E),[R,P]=C;return g.useEffect(()=>{if(!k)return;const M=ab(()=>{});return M.observe(k,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[k]),(0,p.jsx)(i,{scope:w,itemMap:R,setItemMap:P,collectionRef:T,collectionRefObject:A,collectionElement:k,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=cs(c),h=g.forwardRef((b,w)=>{const{scope:S,children:C}=b,A=s(c,S),k=Ce(w,A.collectionRef);return(0,p.jsx)(u,{ref:k,children:C})});h.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",m=cs(f),v=g.forwardRef((b,w)=>{const{scope:S,children:C,...A}=b,k=g.useRef(null),[E,T]=g.useState(null),R=Ce(w,k,T),{setItemMap:P}=s(f,S),M=g.useRef(A);sb(M.current,A)||(M.current=A);const N=M.current;return g.useEffect(()=>{const L=N;return P(I=>E?I.has(E)?I.set(E,{...L,element:E}).toSorted(uf):(I.set(E,{...L,element:E}),I.toSorted(uf)):I),()=>{P(I=>!E||!I.has(E)?I:(I.delete(E),new $u(I)))}},[E,N,P]),(0,p.jsx)(m,{[d]:"",ref:R,children:C})});v.displayName=f;function y(){return g.useState(new $u)}Ye(y,"useInitCollection");function x(b){const{itemMap:w}=s(e+"CollectionConsumer",b);return w}return Ye(x,"useCollection"),[{Provider:o,Slot:h,ItemSlot:v},{createCollectionScope:r,useCollection:x,useInitCollection:y}]}Ye(_M,"createCollection");function sb(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}Ye(sb,"shallowEqual");function ob(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Ye(ob,"isElementPreceding");function uf(e,t){return!e[1].element||!t[1].element?0:ob(e[1].element,t[1].element)?-1:1}Ye(uf,"sortByDocumentPosition");function ab(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Ye(ab,"getChildListObserver");var jM=Object.defineProperty,Ms=(e,t)=>jM(e,"name",{value:t,configurable:!0}),lb=!!(typeof window<"u"&&window.document&&window.document.createElement);function te(e,t,{checkForDefaultPrevented:n=!0}={}){return Ms(function(i){if(e?.(i),n===!1||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}Ms(te,"composeEventHandlers");function BM(e){if(!lb)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ms(BM,"getOwnerWindow");function hf(e){if(!lb)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ms(hf,"getOwnerDocument");function cb(e,t=!1){const{activeElement:n}=hf(e);if(!n?.nodeName)return null;if(ub(n)&&n.contentDocument)return cb(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=hf(n).getElementById(r);if(i)return i}}return n}Ms(cb,"getActiveElement");function ub(e){return e.tagName==="IFRAME"}Ms(ub,"isFrame");var Rt=globalThis?.document?g.useLayoutEffect:()=>{},FM=Object.defineProperty,VM=(e,t)=>FM(e,"name",{value:t,configurable:!0}),Ig=g[" useEffectEvent ".trim().toString()],Og=g[" useInsertionEffect ".trim().toString()];function hb(e){if(typeof Ig=="function")return Ig(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Og=="function"?Og(()=>{t.current=e}):Rt(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}VM(hb,"useEffectEvent");var zM=Object.defineProperty,ma=(e,t)=>zM(e,"name",{value:t,configurable:!0}),$M=g[" useInsertionEffect ".trim().toString()]||Rt;function ga({prop:e,defaultProp:t,onChange:n=ma(()=>{},"onChange"),caller:r}){const[i,s,o]=fb({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:i,g.useCallback(c=>{if(a){const u=db(c)?c(e):c;u!==e&&o.current?.(u)}else s(c)},[a,e,s,o])]}ma(ga,"useControllableState");function fb({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return $M(()=>{s.current=t},[t]),g.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}ma(fb,"useUncontrolledState");function db(e){return typeof e=="function"}ma(db,"isFunction");var Dg=Symbol("RADIX:SYNC_STATE");function HM(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=hb(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=g.useReducer((y,x)=>{if(x.type===Dg)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,m=g.useRef(d);g.useEffect(()=>{m.current!==d&&(m.current=d,l||c(d))},[d,m,l]);const v=g.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return g.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:Dg,state:i})},[i,h.state,l]),[v,f]}ma(HM,"useControllableStateReducer");var WM=Object.defineProperty,sr=(e,t)=>WM(e,"name",{value:t,configurable:!0});function pb(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}sr(pb,"useStateMachine");var Ln=sr(e=>{const{present:t,children:n}=e,r=mb(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=gb(r.ref,vb(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null},"Presence");function mb(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=g.useRef(void 0),[a,l]=pb(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{a==="mounted"?(s.current=o.current??ji(r.current),o.current=void 0):s.current="none"},[a]),Rt(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=ji(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]),Rt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,h=sr(d=>{const m=ji(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&m&&(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=sr(d=>{d.target===t&&(s.current=ji(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:g.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=ji(u)}else r.current=null;n(c)},[])}}sr(mb,"usePresence");function ff(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}sr(ff,"setRef");function gb(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=ff(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():ff(r[o],null)}}},[])}sr(gb,"useStableComposedRefs");function ji(e){return e?.animationName||"none"}sr(ji,"getAnimationName");function vb(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)}sr(vb,"getElementRef");var UM=Object.defineProperty,qM=(e,t)=>UM(e,"name",{value:t,configurable:!0}),KM=g[" useId ".trim().toString()]||(()=>{}),GM=0;function di(e){const[t,n]=g.useState(KM());return Rt(()=>{e||n(r=>r??String(GM++))},[e]),e||(t?`radix-${t}`:"")}qM(di,"useId");var QM=Object.defineProperty,YM=(e,t)=>QM(e,"name",{value:t,configurable:!0}),XM=g.createContext(void 0);function $c(e){const t=g.useContext(XM);return e||t||"ltr"}YM($c,"useDirection");var JM=Object.defineProperty,ZM=(e,t)=>JM(e,"name",{value:t,configurable:!0});function Je(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}ZM(Je,"useCallbackRef");var eR=Object.defineProperty,Qe=(e,t)=>eR(e,"name",{value:t,configurable:!0}),df="dismissableLayer.update",tR="dismissableLayer.pointerDownOutside",nR="dismissableLayer.focusOutside",Ng,yb=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xb=g.forwardRef(Qe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=g.useContext(yb),[f,d]=g.useState(null),m=f?.ownerDocument??globalThis?.document,[,v]=g.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=g.useRef(!1),E=bb(M=>{o?.(M),l?.(M),M.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(M=>{if(!(M instanceof Node))return!1;const N=[...h.branches].some(L=>L.contains(M));return A&&!N},[h.branches,A])}),T=wb(M=>{if(i&&k.current)return;const N=M.target;[...h.branches].some(L=>L.contains(N))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},m),R=f?S===x.length-1:!1,P=Je(M=>{M.key==="Escape"&&(s?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return g.useEffect(()=>{if(R)return m.addEventListener("keydown",P,{capture:!0}),()=>m.removeEventListener("keydown",P,{capture:!0})},[m,R,P]),g.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Ng=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),pf(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Ng))}},[f,m,r,h]),g.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),pf())},[f,h]),g.useEffect(()=>{const M=Qe(()=>v({}),"handleUpdate");return document.addEventListener(df,M),()=>document.removeEventListener(df,M)},[]),(0,p.jsx)(Le.div,{...u,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:te(t.onFocusCapture,T.onFocusCapture),onBlurCapture:te(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:te(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function rR(){const e=g.useContext(yb),[t,n]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Qe(rR,"useDismissableLayerSurface");var iR=Qe(()=>!0,"IS_TRUE");function bb(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=iR}=t,a=Je(e),l=g.useRef(!1),c=g.useRef(!1),u=g.useRef(new Map),h=g.useRef(()=>{});return g.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}Qe(f,"resetOutsideInteraction");function d(){return Array.from(u.current.values()).some(Boolean)}Qe(d,"isOutsideInteractionIntercepted");function m(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)}Qe(m,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}Qe(v,"handleInteractionBubble");const y=Qe(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const A=d();f(),A||Op(tR,a,C,{discrete:!0})};if(Qe(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,m,!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,m,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:Qe(()=>l.current=!0,"onPointerDownCapture")}}Qe(bb,"usePointerDownOutside");function wb(e,t=globalThis?.document){const n=Je(e),r=g.useRef(!1);return g.useEffect(()=>{const i=Qe(s=>{s.target&&!r.current&&Op(nR,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Qe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Qe(()=>r.current=!1,"onBlurCapture")}}Qe(wb,"useFocusOutside");function pf(){const e=new CustomEvent(df);document.dispatchEvent(e)}Qe(pf,"dispatchUpdate");function Op(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?Rp(i,s):i.dispatchEvent(s)}Qe(Op,"handleAndDispatchCustomEvent");var sR=Object.defineProperty,ft=(e,t)=>sR(e,"name",{value:t,configurable:!0}),Hu="focusScope.autoFocusOnMount",Wu="focusScope.autoFocusOnUnmount",Lg={bubbles:!1,cancelable:!0},oR=g.forwardRef(ft(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=g.useState(null),u=Je(s),h=Je(o),f=g.useRef(null),d=Ce(n,c),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let y=function(S){if(m.paused||!l)return;const C=S.target;l.contains(C)?f.current=C:Hn(f.current,{select:!0})},x=function(S){if(m.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||Hn(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&Hn(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,m.paused]),g.useEffect(()=>{if(l){_g.add(m);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(Hu,Lg);l.addEventListener(Hu,u),l.dispatchEvent(x),x.defaultPrevented||(Sb(Eb(Dp(l)),{select:!0}),document.activeElement===y&&Hn(l))}return()=>{l.removeEventListener(Hu,u),setTimeout(()=>{const x=new CustomEvent(Wu,Lg);l.addEventListener(Wu,h),l.dispatchEvent(x),x.defaultPrevented||Hn(y??document.body,{select:!0}),l.removeEventListener(Wu,h),_g.remove(m)},0)}}},[l,u,h,m]);const v=g.useCallback(y=>{if(!r&&!i||m.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]=kb(w);S&&C?!y.shiftKey&&b===C?(y.preventDefault(),r&&Hn(S,{select:!0})):y.shiftKey&&b===S&&(y.preventDefault(),r&&Hn(C,{select:!0})):b===w&&y.preventDefault()}},[r,i,m.paused]);return(0,p.jsx)(Le.div,{tabIndex:-1,...a,ref:d,onKeyDown:v})},"FocusScope"));function Sb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Hn(r,{select:t}),document.activeElement!==n)return}ft(Sb,"focusFirst");function kb(e){const t=Dp(e);return[mf(t,e),mf(t.reverse(),e)]}ft(kb,"getTabbableEdges");function Dp(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(Dp,"getTabbableCandidates");function mf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Cb(r,{upTo:t})))return r}ft(mf,"findVisible");function Cb(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(Cb,"isHidden");function Ab(e){return e instanceof HTMLInputElement&&"select"in e}ft(Ab,"isSelectableInput");function Hn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ab(e)&&t&&e.select()}}ft(Hn,"focus");var _g=Tb();function Tb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=gf(e,t),e.unshift(t)},remove(t){e=gf(e,t),e[0]?.resume()}}}ft(Tb,"createFocusScopesStack");function gf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ft(gf,"arrayRemove");function Eb(e){return e.filter(t=>t.tagName!=="A")}ft(Eb,"removeLinks");var aR=Object.defineProperty,lR=(e,t)=>aR(e,"name",{value:t,configurable:!0}),Mb=g.forwardRef(lR(function(t,n){const{container:r,...i}=t,[s,o]=g.useState(!1);Rt(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?pa.createPortal((0,p.jsx)(Le.div,{...i,ref:n}),a):null},"Portal")),cR=Object.defineProperty,Np=(e,t)=>cR(e,"name",{value:t,configurable:!0}),Ba=0,Ei=null;function uR(e){return Lp(),e.children}Np(uR,"FocusGuards");function Lp(){g.useEffect(()=>{Ei||(Ei={start:vf(),end:vf()});const{start:e,end:t}=Ei;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ba++,()=>{Ba===1&&(Ei?.start.remove(),Ei?.end.remove(),Ei=null),Ba=Math.max(0,Ba-1)}},[])}Np(Lp,"useFocusGuards");function vf(){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}Np(vf,"createFocusGuard");var kn=function(){return kn=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},kn.apply(this,arguments)};function Rb(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 hR(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 Cl="right-scroll-bar-position",Al="width-before-scroll-bar",fR="with-scroll-bars-hidden",dR="--removed-body-scroll-bar-size";function Uu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pR(e,t){var n=(0,g.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 mR=typeof window<"u"?g.useLayoutEffect:g.useEffect,jg=new WeakMap;function gR(e,t){var n=pR(t||null,function(r){return e.forEach(function(i){return Uu(i,r)})});return mR(function(){var r=jg.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Uu(a,null)}),s.forEach(function(a){i.has(a)||Uu(a,o)})}jg.set(n,e)},[e]),n}function vR(e){return e}function yR(e,t){t===void 0&&(t=vR);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 xR(e){e===void 0&&(e={});var t=yR(null);return t.options=kn({async:!0,ssr:!1},e),t}var Pb=function(e){var t=e.sideCar,n=Rb(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 g.createElement(r,kn({},n))};Pb.isSideCarExport=!0;function bR(e,t){return e.useMedium(t),Pb}var Ib=xR(),qu=function(){},Hc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:qu,onWheelCapture:qu,onTouchMoveCapture:qu}),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,m=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=Rb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,A=gR([n,t]),k=kn(kn({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Ib,removeScrollBar:c,shards:h,noRelative:d,noIsolation:m,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?g.cloneElement(g.Children.only(a),kn(kn({},k),{ref:A})):g.createElement(b,kn({},k,{className:l,ref:A}),a))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:Al,zeroRight:Cl};var Bg,wR=function(){if(Bg)return Bg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SR(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wR();return t&&e.setAttribute("nonce",t),e}function kR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CR(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var AR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=SR())&&(kR(t,n),CR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},TR=function(){var e=AR();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ob=function(){var e=TR(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},ER={left:0,top:0,right:0,gap:0},Ku=function(e){return parseInt(e||"",10)||0},MR=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[Ku(n),Ku(r),Ku(i)]},RR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ER;var t=MR(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])}},PR=Ob(),bo="data-scroll-locked",IR=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 Xx}from"./rolldown-runtime-COoCppmG.js";import{Dt as Ge,Gt as lf,It as nt,Kt as yo,Lt as Mr,Nt as br,Tt as Qt,Ut as ve,Vt as Sl,bt as xo,ft as zc,mt as GE,wt as Jx}from"./project-route-CVSc0mXZ.js";import{Dt as QE,Gt as Wn,Ht as cf,Jt as YE,Kt as XE,Ot as JE,T as ZE,Ut as In,Wt as sc,Z as Zx,Zi as eM,c as tM,ds as nM,et as rM,fs as iM,ms as eb,ot as Mg,ps as tb,qt as sM,t as oM,w as Rg,y as aM}from"./error-reporting-BSiw4y1I.js";import{A as cs,C as lM,D as G,H as cM,I as nb,N as Ce,O as uM,S as hM,T as Ot,V as Mp,i as fM,j as dM,k as pM,n as mM,r as gM,t as vM,w as xe,z as yM}from"./use-reduced-motion-iJQiY9UT.js";import{n as xM,t as bM}from"./react-dom-CeQ1Kv3m.js";import{i as wM}from"./preload-helper-SIk4t7Ze.js";import{a as SM,c as kM,n as CM,o as AM}from"./chunk-D32TOXHM-oQ9_W5Z_.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.25.2"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c80ceb55-37e6-46cf-9417-4ede68dcfb2b",e._sentryDebugIdIdentifier="sentry-dbid-c80ceb55-37e6-46cf-9417-4ede68dcfb2b")}catch{}})();var g=Xx(xM(),1),pa=Xx(bM(),1),p=wM(),TM=Object.defineProperty,EM=(e,t)=>TM(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=cs(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,p.jsx)(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rp(e,t){e&&pa.flushSync(()=>e.dispatchEvent(t))}EM(Rp,"dispatchDiscreteCustomEvent");var MM=Object.defineProperty,RM=(e,t)=>MM(e,"name",{value:t,configurable:!0}),PM=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"}),IM=g.forwardRef(RM(function(t,n){return(0,p.jsx)(Le.span,{...t,ref:n,style:{...PM,...t.style}})},"VisuallyHidden")),OM=IM,DM=Object.defineProperty,Dt=(e,t)=>DM(e,"name",{value:t,configurable:!0});function NM(e,t){const n=g.createContext(t);n.displayName=e+"Context";const r=Dt(s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return(0,p.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=g.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Dt(i,"useContext"),[r,i]}Dt(NM,"createContext");function cr(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=Dt(h=>{const{scope:f,children:d,...m}=h,v=f?.[e]?.[l]||a,y=g.useMemo(()=>m,Object.values(m));return(0,p.jsx)(v.Provider,{value:y,children:d})},"Provider");c.displayName=s+"Provider";function u(h,f,d={}){const{optional:m=!1}=d,v=f?.[e]?.[l]||a,y=g.useContext(v);if(y)return y;if(o!==void 0)return o;if(!m)throw new Error(`\`${h}\` must be used within \`${s}\``)}return Dt(u,"useContext"),[c,u]}Dt(r,"createContext");const i=Dt(()=>{const s=n.map(o=>g.createContext(o));return Dt(function(a){const l=a?.[e]||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,rb(i,...t)]}Dt(cr,"createContextScope");function rb(...e){const t=e[0];if(e.length===1)return t;const n=Dt(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Dt(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Dt(rb,"composeContextScopes");var LM=Object.defineProperty,Ye=(e,t)=>LM(e,"name",{value:t,configurable:!0});function Pp(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Ye(v=>{const{scope:y,children:x}=v,b=g.useRef(null),w=g.useRef(new Map).current;return(0,p.jsx)(i,{scope:y,itemMap:w,collectionRef:b,children:x})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=cs(a),c=g.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),S=Ce(y,w.collectionRef);return(0,p.jsx)(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=cs(u),d=g.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=g.useRef(null),C=Ce(y,S),A=s(u,x);return g.useEffect(()=>(A.itemMap.set(S,{ref:S,...w}),()=>{A.itemMap.delete(S)})),(0,p.jsx)(f,{[h]:"",ref:C,children:b})});d.displayName=u;function m(v){const y=s(e+"CollectionConsumer",v);return g.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 Ye(m,"useCollection"),[{Provider:o,Slot:c,ItemSlot:d},m,r]}Ye(Pp,"createCollection");var Pg=new WeakMap,$u=class dr extends Map{static{Ye(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],Pg.set(this,!0)}set(t,n){return Pg.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=Ip(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 m=u[d];u[d]===n&&(m=u[d+1]),i&&this.delete(n),h=this.get(m),this.set(n,r)}else{!f&&u[d-1]===n&&(f=!0);const m=u[f?d:d-1],v=h;h=this.get(m),this.delete(m),this.set(m,v)}return this}with(t,n,r){const i=new dr(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=kl(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=kl(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return kl(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 dr(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 dr(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 dr(n)}toReversed(){const t=new dr;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 dr(n)}slice(t,n){const r=new dr;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 kl(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=ib(e,t);return n===-1?void 0:e[n]}Ye(kl,"at");function ib(e,t){const n=e.length,r=Ip(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Ye(ib,"toSafeIndex");function Ip(e){return e!==e||e===0?0:Math.trunc(e)}Ye(Ip,"toSafeInteger");function _M(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new $u,setItemMap:Ye(()=>{},"setItemMap")}),o=Ye(({state:b,...w})=>b?(0,p.jsx)(l,{...w,state:b}):(0,p.jsx)(a,{...w}),"CollectionProvider");o.displayName=t;const a=Ye(b=>{const w=y();return(0,p.jsx)(l,{...b,state:w})},"CollectionInit");a.displayName=t+"Init";const l=Ye(b=>{const{scope:w,children:S,state:C}=b,A=g.useRef(null),[k,E]=g.useState(null),T=Ce(A,E),[R,P]=C;return g.useEffect(()=>{if(!k)return;const M=ab(()=>{});return M.observe(k,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[k]),(0,p.jsx)(i,{scope:w,itemMap:R,setItemMap:P,collectionRef:T,collectionRefObject:A,collectionElement:k,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=cs(c),h=g.forwardRef((b,w)=>{const{scope:S,children:C}=b,A=s(c,S),k=Ce(w,A.collectionRef);return(0,p.jsx)(u,{ref:k,children:C})});h.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",m=cs(f),v=g.forwardRef((b,w)=>{const{scope:S,children:C,...A}=b,k=g.useRef(null),[E,T]=g.useState(null),R=Ce(w,k,T),{setItemMap:P}=s(f,S),M=g.useRef(A);sb(M.current,A)||(M.current=A);const N=M.current;return g.useEffect(()=>{const L=N;return P(I=>E?I.has(E)?I.set(E,{...L,element:E}).toSorted(uf):(I.set(E,{...L,element:E}),I.toSorted(uf)):I),()=>{P(I=>!E||!I.has(E)?I:(I.delete(E),new $u(I)))}},[E,N,P]),(0,p.jsx)(m,{[d]:"",ref:R,children:C})});v.displayName=f;function y(){return g.useState(new $u)}Ye(y,"useInitCollection");function x(b){const{itemMap:w}=s(e+"CollectionConsumer",b);return w}return Ye(x,"useCollection"),[{Provider:o,Slot:h,ItemSlot:v},{createCollectionScope:r,useCollection:x,useInitCollection:y}]}Ye(_M,"createCollection");function sb(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}Ye(sb,"shallowEqual");function ob(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Ye(ob,"isElementPreceding");function uf(e,t){return!e[1].element||!t[1].element?0:ob(e[1].element,t[1].element)?-1:1}Ye(uf,"sortByDocumentPosition");function ab(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Ye(ab,"getChildListObserver");var jM=Object.defineProperty,Ms=(e,t)=>jM(e,"name",{value:t,configurable:!0}),lb=!!(typeof window<"u"&&window.document&&window.document.createElement);function te(e,t,{checkForDefaultPrevented:n=!0}={}){return Ms(function(i){if(e?.(i),n===!1||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}Ms(te,"composeEventHandlers");function BM(e){if(!lb)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ms(BM,"getOwnerWindow");function hf(e){if(!lb)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ms(hf,"getOwnerDocument");function cb(e,t=!1){const{activeElement:n}=hf(e);if(!n?.nodeName)return null;if(ub(n)&&n.contentDocument)return cb(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=hf(n).getElementById(r);if(i)return i}}return n}Ms(cb,"getActiveElement");function ub(e){return e.tagName==="IFRAME"}Ms(ub,"isFrame");var Rt=globalThis?.document?g.useLayoutEffect:()=>{},FM=Object.defineProperty,VM=(e,t)=>FM(e,"name",{value:t,configurable:!0}),Ig=g[" useEffectEvent ".trim().toString()],Og=g[" useInsertionEffect ".trim().toString()];function hb(e){if(typeof Ig=="function")return Ig(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Og=="function"?Og(()=>{t.current=e}):Rt(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}VM(hb,"useEffectEvent");var zM=Object.defineProperty,ma=(e,t)=>zM(e,"name",{value:t,configurable:!0}),$M=g[" useInsertionEffect ".trim().toString()]||Rt;function ga({prop:e,defaultProp:t,onChange:n=ma(()=>{},"onChange"),caller:r}){const[i,s,o]=fb({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:i,g.useCallback(c=>{if(a){const u=db(c)?c(e):c;u!==e&&o.current?.(u)}else s(c)},[a,e,s,o])]}ma(ga,"useControllableState");function fb({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return $M(()=>{s.current=t},[t]),g.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}ma(fb,"useUncontrolledState");function db(e){return typeof e=="function"}ma(db,"isFunction");var Dg=Symbol("RADIX:SYNC_STATE");function HM(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=hb(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=g.useReducer((y,x)=>{if(x.type===Dg)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,m=g.useRef(d);g.useEffect(()=>{m.current!==d&&(m.current=d,l||c(d))},[d,m,l]);const v=g.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return g.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:Dg,state:i})},[i,h.state,l]),[v,f]}ma(HM,"useControllableStateReducer");var WM=Object.defineProperty,sr=(e,t)=>WM(e,"name",{value:t,configurable:!0});function pb(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}sr(pb,"useStateMachine");var Ln=sr(e=>{const{present:t,children:n}=e,r=mb(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=gb(r.ref,vb(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null},"Presence");function mb(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=g.useRef(void 0),[a,l]=pb(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{a==="mounted"?(s.current=o.current??ji(r.current),o.current=void 0):s.current="none"},[a]),Rt(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=ji(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]),Rt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,h=sr(d=>{const m=ji(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&m&&(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=sr(d=>{d.target===t&&(s.current=ji(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:g.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=ji(u)}else r.current=null;n(c)},[])}}sr(mb,"usePresence");function ff(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}sr(ff,"setRef");function gb(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=ff(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():ff(r[o],null)}}},[])}sr(gb,"useStableComposedRefs");function ji(e){return e?.animationName||"none"}sr(ji,"getAnimationName");function vb(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)}sr(vb,"getElementRef");var UM=Object.defineProperty,qM=(e,t)=>UM(e,"name",{value:t,configurable:!0}),KM=g[" useId ".trim().toString()]||(()=>{}),GM=0;function di(e){const[t,n]=g.useState(KM());return Rt(()=>{e||n(r=>r??String(GM++))},[e]),e||(t?`radix-${t}`:"")}qM(di,"useId");var QM=Object.defineProperty,YM=(e,t)=>QM(e,"name",{value:t,configurable:!0}),XM=g.createContext(void 0);function $c(e){const t=g.useContext(XM);return e||t||"ltr"}YM($c,"useDirection");var JM=Object.defineProperty,ZM=(e,t)=>JM(e,"name",{value:t,configurable:!0});function Je(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}ZM(Je,"useCallbackRef");var eR=Object.defineProperty,Qe=(e,t)=>eR(e,"name",{value:t,configurable:!0}),df="dismissableLayer.update",tR="dismissableLayer.pointerDownOutside",nR="dismissableLayer.focusOutside",Ng,yb=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xb=g.forwardRef(Qe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=g.useContext(yb),[f,d]=g.useState(null),m=f?.ownerDocument??globalThis?.document,[,v]=g.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=g.useRef(!1),E=bb(M=>{o?.(M),l?.(M),M.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(M=>{if(!(M instanceof Node))return!1;const N=[...h.branches].some(L=>L.contains(M));return A&&!N},[h.branches,A])}),T=wb(M=>{if(i&&k.current)return;const N=M.target;[...h.branches].some(L=>L.contains(N))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},m),R=f?S===x.length-1:!1,P=Je(M=>{M.key==="Escape"&&(s?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return g.useEffect(()=>{if(R)return m.addEventListener("keydown",P,{capture:!0}),()=>m.removeEventListener("keydown",P,{capture:!0})},[m,R,P]),g.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Ng=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),pf(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Ng))}},[f,m,r,h]),g.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),pf())},[f,h]),g.useEffect(()=>{const M=Qe(()=>v({}),"handleUpdate");return document.addEventListener(df,M),()=>document.removeEventListener(df,M)},[]),(0,p.jsx)(Le.div,{...u,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:te(t.onFocusCapture,T.onFocusCapture),onBlurCapture:te(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:te(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function rR(){const e=g.useContext(yb),[t,n]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Qe(rR,"useDismissableLayerSurface");var iR=Qe(()=>!0,"IS_TRUE");function bb(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=iR}=t,a=Je(e),l=g.useRef(!1),c=g.useRef(!1),u=g.useRef(new Map),h=g.useRef(()=>{});return g.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}Qe(f,"resetOutsideInteraction");function d(){return Array.from(u.current.values()).some(Boolean)}Qe(d,"isOutsideInteractionIntercepted");function m(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)}Qe(m,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}Qe(v,"handleInteractionBubble");const y=Qe(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const A=d();f(),A||Op(tR,a,C,{discrete:!0})};if(Qe(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,m,!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,m,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:Qe(()=>l.current=!0,"onPointerDownCapture")}}Qe(bb,"usePointerDownOutside");function wb(e,t=globalThis?.document){const n=Je(e),r=g.useRef(!1);return g.useEffect(()=>{const i=Qe(s=>{s.target&&!r.current&&Op(nR,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Qe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Qe(()=>r.current=!1,"onBlurCapture")}}Qe(wb,"useFocusOutside");function pf(){const e=new CustomEvent(df);document.dispatchEvent(e)}Qe(pf,"dispatchUpdate");function Op(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?Rp(i,s):i.dispatchEvent(s)}Qe(Op,"handleAndDispatchCustomEvent");var sR=Object.defineProperty,ft=(e,t)=>sR(e,"name",{value:t,configurable:!0}),Hu="focusScope.autoFocusOnMount",Wu="focusScope.autoFocusOnUnmount",Lg={bubbles:!1,cancelable:!0},oR=g.forwardRef(ft(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=g.useState(null),u=Je(s),h=Je(o),f=g.useRef(null),d=Ce(n,c),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let y=function(S){if(m.paused||!l)return;const C=S.target;l.contains(C)?f.current=C:Hn(f.current,{select:!0})},x=function(S){if(m.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||Hn(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&Hn(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,m.paused]),g.useEffect(()=>{if(l){_g.add(m);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(Hu,Lg);l.addEventListener(Hu,u),l.dispatchEvent(x),x.defaultPrevented||(Sb(Eb(Dp(l)),{select:!0}),document.activeElement===y&&Hn(l))}return()=>{l.removeEventListener(Hu,u),setTimeout(()=>{const x=new CustomEvent(Wu,Lg);l.addEventListener(Wu,h),l.dispatchEvent(x),x.defaultPrevented||Hn(y??document.body,{select:!0}),l.removeEventListener(Wu,h),_g.remove(m)},0)}}},[l,u,h,m]);const v=g.useCallback(y=>{if(!r&&!i||m.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]=kb(w);S&&C?!y.shiftKey&&b===C?(y.preventDefault(),r&&Hn(S,{select:!0})):y.shiftKey&&b===S&&(y.preventDefault(),r&&Hn(C,{select:!0})):b===w&&y.preventDefault()}},[r,i,m.paused]);return(0,p.jsx)(Le.div,{tabIndex:-1,...a,ref:d,onKeyDown:v})},"FocusScope"));function Sb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Hn(r,{select:t}),document.activeElement!==n)return}ft(Sb,"focusFirst");function kb(e){const t=Dp(e);return[mf(t,e),mf(t.reverse(),e)]}ft(kb,"getTabbableEdges");function Dp(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(Dp,"getTabbableCandidates");function mf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Cb(r,{upTo:t})))return r}ft(mf,"findVisible");function Cb(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(Cb,"isHidden");function Ab(e){return e instanceof HTMLInputElement&&"select"in e}ft(Ab,"isSelectableInput");function Hn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ab(e)&&t&&e.select()}}ft(Hn,"focus");var _g=Tb();function Tb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=gf(e,t),e.unshift(t)},remove(t){e=gf(e,t),e[0]?.resume()}}}ft(Tb,"createFocusScopesStack");function gf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ft(gf,"arrayRemove");function Eb(e){return e.filter(t=>t.tagName!=="A")}ft(Eb,"removeLinks");var aR=Object.defineProperty,lR=(e,t)=>aR(e,"name",{value:t,configurable:!0}),Mb=g.forwardRef(lR(function(t,n){const{container:r,...i}=t,[s,o]=g.useState(!1);Rt(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?pa.createPortal((0,p.jsx)(Le.div,{...i,ref:n}),a):null},"Portal")),cR=Object.defineProperty,Np=(e,t)=>cR(e,"name",{value:t,configurable:!0}),Ba=0,Ei=null;function uR(e){return Lp(),e.children}Np(uR,"FocusGuards");function Lp(){g.useEffect(()=>{Ei||(Ei={start:vf(),end:vf()});const{start:e,end:t}=Ei;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ba++,()=>{Ba===1&&(Ei?.start.remove(),Ei?.end.remove(),Ei=null),Ba=Math.max(0,Ba-1)}},[])}Np(Lp,"useFocusGuards");function vf(){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}Np(vf,"createFocusGuard");var kn=function(){return kn=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},kn.apply(this,arguments)};function Rb(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 hR(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 Cl="right-scroll-bar-position",Al="width-before-scroll-bar",fR="with-scroll-bars-hidden",dR="--removed-body-scroll-bar-size";function Uu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pR(e,t){var n=(0,g.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 mR=typeof window<"u"?g.useLayoutEffect:g.useEffect,jg=new WeakMap;function gR(e,t){var n=pR(t||null,function(r){return e.forEach(function(i){return Uu(i,r)})});return mR(function(){var r=jg.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Uu(a,null)}),s.forEach(function(a){i.has(a)||Uu(a,o)})}jg.set(n,e)},[e]),n}function vR(e){return e}function yR(e,t){t===void 0&&(t=vR);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 xR(e){e===void 0&&(e={});var t=yR(null);return t.options=kn({async:!0,ssr:!1},e),t}var Pb=function(e){var t=e.sideCar,n=Rb(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 g.createElement(r,kn({},n))};Pb.isSideCarExport=!0;function bR(e,t){return e.useMedium(t),Pb}var Ib=xR(),qu=function(){},Hc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:qu,onWheelCapture:qu,onTouchMoveCapture:qu}),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,m=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=Rb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,A=gR([n,t]),k=kn(kn({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Ib,removeScrollBar:c,shards:h,noRelative:d,noIsolation:m,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?g.cloneElement(g.Children.only(a),kn(kn({},k),{ref:A})):g.createElement(b,kn({},k,{className:l,ref:A}),a))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:Al,zeroRight:Cl};var Bg,wR=function(){if(Bg)return Bg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SR(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wR();return t&&e.setAttribute("nonce",t),e}function kR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CR(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var AR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=SR())&&(kR(t,n),CR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},TR=function(){var e=AR();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ob=function(){var e=TR(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},ER={left:0,top:0,right:0,gap:0},Ku=function(e){return parseInt(e||"",10)||0},MR=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[Ku(n),Ku(r),Ku(i)]},RR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ER;var t=MR(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])}},PR=Ob(),bo="data-scroll-locked",IR=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(fR,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(a,"px ").concat(r,`;
@@ -70,4 +70,4 @@ import{o as Xx}from"./rolldown-runtime-CYCouw1w.js";import{Dt as Ge,Gt as lf,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 VU(e,t){e!==void 0&&bg(e);const n=t?RE(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 $x({recording:e,screenshotBase64:t}){let n;try{n=VU(e,t)}catch{return(0,p.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Unsupported workspace capture."})}return(0,p.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 zU({recording:e,screenshotUrl:t}){const n=mg(t??void 0),[r,i]=(0,g.useState)();let s=!1;try{e!==void 0&&bg(e),s=!0}catch{}return(0,g.useEffect)(()=>{if(!s||!n)return;const o=new AbortController;return(async()=>{try{if(!Ia(n))throw new Error("Owned screenshot link unavailable");const a=await Q4(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 m=btoa(d);RE(m),o.signal.aborted||i({url:n,base64:m})}catch{o.signal.aborted||i({url:n,failed:!0})}})(),()=>o.abort()},[n,s]),s?n&&r?.url!==n?(0,p.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading captured workspace…"}):(0,p.jsxs)("div",{className:"space-y-2",children:[r?.failed?(0,p.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Captured image unavailable."}):null,(0,p.jsx)($x,{recording:e,screenshotBase64:n?r?.base64:void 0})]}):(0,p.jsx)($x,{recording:e})}var $U=500,HU={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 PE(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 Ts(e){const t=PE(e.action),n=e.locatorLabel?.trim();return n?`Interact · ${t} ${n}`:`Interact · ${t}`}function Vc(e){return e.assertion?e.assertion.passed?"ok":"error":e.ok===!0?"ok":e.ok===!1?"error":"unknown"}function eo(e){return`${e.toolCallId}:${e.stepIndex}`}function WU(e){if(!e)return[];const t=[];return typeof e.durationMs=="number"&&e.durationMs>0&&t.push({key:"duration",label:UU(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 UU(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 IE(e){return typeof e=="string"&&e.length>0?e:null}function iK(e){return(e.widgetRenderObservations?.length??0)>0||(e.browserInteractionSteps?.length??0)>0||IE(e.videoUrl)!==null}function qU(e){return e==="ok"?"OK":e==="error"?"Failed":"Unknown"}function OE({step:e,leading:t,className:n}){const r=Vc(e),i=e.widgetToolCalls??[],s=e.coordinateX!=null&&e.coordinateY!=null?`(${e.coordinateX}, ${e.coordinateY})`:null;return(0,p.jsxs)("div",{"data-testid":"browser-step-detail",className:G("flex flex-col gap-4",n),children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[t,(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:Ts(e)}),(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:["App interaction · ",e.elapsedMs,"ms",s?` · ${s}`:""]})]}),(0,p.jsx)("span",{className:G("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[11px] font-medium",HU[r]),children:qU(r)})]}),e.assertion&&!e.assertion.passed&&e.assertion.reason?(0,p.jsx)("p",{className:"text-xs text-destructive",children:e.assertion.reason}):null,e.pluginWorkspace?(0,p.jsx)(zU,{recording:e.pluginWorkspace,screenshotUrl:e.screenshotUrl}):e.screenshotUrl?(0,p.jsx)(aE,{src:e.screenshotUrl,alt:Ts(e),className:"max-h-72 w-full rounded-md border border-border/50 object-contain"}):null,i.length>0?(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Widget tool calls"}),i.map((o,a)=>(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,p.jsx)("span",{className:G("inline-block h-1.5 w-1.5 shrink-0 rounded-full",o.ok?"bg-success":"bg-destructive"),"aria-hidden":!0}),(0,p.jsx)("span",{className:"font-mono text-foreground",children:o.name}),o.error?(0,p.jsx)("span",{className:"truncate text-destructive",children:o.error}):null]},`${o.name}-${a}`))]}):null,e.followUps&&e.followUps.length>0?(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Sent message to chat"}),e.followUps.map((o,a)=>(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,p.jsx)("span",{"aria-hidden":!0,children:"↳"}),(0,p.jsx)("span",{className:"truncate text-foreground",children:o})]},a))]}):null]})}function KU(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,"0")}`}function GU(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 sK({steps:e,videoUrl:t,videoMeta:n,isRunning:r=!1,className:i}){const s=(0,g.useRef)(null),[o,a]=(0,g.useState)(null),[l,c]=(0,g.useState)(null),u=(0,g.useRef)(null),[h,f]=(0,g.useState)(!1),[d,m]=(0,g.useState)(null),v=mg(IE(t)),y=(0,g.useMemo)(()=>WU(n),[n]),x=(0,g.useMemo)(()=>[...e].sort((T,R)=>(T.videoOffsetMs??Number.POSITIVE_INFINITY)-(R.videoOffsetMs??Number.POSITIVE_INFINITY)||T.promptIndex-R.promptIndex||T.ts-R.ts),[e]),b=o??l??null,w=(0,g.useMemo)(()=>x.find(T=>eo(T)===b)??null,[x,b]),S=v!=null&&!h,C=x.some(T=>T.screenshotUrl),A=(0,g.useCallback)(T=>{a(eo(T));const R=s.current;if(!R||!S||T.videoOffsetMs==null)return;const P=T.videoOffsetMs/1e3;u.current=P,R.currentTime=P},[S]),k=(0,g.useCallback)(()=>{u.current=null},[]),E=(0,g.useCallback)(()=>{const T=s.current;if(!T)return;const R=GU(x,T.currentTime*1e3);if(c(R?eo(R):null),u.current==null){if(o!=null){const P=x.find(M=>eo(M)===o);if(P?.videoOffsetMs!=null){const M=P.videoOffsetMs-T.currentTime*1e3;if(M>0&&M<$U)return}}a(null)}},[x,o]);return(0,g.useEffect)(()=>{f(!1)},[v]),(0,g.useEffect)(()=>{if(!d||d.url!==v)return;const T=setTimeout(()=>{m(null),f(!1)},d.delayMs);return()=>clearTimeout(T)},[d,v]),x.length===0&&!v?(0,p.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,p.jsxs)("section",{className:G("flex min-w-0 flex-col gap-3",i),"data-testid":"browser-step-filmstrip",children:[(0,p.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,p.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Replay",(0,p.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,p.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(T=>(0,p.jsx)("span",{title:T.title,children:T.label},T.key)),n?.truncated?(0,p.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,p.jsx)("video",{ref:s,src:v,controls:!0,preload:"metadata",onTimeUpdate:E,onSeeked:k,onError:()=>{const T=sE(v);f(!0),m(T!==null&&T>0?{url:v,delayMs:T}:null)},onLoadedMetadata:()=>oE(v),className:"w-full rounded-md border border-border/60 bg-black","data-testid":"browser-replay-video"}):(0,p.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,p.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,p.jsx)("div",{className:"flex min-w-0 gap-2 overflow-x-auto pb-1","data-testid":"browser-filmstrip-track",children:x.map(T=>{const R=eo(T),P=Vc(T),M=R===b;return(0,p.jsxs)("button",{type:"button",onClick:()=>A(T),"aria-pressed":M,title:Ts(T),"data-testid":"browser-filmstrip-frame","data-step-key":R,"data-active":M?"true":"false",className:G("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:[T.pluginWorkspace?(0,p.jsx)("span",{className:"text-xs text-muted-foreground",children:"Workspace capture"}):T.screenshotUrl?(0,p.jsx)(aE,{src:T.screenshotUrl,alt:Ts(T),loading:"lazy",className:"h-16 w-full rounded-sm border border-border/40 bg-background object-cover object-top"}):(0,p.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,p.jsx)("span",{className:"truncate text-[10px] font-medium text-foreground",children:PE(T.action)}),(0,p.jsx)("span",{className:G("truncate text-[10px]",P==="error"?"text-destructive":"text-muted-foreground"),children:T.videoOffsetMs!=null?KU(T.videoOffsetMs):`turn ${T.promptIndex+1}`})]},R)})}),w?(0,p.jsx)(OE,{step:w,className:"rounded-lg bg-muted/5 px-4 py-4"}):(0,p.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Select a frame to see the interaction that produced it."})]}):null]})}function QU(e){return typeof e=="string"&&e.length>0&&e.length<=200?e:void 0}var YU={[-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 XU(e){const t=YU[e];return t?`${e} · ${t}`:String(e)}var JU=Mr({id:ve(),parentId:ve().optional(),name:ve(),category:xo(["step","llm","tool","error","connection","discovery"]),startMs:nt(),endMs:nt(),promptIndex:nt().optional(),stepIndex:nt().optional(),authoredStepId:ve().optional(),status:xo(["ok","error"]).optional(),toolCallId:ve().optional(),toolName:ve().optional(),toolOrigin:xo(["mcp","native","builtin","unknown"]).optional(),serverId:ve().optional(),connectionId:ve().optional(),modelId:ve().optional(),inputTokens:nt().optional(),outputTokens:nt().optional(),totalTokens:nt().optional(),cost:yo().transform(kS).optional(),callId:yo().transform(QU).optional(),messageStartIndex:nt().optional(),messageEndIndex:nt().optional(),finishReason:ve().optional(),provider:ve().optional(),responseId:ve().optional(),responseTimestamp:ve().optional(),ttfcMs:nt().optional(),mcpErrorCode:nt().optional(),outputSource:lf([br("narration"),br("evidence"),br("reconstructed")]).optional(),wireCorroborated:Ge().optional(),evidenceRequestId:ve().optional(),evidenceStatus:lf([br("complete"),br("incomplete")]).optional()}),Qr=Mr({toolName:ve(),arguments:Sl(ve(),Jx())}),ZU=Mr({promptIndex:nt(),prompt:ve(),expectedToolCalls:Qt(Qr),actualToolCalls:Qt(Qr),expectedOutput:ve().optional(),passed:Ge(),missing:Qt(Qr),unexpected:Qt(Qr),argumentMismatches:Qt(Mr({expected:Qr,actual:Qr,mismatchedArguments:Qt(ve())})),retries:Qt(Qr.extend({actualIndex:nt().int().nonnegative(),retriedByIndex:nt().int().nonnegative()})).optional()}),eq=Mr({toolCallId:ve(),toolName:ve(),protocol:lf([br("mcp-apps"),br("openai-apps")]),serverId:ve(),resourceUri:ve().optional(),toolMetadata:Sl(ve(),yo()),widgetCsp:Sl(ve(),yo()).nullable().optional(),widgetPermissions:Sl(ve(),yo()).nullable().optional(),widgetPermissive:Ge().optional(),prefersBorder:Ge().optional(),widgetHtmlBlobId:ve().optional(),widgetHtmlUrl:ve().nullable().optional(),injectedOpenAiCompat:Ge().optional(),injectedOpenAiCompatCapabilities:Mr({callTool:Ge().optional(),sendFollowUpMessage:Ge().optional(),setWidgetState:Ge().optional(),requestDisplayMode:xo(["all","fullscreen-only","none"]).optional(),notifyIntrinsicHeight:Ge().optional(),openExternal:Ge().optional(),setOpenInAppUrl:Ge().optional(),requestModal:Ge().optional(),uploadFile:Ge().optional(),selectFiles:Ge().optional(),getFileDownloadUrl:Ge().optional(),requestCheckout:Ge().optional(),requestClose:Ge().optional()}).optional()}),tq=Mr({source:xo(["hosted","widget"]),fps:nt().optional(),durationMs:nt().optional(),distinctFrames:nt().optional(),truncated:Ge().optional()}),oK=Mr({traceVersion:br(1),messages:Qt(Jx()),widgetSnapshots:Qt(eq).optional(),spans:Qt(JU).optional(),prompts:Qt(ZU).optional(),videoBlobId:ve().optional(),videoMeta:tq.optional()});function nq(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 rq({recording:e}){let t;try{t=bg(e)}catch{return null}return(0,p.jsxs)("section",{"aria-label":"Workspace events",className:"mt-4 space-y-2 text-xs",children:[(0,p.jsx)("p",{className:"font-medium",children:"Workspace events"}),t.droppedEvents>0&&(0,p.jsxs)("p",{className:"text-muted-foreground",children:[t.droppedEvents," earlier events omitted."]}),t.events.map(n=>(0,p.jsxs)("div",{className:"flex gap-2 border-b border-border py-2",children:[(0,p.jsx)("span",{className:"tabular-nums text-muted-foreground",children:n.sequence}),(0,p.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))]})}var wg=(0,g.createContext)(void 0);function aK({accounts:e,children:t}){const n=X4();return(0,p.jsx)(wg.Provider,{value:n?e:void 0,children:t})}function DE(){const e=(0,g.useContext)(wg);return(0,g.useCallback)(t=>ME(t,e),[e])}function lK({spans:e,children:t}){const n=(0,g.useContext)(wg),r=(0,g.useMemo)(()=>_U(e,n),[e,n]);return(0,p.jsx)(Z1.Provider,{value:r,children:t})}var iq=1024;function sq(e){const[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1);return(0,g.useLayoutEffect)(()=>{if(e!=="auto"||!t)return;const s=()=>i(t.getBoundingClientRect().width>=iq);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 oq=["all","connection","discovery","llm","tool","error"];function sf(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 aq({filter:e,onFilterChange:t,isFullyExpanded:n,expandDisabled:r,onToggleExpandAll:i,zoomControls:s,showBottomBorder:o=!0}){return(0,p.jsxs)("div",{className:G("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,p.jsxs)(Vm,{children:[(0,p.jsx)(zm,{asChild:!0,children:(0,p.jsxs)(Ot,{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: ${sf(e)}`,children:[(0,p.jsx)(ZD,{className:"size-3.5 shrink-0 opacity-80","aria-hidden":!0}),sf(e)]})}),(0,p.jsx)($m,{align:"start",className:"min-w-[8rem]",children:(0,p.jsx)(GV,{value:e,onValueChange:a=>t(a),children:oq.map(a=>(0,p.jsx)(QV,{value:a,className:"text-xs",children:sf(a)},a))})})]}),(0,p.jsx)(Ot,{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,p.jsx)(lN,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0}):(0,p.jsx)(QD,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0})}),s?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"bg-border hidden h-3 w-px shrink-0 md:block","aria-hidden":!0}),(0,p.jsx)("div",{className:"flex shrink-0 items-center gap-0.5",children:s})]}):null]})}function NE(e,t=[]){const n=e.filter(r=>r.category==="llm");if(!(!n.some(r=>r.cost)&&t.length===0))return CN([...n.map(r=>r.cost),...t])}function LE(e,t){if(!e||e.kind==="interaction")return;if(e.kind==="span"){const{span:r}=e;if(r.category!=="llm")return;const i=r.cost??t?.find(({id:s})=>s===r.id)?.cost;return i?{kind:"call",cost:i}:void 0}const n=NE((t??[]).filter(r=>(r.promptIndex??0)===e.promptIndex));return n?{kind:"rollup",rollup:n}:void 0}function lq(e){if(e===0)return"$0.00";if(e<1e-4)return"<$0.0001";const t=e.toFixed(4);return Number(t)<1?`$${t}`:`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}var Sg={provider_reported:"Provider-reported",list_price:"Estimated at list price",customer_rate:"Estimated at your rates",runner_reported:"Runner-reported"},_E={partial:"Partial",unavailable:"Cost unavailable"},kg=e=>e==="list_price"||e==="customer_rate",cq={no_usage:"No token usage was reported for this call.",no_rate:"No price is on record for this model.",invalid_rate:"The price on record for this model was invalid. An organization admin can set a price under Model prices to price future calls.",unsupported_currency:"The price on record is not in US dollars."},uq={usage:"unreported usage",input_tokens:"input tokens",output_tokens:"output tokens",rate:"tokens without a rate",cache_read_rate:"cache reads",cache_write_rate:"cache writes",cache_write_1h_rate:"one-hour cache writes",web_search_rate:"web searches"},hq={input:"Input",cacheRead:"Cache read",cacheWrite:"Cache write",output:"Output",webSearch:"Web search"};function fq(e){if(e.length<=1)return e[0]&&Sg[e[0]];const t=e.filter(kg).length;return t===e.length?"Estimated":t>0?"Reported and estimated":"Reported"}function dq(e){const t=(e.missing??[]).map(i=>uq[i]),n=e.completeness==="unavailable"?e.reason?cq[e.reason]:"No price is on record for this call.":e.completeness==="partial"?t.length>0?`Excludes ${t.join(", ")}.`:"Some charges on this call are not priced.":void 0,r=Object.entries(hq).flatMap(([i,s])=>{const o=e.parts?.[i];return typeof o=="number"?[{label:s,amountUsd:o}]:[]});return{amountUsd:e.amountUsd,estimated:e.source?kg(e.source):!1,sourceLabel:e.source?Sg[e.source]:void 0,completeness:e.completeness,note:n,parts:r}}function pq(e){const t=e.totalCalls-e.unavailableCalls,n=e.totalCalls===1?"call":"calls",r=e.partialCalls>0?`, ${e.partialCalls} partly`:"";return{amountUsd:e.completeness==="unavailable"?void 0:e.knownSubtotalUsd,estimated:e.sources.some(kg),sourceLabel:fq(e.sources),completeness:e.completeness,coverage:`${t} of ${e.totalCalls} ${n} priced${r}`,parts:[]}}function jE(e){return e.kind==="call"?dq(e.cost):pq(e.rollup)}var mq="trace-cost";function Oa(){return $1(mq)===!0}var BE="evalIterationModelCalls:list",gq=pu(BE),wl=e=>Number.isInteger(e)&&e>=0;function vq(e){if(!e||typeof e!="object")return;const t=e,{knownSubtotalUsd:n,sources:r}=t;return t.currency==="USD"&&typeof n=="number"&&Number.isFinite(n)&&n>=0&&["complete","partial","unavailable"].includes(t.completeness)&&wl(t.totalCalls)&&wl(t.completeCalls)&&wl(t.partialCalls)&&wl(t.unavailableCalls)&&Array.isArray(r)&&r.every(i=>typeof i=="string"&&Object.hasOwn(Sg,i))?e:void 0}function cK(e,t){const n=vq(e.usage?.costRollup);return{iterationId:e._id,...n?{rollup:n}:{},harness:t?t.startsWith("harness:"):!!eM(e.execution)?.harness}}function yq(e,t){const n=new Set(e.filter(o=>o.category==="llm").map(o=>o.id)),r=new Map,i=[],s=new Set;for(const o of t??[]){if(s.has(o.generationId))continue;s.add(o.generationId);const a=kS(o.cost),l=o.matchedSpanId;l&&n.has(l)&&!r.has(l)?r.set(l,a):i.push({generationId:o.generationId,modelId:o.modelId,cost:a})}return{spans:e.map(o=>{const a=o.cost??r.get(o.id);return a===o.cost?o:{...o,cost:a}}),unmatched:i}}function xq(e){return tM(e,BE)}var FE=[];function Lu(e){const t=Oa();return(0,g.useMemo)(()=>t&&e?jE(e):void 0,[t,e])}function ha({amountUsd:e,estimated:t,slot:n=!1}){return(0,p.jsxs)("span",{className:"whitespace-nowrap tabular-nums",children:[t?(0,p.jsx)("span",{className:"inline-block w-[1ch] text-center",children:"≈"}):n?(0,p.jsx)("span",{"aria-hidden":!0,className:"inline-block w-[1ch]"}):null,lq(e)]})}function VE({view:e}){return(0,p.jsxs)(p.Fragment,{children:[e.sourceLabel?(0,p.jsx)(kc,{variant:"outline",className:"px-1.5 py-0 text-[10px] text-muted-foreground",children:e.sourceLabel}):null,e.completeness!=="complete"?(0,p.jsx)(kc,{variant:"outline",className:G("px-1.5 py-0 text-[10px]",e.completeness==="partial"?"border-warning/50 bg-warning/10 text-foreground":"text-muted-foreground"),children:_E[e.completeness]}):null,e.coverage?(0,p.jsx)("span",{children:e.coverage}):null,e.note?(0,p.jsx)("span",{children:e.note}):null]})}function bq({cost:e}){const t=Lu(e);return t?.amountUsd===void 0?null:(0,p.jsxs)("span",{"data-testid":"trace-cost-inline",children:[" · ",(0,p.jsx)("span",{className:"font-medium text-foreground",children:(0,p.jsx)(ha,{amountUsd:t.amountUsd,estimated:t.estimated})})]})}function wq({cost:e}){const t=Lu(e);return t?(0,p.jsxs)("div",{"data-testid":"trace-cost-chips",className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[(0,p.jsx)("span",{className:"text-muted-foreground/70",children:"Cost"}),(0,p.jsx)(VE,{view:t})]}):null}function to({label:e,children:t}){return(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:e}),(0,p.jsx)("span",{className:"min-w-0 text-right font-medium text-popover-foreground",children:t})]})}function Sq({cost:e}){const t=Lu(e);return t?(0,p.jsxs)("div",{"data-testid":"trace-row-hover-cost",className:"space-y-1.5",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Cost"}),(0,p.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,p.jsx)(to,{label:e?.kind==="rollup"?"Total":"Amount",children:t.amountUsd===void 0?"Unavailable":(0,p.jsx)(ha,{amountUsd:t.amountUsd,estimated:t.estimated,slot:!0})}),t.parts.map(n=>(0,p.jsx)(to,{label:n.label,children:(0,p.jsx)(ha,{amountUsd:n.amountUsd,estimated:t.estimated,slot:!0})},n.label)),t.sourceLabel?(0,p.jsx)(to,{label:"Source",children:t.sourceLabel}):null,t.completeness==="partial"?(0,p.jsx)(to,{label:"Status",children:_E.partial}):null,t.coverage?(0,p.jsx)(to,{label:"Coverage",children:t.coverage}):null,t.note?(0,p.jsx)("p",{className:"text-popover-foreground/70",children:t.note}):null]})]}):null}function kq(e,t){const n=Oa()&&t?.harness?t.iterationId:void 0,[r,i]=(0,g.useState)(),s=r?.iterationId===n?r?.calls:void 0,o=(0,g.useMemo)(()=>s?yq(e??[],s):void 0,[e,s]),a=(0,g.useCallback)(()=>i(void 0),[]),l=n?(0,p.jsx)(Sc,{name:"trace-cost-model-calls",isExpectedError:xq,onError:a,fallback:null,children:(0,p.jsx)(Cq,{iterationId:n,onLoad:i})},n):null;return{spans:o?.spans??e,unmatched:o?.unmatched??FE,loader:l}}function Cq({iterationId:e,onLoad:t}){const n=V1(gq,{iterationId:e});return(0,g.useEffect)(()=>{n&&t({iterationId:e,calls:n})},[n,e,t]),null}function Aq({spans:e,iteration:t,unmatched:n=FE}){const r=Oa(),i=Lu((0,g.useMemo)(()=>{if(!r)return;const s=t?.rollup??NE(e??[],n.map(o=>o.cost));return s&&{kind:"rollup",rollup:s}},[r,e,t?.rollup,n]));return i?(0,p.jsxs)("div",{"data-testid":"trace-cost-summary",className:"shrink-0 space-y-2 rounded-lg border border-border/50 bg-background px-3 py-2 text-xs text-muted-foreground",children:[(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,p.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide",children:"Trace cost"}),i.amountUsd!==void 0?(0,p.jsx)("span",{className:"text-sm font-semibold text-foreground",children:(0,p.jsx)(ha,{amountUsd:i.amountUsd,estimated:i.estimated})}):null,(0,p.jsx)(VE,{view:i})]}),n.length>0?(0,p.jsx)(Tq,{calls:n}):null]}):null}function Tq({calls:e}){return(0,p.jsxs)("div",{"data-testid":"trace-cost-unmatched-calls",className:"space-y-1",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide",children:"Model calls not matched to a step"}),(0,p.jsx)("ul",{"data-testid":"trace-cost-unmatched-list",className:"max-h-40 space-y-0.5 overflow-y-auto",children:e.map(t=>{const n=t.cost&&jE({kind:"call",cost:t.cost});return(0,p.jsxs)("li",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,p.jsx)("span",{className:"min-w-0 truncate font-mono text-foreground",children:t.modelId}),(0,p.jsx)("span",{className:"font-medium text-foreground",children:n?.amountUsd!==void 0?(0,p.jsx)(ha,{amountUsd:n.amountUsd,estimated:n.estimated}):"Cost unavailable"}),n?.sourceLabel?(0,p.jsx)("span",{children:n.sourceLabel}):null]},t.generationId)})})]})}var Hx=[0,25,50,75,100],Eq=54,Mq=120;function Rq(e){if(!Number.isFinite(e))return[0,100];if(e<=0)return[0,100];const t=Math.max(2,Math.floor(e/Eq));return t>=Hx.length?[...Hx]:t<=2?[0,100]:t===3?[0,50,100]:[0,25,75,100]}function Pq(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 Wx(e){return e<=0?ic(0):`${ic(0)}–${ic(e)}`}function Iq(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 _u(e,t){return t}function Ux(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 _u(e,9)}}function Oq(e,t){if(e.startMs!==t.startMs)return e.startMs-t.startMs;const n=Ux(e.category)-Ux(t.category);return n!==0?n:e.endMs!==t.endMs?e.endMs-t.endMs:e.name.localeCompare(t.name)}function Dq(e,t){return typeof e!="number"||t<50?null:e/(t/1e3)}function No(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:`${Math.round(e)}ms`}function ic(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`}function Jn(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function fa(e){const t=e.toolName??e.name;return typeof t=="string"&&t.trim()?t:void 0}function Da(e){return Array.isArray(e.content)?e.content.filter(t=>Jn(t)&&typeof t.type=="string"):typeof e.content=="string"?[{type:"text",text:e.content}]:[]}function zE(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(Jn(e)){const t=Object.keys(e);return t.length>0?`{ ${t.slice(0,4).join(", ")}${t.length>4?", ...":""} }`:"{}"}return String(e)}function Nq(e){const t=Da(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: ${fa(r)??"Tool"}`:r.type==="tool-result"?`Tool result: ${fa(r)??"Tool"}`:typeof r.type=="string"?r.type:"content").join(" | ");return n.length>220?`${n.slice(0,217)}...`:n}function Lq(e){return!Jn(e)||!("type"in e)||!("value"in e)?e:e.value}function _q(e){return e.result!==void 0?e.result:Lq(e.output)}function jq(e){const t=_q(e);if(typeof e.error=="string"&&e.error.trim())return e.error.trim();if(Jn(e.error)&&typeof e.error.message=="string")return e.error.message;if(Jn(e.output)&&e.output.type==="error-text")return typeof e.output.value=="string"?e.output.value:"Tool error";if(Jn(e.result)&&e.result.isError===!0||Jn(e.output)&&Jn(e.output.value)&&e.output.value.isError===!0||e.isError===!0)return rf(t)??"Tool error"}function ju(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 Da(a)){const c=typeof t=="string"&&l.toolCallId===t,u=!t&&typeof n=="string"&&fa(l)===n;if(!(!c&&!u)&&(l.type==="tool-call"&&(i=l.input??l.parameters??l.args),l.type==="tool-result")){s=l.result??(Jn(l.output)&&"value"in l.output?l.output.value:l.output);const h=jq(l);h&&(o=h)}}return{input:i,output:s,errorText:o}}function Zi(e,t,n=!1){return e.category==="error"||e.status==="error"?!0:e.category==="tool"?!!ju(t,e.toolCallId,e.toolName??e.name,n?e:void 0).errorText:!1}function _s(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 Bq(e){return _s(e.messageStartIndex,e.messageEndIndex)}function Fq(e){return _s(e.span.messageStartIndex,e.span.messageEndIndex)}function $E(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 HE(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 Cg(e,t,n){if(!e.length)return;const r=_s(t,n);if(!r){const s=e.findIndex(o=>o.role==="user");return s>=0?s:void 0}const i=HE(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 Vq(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 _u(n,"trace-waterfall-bar-step")}}function zq(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 _u(e,"text-muted-foreground")}}function $q(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 _u(n,"border-l-muted-foreground")}}function Hq(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)=>Oq(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 qx(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 of(e){return{role:e.role,content:e.content}}function WE(e,t,n){const r=_s(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 Wq(e,t,n){const r=_s(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(of),output:null};const o=WE(e,t,n),a=i[s];return{input:o.length>0?o.map(of):null,output:of(a)}}var Uq=96;function Zt(e,t=Uq){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function da(e){return typeof e.content=="string"?e.content.trim():Da(e).map(t=>t.type==="text"&&typeof t.text=="string"?t.text.trim():"").filter(Boolean).join(" ")}function qq(e){const t=Da(e),n=[];for(const r of t)r.type==="tool-call"&&n.push(fa(r)??"tool");return n}function Kq(e,t){if(!e.length)return;const n=WE(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=da(i);if(s)return Zt(s)}}for(const r of n)if(r.role==="system"){const i=da(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=Nq(i);if(s&&s!=="No content")return Zt(s)}}}}function Gq(e,t){if(!e.length)return;const n=_s(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=da(s);if(o)return{kind:"text",preview:Zt(o)};const a=qq(s);if(a.length>0)return{kind:"tools",preview:Zt(`Calling ${a.join(", ")}`)}}}function Qq(e,t,n){const r=Cg(e,t,n);if(typeof r!="number")return;const i=da(e[r]);return i?Zt(i):void 0}function Yq(e,t,n){const r=Cg(e,t,n);if(typeof r=="number")return da(e[r])||void 0}function Kx(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&&fa(e)===n)}function Xq(e,t,n){if(n)for(let r=n.startIndex;r<=n.endIndex;r+=1){const i=e[r];if(!i)continue;const s=Da(i);if(s.some(o=>o.type==="tool-call"&&Kx(o,t))||s.some(o=>o.type==="tool-result"&&Kx(o,t)))return r}}function Jq(e,t){const n=Cg(t,e.messageStartIndex,e.messageEndIndex);if(typeof n=="number")return{focusSourceIndex:n,highlightSourceIndices:[n]};const r=$E(Bq(e));if(r.length!==0)return{focusSourceIndex:r[0],highlightSourceIndices:r}}function Zq(e,t){const n=Fq(e),r=$E(n);if(r.length===0)return;const i=HE(t,n,s=>s.role==="assistant");return{focusSourceIndex:(e.span.category==="tool"?Xq(t,e.span,n):void 0)??i??r[0],highlightSourceIndices:r}}function e6(e,t,n=!1){const r=ju(e,t.toolCallId,t.toolName??t.name,n?t:void 0);if(r.input==null)return;const i=zE(r.input);if(!(!i||i==="None"))return Zt(i)}function Es({category:e,size:t="sm"}){const n=G(t==="lg"?"h-5 w-5 shrink-0":"h-3.5 w-3.5 shrink-0",zq(e));switch(e){case"prompt":return(0,p.jsx)(fN,{className:n,"aria-hidden":!0});case"llm":return(0,p.jsx)(KD,{className:n,"aria-hidden":!0});case"tool":return(0,p.jsx)(dN,{className:n,"aria-hidden":!0});case"interaction":return(0,p.jsx)(iN,{className:n,"aria-hidden":!0});case"error":return(0,p.jsx)(GD,{className:n,"aria-hidden":!0});case"connection":case"discovery":case"step":return(0,p.jsx)(nv,{className:n,"aria-hidden":!0});default:return(0,p.jsx)(nv,{className:n,"aria-hidden":!0})}}function t6(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 n6(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=t6(t,e.span);return typeof r.inputTokens=="number"||typeof r.outputTokens=="number"||typeof r.totalTokens=="number"?r:n}function af(e){return typeof e=="number"?e.toLocaleString():"—"}function Gx(e){return typeof e=="number"&&Number.isFinite(e)?new Date(e).toLocaleString():"—"}function r6({traceStartedAtMs:e,traceEndedAtMs:t,traceDurationMs:n}){return typeof e=="number"&&Number.isFinite(e)?e:typeof t=="number"&&Number.isFinite(t)?t-n:null}function Tp(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=Kq(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=Gq(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=e6(t,i,n),u=!c||c==="{}"||c==="None";if(c&&!u)return{title:l,subtitle:c};if(u){const h=ju(t,i.toolCallId,i.toolName??i.name,n?i:void 0);if(h.output!=null){const f=zE(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 Ep(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 i6({format:e,onFormatChange:t}){return(0,p.jsx)("div",{className:"flex flex-wrap gap-1",children:["plain","markdown"].map(n=>(0,p.jsx)(Ot,{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 Qx({value:e}){const[t,n]=(0,g.useState)("plain");return(0,g.useEffect)(()=>{typeof e=="string"&&n("plain")},[e]),e==null?(0,p.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,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(i6,{format:t,onFormatChange:n}),t==="markdown"?(0,p.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,p.jsx)(JT,{content:e})}):(0,p.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,p.jsx)(A4,{value:e,containerClassName:"max-h-56 rounded-md border border-border/60 bg-background"})}function s6({row:e}){return(0,p.jsxs)("div",{"data-testid":"trace-detail-pane",className:"min-h-[280px] rounded-lg bg-muted/5 px-5 py-5",children:[(0,p.jsx)(OE,{step:e.step,leading:(0,p.jsx)(Es,{category:"interaction",size:"lg"})}),e.step.pluginWorkspace&&(0,p.jsx)(rq,{recording:e.step.pluginWorkspace})]})}function Yx(e){return e.split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function o6(e){return e.engine==="harness"?e.harness?Yx(e.harness):"Harness":e.engine==="emulated"?"Emulated":e.harness?Yx(e.harness):"Unknown"}function a6({row:e,recordedSpans:t,projectedMessages:n,transcriptMessages:r,onRevealInTranscript:i,turnRuntimeByPromptIndex:s}){const o=DE(),a=Oa();if(!e)return(0,p.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,p.jsx)("div",{className:"flex h-14 w-14 items-center justify-center rounded-full border border-border/50 bg-background shadow-sm",children:(0,p.jsx)(JD,{className:"h-7 w-7 text-muted-foreground","aria-hidden":!0})}),(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("p",{className:"text-sm font-medium text-foreground",children:"No span selected"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click a row or use arrow keys"})]})]});if(e.kind==="interaction")return(0,p.jsx)(s6,{row:e});const l=e.kind==="prompt"?Jq(e,r):Zq(e,r),c=e.kind==="span"?ju(r,e.span.toolCallId,e.span.toolName??e.span.name,n?e.span:void 0):{},{durationMs:u}=Ep(e),h=e.kind==="span"?Tp(e,r,n,o(e.span)):null,f=e.kind==="prompt"?e.label:h.title,d=e.kind==="prompt"?e.hasAnyFailure?"error":"ok":Zi(e.span,r,n)?"error":"ok",m=e.kind==="prompt"?"prompt":e.span.category==="tool"&&Zi(e.span,r,n)?"error":e.span.category,v=s?.get(e.promptIndex),y=e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?Wq(r,e.span.messageStartIndex,e.span.messageEndIndex):{input:null,output:null},x=e.kind==="span"&&e.span.category==="tool"&&(!!e.span.toolCallId||!!(e.span.toolName?.trim()||e.span.name?.trim())),b=e.kind==="prompt"?null:x?c.input:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?y.input:(e.kind==="span"&&e.span.category==="error",null),w=e.kind==="prompt"?null:x?c.output:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?y.output:e.kind==="span"&&e.span.category==="error"?e.span.name:null,S=e.kind==="prompt"?Yq(r,e.messageStartIndex,e.messageEndIndex):void 0,C=e.kind==="span"&&(typeof e.span.inputTokens=="number"||typeof e.span.outputTokens=="number"||typeof e.span.totalTokens=="number"),A=e.kind==="prompt"&&(typeof e.aggregatedInputTokens=="number"||typeof e.aggregatedOutputTokens=="number"||typeof e.aggregatedTotalTokens=="number"),k=e.kind==="span"&&c.errorText?c.errorText:null,E=!!(l&&i),T=a?LE(e,t):void 0;return(0,p.jsxs)("div",{"data-testid":"trace-detail-pane",className:"space-y-4 bg-background p-4",children:[(0,p.jsxs)("div",{className:G("border-b border-border/40 pb-3",E?"flex flex-col gap-3 min-[400px]:flex-row min-[400px]:items-start":""),children:[(0,p.jsxs)("div",{className:G("flex gap-3",E?"min-w-0 min-[400px]:flex-1":""),children:[(0,p.jsx)("div",{className:"shrink-0 pt-0.5",children:e.kind==="prompt"?(0,p.jsx)(Es,{category:"prompt",size:"lg"}):(0,p.jsx)(Es,{category:m,size:"lg"})}),(0,p.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,p.jsx)("h3",{className:"text-sm font-bold leading-tight text-foreground",children:f}),v?(0,p.jsxs)(kc,{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:v.engine==="harness"?"This turn ran through the harness adapter.":v.engine==="emulated"?"This turn ran through MCPJam's emulated chat engine.":v.harness?"This turn ran through the harness adapter.":"Runtime engine was not recorded for this turn.",children:["Engine: ",o6(v)]}):null,d==="error"?(0,p.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]}),(0,p.jsxs)("div",{className:"text-xs tabular-nums text-muted-foreground",children:[(0,p.jsx)("span",{className:"font-medium text-foreground",children:No(u)}),e.kind==="prompt"&&A?(0,p.jsxs)(p.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"&&C?(0,p.jsxs)(p.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,(0,p.jsx)(bq,{cost:T})]}),(0,p.jsx)(wq,{cost:T}),e.kind==="span"?(()=>{const R=e.span,P=R.category==="llm"?Dq(R.outputTokens,u):null,M=[];return R.provider&&M.push({label:"Provider",value:R.provider}),R.finishReason&&M.push({label:"Finish",value:R.finishReason}),typeof R.ttfcMs=="number"&&M.push({label:"TTFC",value:No(R.ttfcMs)}),P!==null&&M.push({label:"Throughput",value:`${P.toFixed(1)} tok/s`}),R.responseId&&M.push({label:"Response ID",value:R.responseId}),M.length===0?null:(0,p.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:M.map(N=>(0,p.jsxs)("span",{className:"truncate",children:[(0,p.jsxs)("span",{className:"text-muted-foreground/70",children:[N.label,":"," "]}),(0,p.jsx)("span",{className:"font-medium text-foreground",children:N.value})]},N.label))})})():null]})]}),E?(0,p.jsx)("div",{className:"flex min-w-0 min-[400px]:flex-1 min-[400px]:justify-end min-[400px]:pt-0.5",children:(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"outline",className:"w-full shrink-0 justify-center whitespace-nowrap min-[400px]:w-auto",onClick:()=>{l&&i&&i(l)},children:[(0,p.jsx)(tN,{className:"h-3.5 w-3.5"}),"Reveal in Chat"]})}):null]}),e.kind==="prompt"&&S?(0,p.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:S}):null,n&&e.kind==="span"&&e.span.messageStartIndex===void 0?(0,p.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,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Input"}),(0,p.jsx)(Qx,{value:b??void 0})]}),(0,p.jsxs)("div",{className:G("space-y-2",e.span.category==="error"||k?"rounded-md border border-destructive/50 bg-destructive/50 p-2":""),children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Output"}),(0,p.jsx)(Qx,{value:w??void 0}),k?(0,p.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:k}):null,typeof e.span.mcpErrorCode=="number"?(0,p.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,p.jsx)("span",{className:"text-muted-foreground/70",children:"MCP error: "}),(0,p.jsx)("span",{className:"font-medium text-foreground",children:XU(e.span.mcpErrorCode)})]}):null]})]}):null]})}function uK({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:m,onExpandedStepIdsChange:v,viewportMaxMs:y,turnRuntimeByPromptIndex:x,fillContent:b=!1,detailPlacement:w="below",iterationCost:S}){const{containerRef:C,direction:A}=sq(w),k=A==="horizontal",E=(0,g.useMemo)(()=>t?nq(e??[],s):void 0,[t,e,s]),T=E?.spans??e,R=kq(T,S),P=R.spans,M=vM(),N=DE(),L=Oa(),I=(0,g.useMemo)(()=>new Set(L?(P??[]).filter(O=>O.cost).map(O=>O.id):[]),[L,P]),_=T&&T.length>0?"recorded":(r??0)>0?"estimated":"none",j=(0,g.useMemo)(()=>T?.length?Hq(T).map(O=>E?{...O,messageStartIndex:E.userIndices[O.promptIndex]??-1,messageEndIndex:E.userIndices[O.promptIndex]??-1}:O):[],[T,E]),$=(0,g.useMemo)(()=>{const O=new Map;for(const le of n??[]){const fe=O.get(le.toolCallId);fe?fe.push(le):O.set(le.toolCallId,[le])}for(const le of O.values())le.sort((fe,Ie)=>fe.stepIndex-Ie.stepIndex);return O},[n]),B=T?.length?T.reduce((O,le)=>Math.max(O,le.endMs),1):Math.max(r??0,1),D=(0,g.useMemo)(()=>T?.map(O=>`${O.id}:${O.startMs}:${O.endMs}`).join("|")??_,[_,T]),[se,ne]=(0,g.useState)(1);(0,g.useEffect)(()=>{y===void 0&&ne(B)},[B,D,y]);const F=Math.max(1,y!==void 0?y:se),q=Math.max(1,Math.round(B/50)),K=(0,g.useMemo)(()=>r6({traceStartedAtMs:o,traceEndedAtMs:a,traceDurationMs:B}),[B,a,o]),[Y,H]=(0,g.useState)("all"),X=u!==void 0?u:Y,oe=h??H,[pe,ae]=(0,g.useState)(new Set),[at,et]=(0,g.useState)(new Set),Re=f!==void 0?f:pe,ze=d??ae,_e=m!==void 0?m:at,_n=v??et,[je,hn]=(0,g.useState)(null),[wt,tt]=(0,g.useState)(null),[J,ge]=(0,g.useState)(null),ke=(0,g.useRef)(null),js=(0,g.useRef)(null),[$e,Ai]=(0,g.useState)(-1);(0,g.useLayoutEffect)(()=>{const O=js.current;if(!O)return;const le=()=>{const Ie=O.getBoundingClientRect().width;Ai(Number.isFinite(Ie)?Ie:0)};if(le(),typeof ResizeObserver>"u")return;const fe=new ResizeObserver(le);return fe.observe(O),()=>fe.disconnect()},[A]);const gt=(0,g.useMemo)(()=>Rq($e),[$e]),Ti=(0,g.useMemo)(()=>gt.length!==2?!1:$e<0||$e===0?!0:$e<Mq,[$e,gt]);(0,g.useEffect)(()=>{c||(ae(new Set(j.map(O=>O.key))),et(qx(j)))},[c,j]);const Pe=(0,g.useMemo)(()=>{if(_!=="recorded")return[];const O=[],le=new Set;function fe(re){return X==="all"?!0:X==="error"?Zi(re,s,t):re.category===X}function Ie(re,zt,fn){const Wr=re.span.category==="step",$t=Wr?fn:fn+1,dn=re.children.map(St=>Ie(St,zt,$t)),Fs=dn.flatMap(St=>St.rows),Vs=dn.some(St=>St.hasVisibleContent);if(Wr)return{hasVisibleContent:Vs||re.children.length>0,rows:Fs};if(re.span.category==="llm"&&!I.has(re.span.id)&&typeof re.span.totalTokens!="number"&&typeof re.span.inputTokens!="number"&&typeof re.span.outputTokens!="number"&&re.span.endMs-re.span.startMs<50)return{hasVisibleContent:!1,rows:[]};const jn=re.span.toolCallId,zs=re.span.category==="tool"&&!!jn&&!le.has(jn);zs&&jn&&le.add(jn);const _a=zs&&jn?($.get(jn)??[]).filter(St=>X==="all"||X==="tool"?!0:X==="error"?Vc(St)==="error":!1).map((St,Vu)=>({kind:"interaction",key:`interaction-${re.span.id}-${St.stepIndex}-${Vu}`,promptIndex:zt,depth:fn+1,step:St,startMs:re.span.startMs,endMs:re.span.endMs,status:Vc(St)})):[];if(!(fe(re.span)||Vs||_a.length>0))return{hasVisibleContent:Vs,rows:Fs};const $s={kind:"span",key:re.span.id,promptIndex:zt,depth:fn,span:re.span,hasChildren:re.children.length>0,isExpanded:_e.has(re.span.id)};return{hasVisibleContent:!0,rows:[$s,...$s.hasChildren&&$s.isExpanded?Fs:[],..._a]}}for(const re of j){const zt=re.roots.map(dn=>Ie(dn,re.promptIndex,0)).flatMap(dn=>dn.rows);if(!(zt.length>0||X==="all"&&re.spans.length>0))continue;const fn=re.spans.some(dn=>Zi(dn,s,t)),Wr=Qq(s,re.messageStartIndex,re.messageEndIndex),$t=Iq(re.spans);O.push({kind:"prompt",key:re.key,promptIndex:re.promptIndex,label:re.label,conversationLabel:Wr?`User: "${Wr}"`:void 0,startMs:re.startMs,endMs:re.endMs,messageStartIndex:re.messageStartIndex,messageEndIndex:re.messageEndIndex,counts:re.counts,hasAnyFailure:fn,isExpanded:Re.has(re.key),aggregatedInputTokens:$t.inputTokens,aggregatedOutputTokens:$t.outputTokens,aggregatedTotalTokens:$t.totalTokens}),Re.has(re.key)&&O.push(...zt)}return O},[Re,_e,X,j,$,_,s,t,I]),Bs=(0,g.useMemo)(()=>qx(j),[j]),Na=(0,g.useMemo)(()=>{if(j.length===0)return!1;for(const O of j)if(!Re.has(O.key))return!1;for(const O of Bs)if(!_e.has(O))return!1;return!0},[j,Re,_e,Bs]);(0,g.useEffect)(()=>{if(Pe.length===0){hn(null);return}(!je||!Pe.some(O=>O.key===je))&&hn(Pe[0].key)},[Pe,je]);const Hr=Pe.find(O=>O.key===je),Te=wt?Pe.find(O=>O.key===wt):void 0,Bu=wt?Pe.findIndex(O=>O.key===wt):-1;(0,g.useEffect)(()=>{wt&&!Pe.some(O=>O.key===wt)&&(tt(null),ge(null),ke.current=null)},[wt,Pe]);const La=(0,g.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,g.useEffect)(()=>{if(!wt)return;const O=()=>{const le=ke.current;le&&ge(La(le))};return window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[wt,La]);const Ag=(0,g.useMemo)(()=>{if(!Te)return null;const{startMs:O,endMs:le}=Ep(Te),fe=Te.kind==="span"&&Zi(Te.span,s,t),Ie=Te.kind==="span"?Tp(Te,s,t,N(Te.span)):null,re=Te.kind==="prompt"?Te.conversationLabel??Te.label:Te.kind==="interaction"?Ts(Te.step):Ie.title,zt=n6(Te,T),fn=Te.kind==="prompt"?"prompt":Te.kind==="interaction"?"interaction":Te.span.category==="tool"&&fe?"error":Te.span.category;return{label:re,spanShowsFailure:fe,tokenStats:zt,rowStartTimestamp:K!==null?K+O:null,rowEndTimestamp:K!==null?K+le:null,glyphCategory:fn,cost:L?LE(Te,P):void 0}},[Te,T,P,K,s,t,N,L]),UE=(0,g.useCallback)(O=>{if(Pe.length===0)return;const le=Pe.findIndex(fe=>fe.key===je);if(O.key==="ArrowDown"){O.preventDefault();const fe=le<0?0:Math.min(Pe.length-1,le+1);hn(Pe[fe].key);return}if(O.key==="ArrowUp"){O.preventDefault();const fe=le<=0?0:le-1;hn(Pe[fe].key);return}if(O.key==="Enter"&&le>=0){const fe=Pe[le];if(fe.kind==="prompt"){O.preventDefault();const Ie=new Set(Re);Ie.has(fe.key)?Ie.delete(fe.key):Ie.add(fe.key),ze(Ie);return}if(fe.kind==="span"&&fe.hasChildren){O.preventDefault();const Ie=new Set(_e);Ie.has(fe.key)?Ie.delete(fe.key):Ie.add(fe.key),_n(Ie)}}},[Re,_e,Pe,je,ze,_n]),Fu=(0,p.jsxs)(p.Fragment,{children:[R.loader,(0,p.jsx)(Aq,{spans:P,iteration:S,unmatched:R.unmatched})]});if(_==="none")return(0,p.jsxs)(p.Fragment,{children:[Fu,(0,p.jsx)("div",{className:"text-xs text-muted-foreground",children:"No timing data recorded for this iteration."})]});if(_==="estimated")return(0,p.jsxs)("div",{className:"space-y-3",children:[Fu,(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(kc,{className:"border-warning/50 bg-warning/50 text-foreground",children:"Estimated total only"}),(0,p.jsx)("span",{className:"text-xs text-muted-foreground",children:No(r??0)})]}),(0,p.jsxs)("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[(0,p.jsx)("p",{children:"Per-step timing was not recorded for this run."}),i>0?(0,p.jsxs)("p",{children:["Conversation detail is in the Chat tab. Open"," ",(0,p.jsx)("span",{className:"font-medium text-foreground/80",children:"Raw"})," to inspect the stored trace and confirm whether a"," ",(0,p.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 qE=y===void 0?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Ot,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom in timeline","aria-label":"Zoom in timeline",disabled:se<=q,onClick:()=>ne(O=>Math.max(q,Math.round(O*.8))),children:(0,p.jsx)(oN,{className:"size-3.5","aria-hidden":!0})}),(0,p.jsx)(Ot,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom out timeline","aria-label":"Zoom out timeline",disabled:se>=B*4,onClick:()=>ne(O=>Math.min(B*4,Math.round(O*1.25))),children:(0,p.jsx)(rN,{className:"size-3.5","aria-hidden":!0})})]}):null;return(0,p.jsxs)("div",{className:G("space-y-2",b&&"flex min-h-0 flex-1 flex-col"),children:[c?null:(0,p.jsxs)("div",{className:b?"shrink-0":void 0,children:[(0,p.jsx)(aq,{filter:X,onFilterChange:oe,isFullyExpanded:Na,expandDisabled:j.length===0,zoomControls:qE,onToggleExpandAll:()=>{Na?(ze(new Set),_n(new Set)):(ze(new Set(j.map(O=>O.key))),_n(new Set(Bs)))}}),(0,p.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,p.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,p.jsx)("span",{className:G("h-2 w-2.5 rounded-sm",le)}),O]},O))})]}),Fu,(0,p.jsx)("div",{ref:C,className:G("@container/trace-timeline min-w-0",b&&"flex min-h-0 flex-1 flex-col"),children:(0,p.jsxs)(RU,{direction:A,className:G("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,p.jsx)(Cp,{defaultSize:k?62:65,minSize:0,className:"min-h-0 min-w-0 overflow-hidden",children:(0,p.jsx)(NU,{className:G(b?"h-full min-h-0 overflow-hidden":"max-h-[calc(100vh-8rem)] min-h-0"),children:(0,p.jsx)("div",{tabIndex:0,role:"region","aria-label":"Trace timeline. Use arrow keys to change selection, Enter to expand.",onKeyDown:UE,className:"relative min-h-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:(0,p.jsxs)("div",{className:"grid pr-4",style:{gridTemplateColumns:"minmax(140px, 260px) minmax(0, 1fr) minmax(5.25rem, max-content)",gridTemplateRows:`auto repeat(${Pe.length}, minmax(48px, auto))`},children:[(0,p.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,p.jsxs)("div",{className:"flex min-h-6 min-w-0 items-center gap-3",children:[(0,p.jsx)("div",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:"Trace"}),(0,p.jsx)("div",{className:"min-h-6 min-w-0 flex-1",children:(0,p.jsx)("div",{ref:js,className:"relative h-6 min-w-0",children:Ti?(0,p.jsx)("div",{className:"flex h-full min-w-0 items-center justify-center",children:(0,p.jsx)("span",{className:"min-w-0 max-w-full truncate text-center text-[10px] tabular-nums text-muted-foreground",title:Wx(F),children:Wx(F)})}):gt.map(O=>{const le=O>=100?"100%":`${O}%`;return(0,p.jsx)("div",{className:"pointer-events-none absolute inset-y-0",style:{left:le},children:(0,p.jsx)("div",{className:G("absolute text-[10px] tabular-nums text-muted-foreground",Pq(O)),children:ic(F*O/100)})},O)})})})]})}),(0,p.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,p.jsxs)("div",{className:"flex h-6 w-full min-w-0 items-center justify-start gap-1.5",children:[(0,p.jsx)(tv,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,p.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Latency"})]})}),Pe.length>0?(0,p.jsx)("div",{className:"pointer-events-none relative z-0 bg-transparent",style:{gridColumn:2,gridRow:`2 / ${Pe.length+2}`},children:gt.map(O=>(0,p.jsx)("div",{className:"absolute top-0 bottom-0 w-px bg-border/40",style:{left:O>=100?"100%":`${O}%`}},O))}):null,Pe.map((O,le)=>{const fe=O.key===je,{startMs:Ie,endMs:re,durationMs:zt}=Ep(O),fn=Ie/F*100,Wr=Math.max((re-Ie)/F*100,.45),$t=O.kind==="span"&&Zi(O.span,s,t),dn=O.kind==="prompt"?"prompt":O.kind==="interaction"?"interaction":O.span.category==="tool"&&$t?"error":O.span.category,Fs=O.kind==="interaction"&&O.status==="error",Vs=O.kind==="span"?Tp(O,s,t):null,jn=O.kind==="prompt"?O.conversationLabel??O.label:O.kind==="interaction"?Ts(O.step):Vs.title,zs=No(zt),_a=O.kind==="prompt"?!0:O.kind==="interaction"?!1:O.hasChildren||O.span.category==="llm",$s=le+2,St=$q(O,$t),Vu=Vq(O,$t),Tg=()=>{td("trace_span_clicked",{location:"trace_timeline",span_kind:O.kind}),hn(O.key)},zu=kt=>{kt.stopPropagation(),Tg()},KE=fe?G("bg-transparent",St):"border-l-transparent bg-background group-hover:bg-muted/20 hover:bg-muted/20",Eg=fe?"bg-transparent":"bg-background group-hover:bg-muted/20 hover:bg-muted/20";return(0,p.jsxs)(s1.div,{"data-testid":"trace-row","data-state":fe?"selected":void 0,onClick:Tg,onMouseEnter:kt=>{tt(O.key);const Ct=kt.currentTarget;ke.current=Ct,ge(La(Ct))},onMouseLeave:()=>{tt(kt=>kt===O.key?null:kt),ge(null),ke.current=null},onFocus:kt=>{tt(O.key);const Ct=kt.currentTarget;ke.current=Ct,ge(La(Ct))},onBlur:kt=>{kt.currentTarget.contains(kt.relatedTarget)||(tt(Ct=>Ct===O.key?null:Ct),ge(null),ke.current=null)},initial:M||le>=20?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:M||le>=20?{duration:0}:{duration:.15,delay:le*.03+.05,ease:[.16,1,.3,1]},style:{gridColumn:"1 / 4",gridRow:$s,display:"grid",gridTemplateColumns:"subgrid"},className:G("group min-h-0 min-w-0 cursor-pointer items-stretch",fe&&"trace-waterfall-row-selected ring-1 ring-inset ring-ring/40"),children:[(0,p.jsxs)("div",{className:G("flex items-center gap-2 border-b border-border/40 px-4 py-2 transition-all duration-150 border-l-2",KE),children:[(0,p.jsx)("div",{className:"flex shrink-0 items-center",style:{paddingLeft:O.kind==="prompt"?0:O.depth*16},children:_a?(0,p.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:kt=>{if(kt.stopPropagation(),O.kind==="prompt"){const ja=new Set(Re);ja.has(O.key)?ja.delete(O.key):ja.add(O.key),ze(ja);return}const Ct=new Set(_e);Ct.has(O.key)?Ct.delete(O.key):Ct.add(O.key),_n(Ct)},"aria-label":O.kind==="prompt"?`${O.isExpanded?"Collapse":"Expand"} ${O.label}`:`${"isExpanded"in O&&O.isExpanded?"Collapse":"Expand"} ${jn}`,children:"isExpanded"in O&&O.isExpanded?(0,p.jsx)(Xw,{className:"h-3.5 w-3.5"}):(0,p.jsx)(fs,{className:"h-3.5 w-3.5"})}):(0,p.jsx)("span",{className:"mr-1 h-5 w-5"})}),(0,p.jsx)("button",{type:"button","data-testid":"trace-row-label-button",className:"min-w-0 flex-1 text-left",onClick:zu,children:(0,p.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,p.jsx)("span",{"data-testid":"trace-row-glyph",className:"inline-flex shrink-0 items-center",children:O.kind==="prompt"?(0,p.jsx)(Es,{category:"prompt"}):(0,p.jsx)(Es,{category:dn})}),(0,p.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:jn}),(0,p.jsx)(xz,{name:O.kind==="span"?N(O.span):void 0}),O.kind==="prompt"&&O.hasAnyFailure?(0,p.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||Fs?(0,p.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]})})]}),(0,p.jsx)("button",{type:"button","data-testid":"trace-row-bar-hit","data-state":fe?"selected":void 0,className:G("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",Eg),"aria-label":`Select on timeline (${No(zt)})`,onClick:zu,children:(0,p.jsx)("div",{"data-testid":O.kind==="span"&&$t?"trace-row-bar-error":"trace-row-bar",className:G("absolute top-1/2 z-[1] h-4 min-w-0 -translate-y-1/2 rounded-[3px] transition-[left,width] duration-150",Vu),style:{left:`${fn}%`,width:`max(${Wr}%, 3px)`}})}),(0,p.jsxs)("button",{type:"button","data-testid":"trace-row-duration-hit","data-state":fe?"selected":void 0,className:G("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",Eg),"aria-label":`Select row duration (${zs})`,onClick:zu,children:[(0,p.jsx)(tv,{className:"size-3 shrink-0 opacity-80","aria-hidden":!0}),zs]})]},O.key)})]})})})}),(0,p.jsx)(PU,{withHandle:!0}),(0,p.jsx)(Cp,{defaultSize:k?38:35,minSize:k?25:20,className:"min-h-0 min-w-0 overflow-hidden",children:(0,p.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,p.jsx)(a6,{projectedMessages:t,row:Hr,recordedSpans:P,transcriptMessages:s,onRevealInTranscript:l,turnRuntimeByPromptIndex:x})})})]},A)}),Te&&Ag&&J?(0,p.jsx)(l6,{hoverPos:J,info:Ag,placement:Bu===0?"bottom":"top",reduceMotion:M??!1,rowKey:Te.key}):null]})}function l6({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,pa.createPortal)((0,p.jsx)("div",{className:"pointer-events-none",style:d,children:(0,p.jsx)(s1.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,p.jsxs)("div",{"data-testid":"trace-row-hover-card",className:"space-y-3 p-3",children:[(0,p.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,p.jsx)(Es,{category:t.glyphCategory}),(0,p.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-semibold text-popover-foreground",children:t.label})]}),(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Time"}),(0,p.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Start"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-start",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:Gx(t.rowStartTimestamp)})]}),(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"End"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-end",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:Gx(t.rowEndTimestamp)})]})]})]}),(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Tokens"}),(0,p.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Input"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-input-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:af(t.tokenStats.inputTokens)})]}),(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Output"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-output-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:af(t.tokenStats.outputTokens)})]}),(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Total"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-total-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:af(t.tokenStats.totalTokens)})]})]})]}),(0,p.jsx)(Sq,{cost:t.cost})]})},i)}),document.body)}export{F8 as $,a1 as $n,KD as $r,p8 as $t,RU as A,J6 as An,dN as Ar,R8 as At,JT as B,W6 as Bn,nN as Br,v8 as Bt,rK as C,te as Ci,r8 as Cn,ru as Cr,Bl as Ct,Js as D,Le as Di,Z6 as Dn,x6 as Dr,E8 as Dt,tK as E,PM as Ei,oF as En,AS as Er,QV as Et,W4 as F,$6 as Fn,cN as Fr,k8 as Ft,S4 as G,V6 as Gn,XD as Gr,pt as Gt,X8 as H,UB as Hn,eN as Hr,NV as Ht,eK as I,Q6 as In,oN as Ir,C8 as It,$z as J,FB as Jn,tv as Jr,IF as Jt,v4 as K,F6 as Kn,YD as Kr,pu as Kt,G4 as L,K6 as Ln,sN as Lr,Sc as Lt,aE as M,H6 as Mn,hN as Mr,w8 as Mt,pg as N,q6 as Nn,uN as Nr,S8 as Nt,PU as O,X6 as On,no as Or,M8 as Ot,Q4 as P,z6 as Pn,nu as Pr,$1 as Pt,V8 as Q,C6 as Qn,hs as Qr,du as Qt,mg as R,U6 as Rn,iN as Rr,FV as Rt,Ap as S,Rt as Si,w1 as Sn,we as Sr,$m as St,LU as T,cr as Ti,o8 as Tn,PN as Tr,GV as Tt,E4 as U,ms as Un,ZD as Ur,x8 as Ut,J8 as V,Pm as Vn,tN as Vr,b8 as Vt,A4 as W,zB as Wn,JD as Wr,V1 as Wt,$8 as X,MB as Xn,fs as Xr,E1 as Xt,xz as Y,EB as Yn,GD as Yr,m8 as Yt,z8 as Z,k6 as Zn,Xw as Zr,CF as Zt,PE as _,Je as _i,i8 as _n,s1 as _r,rz as _t,ha as a,yI as ai,u8 as an,NB as ar,vr as at,zU as b,Ln as bi,rF as bn,Kk as br,Vm as bt,_E as c,Qc as ci,c8 as cn,D6 as cr,lz as ct,aq as d,_b as di,A1 as dn,R6 as dr,D8 as dt,Iw as ei,d8 as en,A6 as er,B8 as et,aK as f,Lp as fi,t8 as fn,T6 as fr,O8 as ft,sK as g,rR as gi,n8 as gn,uu as gr,I8 as gt,tq as h,xb as hi,_m as hn,M6 as hr,ys as ht,Rq as i,tw as ii,h8 as in,LB as ir,mr as it,X4 as j,G6 as jn,fN as jr,zm as jt,Cp as k,Y6 as kn,xN as kr,P8 as kt,jE as l,Bb as li,l8 as ln,L6 as lr,_8 as lt,JU as m,oR as mi,S1 as mn,E6 as mr,L8 as mt,Hq as n,OI as ni,yF as nn,O6 as nr,cz as nt,cK as o,nw as oi,td as on,N6 as or,az as ot,lK as p,Mb as pi,b1 as pn,P6 as pr,N8 as pt,Kz as q,B6 as qn,ts as qr,Bm as qt,qx as r,lw as ri,xF as rn,_6 as rr,j8 as rt,Oa as s,$p as si,dF as sn,j6 as sr,gr as st,uK as t,DI as ti,f8 as tn,_B as tr,q0 as tt,LE as u,YR as ui,uF as un,I6 as ur,kc as ut,iK as v,$c as vi,s8 as vn,S6 as vr,W1 as vt,NU as w,Pp as wi,e8 as wn,ov as wr,YV as wt,nK as x,ga as xi,Dm as xn,$L as xr,T8 as xt,IE as y,di as yi,a8 as yn,vj as yr,nz as yt,Z8 as z,jt as zn,rN as zr,y8 as zt};
72
72
 
73
- //# sourceMappingURL=trace-timeline-B70MN4E4.js.map
73
+ //# sourceMappingURL=trace-timeline-CKGcby6S.js.map
@@ -1 +1 @@
1
- import{t as r}from"./trace-timeline-B70MN4E4.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.25.0"};var d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="ac516123-76b1-4aa1-82d8-a8c8098112f0",e._sentryDebugIdIdentifier="sentry-dbid-ac516123-76b1-4aa1-82d8-a8c8098112f0")}catch{}})();export{r as TraceTimeline};
1
+ import{t as r}from"./trace-timeline-CKGcby6S.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.25.2"};var d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="ac516123-76b1-4aa1-82d8-a8c8098112f0",e._sentryDebugIdIdentifier="sentry-dbid-ac516123-76b1-4aa1-82d8-a8c8098112f0")}catch{}})();export{r as TraceTimeline};