@ai-sdk/devtools 0.0.1 → 0.0.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.
@@ -173,4 +173,4 @@ If you want to hide the \`${l.titleName}\`, you can wrap it with our VisuallyHid
173
173
 
174
174
  For more information, see https://radix-ui.com/primitives/docs/components/${l.docsSlug}`;return w.useEffect(()=>{n&&(document.getElementById(n)||console.error(o))},[o,n]),null},dw="DialogDescriptionWarning",fw=({contentRef:n,descriptionId:l})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Hm(dw).contentName}}.`;return w.useEffect(()=>{var c;const u=(c=n.current)==null?void 0:c.getAttribute("aria-describedby");l&&u&&(document.getElementById(l)||console.warn(s))},[s,n,l]),null},pw=_m,mw=Om,hw=Lm,gw=Mm,vw=zm,yw=$m;function xw(n){if(typeof document>"u")return;let l=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",l.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n))}const Vm=ee.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),ll=()=>{const n=ee.useContext(Vm);if(!n)throw new Error("useDrawerContext must be used within a Drawer.Root");return n};xw(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
175
175
  [data-state=closed]
176
- ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function ww(){const n=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(n)&&/Mobile/.test(n)||/FxiOS/.test(n))}function Sw(){return Wu(/^Mac/)}function Cw(){return Wu(/^iPhone/)}function dp(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function kw(){return Wu(/^iPad/)||Sw()&&navigator.maxTouchPoints>1}function Um(){return Cw()||kw()}function Wu(n){return typeof window<"u"&&window.navigator!=null?n.test(window.navigator.platform):void 0}const bw=24,Ew=typeof window<"u"?w.useLayoutEffect:w.useEffect;function fp(...n){return(...l)=>{for(let o of n)typeof o=="function"&&o(...l)}}const au=typeof document<"u"&&window.visualViewport;function pp(n){let l=window.getComputedStyle(n);return/(auto|scroll)/.test(l.overflow+l.overflowX+l.overflowY)}function Ym(n){for(pp(n)&&(n=n.parentElement);n&&!pp(n);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const Nw=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Ti=0,uu;function Rw(n={}){let{isDisabled:l}=n;Ew(()=>{if(!l)return Ti++,Ti===1&&Um()&&(uu=Tw()),()=>{Ti--,Ti===0&&(uu==null||uu())}},[l])}function Tw(){let n,l=0,o=x=>{n=Ym(x.target),!(n===document.documentElement&&n===document.body)&&(l=x.changedTouches[0].pageY)},s=x=>{if(!n||n===document.documentElement||n===document.body){x.preventDefault();return}let S=x.changedTouches[0].pageY,b=n.scrollTop,E=n.scrollHeight-n.clientHeight;E!==0&&((b<=0&&S>l||b>=E&&S<l)&&x.preventDefault(),l=S)},u=x=>{let S=x.target;vu(S)&&S!==document.activeElement&&(x.preventDefault(),S.style.transform="translateY(-2000px)",S.focus(),requestAnimationFrame(()=>{S.style.transform=""}))},c=x=>{let S=x.target;vu(S)&&(S.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{S.style.transform="",au&&(au.height<window.innerHeight?requestAnimationFrame(()=>{mp(S)}):au.addEventListener("resize",()=>mp(S),{once:!0}))}))},f=()=>{window.scrollTo(0,0)},m=window.pageXOffset,h=window.pageYOffset,v=fp(Pw(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let y=fp(qo(document,"touchstart",o,{passive:!1,capture:!0}),qo(document,"touchmove",s,{passive:!1,capture:!0}),qo(document,"touchend",u,{passive:!1,capture:!0}),qo(document,"focus",c,!0),qo(window,"scroll",f));return()=>{v(),y(),window.scrollTo(m,h)}}function Pw(n,l,o){let s=n.style[l];return n.style[l]=o,()=>{n.style[l]=s}}function qo(n,l,o,s){return n.addEventListener(l,o,s),()=>{n.removeEventListener(l,o,s)}}function mp(n){let l=document.scrollingElement||document.documentElement;for(;n&&n!==l;){let o=Ym(n);if(o!==document.documentElement&&o!==document.body&&o!==n){let s=o.getBoundingClientRect().top,u=n.getBoundingClientRect().top,c=n.getBoundingClientRect().bottom;const f=o.getBoundingClientRect().bottom+bw;c>f&&(o.scrollTop+=u-s)}n=o.parentElement}}function vu(n){return n instanceof HTMLInputElement&&!Nw.has(n.type)||n instanceof HTMLTextAreaElement||n instanceof HTMLElement&&n.isContentEditable}function jw(n,l){typeof n=="function"?n(l):n!=null&&(n.current=l)}function _w(...n){return l=>n.forEach(o=>jw(o,l))}function Xm(...n){return w.useCallback(_w(...n),n)}const Qm=new WeakMap;function qe(n,l,o=!1){if(!n||!(n instanceof HTMLElement))return;let s={};Object.entries(l).forEach(([u,c])=>{if(u.startsWith("--")){n.style.setProperty(u,c);return}s[u]=n.style[u],n.style[u]=c}),!o&&Qm.set(n,s)}function Aw(n,l){if(!n||!(n instanceof HTMLElement))return;let o=Qm.get(n);o&&(n.style[l]=o[l])}const Xe=n=>{switch(n){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return n}};function Pi(n,l){if(!n)return null;const o=window.getComputedStyle(n),s=o.transform||o.webkitTransform||o.mozTransform;let u=s.match(/^matrix3d\((.+)\)$/);return u?parseFloat(u[1].split(", ")[Xe(l)?13:12]):(u=s.match(/^matrix\((.+)\)$/),u?parseFloat(u[1].split(", ")[Xe(l)?5:4]):null)}function Ow(n){return 8*(Math.log(n+1)-2)}function cu(n,l){if(!n)return()=>{};const o=n.style.cssText;return Object.assign(n.style,l),()=>{n.style.cssText=o}}function Dw(...n){return(...l)=>{for(const o of n)typeof o=="function"&&o(...l)}}const Fe={DURATION:.5,EASE:[.32,.72,0,1]},Gm=.4,Lw=.25,Mw=100,Km=8,ji=16,yu=26,du="vaul-dragging";function qm(n){const l=ee.useRef(n);return ee.useEffect(()=>{l.current=n}),ee.useMemo(()=>(...o)=>l.current==null?void 0:l.current.call(l,...o),[])}function zw({defaultProp:n,onChange:l}){const o=ee.useState(n),[s]=o,u=ee.useRef(s),c=qm(l);return ee.useEffect(()=>{u.current!==s&&(c(s),u.current=s)},[s,u,c]),o}function Zm({prop:n,defaultProp:l,onChange:o=()=>{}}){const[s,u]=zw({defaultProp:l,onChange:o}),c=n!==void 0,f=c?n:s,m=qm(o),h=ee.useCallback(v=>{if(c){const x=typeof v=="function"?v(n):v;x!==n&&m(x)}else u(v)},[c,n,u,m]);return[f,h]}function Iw({activeSnapPointProp:n,setActiveSnapPointProp:l,snapPoints:o,drawerRef:s,overlayRef:u,fadeFromIndex:c,onSnapPointChange:f,direction:m="bottom",container:h,snapToSequentialPoint:v}){const[y,x]=Zm({prop:n,defaultProp:o==null?void 0:o[0],onChange:l}),[S,b]=ee.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ee.useEffect(()=>{function I(){b({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]);const E=ee.useMemo(()=>y===(o==null?void 0:o[o.length-1])||null,[o,y]),C=ee.useMemo(()=>{var I;return(I=o==null?void 0:o.findIndex($=>$===y))!=null?I:null},[o,y]),j=o&&o.length>0&&(c||c===0)&&!Number.isNaN(c)&&o[c]===y||!o,_=ee.useMemo(()=>{const I=h?{width:h.getBoundingClientRect().width,height:h.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var $;return($=o==null?void 0:o.map(B=>{const J=typeof B=="string";let ue=0;if(J&&(ue=parseInt(B,10)),Xe(m)){const X=J?ue:S?B*I.height:0;return S?m==="bottom"?I.height-X:-I.height+X:X}const ve=J?ue:S?B*I.width:0;return S?m==="right"?I.width-ve:-I.width+ve:ve}))!=null?$:[]},[o,S,h]),R=ee.useMemo(()=>C!==null?_==null?void 0:_[C]:null,[_,C]),z=ee.useCallback(I=>{var $;const B=($=_==null?void 0:_.findIndex(J=>J===I))!=null?$:null;f(B),qe(s.current,{transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,transform:Xe(m)?`translate3d(0, ${I}px, 0)`:`translate3d(${I}px, 0, 0)`}),_&&B!==_.length-1&&c!==void 0&&B!==c&&B<c?qe(u.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,opacity:"0"}):qe(u.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,opacity:"1"}),x(o==null?void 0:o[Math.max(B,0)])},[s.current,o,_,c,u,x]);ee.useEffect(()=>{if(y||n){var I;const $=(I=o==null?void 0:o.findIndex(B=>B===n||B===y))!=null?I:-1;_&&$!==-1&&typeof _[$]=="number"&&z(_[$])}},[y,n,o,_,z]);function D({draggedDistance:I,closeDrawer:$,velocity:B,dismissible:J}){if(c===void 0)return;const ue=m==="bottom"||m==="right"?(R??0)-I:(R??0)+I,ve=C===c-1,X=C===0,pe=I>0;if(ve&&qe(u.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`}),!v&&B>2&&!pe){J?$():z(_[0]);return}if(!v&&B>2&&pe&&_&&o){z(_[o.length-1]);return}const ce=_==null?void 0:_.reduce((q,A)=>typeof q!="number"||typeof A!="number"?q:Math.abs(A-ue)<Math.abs(q-ue)?A:q),se=Xe(m)?window.innerHeight:window.innerWidth;if(B>Gm&&Math.abs(I)<se*.4){const q=pe?1:-1;if(q>0&&E&&o){z(_[o.length-1]);return}if(X&&q<0&&J&&$(),C===null)return;z(_[C+q]);return}z(ce)}function F({draggedDistance:I}){if(R===null)return;const $=m==="bottom"||m==="right"?R-I:R+I;(m==="bottom"||m==="right")&&$<_[_.length-1]||(m==="top"||m==="left")&&$>_[_.length-1]||qe(s.current,{transform:Xe(m)?`translate3d(0, ${$}px, 0)`:`translate3d(${$}px, 0, 0)`})}function U(I,$){if(!o||typeof C!="number"||!_||c===void 0)return null;const B=C===c-1;if(C>=c&&$)return 0;if(B&&!$)return 1;if(!j&&!B)return null;const ue=B?C+1:C-1,ve=B?_[ue]-_[ue-1]:_[ue+1]-_[ue],X=I/Math.abs(ve);return B?1-X:X}return{isLastSnapPoint:E,activeSnapPoint:y,shouldFade:j,getPercentageDragged:U,setActiveSnapPoint:x,activeSnapPointIndex:C,onRelease:D,onDrag:F,snapPointsOffset:_}}const $w=()=>()=>{};function Fw(){const{direction:n,isOpen:l,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:u}=ll(),c=ee.useRef(null),f=w.useMemo(()=>document.body.style.backgroundColor,[]);function m(){return(window.innerWidth-yu)/window.innerWidth}ee.useEffect(()=>{if(l&&o){c.current&&clearTimeout(c.current);const h=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!h)return;Dw(s&&!u?cu(document.body,{background:"black"}):$w,cu(h,{transformOrigin:Xe(n)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Fe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Fe.EASE.join(",")})`}));const v=cu(h,{borderRadius:`${Km}px`,overflow:"hidden",...Xe(n)?{transform:`scale(${m()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${m()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{v(),c.current=window.setTimeout(()=>{f?document.body.style.background=f:document.body.style.removeProperty("background")},Fe.DURATION*1e3)}}},[l,o,f])}let Zo=null;function Ww({isOpen:n,modal:l,nested:o,hasBeenOpened:s,preventScrollRestoration:u,noBodyStyles:c}){const[f,m]=ee.useState(()=>typeof window<"u"?window.location.href:""),h=ee.useRef(0),v=ee.useCallback(()=>{if(dp()&&Zo===null&&n&&!c){Zo={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:x,innerHeight:S}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-h.current}px`,left:`${-x}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const b=S-window.innerHeight;b&&h.current>=S&&(document.body.style.top=`${-(h.current+b)}px`)}),300)}},[n]),y=ee.useCallback(()=>{if(dp()&&Zo!==null&&!c){const x=-parseInt(document.body.style.top,10),S=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Zo),window.requestAnimationFrame(()=>{if(u&&f!==window.location.href){m(window.location.href);return}window.scrollTo(S,x)}),Zo=null}},[f]);return ee.useEffect(()=>{function x(){h.current=window.scrollY}return x(),window.addEventListener("scroll",x),()=>{window.removeEventListener("scroll",x)}},[]),ee.useEffect(()=>{if(l)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||y()}},[l,y]),ee.useEffect(()=>{o||!s||(n?(!window.matchMedia("(display-mode: standalone)").matches&&v(),l||window.setTimeout(()=>{y()},500)):y())},[n,s,f,l,o,v,y]),{restorePositionSetting:y}}function Bw({open:n,onOpenChange:l,children:o,onDrag:s,onRelease:u,snapPoints:c,shouldScaleBackground:f=!1,setBackgroundColorOnScale:m=!0,closeThreshold:h=Lw,scrollLockTimeout:v=Mw,dismissible:y=!0,handleOnly:x=!1,fadeFromIndex:S=c&&c.length-1,activeSnapPoint:b,setActiveSnapPoint:E,fixed:C,modal:j=!0,onClose:_,nested:R,noBodyStyles:z=!1,direction:D="bottom",defaultOpen:F=!1,disablePreventScroll:U=!0,snapToSequentialPoint:I=!1,preventScrollRestoration:$=!1,repositionInputs:B=!0,onAnimationEnd:J,container:ue,autoFocus:ve=!1}){var X,pe;const[ce=!1,se]=Zm({defaultProp:F,prop:n,onChange:ge=>{l==null||l(ge),!ge&&!R&&uo(),setTimeout(()=>{J==null||J(ge)},Fe.DURATION*1e3),ge&&!j&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ge||(document.body.style.pointerEvents="auto")}}),[q,A]=ee.useState(!1),[K,G]=ee.useState(!1),[P,W]=ee.useState(!1),ne=ee.useRef(null),de=ee.useRef(null),we=ee.useRef(null),Se=ee.useRef(null),fe=ee.useRef(null),Ce=ee.useRef(!1),Ne=ee.useRef(null),Oe=ee.useRef(0),Ze=ee.useRef(!1),Ct=ee.useRef(!F),kt=ee.useRef(0),ye=ee.useRef(null),nr=ee.useRef(((X=ye.current)==null?void 0:X.getBoundingClientRect().height)||0),rr=ee.useRef(((pe=ye.current)==null?void 0:pe.getBoundingClientRect().width)||0),hn=ee.useRef(0),kr=ee.useCallback(ge=>{c&&ge===Pn.length-1&&(de.current=new Date)},[]),{activeSnapPoint:Jt,activeSnapPointIndex:_t,setActiveSnapPoint:gn,onRelease:so,snapPointsOffset:Pn,onDrag:al,shouldFade:ao,getPercentageDragged:ul}=Iw({snapPoints:c,activeSnapPointProp:b,setActiveSnapPointProp:E,drawerRef:ye,fadeFromIndex:S,overlayRef:ne,onSnapPointChange:kr,direction:D,container:ue,snapToSequentialPoint:I});Rw({isDisabled:!ce||K||!j||P||!q||!B||!U});const{restorePositionSetting:uo}=Ww({isOpen:ce,modal:j,nested:R??!1,hasBeenOpened:q,preventScrollRestoration:$,noBodyStyles:z});function vn(){return(window.innerWidth-yu)/window.innerWidth}function cl(ge){var Re,Te;!y&&!c||ye.current&&!ye.current.contains(ge.target)||(nr.current=((Re=ye.current)==null?void 0:Re.getBoundingClientRect().height)||0,rr.current=((Te=ye.current)==null?void 0:Te.getBoundingClientRect().width)||0,G(!0),we.current=new Date,Um()&&window.addEventListener("touchend",()=>Ce.current=!1,{once:!0}),ge.target.setPointerCapture(ge.pointerId),Oe.current=Xe(D)?ge.pageY:ge.pageX)}function jn(ge,Re){var Te;let ke=ge;const Me=(Te=window.getSelection())==null?void 0:Te.toString(),ot=ye.current?Pi(ye.current,D):null,Je=new Date;if(ke.tagName==="SELECT"||ke.hasAttribute("data-vaul-no-drag")||ke.closest("[data-vaul-no-drag]"))return!1;if(D==="right"||D==="left")return!0;if(de.current&&Je.getTime()-de.current.getTime()<500)return!1;if(ot!==null&&(D==="bottom"?ot>0:ot<0))return!0;if(Me&&Me.length>0)return!1;if(fe.current&&Je.getTime()-fe.current.getTime()<v&&ot===0||Re)return fe.current=Je,!1;for(;ke;){if(ke.scrollHeight>ke.clientHeight){if(ke.scrollTop!==0)return fe.current=new Date,!1;if(ke.getAttribute("role")==="dialog")return!0}ke=ke.parentNode}return!0}function or(ge){if(ye.current&&K){const Re=D==="bottom"||D==="right"?1:-1,Te=(Oe.current-(Xe(D)?ge.pageY:ge.pageX))*Re,ke=Te>0,Me=c&&!y&&!ke;if(Me&&_t===0)return;const ot=Math.abs(Te),Je=document.querySelector("[data-vaul-drawer-wrapper]"),$t=D==="bottom"||D==="top"?nr.current:rr.current;let mt=ot/$t;const Ft=ul(ot,ke);if(Ft!==null&&(mt=Ft),Me&&mt>=1||!Ce.current&&!jn(ge.target,ke))return;if(ye.current.classList.add(du),Ce.current=!0,qe(ye.current,{transition:"none"}),qe(ne.current,{transition:"none"}),c&&al({draggedDistance:Te}),ke&&!c){const st=Ow(Te),_n=Math.min(st*-1,0)*Re;qe(ye.current,{transform:Xe(D)?`translate3d(0, ${_n}px, 0)`:`translate3d(${_n}px, 0, 0)`});return}const Wt=1-mt;if((ao||S&&_t===S-1)&&(s==null||s(ge,mt),qe(ne.current,{opacity:`${Wt}`,transition:"none"},!0)),Je&&ne.current&&f){const st=Math.min(vn()+mt*(1-vn()),1),_n=8-mt*8,An=Math.max(0,14-mt*14);qe(Je,{borderRadius:`${_n}px`,transform:Xe(D)?`scale(${st}) translate3d(0, ${An}px, 0)`:`scale(${st}) translate3d(${An}px, 0, 0)`,transition:"none"},!0)}if(!c){const st=ot*Re;qe(ye.current,{transform:Xe(D)?`translate3d(0, ${st}px, 0)`:`translate3d(${st}px, 0, 0)`})}}}ee.useEffect(()=>{window.requestAnimationFrame(()=>{Ct.current=!0})},[]),ee.useEffect(()=>{var ge;function Re(){if(!ye.current||!B)return;const Te=document.activeElement;if(vu(Te)||Ze.current){var ke;const Me=((ke=window.visualViewport)==null?void 0:ke.height)||0,ot=window.innerHeight;let Je=ot-Me;const $t=ye.current.getBoundingClientRect().height||0,mt=$t>ot*.8;hn.current||(hn.current=$t);const Ft=ye.current.getBoundingClientRect().top;if(Math.abs(kt.current-Je)>60&&(Ze.current=!Ze.current),c&&c.length>0&&Pn&&_t){const Wt=Pn[_t]||0;Je+=Wt}if(kt.current=Je,$t>Me||Ze.current){const Wt=ye.current.getBoundingClientRect().height;let st=Wt;Wt>Me&&(st=Me-(mt?Ft:yu)),C?ye.current.style.height=`${Wt-Math.max(Je,0)}px`:ye.current.style.height=`${Math.max(st,Me-Ft)}px`}else ww()||(ye.current.style.height=`${hn.current}px`);c&&c.length>0&&!Ze.current?ye.current.style.bottom="0px":ye.current.style.bottom=`${Math.max(Je,0)}px`}}return(ge=window.visualViewport)==null||ge.addEventListener("resize",Re),()=>{var Te;return(Te=window.visualViewport)==null?void 0:Te.removeEventListener("resize",Re)}},[_t,c,Pn]);function lr(ge){dl(),_==null||_(),ge||se(!1),setTimeout(()=>{c&&gn(c[0])},Fe.DURATION*1e3)}function co(){if(!ye.current)return;const ge=document.querySelector("[data-vaul-drawer-wrapper]"),Re=Pi(ye.current,D);qe(ye.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`}),qe(ne.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,opacity:"1"}),f&&Re&&Re>0&&ce&&qe(ge,{borderRadius:`${Km}px`,overflow:"hidden",...Xe(D)?{transform:`scale(${vn()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${vn()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Fe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Fe.EASE.join(",")})`},!0)}function dl(){!K||!ye.current||(ye.current.classList.remove(du),Ce.current=!1,G(!1),Se.current=new Date)}function fs(ge){if(!K||!ye.current)return;ye.current.classList.remove(du),Ce.current=!1,G(!1),Se.current=new Date;const Re=Pi(ye.current,D);if(!ge||!jn(ge.target,!1)||!Re||Number.isNaN(Re)||we.current===null)return;const Te=Se.current.getTime()-we.current.getTime(),ke=Oe.current-(Xe(D)?ge.pageY:ge.pageX),Me=Math.abs(ke)/Te;if(Me>.05&&(W(!0),setTimeout(()=>{W(!1)},200)),c){so({draggedDistance:ke*(D==="bottom"||D==="right"?1:-1),closeDrawer:lr,velocity:Me,dismissible:y}),u==null||u(ge,!0);return}if(D==="bottom"||D==="right"?ke>0:ke<0){co(),u==null||u(ge,!0);return}if(Me>Gm){lr(),u==null||u(ge,!1);return}var ot;const Je=Math.min((ot=ye.current.getBoundingClientRect().height)!=null?ot:0,window.innerHeight);var $t;const mt=Math.min(($t=ye.current.getBoundingClientRect().width)!=null?$t:0,window.innerWidth),Ft=D==="left"||D==="right";if(Math.abs(Re)>=(Ft?mt:Je)*h){lr(),u==null||u(ge,!1);return}u==null||u(ge,!0),co()}ee.useEffect(()=>(ce&&(qe(document.documentElement,{scrollBehavior:"auto"}),de.current=new Date),()=>{Aw(document.documentElement,"scrollBehavior")}),[ce]);function fo(ge){const Re=ge?(window.innerWidth-ji)/window.innerWidth:1,Te=ge?-16:0;Ne.current&&window.clearTimeout(Ne.current),qe(ye.current,{transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,transform:Xe(D)?`scale(${Re}) translate3d(0, ${Te}px, 0)`:`scale(${Re}) translate3d(${Te}px, 0, 0)`}),!ge&&ye.current&&(Ne.current=setTimeout(()=>{const ke=Pi(ye.current,D);qe(ye.current,{transition:"none",transform:Xe(D)?`translate3d(0, ${ke}px, 0)`:`translate3d(${ke}px, 0, 0)`})},500))}function po(ge,Re){if(Re<0)return;const Te=(window.innerWidth-ji)/window.innerWidth,ke=Te+Re*(1-Te),Me=-16+Re*ji;qe(ye.current,{transform:Xe(D)?`scale(${ke}) translate3d(0, ${Me}px, 0)`:`scale(${ke}) translate3d(${Me}px, 0, 0)`,transition:"none"})}function mo(ge,Re){const Te=Xe(D)?window.innerHeight:window.innerWidth,ke=Re?(Te-ji)/Te:1,Me=Re?-16:0;Re&&qe(ye.current,{transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,transform:Xe(D)?`scale(${ke}) translate3d(0, ${Me}px, 0)`:`scale(${ke}) translate3d(${Me}px, 0, 0)`})}return ee.useEffect(()=>{j||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[j]),ee.createElement(pw,{defaultOpen:F,onOpenChange:ge=>{!y&&!ge||(ge?A(!0):lr(!0),se(ge))},open:ce},ee.createElement(Vm.Provider,{value:{activeSnapPoint:Jt,snapPoints:c,setActiveSnapPoint:gn,drawerRef:ye,overlayRef:ne,onOpenChange:l,onPress:cl,onRelease:fs,onDrag:or,dismissible:y,shouldAnimate:Ct,handleOnly:x,isOpen:ce,isDragging:K,shouldFade:ao,closeDrawer:lr,onNestedDrag:po,onNestedOpenChange:fo,onNestedRelease:mo,keyboardIsOpen:Ze,modal:j,snapPointsOffset:Pn,activeSnapPointIndex:_t,direction:D,shouldScaleBackground:f,setBackgroundColorOnScale:m,noBodyStyles:z,container:ue,autoFocus:ve}},o))}const Jm=ee.forwardRef(function({...n},l){const{overlayRef:o,snapPoints:s,onRelease:u,shouldFade:c,isOpen:f,modal:m,shouldAnimate:h}=ll(),v=Xm(l,o),y=s&&s.length>0;if(!m)return null;const x=ee.useCallback(S=>u(S),[u]);return ee.createElement(gw,{onMouseUp:x,ref:v,"data-vaul-overlay":"","data-vaul-snap-points":f&&y?"true":"false","data-vaul-snap-points-overlay":f&&c?"true":"false","data-vaul-animate":h!=null&&h.current?"true":"false",...n})});Jm.displayName="Drawer.Overlay";const eh=ee.forwardRef(function({onPointerDownOutside:n,style:l,onOpenAutoFocus:o,...s},u){const{drawerRef:c,onPress:f,onRelease:m,onDrag:h,keyboardIsOpen:v,snapPointsOffset:y,activeSnapPointIndex:x,modal:S,isOpen:b,direction:E,snapPoints:C,container:j,handleOnly:_,shouldAnimate:R,autoFocus:z}=ll(),[D,F]=ee.useState(!1),U=Xm(u,c),I=ee.useRef(null),$=ee.useRef(null),B=ee.useRef(!1),J=C&&C.length>0;Fw();const ue=(X,pe,ce=0)=>{if(B.current)return!0;const se=Math.abs(X.y),q=Math.abs(X.x),A=q>se,K=["bottom","right"].includes(pe)?1:-1;if(pe==="left"||pe==="right"){if(!(X.x*K<0)&&q>=0&&q<=ce)return A}else if(!(X.y*K<0)&&se>=0&&se<=ce)return!A;return B.current=!0,!0};ee.useEffect(()=>{J&&window.requestAnimationFrame(()=>{F(!0)})},[]);function ve(X){I.current=null,B.current=!1,m(X)}return ee.createElement(vw,{"data-vaul-drawer-direction":E,"data-vaul-drawer":"","data-vaul-delayed-snap-points":D?"true":"false","data-vaul-snap-points":b&&J?"true":"false","data-vaul-custom-container":j?"true":"false","data-vaul-animate":R!=null&&R.current?"true":"false",...s,ref:U,style:y&&y.length>0?{"--snap-point-height":`${y[x??0]}px`,...l}:l,onPointerDown:X=>{_||(s.onPointerDown==null||s.onPointerDown.call(s,X),I.current={x:X.pageX,y:X.pageY},f(X))},onOpenAutoFocus:X=>{o==null||o(X),z||X.preventDefault()},onPointerDownOutside:X=>{if(n==null||n(X),!S||X.defaultPrevented){X.preventDefault();return}v.current&&(v.current=!1)},onFocusOutside:X=>{if(!S){X.preventDefault();return}},onPointerMove:X=>{if($.current=X,_||(s.onPointerMove==null||s.onPointerMove.call(s,X),!I.current))return;const pe=X.pageY-I.current.y,ce=X.pageX-I.current.x,se=X.pointerType==="touch"?10:2;ue({x:ce,y:pe},E,se)?h(X):(Math.abs(ce)>se||Math.abs(pe)>se)&&(I.current=null)},onPointerUp:X=>{s.onPointerUp==null||s.onPointerUp.call(s,X),I.current=null,B.current=!1,m(X)},onPointerOut:X=>{s.onPointerOut==null||s.onPointerOut.call(s,X),ve($.current)},onContextMenu:X=>{s.onContextMenu==null||s.onContextMenu.call(s,X),$.current&&ve($.current)}})});eh.displayName="Drawer.Content";const Hw=250,Vw=120,Uw=ee.forwardRef(function({preventCycle:n=!1,children:l,...o},s){const{closeDrawer:u,isDragging:c,snapPoints:f,activeSnapPoint:m,setActiveSnapPoint:h,dismissible:v,handleOnly:y,isOpen:x,onPress:S,onDrag:b}=ll(),E=ee.useRef(null),C=ee.useRef(!1);function j(){if(C.current){z();return}window.setTimeout(()=>{_()},Vw)}function _(){if(c||n||C.current){z();return}if(z(),!f||f.length===0){v||u();return}if(m===f[f.length-1]&&v){u();return}const F=f.findIndex(I=>I===m);if(F===-1)return;const U=f[F+1];h(U)}function R(){E.current=window.setTimeout(()=>{C.current=!0},Hw)}function z(){E.current&&window.clearTimeout(E.current),C.current=!1}return ee.createElement("div",{onClick:j,onPointerCancel:z,onPointerDown:D=>{y&&S(D),R()},onPointerMove:D=>{y&&b(D)},ref:s,"data-vaul-drawer-visible":x?"true":"false","data-vaul-handle":"","aria-hidden":"true",...o},ee.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},l))});Uw.displayName="Drawer.Handle";function Yw(n){const l=ll(),{container:o=l.container,...s}=n;return ee.createElement(hw,{container:o,...s})}const oo={Root:Bw,Content:eh,Overlay:Jm,Trigger:mw,Portal:Yw,Title:yw};function Ii({...n}){return p.jsx(oo.Root,{"data-slot":"drawer",...n})}function $i({...n}){return p.jsx(oo.Trigger,{"data-slot":"drawer-trigger",...n})}function Xw({...n}){return p.jsx(oo.Portal,{"data-slot":"drawer-portal",...n})}function Qw({className:n,...l}){return p.jsx(oo.Overlay,{"data-slot":"drawer-overlay",className:fn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...l})}function Fi({className:n,children:l,...o}){return p.jsxs(Xw,{"data-slot":"drawer-portal",children:[p.jsx(Qw,{}),p.jsxs(oo.Content,{"data-slot":"drawer-content",className:fn("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:border-l","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",n),...o,children:[p.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),l]})]})}function Wi({className:n,...l}){return p.jsx("div",{"data-slot":"drawer-header",className:fn("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",n),...l})}function Bi({className:n,...l}){return p.jsx(oo.Title,{"data-slot":"drawer-title",className:fn("text-foreground font-semibold",n),...l})}const Gw=["top","right","bottom","left"],er=Math.min,Tt=Math.max,qi=Math.round,_i=Math.floor,an=n=>({x:n,y:n}),Kw={left:"right",right:"left",bottom:"top",top:"bottom"},qw={start:"end",end:"start"};function xu(n,l,o){return Tt(n,er(l,o))}function Rn(n,l){return typeof n=="function"?n(l):n}function Tn(n){return n.split("-")[0]}function lo(n){return n.split("-")[1]}function Bu(n){return n==="x"?"y":"x"}function Hu(n){return n==="y"?"height":"width"}const Zw=new Set(["top","bottom"]);function sn(n){return Zw.has(Tn(n))?"y":"x"}function Vu(n){return Bu(sn(n))}function Jw(n,l,o){o===void 0&&(o=!1);const s=lo(n),u=Vu(n),c=Hu(u);let f=u==="x"?s===(o?"end":"start")?"right":"left":s==="start"?"bottom":"top";return l.reference[c]>l.floating[c]&&(f=Zi(f)),[f,Zi(f)]}function e1(n){const l=Zi(n);return[wu(n),l,wu(l)]}function wu(n){return n.replace(/start|end/g,l=>qw[l])}const hp=["left","right"],gp=["right","left"],t1=["top","bottom"],n1=["bottom","top"];function r1(n,l,o){switch(n){case"top":case"bottom":return o?l?gp:hp:l?hp:gp;case"left":case"right":return l?t1:n1;default:return[]}}function o1(n,l,o,s){const u=lo(n);let c=r1(Tn(n),o==="start",s);return u&&(c=c.map(f=>f+"-"+u),l&&(c=c.concat(c.map(wu)))),c}function Zi(n){return n.replace(/left|right|bottom|top/g,l=>Kw[l])}function l1(n){return{top:0,right:0,bottom:0,left:0,...n}}function th(n){return typeof n!="number"?l1(n):{top:n,right:n,bottom:n,left:n}}function Ji(n){const{x:l,y:o,width:s,height:u}=n;return{width:s,height:u,top:o,left:l,right:l+s,bottom:o+u,x:l,y:o}}function vp(n,l,o){let{reference:s,floating:u}=n;const c=sn(l),f=Vu(l),m=Hu(f),h=Tn(l),v=c==="y",y=s.x+s.width/2-u.width/2,x=s.y+s.height/2-u.height/2,S=s[m]/2-u[m]/2;let b;switch(h){case"top":b={x:y,y:s.y-u.height};break;case"bottom":b={x:y,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:x};break;case"left":b={x:s.x-u.width,y:x};break;default:b={x:s.x,y:s.y}}switch(lo(l)){case"start":b[f]-=S*(o&&v?-1:1);break;case"end":b[f]+=S*(o&&v?-1:1);break}return b}const i1=async(n,l,o)=>{const{placement:s="bottom",strategy:u="absolute",middleware:c=[],platform:f}=o,m=c.filter(Boolean),h=await(f.isRTL==null?void 0:f.isRTL(l));let v=await f.getElementRects({reference:n,floating:l,strategy:u}),{x:y,y:x}=vp(v,s,h),S=s,b={},E=0;for(let C=0;C<m.length;C++){const{name:j,fn:_}=m[C],{x:R,y:z,data:D,reset:F}=await _({x:y,y:x,initialPlacement:s,placement:S,strategy:u,middlewareData:b,rects:v,platform:f,elements:{reference:n,floating:l}});y=R??y,x=z??x,b={...b,[j]:{...b[j],...D}},F&&E<=50&&(E++,typeof F=="object"&&(F.placement&&(S=F.placement),F.rects&&(v=F.rects===!0?await f.getElementRects({reference:n,floating:l,strategy:u}):F.rects),{x:y,y:x}=vp(v,S,h)),C=-1)}return{x:y,y:x,placement:S,strategy:u,middlewareData:b}};async function tl(n,l){var o;l===void 0&&(l={});const{x:s,y:u,platform:c,rects:f,elements:m,strategy:h}=n,{boundary:v="clippingAncestors",rootBoundary:y="viewport",elementContext:x="floating",altBoundary:S=!1,padding:b=0}=Rn(l,n),E=th(b),j=m[S?x==="floating"?"reference":"floating":x],_=Ji(await c.getClippingRect({element:(o=await(c.isElement==null?void 0:c.isElement(j)))==null||o?j:j.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(m.floating)),boundary:v,rootBoundary:y,strategy:h})),R=x==="floating"?{x:s,y:u,width:f.floating.width,height:f.floating.height}:f.reference,z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m.floating)),D=await(c.isElement==null?void 0:c.isElement(z))?await(c.getScale==null?void 0:c.getScale(z))||{x:1,y:1}:{x:1,y:1},F=Ji(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:R,offsetParent:z,strategy:h}):R);return{top:(_.top-F.top+E.top)/D.y,bottom:(F.bottom-_.bottom+E.bottom)/D.y,left:(_.left-F.left+E.left)/D.x,right:(F.right-_.right+E.right)/D.x}}const s1=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:s,placement:u,rects:c,platform:f,elements:m,middlewareData:h}=l,{element:v,padding:y=0}=Rn(n,l)||{};if(v==null)return{};const x=th(y),S={x:o,y:s},b=Vu(u),E=Hu(b),C=await f.getDimensions(v),j=b==="y",_=j?"top":"left",R=j?"bottom":"right",z=j?"clientHeight":"clientWidth",D=c.reference[E]+c.reference[b]-S[b]-c.floating[E],F=S[b]-c.reference[b],U=await(f.getOffsetParent==null?void 0:f.getOffsetParent(v));let I=U?U[z]:0;(!I||!await(f.isElement==null?void 0:f.isElement(U)))&&(I=m.floating[z]||c.floating[E]);const $=D/2-F/2,B=I/2-C[E]/2-1,J=er(x[_],B),ue=er(x[R],B),ve=J,X=I-C[E]-ue,pe=I/2-C[E]/2+$,ce=xu(ve,pe,X),se=!h.arrow&&lo(u)!=null&&pe!==ce&&c.reference[E]/2-(pe<ve?J:ue)-C[E]/2<0,q=se?pe<ve?pe-ve:pe-X:0;return{[b]:S[b]+q,data:{[b]:ce,centerOffset:pe-ce-q,...se&&{alignmentOffset:q}},reset:se}}}),a1=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,s;const{placement:u,middlewareData:c,rects:f,initialPlacement:m,platform:h,elements:v}=l,{mainAxis:y=!0,crossAxis:x=!0,fallbackPlacements:S,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:C=!0,...j}=Rn(n,l);if((o=c.arrow)!=null&&o.alignmentOffset)return{};const _=Tn(u),R=sn(m),z=Tn(m)===m,D=await(h.isRTL==null?void 0:h.isRTL(v.floating)),F=S||(z||!C?[Zi(m)]:e1(m)),U=E!=="none";!S&&U&&F.push(...o1(m,C,E,D));const I=[m,...F],$=await tl(l,j),B=[];let J=((s=c.flip)==null?void 0:s.overflows)||[];if(y&&B.push($[_]),x){const pe=Jw(u,f,D);B.push($[pe[0]],$[pe[1]])}if(J=[...J,{placement:u,overflows:B}],!B.every(pe=>pe<=0)){var ue,ve;const pe=(((ue=c.flip)==null?void 0:ue.index)||0)+1,ce=I[pe];if(ce&&(!(x==="alignment"?R!==sn(ce):!1)||J.every(A=>sn(A.placement)===R?A.overflows[0]>0:!0)))return{data:{index:pe,overflows:J},reset:{placement:ce}};let se=(ve=J.filter(q=>q.overflows[0]<=0).sort((q,A)=>q.overflows[1]-A.overflows[1])[0])==null?void 0:ve.placement;if(!se)switch(b){case"bestFit":{var X;const q=(X=J.filter(A=>{if(U){const K=sn(A.placement);return K===R||K==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(K=>K>0).reduce((K,G)=>K+G,0)]).sort((A,K)=>A[1]-K[1])[0])==null?void 0:X[0];q&&(se=q);break}case"initialPlacement":se=m;break}if(u!==se)return{reset:{placement:se}}}return{}}}};function yp(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function xp(n){return Gw.some(l=>n[l]>=0)}const u1=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o}=l,{strategy:s="referenceHidden",...u}=Rn(n,l);switch(s){case"referenceHidden":{const c=await tl(l,{...u,elementContext:"reference"}),f=yp(c,o.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:xp(f)}}}case"escaped":{const c=await tl(l,{...u,altBoundary:!0}),f=yp(c,o.floating);return{data:{escapedOffsets:f,escaped:xp(f)}}}default:return{}}}}},nh=new Set(["left","top"]);async function c1(n,l){const{placement:o,platform:s,elements:u}=n,c=await(s.isRTL==null?void 0:s.isRTL(u.floating)),f=Tn(o),m=lo(o),h=sn(o)==="y",v=nh.has(f)?-1:1,y=c&&h?-1:1,x=Rn(l,n);let{mainAxis:S,crossAxis:b,alignmentAxis:E}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return m&&typeof E=="number"&&(b=m==="end"?E*-1:E),h?{x:b*y,y:S*v}:{x:S*v,y:b*y}}const d1=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,s;const{x:u,y:c,placement:f,middlewareData:m}=l,h=await c1(l,n);return f===((o=m.offset)==null?void 0:o.placement)&&(s=m.arrow)!=null&&s.alignmentOffset?{}:{x:u+h.x,y:c+h.y,data:{...h,placement:f}}}}},f1=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:s,placement:u}=l,{mainAxis:c=!0,crossAxis:f=!1,limiter:m={fn:j=>{let{x:_,y:R}=j;return{x:_,y:R}}},...h}=Rn(n,l),v={x:o,y:s},y=await tl(l,h),x=sn(Tn(u)),S=Bu(x);let b=v[S],E=v[x];if(c){const j=S==="y"?"top":"left",_=S==="y"?"bottom":"right",R=b+y[j],z=b-y[_];b=xu(R,b,z)}if(f){const j=x==="y"?"top":"left",_=x==="y"?"bottom":"right",R=E+y[j],z=E-y[_];E=xu(R,E,z)}const C=m.fn({...l,[S]:b,[x]:E});return{...C,data:{x:C.x-o,y:C.y-s,enabled:{[S]:c,[x]:f}}}}}},p1=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:s,placement:u,rects:c,middlewareData:f}=l,{offset:m=0,mainAxis:h=!0,crossAxis:v=!0}=Rn(n,l),y={x:o,y:s},x=sn(u),S=Bu(x);let b=y[S],E=y[x];const C=Rn(m,l),j=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(h){const z=S==="y"?"height":"width",D=c.reference[S]-c.floating[z]+j.mainAxis,F=c.reference[S]+c.reference[z]-j.mainAxis;b<D?b=D:b>F&&(b=F)}if(v){var _,R;const z=S==="y"?"width":"height",D=nh.has(Tn(u)),F=c.reference[x]-c.floating[z]+(D&&((_=f.offset)==null?void 0:_[x])||0)+(D?0:j.crossAxis),U=c.reference[x]+c.reference[z]+(D?0:((R=f.offset)==null?void 0:R[x])||0)-(D?j.crossAxis:0);E<F?E=F:E>U&&(E=U)}return{[S]:b,[x]:E}}}},m1=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,s;const{placement:u,rects:c,platform:f,elements:m}=l,{apply:h=()=>{},...v}=Rn(n,l),y=await tl(l,v),x=Tn(u),S=lo(u),b=sn(u)==="y",{width:E,height:C}=c.floating;let j,_;x==="top"||x==="bottom"?(j=x,_=S===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(_=x,j=S==="end"?"top":"bottom");const R=C-y.top-y.bottom,z=E-y.left-y.right,D=er(C-y[j],R),F=er(E-y[_],z),U=!l.middlewareData.shift;let I=D,$=F;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&($=z),(s=l.middlewareData.shift)!=null&&s.enabled.y&&(I=R),U&&!S){const J=Tt(y.left,0),ue=Tt(y.right,0),ve=Tt(y.top,0),X=Tt(y.bottom,0);b?$=E-2*(J!==0||ue!==0?J+ue:Tt(y.left,y.right)):I=C-2*(ve!==0||X!==0?ve+X:Tt(y.top,y.bottom))}await h({...l,availableWidth:$,availableHeight:I});const B=await f.getDimensions(m.floating);return E!==B.width||C!==B.height?{reset:{rects:!0}}:{}}}};function is(){return typeof window<"u"}function io(n){return rh(n)?(n.nodeName||"").toLowerCase():"#document"}function jt(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function mn(n){var l;return(l=(rh(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function rh(n){return is()?n instanceof Node||n instanceof jt(n).Node:!1}function Gt(n){return is()?n instanceof Element||n instanceof jt(n).Element:!1}function cn(n){return is()?n instanceof HTMLElement||n instanceof jt(n).HTMLElement:!1}function wp(n){return!is()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof jt(n).ShadowRoot}const h1=new Set(["inline","contents"]);function il(n){const{overflow:l,overflowX:o,overflowY:s,display:u}=Kt(n);return/auto|scroll|overlay|hidden|clip/.test(l+s+o)&&!h1.has(u)}const g1=new Set(["table","td","th"]);function v1(n){return g1.has(io(n))}const y1=[":popover-open",":modal"];function ss(n){return y1.some(l=>{try{return n.matches(l)}catch{return!1}})}const x1=["transform","translate","scale","rotate","perspective"],w1=["transform","translate","scale","rotate","perspective","filter"],S1=["paint","layout","strict","content"];function Uu(n){const l=Yu(),o=Gt(n)?Kt(n):n;return x1.some(s=>o[s]?o[s]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!l&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!l&&(o.filter?o.filter!=="none":!1)||w1.some(s=>(o.willChange||"").includes(s))||S1.some(s=>(o.contain||"").includes(s))}function C1(n){let l=tr(n);for(;cn(l)&&!Jr(l);){if(Uu(l))return l;if(ss(l))return null;l=tr(l)}return null}function Yu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const k1=new Set(["html","body","#document"]);function Jr(n){return k1.has(io(n))}function Kt(n){return jt(n).getComputedStyle(n)}function as(n){return Gt(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tr(n){if(io(n)==="html")return n;const l=n.assignedSlot||n.parentNode||wp(n)&&n.host||mn(n);return wp(l)?l.host:l}function oh(n){const l=tr(n);return Jr(l)?n.ownerDocument?n.ownerDocument.body:n.body:cn(l)&&il(l)?l:oh(l)}function nl(n,l,o){var s;l===void 0&&(l=[]),o===void 0&&(o=!0);const u=oh(n),c=u===((s=n.ownerDocument)==null?void 0:s.body),f=jt(u);if(c){const m=Su(f);return l.concat(f,f.visualViewport||[],il(u)?u:[],m&&o?nl(m):[])}return l.concat(u,nl(u,[],o))}function Su(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function lh(n){const l=Kt(n);let o=parseFloat(l.width)||0,s=parseFloat(l.height)||0;const u=cn(n),c=u?n.offsetWidth:o,f=u?n.offsetHeight:s,m=qi(o)!==c||qi(s)!==f;return m&&(o=c,s=f),{width:o,height:s,$:m}}function Xu(n){return Gt(n)?n:n.contextElement}function qr(n){const l=Xu(n);if(!cn(l))return an(1);const o=l.getBoundingClientRect(),{width:s,height:u,$:c}=lh(l);let f=(c?qi(o.width):o.width)/s,m=(c?qi(o.height):o.height)/u;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const b1=an(0);function ih(n){const l=jt(n);return!Yu()||!l.visualViewport?b1:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function E1(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==jt(n)?!1:l}function Sr(n,l,o,s){l===void 0&&(l=!1),o===void 0&&(o=!1);const u=n.getBoundingClientRect(),c=Xu(n);let f=an(1);l&&(s?Gt(s)&&(f=qr(s)):f=qr(n));const m=E1(c,o,s)?ih(c):an(0);let h=(u.left+m.x)/f.x,v=(u.top+m.y)/f.y,y=u.width/f.x,x=u.height/f.y;if(c){const S=jt(c),b=s&&Gt(s)?jt(s):s;let E=S,C=Su(E);for(;C&&s&&b!==E;){const j=qr(C),_=C.getBoundingClientRect(),R=Kt(C),z=_.left+(C.clientLeft+parseFloat(R.paddingLeft))*j.x,D=_.top+(C.clientTop+parseFloat(R.paddingTop))*j.y;h*=j.x,v*=j.y,y*=j.x,x*=j.y,h+=z,v+=D,E=jt(C),C=Su(E)}}return Ji({width:y,height:x,x:h,y:v})}function us(n,l){const o=as(n).scrollLeft;return l?l.left+o:Sr(mn(n)).left+o}function sh(n,l){const o=n.getBoundingClientRect(),s=o.left+l.scrollLeft-us(n,o),u=o.top+l.scrollTop;return{x:s,y:u}}function N1(n){let{elements:l,rect:o,offsetParent:s,strategy:u}=n;const c=u==="fixed",f=mn(s),m=l?ss(l.floating):!1;if(s===f||m&&c)return o;let h={scrollLeft:0,scrollTop:0},v=an(1);const y=an(0),x=cn(s);if((x||!x&&!c)&&((io(s)!=="body"||il(f))&&(h=as(s)),cn(s))){const b=Sr(s);v=qr(s),y.x=b.x+s.clientLeft,y.y=b.y+s.clientTop}const S=f&&!x&&!c?sh(f,h):an(0);return{width:o.width*v.x,height:o.height*v.y,x:o.x*v.x-h.scrollLeft*v.x+y.x+S.x,y:o.y*v.y-h.scrollTop*v.y+y.y+S.y}}function R1(n){return Array.from(n.getClientRects())}function T1(n){const l=mn(n),o=as(n),s=n.ownerDocument.body,u=Tt(l.scrollWidth,l.clientWidth,s.scrollWidth,s.clientWidth),c=Tt(l.scrollHeight,l.clientHeight,s.scrollHeight,s.clientHeight);let f=-o.scrollLeft+us(n);const m=-o.scrollTop;return Kt(s).direction==="rtl"&&(f+=Tt(l.clientWidth,s.clientWidth)-u),{width:u,height:c,x:f,y:m}}const Sp=25;function P1(n,l){const o=jt(n),s=mn(n),u=o.visualViewport;let c=s.clientWidth,f=s.clientHeight,m=0,h=0;if(u){c=u.width,f=u.height;const y=Yu();(!y||y&&l==="fixed")&&(m=u.offsetLeft,h=u.offsetTop)}const v=us(s);if(v<=0){const y=s.ownerDocument,x=y.body,S=getComputedStyle(x),b=y.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,E=Math.abs(s.clientWidth-x.clientWidth-b);E<=Sp&&(c-=E)}else v<=Sp&&(c+=v);return{width:c,height:f,x:m,y:h}}const j1=new Set(["absolute","fixed"]);function _1(n,l){const o=Sr(n,!0,l==="fixed"),s=o.top+n.clientTop,u=o.left+n.clientLeft,c=cn(n)?qr(n):an(1),f=n.clientWidth*c.x,m=n.clientHeight*c.y,h=u*c.x,v=s*c.y;return{width:f,height:m,x:h,y:v}}function Cp(n,l,o){let s;if(l==="viewport")s=P1(n,o);else if(l==="document")s=T1(mn(n));else if(Gt(l))s=_1(l,o);else{const u=ih(n);s={x:l.x-u.x,y:l.y-u.y,width:l.width,height:l.height}}return Ji(s)}function ah(n,l){const o=tr(n);return o===l||!Gt(o)||Jr(o)?!1:Kt(o).position==="fixed"||ah(o,l)}function A1(n,l){const o=l.get(n);if(o)return o;let s=nl(n,[],!1).filter(m=>Gt(m)&&io(m)!=="body"),u=null;const c=Kt(n).position==="fixed";let f=c?tr(n):n;for(;Gt(f)&&!Jr(f);){const m=Kt(f),h=Uu(f);!h&&m.position==="fixed"&&(u=null),(c?!h&&!u:!h&&m.position==="static"&&!!u&&j1.has(u.position)||il(f)&&!h&&ah(n,f))?s=s.filter(y=>y!==f):u=m,f=tr(f)}return l.set(n,s),s}function O1(n){let{element:l,boundary:o,rootBoundary:s,strategy:u}=n;const f=[...o==="clippingAncestors"?ss(l)?[]:A1(l,this._c):[].concat(o),s],m=f[0],h=f.reduce((v,y)=>{const x=Cp(l,y,u);return v.top=Tt(x.top,v.top),v.right=er(x.right,v.right),v.bottom=er(x.bottom,v.bottom),v.left=Tt(x.left,v.left),v},Cp(l,m,u));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function D1(n){const{width:l,height:o}=lh(n);return{width:l,height:o}}function L1(n,l,o){const s=cn(l),u=mn(l),c=o==="fixed",f=Sr(n,!0,c,l);let m={scrollLeft:0,scrollTop:0};const h=an(0);function v(){h.x=us(u)}if(s||!s&&!c)if((io(l)!=="body"||il(u))&&(m=as(l)),s){const b=Sr(l,!0,c,l);h.x=b.x+l.clientLeft,h.y=b.y+l.clientTop}else u&&v();c&&!s&&u&&v();const y=u&&!s&&!c?sh(u,m):an(0),x=f.left+m.scrollLeft-h.x-y.x,S=f.top+m.scrollTop-h.y-y.y;return{x,y:S,width:f.width,height:f.height}}function fu(n){return Kt(n).position==="static"}function kp(n,l){if(!cn(n)||Kt(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return mn(n)===o&&(o=o.ownerDocument.body),o}function uh(n,l){const o=jt(n);if(ss(n))return o;if(!cn(n)){let u=tr(n);for(;u&&!Jr(u);){if(Gt(u)&&!fu(u))return u;u=tr(u)}return o}let s=kp(n,l);for(;s&&v1(s)&&fu(s);)s=kp(s,l);return s&&Jr(s)&&fu(s)&&!Uu(s)?o:s||C1(n)||o}const M1=async function(n){const l=this.getOffsetParent||uh,o=this.getDimensions,s=await o(n.floating);return{reference:L1(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function z1(n){return Kt(n).direction==="rtl"}const I1={convertOffsetParentRelativeRectToViewportRelativeRect:N1,getDocumentElement:mn,getClippingRect:O1,getOffsetParent:uh,getElementRects:M1,getClientRects:R1,getDimensions:D1,getScale:qr,isElement:Gt,isRTL:z1};function ch(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function $1(n,l){let o=null,s;const u=mn(n);function c(){var m;clearTimeout(s),(m=o)==null||m.disconnect(),o=null}function f(m,h){m===void 0&&(m=!1),h===void 0&&(h=1),c();const v=n.getBoundingClientRect(),{left:y,top:x,width:S,height:b}=v;if(m||l(),!S||!b)return;const E=_i(x),C=_i(u.clientWidth-(y+S)),j=_i(u.clientHeight-(x+b)),_=_i(y),z={rootMargin:-E+"px "+-C+"px "+-j+"px "+-_+"px",threshold:Tt(0,er(1,h))||1};let D=!0;function F(U){const I=U[0].intersectionRatio;if(I!==h){if(!D)return f();I?f(!1,I):s=setTimeout(()=>{f(!1,1e-7)},1e3)}I===1&&!ch(v,n.getBoundingClientRect())&&f(),D=!1}try{o=new IntersectionObserver(F,{...z,root:u.ownerDocument})}catch{o=new IntersectionObserver(F,z)}o.observe(n)}return f(!0),c}function F1(n,l,o,s){s===void 0&&(s={});const{ancestorScroll:u=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,v=Xu(n),y=u||c?[...v?nl(v):[],...nl(l)]:[];y.forEach(_=>{u&&_.addEventListener("scroll",o,{passive:!0}),c&&_.addEventListener("resize",o)});const x=v&&m?$1(v,o):null;let S=-1,b=null;f&&(b=new ResizeObserver(_=>{let[R]=_;R&&R.target===v&&b&&(b.unobserve(l),cancelAnimationFrame(S),S=requestAnimationFrame(()=>{var z;(z=b)==null||z.observe(l)})),o()}),v&&!h&&b.observe(v),b.observe(l));let E,C=h?Sr(n):null;h&&j();function j(){const _=Sr(n);C&&!ch(C,_)&&o(),C=_,E=requestAnimationFrame(j)}return o(),()=>{var _;y.forEach(R=>{u&&R.removeEventListener("scroll",o),c&&R.removeEventListener("resize",o)}),x==null||x(),(_=b)==null||_.disconnect(),b=null,h&&cancelAnimationFrame(E)}}const W1=d1,B1=f1,H1=a1,V1=m1,U1=u1,bp=s1,Y1=p1,X1=(n,l,o)=>{const s=new Map,u={platform:I1,...o},c={...u.platform,_c:s};return i1(n,l,{...u,platform:c})};var Q1=typeof document<"u",G1=function(){},Hi=Q1?w.useLayoutEffect:G1;function es(n,l){if(n===l)return!0;if(typeof n!=typeof l)return!1;if(typeof n=="function"&&n.toString()===l.toString())return!0;let o,s,u;if(n&&l&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==l.length)return!1;for(s=o;s--!==0;)if(!es(n[s],l[s]))return!1;return!0}if(u=Object.keys(n),o=u.length,o!==Object.keys(l).length)return!1;for(s=o;s--!==0;)if(!{}.hasOwnProperty.call(l,u[s]))return!1;for(s=o;s--!==0;){const c=u[s];if(!(c==="_owner"&&n.$$typeof)&&!es(n[c],l[c]))return!1}return!0}return n!==n&&l!==l}function dh(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Ep(n,l){const o=dh(n);return Math.round(l*o)/o}function pu(n){const l=w.useRef(n);return Hi(()=>{l.current=n}),l}function K1(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:s=[],platform:u,elements:{reference:c,floating:f}={},transform:m=!0,whileElementsMounted:h,open:v}=n,[y,x]=w.useState({x:0,y:0,strategy:o,placement:l,middlewareData:{},isPositioned:!1}),[S,b]=w.useState(s);es(S,s)||b(s);const[E,C]=w.useState(null),[j,_]=w.useState(null),R=w.useCallback(A=>{A!==U.current&&(U.current=A,C(A))},[]),z=w.useCallback(A=>{A!==I.current&&(I.current=A,_(A))},[]),D=c||E,F=f||j,U=w.useRef(null),I=w.useRef(null),$=w.useRef(y),B=h!=null,J=pu(h),ue=pu(u),ve=pu(v),X=w.useCallback(()=>{if(!U.current||!I.current)return;const A={placement:l,strategy:o,middleware:S};ue.current&&(A.platform=ue.current),X1(U.current,I.current,A).then(K=>{const G={...K,isPositioned:ve.current!==!1};pe.current&&!es($.current,G)&&($.current=G,Tu.flushSync(()=>{x(G)}))})},[S,l,o,ue,ve]);Hi(()=>{v===!1&&$.current.isPositioned&&($.current.isPositioned=!1,x(A=>({...A,isPositioned:!1})))},[v]);const pe=w.useRef(!1);Hi(()=>(pe.current=!0,()=>{pe.current=!1}),[]),Hi(()=>{if(D&&(U.current=D),F&&(I.current=F),D&&F){if(J.current)return J.current(D,F,X);X()}},[D,F,X,J,B]);const ce=w.useMemo(()=>({reference:U,floating:I,setReference:R,setFloating:z}),[R,z]),se=w.useMemo(()=>({reference:D,floating:F}),[D,F]),q=w.useMemo(()=>{const A={position:o,left:0,top:0};if(!se.floating)return A;const K=Ep(se.floating,y.x),G=Ep(se.floating,y.y);return m?{...A,transform:"translate("+K+"px, "+G+"px)",...dh(se.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:K,top:G}},[o,m,se.floating,y.x,y.y]);return w.useMemo(()=>({...y,update:X,refs:ce,elements:se,floatingStyles:q}),[y,X,ce,se,q])}const q1=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:s,padding:u}=typeof n=="function"?n(o):n;return s&&l(s)?s.current!=null?bp({element:s.current,padding:u}).fn(o):{}:s?bp({element:s,padding:u}).fn(o):{}}}},Z1=(n,l)=>({...W1(n),options:[n,l]}),J1=(n,l)=>({...B1(n),options:[n,l]}),eS=(n,l)=>({...Y1(n),options:[n,l]}),tS=(n,l)=>({...H1(n),options:[n,l]}),nS=(n,l)=>({...V1(n),options:[n,l]}),rS=(n,l)=>({...U1(n),options:[n,l]}),oS=(n,l)=>({...q1(n),options:[n,l]});var lS="Arrow",fh=w.forwardRef((n,l)=>{const{children:o,width:s=10,height:u=5,...c}=n;return p.jsx(He.svg,{...c,ref:l,width:s,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});fh.displayName=lS;var iS=fh;function sS(n){const[l,o]=w.useState(void 0);return un(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const s=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const c=u[0];let f,m;if("borderBoxSize"in c){const h=c.borderBoxSize,v=Array.isArray(h)?h[0]:h;f=v.inlineSize,m=v.blockSize}else f=n.offsetWidth,m=n.offsetHeight;o({width:f,height:m})});return s.observe(n,{box:"border-box"}),()=>s.unobserve(n)}else o(void 0)},[n]),l}var Qu="Popper",[ph,mh]=ol(Qu),[aS,hh]=ph(Qu),gh=n=>{const{__scopePopper:l,children:o}=n,[s,u]=w.useState(null);return p.jsx(aS,{scope:l,anchor:s,onAnchorChange:u,children:o})};gh.displayName=Qu;var vh="PopperAnchor",yh=w.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:s,...u}=n,c=hh(vh,o),f=w.useRef(null),m=rt(l,f),h=w.useRef(null);return w.useEffect(()=>{const v=h.current;h.current=(s==null?void 0:s.current)||f.current,v!==h.current&&c.onAnchorChange(h.current)}),s?null:p.jsx(He.div,{...u,ref:m})});yh.displayName=vh;var Gu="PopperContent",[uS,cS]=ph(Gu),xh=w.forwardRef((n,l)=>{var fe,Ce,Ne,Oe,Ze,Ct;const{__scopePopper:o,side:s="bottom",sideOffset:u=0,align:c="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:h=!0,collisionBoundary:v=[],collisionPadding:y=0,sticky:x="partial",hideWhenDetached:S=!1,updatePositionStrategy:b="optimized",onPlaced:E,...C}=n,j=hh(Gu,o),[_,R]=w.useState(null),z=rt(l,kt=>R(kt)),[D,F]=w.useState(null),U=sS(D),I=(U==null?void 0:U.width)??0,$=(U==null?void 0:U.height)??0,B=s+(c!=="center"?"-"+c:""),J=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ue=Array.isArray(v)?v:[v],ve=ue.length>0,X={padding:J,boundary:ue.filter(fS),altBoundary:ve},{refs:pe,floatingStyles:ce,placement:se,isPositioned:q,middlewareData:A}=K1({strategy:"fixed",placement:B,whileElementsMounted:(...kt)=>F1(...kt,{animationFrame:b==="always"}),elements:{reference:j.anchor},middleware:[Z1({mainAxis:u+$,alignmentAxis:f}),h&&J1({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?eS():void 0,...X}),h&&tS({...X}),nS({...X,apply:({elements:kt,rects:ye,availableWidth:nr,availableHeight:rr})=>{const{width:hn,height:kr}=ye.reference,Jt=kt.floating.style;Jt.setProperty("--radix-popper-available-width",`${nr}px`),Jt.setProperty("--radix-popper-available-height",`${rr}px`),Jt.setProperty("--radix-popper-anchor-width",`${hn}px`),Jt.setProperty("--radix-popper-anchor-height",`${kr}px`)}}),D&&oS({element:D,padding:m}),pS({arrowWidth:I,arrowHeight:$}),S&&rS({strategy:"referenceHidden",...X})]}),[K,G]=Ch(se),P=Pt(E);un(()=>{q&&(P==null||P())},[q,P]);const W=(fe=A.arrow)==null?void 0:fe.x,ne=(Ce=A.arrow)==null?void 0:Ce.y,de=((Ne=A.arrow)==null?void 0:Ne.centerOffset)!==0,[we,Se]=w.useState();return un(()=>{_&&Se(window.getComputedStyle(_).zIndex)},[_]),p.jsx("div",{ref:pe.setFloating,"data-radix-popper-content-wrapper":"",style:{...ce,transform:q?ce.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[(Oe=A.transformOrigin)==null?void 0:Oe.x,(Ze=A.transformOrigin)==null?void 0:Ze.y].join(" "),...((Ct=A.hide)==null?void 0:Ct.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:p.jsx(uS,{scope:o,placedSide:K,onArrowChange:F,arrowX:W,arrowY:ne,shouldHideArrow:de,children:p.jsx(He.div,{"data-side":K,"data-align":G,...C,ref:z,style:{...C.style,animation:q?void 0:"none"}})})})});xh.displayName=Gu;var wh="PopperArrow",dS={top:"bottom",right:"left",bottom:"top",left:"right"},Sh=w.forwardRef(function(l,o){const{__scopePopper:s,...u}=l,c=cS(wh,s),f=dS[c.placedSide];return p.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:p.jsx(iS,{...u,ref:o,style:{...u.style,display:"block"}})})});Sh.displayName=wh;function fS(n){return n!==null}var pS=n=>({name:"transformOrigin",options:n,fn(l){var j,_,R;const{placement:o,rects:s,middlewareData:u}=l,f=((j=u.arrow)==null?void 0:j.centerOffset)!==0,m=f?0:n.arrowWidth,h=f?0:n.arrowHeight,[v,y]=Ch(o),x={start:"0%",center:"50%",end:"100%"}[y],S=(((_=u.arrow)==null?void 0:_.x)??0)+m/2,b=(((R=u.arrow)==null?void 0:R.y)??0)+h/2;let E="",C="";return v==="bottom"?(E=f?x:`${S}px`,C=`${-h}px`):v==="top"?(E=f?x:`${S}px`,C=`${s.floating.height+h}px`):v==="right"?(E=`${-h}px`,C=f?x:`${b}px`):v==="left"&&(E=`${s.floating.width+h}px`,C=f?x:`${b}px`),{data:{x:E,y:C}}}});function Ch(n){const[l,o="center"]=n.split("-");return[l,o]}var mS=gh,hS=yh,gS=xh,vS=Sh,yS=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"}),xS="VisuallyHidden",kh=w.forwardRef((n,l)=>p.jsx(He.span,{...n,ref:l,style:{...yS,...n.style}}));kh.displayName=xS;var wS=kh,[cs,cC]=ol("Tooltip",[mh]),ds=mh(),bh="TooltipProvider",SS=700,Cu="tooltip.open",[CS,Ku]=cs(bh),Eh=n=>{const{__scopeTooltip:l,delayDuration:o=SS,skipDelayDuration:s=300,disableHoverableContent:u=!1,children:c}=n,f=w.useRef(!0),m=w.useRef(!1),h=w.useRef(0);return w.useEffect(()=>{const v=h.current;return()=>window.clearTimeout(v)},[]),p.jsx(CS,{scope:l,isOpenDelayedRef:f,delayDuration:o,onOpen:w.useCallback(()=>{window.clearTimeout(h.current),f.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>f.current=!0,s)},[s]),isPointerInTransitRef:m,onPointerInTransitChange:w.useCallback(v=>{m.current=v},[]),disableHoverableContent:u,children:c})};Eh.displayName=bh;var rl="Tooltip",[kS,sl]=cs(rl),Nh=n=>{const{__scopeTooltip:l,children:o,open:s,defaultOpen:u,onOpenChange:c,disableHoverableContent:f,delayDuration:m}=n,h=Ku(rl,n.__scopeTooltip),v=ds(l),[y,x]=w.useState(null),S=Jo(),b=w.useRef(0),E=f??h.disableHoverableContent,C=m??h.delayDuration,j=w.useRef(!1),[_,R]=Au({prop:s,defaultProp:u??!1,onChange:I=>{I?(h.onOpen(),document.dispatchEvent(new CustomEvent(Cu))):h.onClose(),c==null||c(I)},caller:rl}),z=w.useMemo(()=>_?j.current?"delayed-open":"instant-open":"closed",[_]),D=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,j.current=!1,R(!0)},[R]),F=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),U=w.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{j.current=!0,R(!0),b.current=0},C)},[C,R]);return w.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),p.jsx(mS,{...v,children:p.jsx(kS,{scope:l,contentId:S,open:_,stateAttribute:z,trigger:y,onTriggerChange:x,onTriggerEnter:w.useCallback(()=>{h.isOpenDelayedRef.current?U():D()},[h.isOpenDelayedRef,U,D]),onTriggerLeave:w.useCallback(()=>{E?F():(window.clearTimeout(b.current),b.current=0)},[F,E]),onOpen:D,onClose:F,disableHoverableContent:E,children:o})})};Nh.displayName=rl;var ku="TooltipTrigger",Rh=w.forwardRef((n,l)=>{const{__scopeTooltip:o,...s}=n,u=sl(ku,o),c=Ku(ku,o),f=ds(o),m=w.useRef(null),h=rt(l,m,u.onTriggerChange),v=w.useRef(!1),y=w.useRef(!1),x=w.useCallback(()=>v.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),p.jsx(hS,{asChild:!0,...f,children:p.jsx(He.button,{"aria-describedby":u.open?u.contentId:void 0,"data-state":u.stateAttribute,...s,ref:h,onPointerMove:Be(n.onPointerMove,S=>{S.pointerType!=="touch"&&!y.current&&!c.isPointerInTransitRef.current&&(u.onTriggerEnter(),y.current=!0)}),onPointerLeave:Be(n.onPointerLeave,()=>{u.onTriggerLeave(),y.current=!1}),onPointerDown:Be(n.onPointerDown,()=>{u.open&&u.onClose(),v.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:Be(n.onFocus,()=>{v.current||u.onOpen()}),onBlur:Be(n.onBlur,u.onClose),onClick:Be(n.onClick,u.onClose)})})});Rh.displayName=ku;var qu="TooltipPortal",[bS,ES]=cs(qu,{forceMount:void 0}),Th=n=>{const{__scopeTooltip:l,forceMount:o,children:s,container:u}=n,c=sl(qu,l);return p.jsx(bS,{scope:l,forceMount:o,children:p.jsx(qt,{present:o||c.open,children:p.jsx(zu,{asChild:!0,container:u,children:s})})})};Th.displayName=qu;var eo="TooltipContent",Ph=w.forwardRef((n,l)=>{const o=ES(eo,n.__scopeTooltip),{forceMount:s=o.forceMount,side:u="top",...c}=n,f=sl(eo,n.__scopeTooltip);return p.jsx(qt,{present:s||f.open,children:f.disableHoverableContent?p.jsx(jh,{side:u,...c,ref:l}):p.jsx(NS,{side:u,...c,ref:l})})}),NS=w.forwardRef((n,l)=>{const o=sl(eo,n.__scopeTooltip),s=Ku(eo,n.__scopeTooltip),u=w.useRef(null),c=rt(l,u),[f,m]=w.useState(null),{trigger:h,onClose:v}=o,y=u.current,{onPointerInTransitChange:x}=s,S=w.useCallback(()=>{m(null),x(!1)},[x]),b=w.useCallback((E,C)=>{const j=E.currentTarget,_={x:E.clientX,y:E.clientY},R=_S(_,j.getBoundingClientRect()),z=AS(_,R),D=OS(C.getBoundingClientRect()),F=LS([...z,...D]);m(F),x(!0)},[x]);return w.useEffect(()=>()=>S(),[S]),w.useEffect(()=>{if(h&&y){const E=j=>b(j,y),C=j=>b(j,h);return h.addEventListener("pointerleave",E),y.addEventListener("pointerleave",C),()=>{h.removeEventListener("pointerleave",E),y.removeEventListener("pointerleave",C)}}},[h,y,b,S]),w.useEffect(()=>{if(f){const E=C=>{const j=C.target,_={x:C.clientX,y:C.clientY},R=(h==null?void 0:h.contains(j))||(y==null?void 0:y.contains(j)),z=!DS(_,f);R?S():z&&(S(),v())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[h,y,f,v,S]),p.jsx(jh,{...n,ref:c})}),[RS,TS]=cs(rl,{isInside:!1}),PS=fy("TooltipContent"),jh=w.forwardRef((n,l)=>{const{__scopeTooltip:o,children:s,"aria-label":u,onEscapeKeyDown:c,onPointerDownOutside:f,...m}=n,h=sl(eo,o),v=ds(o),{onClose:y}=h;return w.useEffect(()=>(document.addEventListener(Cu,y),()=>document.removeEventListener(Cu,y)),[y]),w.useEffect(()=>{if(h.trigger){const x=S=>{const b=S.target;b!=null&&b.contains(h.trigger)&&y()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[h.trigger,y]),p.jsx(Mu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:x=>x.preventDefault(),onDismiss:y,children:p.jsxs(gS,{"data-state":h.stateAttribute,...v,...m,ref:l,style:{...m.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(PS,{children:s}),p.jsx(RS,{scope:o,isInside:!0,children:p.jsx(wS,{id:h.contentId,role:"tooltip",children:u||s})})]})})});Ph.displayName=eo;var _h="TooltipArrow",jS=w.forwardRef((n,l)=>{const{__scopeTooltip:o,...s}=n,u=ds(o);return TS(_h,o).isInside?null:p.jsx(vS,{...u,...s,ref:l})});jS.displayName=_h;function _S(n,l){const o=Math.abs(l.top-n.y),s=Math.abs(l.bottom-n.y),u=Math.abs(l.right-n.x),c=Math.abs(l.left-n.x);switch(Math.min(o,s,u,c)){case c:return"left";case u:return"right";case o:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function AS(n,l,o=5){const s=[];switch(l){case"top":s.push({x:n.x-o,y:n.y+o},{x:n.x+o,y:n.y+o});break;case"bottom":s.push({x:n.x-o,y:n.y-o},{x:n.x+o,y:n.y-o});break;case"left":s.push({x:n.x+o,y:n.y-o},{x:n.x+o,y:n.y+o});break;case"right":s.push({x:n.x-o,y:n.y-o},{x:n.x-o,y:n.y+o});break}return s}function OS(n){const{top:l,right:o,bottom:s,left:u}=n;return[{x:u,y:l},{x:o,y:l},{x:o,y:s},{x:u,y:s}]}function DS(n,l){const{x:o,y:s}=n;let u=!1;for(let c=0,f=l.length-1;c<l.length;f=c++){const m=l[c],h=l[f],v=m.x,y=m.y,x=h.x,S=h.y;y>s!=S>s&&o<(x-v)*(s-y)/(S-y)+v&&(u=!u)}return u}function LS(n){const l=n.slice();return l.sort((o,s)=>o.x<s.x?-1:o.x>s.x?1:o.y<s.y?-1:o.y>s.y?1:0),MS(l)}function MS(n){if(n.length<=1)return n.slice();const l=[];for(let s=0;s<n.length;s++){const u=n[s];for(;l.length>=2;){const c=l[l.length-1],f=l[l.length-2];if((c.x-f.x)*(u.y-f.y)>=(c.y-f.y)*(u.x-f.x))l.pop();else break}l.push(u)}l.pop();const o=[];for(let s=n.length-1;s>=0;s--){const u=n[s];for(;o.length>=2;){const c=o[o.length-1],f=o[o.length-2];if((c.x-f.x)*(u.y-f.y)>=(c.y-f.y)*(u.x-f.x))o.pop();else break}o.push(u)}return o.pop(),l.length===1&&o.length===1&&l[0].x===o[0].x&&l[0].y===o[0].y?l:l.concat(o)}var zS=Eh,IS=Nh,$S=Rh,FS=Th,WS=Ph;function BS({delayDuration:n=0,...l}){return p.jsx(zS,{"data-slot":"tooltip-provider",delayDuration:n,...l})}function Ai({...n}){return p.jsx(BS,{children:p.jsx(IS,{"data-slot":"tooltip",...n})})}function Oi({...n}){return p.jsx($S,{"data-slot":"tooltip-trigger",...n})}function Di({className:n,sideOffset:l=4,children:o,...s}){return p.jsx(FS,{children:p.jsx(WS,{"data-slot":"tooltip-content",sideOffset:l,className:fn("bg-background text-foreground border border-border animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",n),...s,children:o})})}function HS(n){const l=n.reduce((c,f)=>(c[f.toolName]=(c[f.toolName]||0)+1,c),{}),o=Object.keys(l),s=c=>{const f=l[c]??0;return f>1?`${c} (x${f})`:c},u=o.map(s);return o.length===1&&o[0]?{label:s(o[0]),details:""}:o.length===2?{label:`${s(o[0])}, ${s(o[1])}`,details:u.join(", ")}:{label:`${s(o[0])}, ${s(o[1])}, ...`,details:u.join(", ")}}function VS(n,l){const o=n==null?void 0:n.prompt;if(!Array.isArray(o))return null;if(l){const h=o.filter(y=>y.role==="user"),v=h[h.length-1];if(v){const y=v.content;let x=null;if(typeof y=="string")x=y;else if(Array.isArray(y)){const S=y.find(b=>b.type==="text");S!=null&&S.text&&(x=S.text)}if(x)return{type:"user",label:`"${Np(x)}"`,fullText:x}}return null}const s=o.filter(h=>h.role==="tool");if(s.length>0){const h=s[s.length-1],v={},y=h.content;if(Array.isArray(y))for(const E of y)E.type==="tool-result"&&E.toolName&&(v[E.toolName]=(v[E.toolName]||0)+1);const x=Object.keys(v);if(x.length===0)return{type:"tool",label:"tool result"};const S=E=>{const C=v[E];return C>1?`${E} (x${C})`:E},b=x.map(S);return x.length===1?{type:"tool",label:S(x[0])}:x.length===2?{type:"tool",label:`${S(x[0])}, ${S(x[1])}`,toolDetails:b.join(", ")}:{type:"tool",label:`${S(x[0])}, ${S(x[1])}, ...`,toolDetails:b.join(", ")}}const u=o.filter(h=>h.role==="user"),c=u[u.length-1];if(!c)return null;const f=c.content;let m=null;if(typeof f=="string")m=f;else if(Array.isArray(f)){const h=f.find(v=>v.type==="text");h!=null&&h.text&&(m=h.text)}return m?{type:"user",label:`"${Np(m)}"`,fullText:m}:null}function Np(n,l=30){return n.length<=l?n:n.slice(0,l).trim()+"…"}function US(n,l){var o;if(l)return{type:"error",icon:"alert",label:"Error"};if((n==null?void 0:n.finishReason)==="tool-calls"){const s=(n==null?void 0:n.toolCalls)||((o=n==null?void 0:n.content)==null?void 0:o.filter(f=>f.type==="tool-call"))||[],{label:u,details:c}=HS(s);return{type:"tool-calls",icon:"wrench",label:u,toolDetails:c||void 0}}return{type:"response",icon:"message",label:"Response"}}function YS(){const[n,l]=w.useState([]),[o,s]=w.useState(null),[u,c]=w.useState(new Set),[f,m]=w.useState(!0),h=async()=>{try{const z=await(await fetch("/api/runs")).json();l(z)}catch(R){console.error("Failed to fetch runs:",R)}finally{m(!1)}},v=async()=>{await fetch("/api/clear",{method:"POST"}),l([]),s(null)};w.useEffect(()=>{h()},[]),w.useEffect(()=>{let R=null,z=null;const D=()=>{R=new EventSource("/api/events"),R.addEventListener("connected",()=>{console.log("[DevTools] Connected to real-time updates")}),R.addEventListener("update",()=>{h(),o&&fetch(`/api/runs/${o.run.id}`).then(F=>F.json()).then(F=>{F&&!F.error&&s(F)}).catch(()=>{})}),R.addEventListener("heartbeat",()=>{}),R.onerror=()=>{console.log("[DevTools] SSE connection lost, reconnecting..."),R==null||R.close(),z=setTimeout(D,2e3)}};return D(),()=>{R==null||R.close(),z&&clearTimeout(z)}},[o==null?void 0:o.run.id]);const y=async R=>{const D=await(await fetch(`/api/runs/${R}`)).json();s(D),c(new Set)},x=R=>{c(z=>{const D=new Set(z);return D.has(R)?D.delete(R):D.add(R),D})},S=R=>R===null?"-":R<1e3?`${R}ms`:`${(R/1e3).toFixed(2)}s`,b=R=>{if(!R)return null;try{return JSON.parse(R)}catch{return R}},E=R=>{var U,I,$;const z=R[0];if(!z)return"Empty run";const D=b(z.input),F=(U=D==null?void 0:D.prompt)==null?void 0:U.find(B=>B.role==="user");if(F){const B=typeof F.content=="string"?F.content:(($=(I=F.content)==null?void 0:I[0])==null?void 0:$.text)||"";return B.slice(0,50)+(B.length>50?"...":"")}return"No user message"},C=R=>R.some(z=>z.error),j=R=>R.reduce((z,D)=>z+(D.duration_ms||0),0),_=R=>R.reduce((z,D)=>{const F=b(D.usage),U=Vi(F==null?void 0:F.inputTokens),I=Ui(F==null?void 0:F.outputTokens),$={total:z.input.total+U.total};(z.input.noCache!==void 0||U.noCache!==void 0)&&($.noCache=(z.input.noCache??0)+(U.noCache??0)),(z.input.cacheRead!==void 0||U.cacheRead!==void 0)&&($.cacheRead=(z.input.cacheRead??0)+(U.cacheRead??0)),(z.input.cacheWrite!==void 0||U.cacheWrite!==void 0)&&($.cacheWrite=(z.input.cacheWrite??0)+(U.cacheWrite??0));const B={total:z.output.total+I.total};return(z.output.text!==void 0||I.text!==void 0)&&(B.text=(z.output.text??0)+(I.text??0)),(z.output.reasoning!==void 0||I.reasoning!==void 0)&&(B.reasoning=(z.output.reasoning??0)+(I.reasoning??0)),{input:$,output:B}},{input:{total:0},output:{total:0}});return p.jsxs("div",{className:"flex flex-col h-screen bg-background",children:[p.jsxs("header",{className:"flex justify-between items-center px-5 py-3 border-b border-border bg-card",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(c0,{}),p.jsx("span",{className:"text-base font-medium text-muted-foreground",children:"DevTools"})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs(Gf,{variant:"ghost",size:"sm",onClick:h,className:"h-8 px-3 text-xs",children:[p.jsx(n0,{className:"size-3.5"}),"Refresh"]}),p.jsxs(Gf,{variant:"ghost",size:"sm",onClick:v,className:"h-8 px-3 text-xs text-destructive-foreground hover:bg-destructive/20",children:[p.jsx(i0,{className:"size-3.5"}),"Clear"]})]})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsxs("aside",{className:"w-[300px] border-r border-border bg-sidebar flex flex-col",children:[p.jsx("div",{className:"px-4 py-3 border-b border-border",children:p.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:"Runs"})}),p.jsx(Zf,{className:"flex-1 overflow-hidden",children:f?p.jsx("p",{className:"p-4 text-muted-foreground text-sm",children:"Loading..."}):n.length===0?p.jsx("p",{className:"p-4 text-muted-foreground text-sm",children:"No runs yet"}):p.jsx("div",{children:n.map(R=>{const z=(o==null?void 0:o.run.id)===R.id;return p.jsxs("button",{className:`w-full text-left px-4 py-3 border-b border-border/50 transition-colors ${z?"bg-accent":"hover:bg-accent/50"}`,onClick:()=>y(R.id),children:[p.jsxs("div",{className:"flex items-start gap-2 mb-1.5 min-w-0",children:[R.isInProgress?p.jsx(wi,{className:"size-3.5 text-blue-400 mt-0.5 shrink-0 animate-spin"}):R.hasError?p.jsx(Ff,{className:"size-3.5 text-destructive-foreground mt-0.5 shrink-0"}):p.jsx(Li,{className:"size-3.5 text-muted-foreground mt-0.5 shrink-0"}),p.jsx("span",{className:"text-[13px] text-foreground leading-tight line-clamp-1 break-all",children:R.firstMessage||"Loading..."})]}),p.jsxs("div",{className:"flex items-center gap-2 ml-5.5 text-[11px] text-muted-foreground",children:[R.type&&p.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${R.type==="stream"?"bg-blue-500/15 text-blue-400":"bg-emerald-500/15 text-emerald-400"}`,children:[R.type==="stream"&&p.jsx(u0,{className:"size-2.5"}),R.type]}),p.jsxs("span",{children:[R.stepCount," ",R.stepCount===1?"step":"steps"]}),p.jsx("span",{children:"·"}),p.jsx("span",{className:"font-mono",children:new Date(R.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]},R.id)})})})]}),p.jsx("main",{className:"flex-1 overflow-hidden",children:p.jsx(Zf,{className:"h-full",children:o?p.jsxs("div",{className:"p-5",children:[p.jsxs("div",{className:"flex items-center justify-between mb-5",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("h2",{className:"text-sm font-medium text-foreground",children:E(o.steps)}),o.run.isInProgress&&p.jsxs(Kf,{variant:"secondary",className:"text-[10px] h-5 gap-1.5 bg-blue-500/15 text-blue-400 border-blue-500/30",children:[p.jsx(wi,{className:"size-3 animate-spin"}),"In Progress"]}),C(o.steps)&&p.jsx(Kf,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]}),p.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[p.jsxs("span",{children:[o.steps.length," steps"]}),p.jsx("span",{className:"px-3 text-muted-foreground/30",children:"·"}),p.jsx("span",{className:"font-mono",children:S(j(o.steps))}),p.jsx("span",{className:"px-3 text-muted-foreground/30",children:"·"}),p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsxs("span",{className:"font-mono cursor-help",children:["input:"," ",Tp(_(o.steps).input)," ",p.jsx("span",{className:"text-muted-foreground/50",children:"→"})," ","output:"," ",Pp(_(o.steps).output)]})}),p.jsx(Di,{children:p.jsx(Rp,{input:_(o.steps).input,output:_(o.steps).output})})]}),p.jsx("span",{className:"px-3 text-muted-foreground/30",children:"·"}),p.jsx("span",{children:new Date(o.run.started_at).toLocaleString()})]})]}),p.jsx("div",{className:"flex flex-col gap-3",children:o.steps.map((R,z)=>{var se,q;const D=u.has(R.id),U=z===o.steps.length-1&&o.run.isInProgress,I=b(R.input),$=b(R.output),B=b(R.usage),J=o.steps[z+1],ue=J?b(J.input):null,ve=((q=(se=ue==null?void 0:ue.prompt)==null?void 0:se.filter(A=>A.role==="tool"))==null?void 0:q.flatMap(A=>A.content))??[],X=US($,R.error),ce=VS(I,z===0);return p.jsx(Ky,{open:D,onOpenChange:()=>x(R.id),children:p.jsxs(uy,{className:`overflow-hidden py-0 gap-0 ${U?"ring-2 ring-blue-500/50 ring-offset-1 ring-offset-background":""}`,children:[p.jsx(qy,{asChild:!0,children:p.jsxs("button",{className:`w-full flex items-center justify-between px-4 py-3 text-left transition-colors hover:bg-accent/50 ${D?"border-b border-border":""}`,children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-mono w-4",children:R.step_number}),p.jsxs("div",{className:"flex items-center gap-2",children:[ce&&p.jsxs(p.Fragment,{children:[ce.type==="user"?p.jsx(Li,{className:"size-3.5 text-muted-foreground"}):p.jsx(el,{className:"size-3.5 text-muted-foreground"}),ce.fullText||ce.toolDetails?p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsx("span",{className:`text-sm text-muted-foreground ${ce.type==="tool"?"font-mono":""}`,children:ce.label})}),p.jsx(Di,{side:"bottom",className:"max-w-sm max-h-40 overflow-hidden",children:p.jsx("span",{className:"line-clamp-6",children:ce.fullText||ce.toolDetails})})]}):p.jsx("span",{className:`text-sm text-muted-foreground ${ce.type==="tool"?"font-mono":""}`,children:ce.label}),p.jsx("span",{className:"text-muted-foreground/50 mx-1",children:"→"})]}),X.icon==="wrench"&&p.jsx(el,{className:"size-3.5 text-muted-foreground"}),X.icon==="message"&&p.jsx(Li,{className:"size-3.5 text-muted-foreground"}),X.icon==="alert"&&p.jsx(Ff,{className:"size-3.5 text-destructive"}),X.toolDetails?p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsx("span",{className:"text-sm font-medium font-mono",children:X.label})}),p.jsx(Di,{children:X.toolDetails})]}):p.jsx("span",{className:`text-sm font-medium ${X.icon==="wrench"?"font-mono":""}`,children:X.label})]})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[U?p.jsxs("span",{className:"text-[11px] text-blue-400 font-medium flex items-center gap-1.5",children:[p.jsx(wi,{className:"size-3 animate-spin"}),"streaming"]}):p.jsx("span",{className:"text-[11px] text-muted-foreground font-mono",children:S(R.duration_ms)}),B&&p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsxs("span",{className:"text-[11px] font-mono text-muted-foreground cursor-help",children:[Tp(Vi(B.inputTokens))," ",p.jsx("span",{className:"text-muted-foreground/50",children:"→"})," ",Pp(Ui(B.outputTokens))]})}),p.jsx(Di,{children:p.jsx(Rp,{input:Vi(B.inputTokens),output:Ui(B.outputTokens),raw:B.raw})})]}),p.jsx(Gv,{className:`size-4 text-muted-foreground transition-transform ${D?"rotate-180":""}`})]})]})}),p.jsxs(Zy,{children:[p.jsx(XS,{modelId:R.model_id,provider:R.provider,input:I,providerOptions:b(R.provider_options),usage:B}),p.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border",children:[p.jsx("div",{className:"bg-card/50",children:p.jsx(QS,{input:I})}),p.jsxs("div",{className:"p-4 bg-background min-h-full",children:[p.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Output"}),R.error?p.jsx("div",{className:"p-3 rounded-md bg-destructive/10 border border-destructive/30 text-sm text-destructive-foreground font-mono",children:R.error}):$?p.jsx(eC,{output:$,toolResults:ve}):U?p.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-400",children:[p.jsx(wi,{className:"size-4 animate-spin"}),p.jsx("span",{children:"Waiting for response..."})]}):p.jsx("p",{className:"text-sm text-muted-foreground",children:"No output"})]})]}),p.jsx(nC,{rawRequest:R.raw_request,rawResponse:R.raw_response,rawChunks:R.raw_chunks,isStream:R.type==="stream"})]})]})},R.id)})})]}):p.jsx("div",{className:"flex items-center justify-center min-h-[calc(100vh-57px)] text-muted-foreground",children:p.jsx("p",{className:"text-sm",children:"Select a run to view details"})})})})]})]})}function XS({modelId:n,provider:l,input:o,providerOptions:s,usage:u}){var m,h;const c=((m=o==null?void 0:o.tools)==null?void 0:m.length)??0,f=[];if((o==null?void 0:o.temperature)!=null&&f.push({label:"temp",value:String(o.temperature)}),(o==null?void 0:o.maxOutputTokens)!=null&&f.push({label:"max tokens",value:String(o.maxOutputTokens)}),(o==null?void 0:o.topP)!=null&&f.push({label:"topP",value:String(o.topP)}),(o==null?void 0:o.topK)!=null&&f.push({label:"topK",value:String(o.topK)}),(o==null?void 0:o.toolChoice)!=null){const v=typeof o.toolChoice=="string"?o.toolChoice:o.toolChoice.type;f.push({label:"tool choice",value:v})}return p.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted/20 border-b border-border text-[11px] text-muted-foreground",children:[l&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-sidebar-primary/10 text-sidebar-primary text-[10px] font-medium",children:l}),p.jsx("span",{className:"font-mono",children:n}),f.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),f.map((v,y)=>p.jsxs("span",{children:[v.label,": ",p.jsx("span",{className:"text-foreground",children:v.value}),y<f.length-1&&p.jsx("span",{className:"text-muted-foreground/30 mx-1",children:"·"})]},y))]}),c>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 hover:text-foreground transition-colors cursor-pointer",children:[p.jsx(el,{className:"size-3"}),c," available ",c===1?"tool":"tools"]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsxs(Bi,{children:["Available Tools (",c,")"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx("div",{className:"space-y-3",children:(h=o==null?void 0:o.tools)==null?void 0:h.map((v,y)=>p.jsx(KS,{tool:v},y))})})]})]})]}),s&&Object.keys(s).length>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 hover:text-foreground transition-colors cursor-pointer",children:[p.jsx(o0,{className:"size-3"}),"Provider options"]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsx(Bi,{children:"Provider Options"})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx(dn,{data:s,size:"lg"})})]})]})]}),u&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 hover:text-foreground transition-colors cursor-pointer",children:[p.jsx(Yv,{className:"size-3"}),"Usage"]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsx(Bi,{children:"Token Usage"})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx(rC,{usage:u})})]})]})]})]})}function QS({input:n}){const l=(n==null?void 0:n.prompt)??[],o=l.length,s=l.slice(-2),u=Math.max(0,o-2);return p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"w-full h-full text-left p-4 hover:bg-accent/30 transition-colors cursor-pointer flex flex-col justify-start",children:[p.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Input"}),p.jsxs("div",{className:"space-y-3",children:[u>0&&p.jsxs("div",{className:"text-[11px] text-muted-foreground/60 text-center py-1.5 rounded-md bg-muted/30",children:["+ ",u," previous"," ",u===1?"message":"messages"]}),s.map((c,f)=>p.jsx(GS,{message:c,index:u+f+1},f)),o===0&&p.jsx("p",{className:"text-sm text-muted-foreground",children:"No messages"})]})]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsxs(Bi,{children:["All Messages (",o,")"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx("div",{className:"space-y-3",children:l.map((c,f)=>p.jsx(JS,{message:c,index:f+1},f))})})]})]})}function GS({message:n,index:l}){const o=n.role,s=n.content,u={user:"User",assistant:"Assistant",system:"System",tool:"Tool"},c=E=>typeof E=="string"?E:Array.isArray(E)?E.filter(C=>C.type==="text").map(C=>C.text).join(""):"",f=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-call"):[],m=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-result"):[],h=E=>Array.isArray(E)?E.filter(C=>C.type==="thinking"||C.type==="reasoning").map(C=>C.thinking||C.text||C.reasoning).join(""):"",v=c(s),y=f(s),x=m(s),S=h(s),b=(v?1:0)+(S?1:0)+y.length+x.length;return p.jsxs("div",{className:"rounded-md border border-border/50 bg-background/50 p-2.5 space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/50",children:l}),p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:u[o]||o}),b>1&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:[b," parts"]})]}),S&&p.jsx("div",{className:"text-xs text-amber-500/60",children:"[thinking]"}),v&&p.jsx("div",{className:"text-xs text-foreground/90 line-clamp-3",children:v}),y.length>0&&p.jsxs("div",{className:"space-y-1",children:[y.slice(0,3).map((E,C)=>{const j=E.args??E.input,_=typeof j=="string"?to(j):j;return p.jsxs("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[E.toolName,"(",oC(_),")"]},C)}),y.length>3&&p.jsxs("div",{className:"text-[11px] text-muted-foreground/60",children:["+",y.length-3," more tool"," ",y.length-3===1?"call":"calls"]})]}),x.length>0&&p.jsxs("div",{className:"space-y-1",children:[x.slice(0,3).map((E,C)=>{const j=E.result??E.output??E,_=lC(j);return p.jsxs("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[E.toolName||"tool","(…) => ",_]},C)}),x.length>3&&p.jsxs("div",{className:"text-[11px] text-muted-foreground/60",children:["+",x.length-3," more tool"," ",x.length-3===1?"result":"results"]})]}),!v&&!S&&y.length===0&&x.length===0&&p.jsx("div",{className:"text-[11px] text-muted-foreground italic",children:"Empty message"})]})}function KS({tool:n}){const[l,o]=w.useState(!1);return p.jsxs("div",{className:"rounded-md border border-border bg-background overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center justify-between p-2.5 hover:bg-accent/50 transition-colors",onClick:()=>o(!l),children:[p.jsx("span",{className:"text-sm font-mono text-purple",children:n.name}),n.parameters&&p.jsx(Cr,{className:`size-3 text-muted-foreground transition-transform ${l?"rotate-90":""}`})]}),l&&n.parameters&&p.jsxs("div",{className:"px-2.5 pb-2.5 border-t border-border",children:[n.description&&p.jsx("p",{className:"text-xs text-muted-foreground mb-2 pt-2",children:n.description}),p.jsx(dn,{data:n.parameters,compact:!0})]}),!l&&n.description&&p.jsx("div",{className:"px-2.5 pb-2 -mt-1",children:p.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:n.description})})]})}function qS({toolName:n,toolCallId:l,data:o}){const[s,u]=w.useState(!1),c=typeof o=="string"?to(o):o;return p.jsxs("div",{className:"rounded-md border border-purple/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-purple/10 hover:bg-purple/20 transition-colors",onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 text-purple transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx(el,{className:"size-3 text-purple shrink-0"}),p.jsx("span",{className:"text-xs font-mono font-medium text-purple",children:n}),!s&&c&&p.jsx("span",{className:"text-[11px] font-mono text-purple/70 truncate",children:Dh(c)}),l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 ml-auto shrink-0",children:l})]}),s&&p.jsx("div",{className:"p-3 bg-card/50 border-t border-purple/30",children:p.jsx(dn,{data:c})})]})}function ZS({toolName:n,toolCallId:l,data:o}){const[s,u]=w.useState(!1);return p.jsxs("div",{className:"rounded-md border border-success/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-success/10 hover:bg-success/20 transition-colors",onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 text-success transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx("span",{className:"text-xs font-medium text-success",children:"Result"}),n&&p.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:n}),l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 ml-auto shrink-0",children:l})]}),s&&p.jsx("div",{className:"p-3 bg-card/50 border-t border-success/30",children:p.jsx(dn,{data:o})})]})}function JS({message:n,index:l}){const o=n.role,s=n.content,u={user:"User",assistant:"Assistant",system:"System",tool:"Tool"},c=E=>typeof E=="string"?E:Array.isArray(E)?E.filter(C=>C.type==="text").map(C=>C.text).join(""):"",f=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-call"):[],m=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-result"):[],h=E=>Array.isArray(E)?E.filter(C=>C.type==="thinking"||C.type==="reasoning").map(C=>C.thinking||C.text||C.reasoning).join(""):"",v=c(s),y=f(s),x=m(s),S=h(s),b=(v?1:0)+(S?1:0)+y.length+x.length;return p.jsxs("div",{className:"rounded-md border border-border/50 bg-background/50 p-3 space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/50",children:l}),p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:u[o]||o}),b>1&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:[b," parts"]})]}),S&&p.jsx(Ah,{content:S}),v&&p.jsx(Oh,{content:v,defaultExpanded:!S&&y.length===0&&x.length===0,isSystem:o==="system"}),y.length>0&&p.jsx("div",{className:"space-y-2",children:y.map((E,C)=>p.jsx(qS,{toolName:E.toolName,toolCallId:E.toolCallId,data:E.args??E.input},C))}),x.length>0&&p.jsx("div",{className:"space-y-2",children:x.map((E,C)=>p.jsx(ZS,{toolName:E.toolName,toolCallId:E.toolCallId,data:E.result??E.output??E},C))}),!v&&!S&&y.length===0&&x.length===0&&p.jsx("div",{className:"text-[11px] text-muted-foreground italic",children:"Empty message"})]})}function eC({output:n,toolResults:l=[]}){var v,y,x;const o=S=>l.find(b=>b.toolCallId===S),s=(n==null?void 0:n.toolCalls)||((v=n==null?void 0:n.content)==null?void 0:v.filter(S=>S.type==="tool-call"))||[],u=(n==null?void 0:n.textParts)||((y=n==null?void 0:n.content)==null?void 0:y.filter(S=>S.type==="text"))||[],c=(n==null?void 0:n.reasoningParts)||((x=n==null?void 0:n.content)==null?void 0:x.filter(S=>S.type==="thinking"||S.type==="reasoning"))||[],f=u.map(S=>S.text).join(""),m=c.map(S=>S.text).join(""),h=f&&!m&&s.length===0;return p.jsxs("div",{className:"space-y-3",children:[m&&p.jsx(Ah,{content:m}),f&&p.jsx(Oh,{content:f,defaultExpanded:h}),s.map((S,b)=>{const E=o(S.toolCallId);return p.jsx(tC,{toolName:S.toolName,args:S.args??S.input,result:(E==null?void 0:E.output)??(E==null?void 0:E.result)},b)})]})}function tC({toolName:n,args:l,result:o}){const[s,u]=w.useState(!1),c=typeof l=="string"?to(l):l,f=typeof o=="string"?to(o):o;return p.jsxs("div",{className:"rounded-md border border-purple/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-purple/10 hover:bg-purple/20 transition-colors",onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 text-purple transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx(el,{className:"size-3 text-purple shrink-0"}),p.jsx("span",{className:"text-xs font-mono font-medium text-purple",children:n}),!s&&c&&p.jsx("span",{className:"text-[11px] font-mono text-purple/70 truncate",children:Dh(c)})]}),s&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"p-3 bg-card/50 border-t border-purple/30",children:[p.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Input"}),p.jsx(dn,{data:c})]}),f&&p.jsxs("div",{className:"p-3 border-t border-border bg-success/5",children:[p.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-2",children:"Output"}),p.jsx(dn,{data:f})]})]})]})}function Ah({content:n}){const[l,o]=w.useState(!1),s=n.length>200?n.slice(0,200)+"…":n;return p.jsxs("div",{className:"rounded-md border border-amber-500/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-amber-500/10 hover:bg-amber-500/20 transition-colors",onClick:()=>o(!l),children:[p.jsx(Cr,{className:`size-3 text-amber-500 transition-transform shrink-0 ${l?"rotate-90":""}`}),p.jsx(Vv,{className:"size-3 text-amber-500 shrink-0"}),p.jsx("span",{className:"text-xs font-medium text-amber-500",children:"Thinking"}),!l&&p.jsx("span",{className:"text-[11px] text-amber-500/70 truncate ml-1",children:s})]}),l&&p.jsx("div",{className:"p-3 bg-card/50 border-t border-amber-500/30",children:p.jsx("div",{className:"text-xs text-foreground/80 leading-relaxed whitespace-pre-wrap",children:n})})]})}function Oh({content:n,defaultExpanded:l=!1,isSystem:o=!1}){const[s,u]=w.useState(l),[c,f]=w.useState(!1),m=n.length>200?n.slice(0,200)+"…":n,h=o?"border-blue-500/30":"border-border",v=o?"bg-blue-500/10":"bg-muted/30",y=o?"hover:bg-blue-500/20":"hover:bg-muted/50",x=o?"text-blue-400":"text-muted-foreground",S=o?"text-blue-400":"text-foreground",b=async E=>{E.stopPropagation(),await navigator.clipboard.writeText(n),f(!0),setTimeout(()=>f(!1),2e3)};return p.jsxs("div",{className:`rounded-md border ${h} overflow-hidden`,children:[p.jsxs("button",{className:`w-full flex items-center gap-2 px-3 py-2 ${v} ${y} transition-colors`,onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 ${x} transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx(Li,{className:`size-3 ${x} shrink-0`}),p.jsx("span",{className:`text-xs font-medium ${S}`,children:"Text"}),!s&&p.jsx("span",{className:`text-[11px] ${o?"text-blue-400/70":"text-muted-foreground"} truncate ml-1`,children:m})]}),s&&p.jsxs("div",{className:`p-3 bg-card/50 border-t ${h} group relative`,children:[p.jsx("button",{onClick:b,className:"absolute top-1.5 right-1.5 p-1.5 rounded-md border border-border bg-background opacity-0 group-hover:opacity-100 transition-opacity z-10",title:"Copy to clipboard",children:c?p.jsx(Op,{className:"size-3 text-success"}):p.jsx(Dp,{className:"size-3 text-muted-foreground"})}),p.jsx("div",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap max-h-60 overflow-y-auto",children:n})]})]})}function dn({data:n,compact:l=!1,size:o="sm"}){const[s,u]=w.useState(!1),c=JSON.stringify(n,null,2),f=l&&c.length>200?JSON.stringify(n):c,m={sm:"text-xs",base:"text-sm",lg:"text-base"},h=async()=>{await navigator.clipboard.writeText(c),u(!0),setTimeout(()=>u(!1),2e3)};return p.jsxs("div",{className:"relative group",children:[p.jsx("button",{onClick:h,className:"absolute top-1.5 right-1.5 p-1.5 rounded-md border border-border bg-background opacity-0 group-hover:opacity-100 transition-opacity z-10",title:"Copy to clipboard",children:s?p.jsx(Op,{className:"size-3 text-success"}):p.jsx(Dp,{className:"size-3 text-muted-foreground"})}),p.jsx("pre",{className:`font-mono ${m[o]} text-muted-foreground whitespace-pre-wrap wrap-break-words bg-background rounded p-2 ${l?"max-h-20 overflow-hidden":""}`,children:f})]})}function nC({rawRequest:n,rawResponse:l,rawChunks:o,isStream:s}){const[u,c]=w.useState(!1),[f,m]=w.useState("parsed");if(!n&&!l)return null;const h=s&&o;return p.jsxs("div",{className:"border-t border-border",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-4 py-2.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors",onClick:()=>c(!u),children:[p.jsx(Cr,{className:`size-3 transition-transform ${u?"rotate-90":""}`}),p.jsx("span",{className:"font-medium uppercase tracking-wider",children:"Request / Response"})]}),u&&p.jsxs("div",{className:"px-4 pb-4 grid grid-cols-2 gap-4",children:[n&&p.jsxs("div",{className:"flex flex-col",children:[p.jsx("div",{className:"h-7 flex items-end mb-2",children:p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Request"})}),p.jsx("div",{className:"max-h-[400px] overflow-auto rounded-md border border-border",children:p.jsx(dn,{data:to(n)})})]}),(l||o)&&p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("div",{className:"h-7 flex items-end justify-between mb-2",children:[p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:s?"Stream":"Response"}),h&&p.jsxs("div",{className:"inline-flex rounded-md border border-border bg-muted/30 p-0.5",children:[p.jsx("button",{onClick:()=>m("parsed"),className:`px-2 py-0.5 text-[10px] font-medium rounded transition-colors ${f==="parsed"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"AI SDK"}),p.jsx("button",{onClick:()=>m("raw"),className:`px-2 py-0.5 text-[10px] font-medium rounded transition-colors ${f==="raw"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Provider"})]})]}),p.jsx("div",{className:"max-h-[400px] overflow-auto rounded-md border border-border",children:p.jsx(dn,{data:to(h&&f==="raw"?o:l)})})]})]})]})}function rC({usage:n}){const l=Vi(n==null?void 0:n.inputTokens),o=Ui(n==null?void 0:n.outputTokens);return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Input Tokens"}),p.jsx("div",{className:"text-2xl font-semibold",children:l.total}),(l.cacheRead!==void 0||l.cacheWrite!==void 0)&&p.jsxs("div",{className:"mt-3 space-y-1 text-sm text-muted-foreground",children:[l.cacheRead!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Cache read"}),p.jsx("span",{className:"font-mono",children:l.cacheRead})]}),l.cacheWrite!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Cache write"}),p.jsx("span",{className:"font-mono",children:l.cacheWrite})]}),l.noCache!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"No cache"}),p.jsx("span",{className:"font-mono",children:l.noCache})]})]})]}),p.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Output Tokens"}),p.jsx("div",{className:"text-2xl font-semibold",children:o.total}),(o.text!==void 0||o.reasoning!==void 0)&&p.jsxs("div",{className:"mt-3 space-y-1 text-sm text-muted-foreground",children:[o.text!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Text"}),p.jsx("span",{className:"font-mono",children:o.text})]}),o.reasoning!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Reasoning"}),p.jsx("span",{className:"font-mono",children:o.reasoning})]})]})]})]}),(n==null?void 0:n.raw)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Raw Provider Usage"}),p.jsx(dn,{data:n.raw,size:"sm"})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Full Usage Object"}),p.jsx(dn,{data:n,size:"sm"})]})]})}function Rp({input:n,output:l,raw:o}){const s=n.noCache!==void 0||n.cacheRead!==void 0||n.cacheWrite!==void 0,u=l.text!==void 0||l.reasoning!==void 0;return s||u?p.jsxs("div",{className:"text-xs space-y-2",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"font-medium mb-1",children:["Input: ",n.total]}),n.cacheRead!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Cache read: ",n.cacheRead]}),n.cacheWrite!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Cache write: ",n.cacheWrite]})]}),p.jsxs("div",{children:[p.jsxs("div",{className:"font-medium mb-1",children:["Output: ",l.total]}),l.text!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Text: ",l.text]}),l.reasoning!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Reasoning: ",l.reasoning]})]}),o!==void 0&&p.jsx("div",{className:"pt-1 border-t border-border mt-1",children:p.jsxs("div",{className:"text-muted-foreground/70 font-mono text-[10px] max-w-[200px] truncate",children:["Raw: ",JSON.stringify(o)]})})]}):p.jsxs("div",{className:"text-xs",children:[p.jsxs("div",{children:["Input: ",n.total]}),p.jsxs("div",{children:["Output: ",l.total]})]})}function to(n){if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n}function Vi(n){return n==null?{total:0}:typeof n=="number"?{total:n}:typeof n=="object"?{total:"total"in n&&typeof n.total=="number"?n.total:0,...typeof n.noCache=="number"&&{noCache:n.noCache},...typeof n.cacheRead=="number"&&{cacheRead:n.cacheRead},...typeof n.cacheWrite=="number"&&{cacheWrite:n.cacheWrite}}:{total:0}}function Ui(n){return n==null?{total:0}:typeof n=="number"?{total:n}:typeof n=="object"?{total:"total"in n&&typeof n.total=="number"?n.total:0,...typeof n.text=="number"&&{text:n.text},...typeof n.reasoning=="number"&&{reasoning:n.reasoning}}:{total:0}}function Tp(n){const{total:l,cacheRead:o}=n;return o&&o>0?`${l} (${o} cached)`:String(l)}function Pp(n){const{total:l,reasoning:o}=n;return o&&o>0?`${l} (${o} reasoning)`:String(l)}function Dh(n,l=40){if(!n||typeof n!="object")return"";const o=Object.entries(n);if(o.length===0)return"";const s=(h,v=20)=>h===null?"null":h===void 0?"undefined":typeof h=="object"?Array.isArray(h)?`[${h.length}]`:"{…}":typeof h=="string"?h.length>v?`"${h.slice(0,v)}…"`:`"${h}"`:String(h),u=o[0];if(!u)return"";const[c,f]=u,m=`${c}: ${s(f)}`;return o.length===1?`{ ${m} }`:`{ ${m}, … }`}function oC(n){if(!n||typeof n!="object")return"";const l=Object.entries(n);if(l.length===0)return"";const o=(m,h=20)=>m===null?"null":m===void 0?"undefined":typeof m=="object"?Array.isArray(m)?`[${m.length}]`:"{…}":typeof m=="string"?m.length>h?`"${m.slice(0,h)}…"`:`"${m}"`:String(m),s=l[0];if(!s)return"";const[u,c]=s,f=`${u}: ${o(c)}`;return l.length===1?`{ ${f} }`:`{ ${f}, … }`}function lC(n){if(n===null)return"null";if(n===void 0)return"undefined";if(typeof n=="string")return n.length>30?`"${n.slice(0,30)}…"`:`"${n}"`;if(Array.isArray(n))return`[${n.length}]`;if(typeof n=="object"){const l=Object.entries(n);if(l.length===0)return"{}";const o=l[0];if(!o)return"{…}";const[s,u]=o;let c;return typeof u=="string"&&u.length>15?c=`"${u.slice(0,15)}…"`:typeof u=="string"?c=`"${u}"`:typeof u=="object"?c=Array.isArray(u)?`[${u.length}]`:"{…}":c=String(u),l.length===1?`{ ${s}: ${c} }`:`{ ${s}: ${c}, … }`}return String(n)}zv.createRoot(document.getElementById("root")).render(p.jsx(YS,{}));
176
+ ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function ww(){const n=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(n)&&/Mobile/.test(n)||/FxiOS/.test(n))}function Sw(){return Wu(/^Mac/)}function Cw(){return Wu(/^iPhone/)}function dp(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function kw(){return Wu(/^iPad/)||Sw()&&navigator.maxTouchPoints>1}function Um(){return Cw()||kw()}function Wu(n){return typeof window<"u"&&window.navigator!=null?n.test(window.navigator.platform):void 0}const bw=24,Ew=typeof window<"u"?w.useLayoutEffect:w.useEffect;function fp(...n){return(...l)=>{for(let o of n)typeof o=="function"&&o(...l)}}const au=typeof document<"u"&&window.visualViewport;function pp(n){let l=window.getComputedStyle(n);return/(auto|scroll)/.test(l.overflow+l.overflowX+l.overflowY)}function Ym(n){for(pp(n)&&(n=n.parentElement);n&&!pp(n);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const Nw=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Ti=0,uu;function Rw(n={}){let{isDisabled:l}=n;Ew(()=>{if(!l)return Ti++,Ti===1&&Um()&&(uu=Tw()),()=>{Ti--,Ti===0&&(uu==null||uu())}},[l])}function Tw(){let n,l=0,o=x=>{n=Ym(x.target),!(n===document.documentElement&&n===document.body)&&(l=x.changedTouches[0].pageY)},s=x=>{if(!n||n===document.documentElement||n===document.body){x.preventDefault();return}let S=x.changedTouches[0].pageY,b=n.scrollTop,E=n.scrollHeight-n.clientHeight;E!==0&&((b<=0&&S>l||b>=E&&S<l)&&x.preventDefault(),l=S)},u=x=>{let S=x.target;vu(S)&&S!==document.activeElement&&(x.preventDefault(),S.style.transform="translateY(-2000px)",S.focus(),requestAnimationFrame(()=>{S.style.transform=""}))},c=x=>{let S=x.target;vu(S)&&(S.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{S.style.transform="",au&&(au.height<window.innerHeight?requestAnimationFrame(()=>{mp(S)}):au.addEventListener("resize",()=>mp(S),{once:!0}))}))},f=()=>{window.scrollTo(0,0)},m=window.pageXOffset,h=window.pageYOffset,v=fp(Pw(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let y=fp(qo(document,"touchstart",o,{passive:!1,capture:!0}),qo(document,"touchmove",s,{passive:!1,capture:!0}),qo(document,"touchend",u,{passive:!1,capture:!0}),qo(document,"focus",c,!0),qo(window,"scroll",f));return()=>{v(),y(),window.scrollTo(m,h)}}function Pw(n,l,o){let s=n.style[l];return n.style[l]=o,()=>{n.style[l]=s}}function qo(n,l,o,s){return n.addEventListener(l,o,s),()=>{n.removeEventListener(l,o,s)}}function mp(n){let l=document.scrollingElement||document.documentElement;for(;n&&n!==l;){let o=Ym(n);if(o!==document.documentElement&&o!==document.body&&o!==n){let s=o.getBoundingClientRect().top,u=n.getBoundingClientRect().top,c=n.getBoundingClientRect().bottom;const f=o.getBoundingClientRect().bottom+bw;c>f&&(o.scrollTop+=u-s)}n=o.parentElement}}function vu(n){return n instanceof HTMLInputElement&&!Nw.has(n.type)||n instanceof HTMLTextAreaElement||n instanceof HTMLElement&&n.isContentEditable}function jw(n,l){typeof n=="function"?n(l):n!=null&&(n.current=l)}function _w(...n){return l=>n.forEach(o=>jw(o,l))}function Xm(...n){return w.useCallback(_w(...n),n)}const Qm=new WeakMap;function qe(n,l,o=!1){if(!n||!(n instanceof HTMLElement))return;let s={};Object.entries(l).forEach(([u,c])=>{if(u.startsWith("--")){n.style.setProperty(u,c);return}s[u]=n.style[u],n.style[u]=c}),!o&&Qm.set(n,s)}function Aw(n,l){if(!n||!(n instanceof HTMLElement))return;let o=Qm.get(n);o&&(n.style[l]=o[l])}const Xe=n=>{switch(n){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return n}};function Pi(n,l){if(!n)return null;const o=window.getComputedStyle(n),s=o.transform||o.webkitTransform||o.mozTransform;let u=s.match(/^matrix3d\((.+)\)$/);return u?parseFloat(u[1].split(", ")[Xe(l)?13:12]):(u=s.match(/^matrix\((.+)\)$/),u?parseFloat(u[1].split(", ")[Xe(l)?5:4]):null)}function Ow(n){return 8*(Math.log(n+1)-2)}function cu(n,l){if(!n)return()=>{};const o=n.style.cssText;return Object.assign(n.style,l),()=>{n.style.cssText=o}}function Dw(...n){return(...l)=>{for(const o of n)typeof o=="function"&&o(...l)}}const Fe={DURATION:.5,EASE:[.32,.72,0,1]},Gm=.4,Lw=.25,Mw=100,Km=8,ji=16,yu=26,du="vaul-dragging";function qm(n){const l=ee.useRef(n);return ee.useEffect(()=>{l.current=n}),ee.useMemo(()=>(...o)=>l.current==null?void 0:l.current.call(l,...o),[])}function zw({defaultProp:n,onChange:l}){const o=ee.useState(n),[s]=o,u=ee.useRef(s),c=qm(l);return ee.useEffect(()=>{u.current!==s&&(c(s),u.current=s)},[s,u,c]),o}function Zm({prop:n,defaultProp:l,onChange:o=()=>{}}){const[s,u]=zw({defaultProp:l,onChange:o}),c=n!==void 0,f=c?n:s,m=qm(o),h=ee.useCallback(v=>{if(c){const x=typeof v=="function"?v(n):v;x!==n&&m(x)}else u(v)},[c,n,u,m]);return[f,h]}function Iw({activeSnapPointProp:n,setActiveSnapPointProp:l,snapPoints:o,drawerRef:s,overlayRef:u,fadeFromIndex:c,onSnapPointChange:f,direction:m="bottom",container:h,snapToSequentialPoint:v}){const[y,x]=Zm({prop:n,defaultProp:o==null?void 0:o[0],onChange:l}),[S,b]=ee.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ee.useEffect(()=>{function I(){b({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[]);const E=ee.useMemo(()=>y===(o==null?void 0:o[o.length-1])||null,[o,y]),C=ee.useMemo(()=>{var I;return(I=o==null?void 0:o.findIndex($=>$===y))!=null?I:null},[o,y]),j=o&&o.length>0&&(c||c===0)&&!Number.isNaN(c)&&o[c]===y||!o,_=ee.useMemo(()=>{const I=h?{width:h.getBoundingClientRect().width,height:h.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var $;return($=o==null?void 0:o.map(B=>{const J=typeof B=="string";let ue=0;if(J&&(ue=parseInt(B,10)),Xe(m)){const X=J?ue:S?B*I.height:0;return S?m==="bottom"?I.height-X:-I.height+X:X}const ve=J?ue:S?B*I.width:0;return S?m==="right"?I.width-ve:-I.width+ve:ve}))!=null?$:[]},[o,S,h]),R=ee.useMemo(()=>C!==null?_==null?void 0:_[C]:null,[_,C]),z=ee.useCallback(I=>{var $;const B=($=_==null?void 0:_.findIndex(J=>J===I))!=null?$:null;f(B),qe(s.current,{transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,transform:Xe(m)?`translate3d(0, ${I}px, 0)`:`translate3d(${I}px, 0, 0)`}),_&&B!==_.length-1&&c!==void 0&&B!==c&&B<c?qe(u.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,opacity:"0"}):qe(u.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,opacity:"1"}),x(o==null?void 0:o[Math.max(B,0)])},[s.current,o,_,c,u,x]);ee.useEffect(()=>{if(y||n){var I;const $=(I=o==null?void 0:o.findIndex(B=>B===n||B===y))!=null?I:-1;_&&$!==-1&&typeof _[$]=="number"&&z(_[$])}},[y,n,o,_,z]);function D({draggedDistance:I,closeDrawer:$,velocity:B,dismissible:J}){if(c===void 0)return;const ue=m==="bottom"||m==="right"?(R??0)-I:(R??0)+I,ve=C===c-1,X=C===0,pe=I>0;if(ve&&qe(u.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`}),!v&&B>2&&!pe){J?$():z(_[0]);return}if(!v&&B>2&&pe&&_&&o){z(_[o.length-1]);return}const ce=_==null?void 0:_.reduce((q,A)=>typeof q!="number"||typeof A!="number"?q:Math.abs(A-ue)<Math.abs(q-ue)?A:q),se=Xe(m)?window.innerHeight:window.innerWidth;if(B>Gm&&Math.abs(I)<se*.4){const q=pe?1:-1;if(q>0&&E&&o){z(_[o.length-1]);return}if(X&&q<0&&J&&$(),C===null)return;z(_[C+q]);return}z(ce)}function F({draggedDistance:I}){if(R===null)return;const $=m==="bottom"||m==="right"?R-I:R+I;(m==="bottom"||m==="right")&&$<_[_.length-1]||(m==="top"||m==="left")&&$>_[_.length-1]||qe(s.current,{transform:Xe(m)?`translate3d(0, ${$}px, 0)`:`translate3d(${$}px, 0, 0)`})}function U(I,$){if(!o||typeof C!="number"||!_||c===void 0)return null;const B=C===c-1;if(C>=c&&$)return 0;if(B&&!$)return 1;if(!j&&!B)return null;const ue=B?C+1:C-1,ve=B?_[ue]-_[ue-1]:_[ue+1]-_[ue],X=I/Math.abs(ve);return B?1-X:X}return{isLastSnapPoint:E,activeSnapPoint:y,shouldFade:j,getPercentageDragged:U,setActiveSnapPoint:x,activeSnapPointIndex:C,onRelease:D,onDrag:F,snapPointsOffset:_}}const $w=()=>()=>{};function Fw(){const{direction:n,isOpen:l,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:u}=ll(),c=ee.useRef(null),f=w.useMemo(()=>document.body.style.backgroundColor,[]);function m(){return(window.innerWidth-yu)/window.innerWidth}ee.useEffect(()=>{if(l&&o){c.current&&clearTimeout(c.current);const h=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!h)return;Dw(s&&!u?cu(document.body,{background:"black"}):$w,cu(h,{transformOrigin:Xe(n)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Fe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Fe.EASE.join(",")})`}));const v=cu(h,{borderRadius:`${Km}px`,overflow:"hidden",...Xe(n)?{transform:`scale(${m()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${m()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{v(),c.current=window.setTimeout(()=>{f?document.body.style.background=f:document.body.style.removeProperty("background")},Fe.DURATION*1e3)}}},[l,o,f])}let Zo=null;function Ww({isOpen:n,modal:l,nested:o,hasBeenOpened:s,preventScrollRestoration:u,noBodyStyles:c}){const[f,m]=ee.useState(()=>typeof window<"u"?window.location.href:""),h=ee.useRef(0),v=ee.useCallback(()=>{if(dp()&&Zo===null&&n&&!c){Zo={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:x,innerHeight:S}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-h.current}px`,left:`${-x}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const b=S-window.innerHeight;b&&h.current>=S&&(document.body.style.top=`${-(h.current+b)}px`)}),300)}},[n]),y=ee.useCallback(()=>{if(dp()&&Zo!==null&&!c){const x=-parseInt(document.body.style.top,10),S=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Zo),window.requestAnimationFrame(()=>{if(u&&f!==window.location.href){m(window.location.href);return}window.scrollTo(S,x)}),Zo=null}},[f]);return ee.useEffect(()=>{function x(){h.current=window.scrollY}return x(),window.addEventListener("scroll",x),()=>{window.removeEventListener("scroll",x)}},[]),ee.useEffect(()=>{if(l)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||y()}},[l,y]),ee.useEffect(()=>{o||!s||(n?(!window.matchMedia("(display-mode: standalone)").matches&&v(),l||window.setTimeout(()=>{y()},500)):y())},[n,s,f,l,o,v,y]),{restorePositionSetting:y}}function Bw({open:n,onOpenChange:l,children:o,onDrag:s,onRelease:u,snapPoints:c,shouldScaleBackground:f=!1,setBackgroundColorOnScale:m=!0,closeThreshold:h=Lw,scrollLockTimeout:v=Mw,dismissible:y=!0,handleOnly:x=!1,fadeFromIndex:S=c&&c.length-1,activeSnapPoint:b,setActiveSnapPoint:E,fixed:C,modal:j=!0,onClose:_,nested:R,noBodyStyles:z=!1,direction:D="bottom",defaultOpen:F=!1,disablePreventScroll:U=!0,snapToSequentialPoint:I=!1,preventScrollRestoration:$=!1,repositionInputs:B=!0,onAnimationEnd:J,container:ue,autoFocus:ve=!1}){var X,pe;const[ce=!1,se]=Zm({defaultProp:F,prop:n,onChange:ge=>{l==null||l(ge),!ge&&!R&&uo(),setTimeout(()=>{J==null||J(ge)},Fe.DURATION*1e3),ge&&!j&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ge||(document.body.style.pointerEvents="auto")}}),[q,A]=ee.useState(!1),[K,G]=ee.useState(!1),[P,W]=ee.useState(!1),ne=ee.useRef(null),de=ee.useRef(null),we=ee.useRef(null),Se=ee.useRef(null),fe=ee.useRef(null),Ce=ee.useRef(!1),Ne=ee.useRef(null),Oe=ee.useRef(0),Ze=ee.useRef(!1),Ct=ee.useRef(!F),kt=ee.useRef(0),ye=ee.useRef(null),nr=ee.useRef(((X=ye.current)==null?void 0:X.getBoundingClientRect().height)||0),rr=ee.useRef(((pe=ye.current)==null?void 0:pe.getBoundingClientRect().width)||0),hn=ee.useRef(0),kr=ee.useCallback(ge=>{c&&ge===Pn.length-1&&(de.current=new Date)},[]),{activeSnapPoint:Jt,activeSnapPointIndex:_t,setActiveSnapPoint:gn,onRelease:so,snapPointsOffset:Pn,onDrag:al,shouldFade:ao,getPercentageDragged:ul}=Iw({snapPoints:c,activeSnapPointProp:b,setActiveSnapPointProp:E,drawerRef:ye,fadeFromIndex:S,overlayRef:ne,onSnapPointChange:kr,direction:D,container:ue,snapToSequentialPoint:I});Rw({isDisabled:!ce||K||!j||P||!q||!B||!U});const{restorePositionSetting:uo}=Ww({isOpen:ce,modal:j,nested:R??!1,hasBeenOpened:q,preventScrollRestoration:$,noBodyStyles:z});function vn(){return(window.innerWidth-yu)/window.innerWidth}function cl(ge){var Re,Te;!y&&!c||ye.current&&!ye.current.contains(ge.target)||(nr.current=((Re=ye.current)==null?void 0:Re.getBoundingClientRect().height)||0,rr.current=((Te=ye.current)==null?void 0:Te.getBoundingClientRect().width)||0,G(!0),we.current=new Date,Um()&&window.addEventListener("touchend",()=>Ce.current=!1,{once:!0}),ge.target.setPointerCapture(ge.pointerId),Oe.current=Xe(D)?ge.pageY:ge.pageX)}function jn(ge,Re){var Te;let ke=ge;const Me=(Te=window.getSelection())==null?void 0:Te.toString(),ot=ye.current?Pi(ye.current,D):null,Je=new Date;if(ke.tagName==="SELECT"||ke.hasAttribute("data-vaul-no-drag")||ke.closest("[data-vaul-no-drag]"))return!1;if(D==="right"||D==="left")return!0;if(de.current&&Je.getTime()-de.current.getTime()<500)return!1;if(ot!==null&&(D==="bottom"?ot>0:ot<0))return!0;if(Me&&Me.length>0)return!1;if(fe.current&&Je.getTime()-fe.current.getTime()<v&&ot===0||Re)return fe.current=Je,!1;for(;ke;){if(ke.scrollHeight>ke.clientHeight){if(ke.scrollTop!==0)return fe.current=new Date,!1;if(ke.getAttribute("role")==="dialog")return!0}ke=ke.parentNode}return!0}function or(ge){if(ye.current&&K){const Re=D==="bottom"||D==="right"?1:-1,Te=(Oe.current-(Xe(D)?ge.pageY:ge.pageX))*Re,ke=Te>0,Me=c&&!y&&!ke;if(Me&&_t===0)return;const ot=Math.abs(Te),Je=document.querySelector("[data-vaul-drawer-wrapper]"),$t=D==="bottom"||D==="top"?nr.current:rr.current;let mt=ot/$t;const Ft=ul(ot,ke);if(Ft!==null&&(mt=Ft),Me&&mt>=1||!Ce.current&&!jn(ge.target,ke))return;if(ye.current.classList.add(du),Ce.current=!0,qe(ye.current,{transition:"none"}),qe(ne.current,{transition:"none"}),c&&al({draggedDistance:Te}),ke&&!c){const st=Ow(Te),_n=Math.min(st*-1,0)*Re;qe(ye.current,{transform:Xe(D)?`translate3d(0, ${_n}px, 0)`:`translate3d(${_n}px, 0, 0)`});return}const Wt=1-mt;if((ao||S&&_t===S-1)&&(s==null||s(ge,mt),qe(ne.current,{opacity:`${Wt}`,transition:"none"},!0)),Je&&ne.current&&f){const st=Math.min(vn()+mt*(1-vn()),1),_n=8-mt*8,An=Math.max(0,14-mt*14);qe(Je,{borderRadius:`${_n}px`,transform:Xe(D)?`scale(${st}) translate3d(0, ${An}px, 0)`:`scale(${st}) translate3d(${An}px, 0, 0)`,transition:"none"},!0)}if(!c){const st=ot*Re;qe(ye.current,{transform:Xe(D)?`translate3d(0, ${st}px, 0)`:`translate3d(${st}px, 0, 0)`})}}}ee.useEffect(()=>{window.requestAnimationFrame(()=>{Ct.current=!0})},[]),ee.useEffect(()=>{var ge;function Re(){if(!ye.current||!B)return;const Te=document.activeElement;if(vu(Te)||Ze.current){var ke;const Me=((ke=window.visualViewport)==null?void 0:ke.height)||0,ot=window.innerHeight;let Je=ot-Me;const $t=ye.current.getBoundingClientRect().height||0,mt=$t>ot*.8;hn.current||(hn.current=$t);const Ft=ye.current.getBoundingClientRect().top;if(Math.abs(kt.current-Je)>60&&(Ze.current=!Ze.current),c&&c.length>0&&Pn&&_t){const Wt=Pn[_t]||0;Je+=Wt}if(kt.current=Je,$t>Me||Ze.current){const Wt=ye.current.getBoundingClientRect().height;let st=Wt;Wt>Me&&(st=Me-(mt?Ft:yu)),C?ye.current.style.height=`${Wt-Math.max(Je,0)}px`:ye.current.style.height=`${Math.max(st,Me-Ft)}px`}else ww()||(ye.current.style.height=`${hn.current}px`);c&&c.length>0&&!Ze.current?ye.current.style.bottom="0px":ye.current.style.bottom=`${Math.max(Je,0)}px`}}return(ge=window.visualViewport)==null||ge.addEventListener("resize",Re),()=>{var Te;return(Te=window.visualViewport)==null?void 0:Te.removeEventListener("resize",Re)}},[_t,c,Pn]);function lr(ge){dl(),_==null||_(),ge||se(!1),setTimeout(()=>{c&&gn(c[0])},Fe.DURATION*1e3)}function co(){if(!ye.current)return;const ge=document.querySelector("[data-vaul-drawer-wrapper]"),Re=Pi(ye.current,D);qe(ye.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`}),qe(ne.current,{transition:`opacity ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,opacity:"1"}),f&&Re&&Re>0&&ce&&qe(ge,{borderRadius:`${Km}px`,overflow:"hidden",...Xe(D)?{transform:`scale(${vn()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${vn()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Fe.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Fe.EASE.join(",")})`},!0)}function dl(){!K||!ye.current||(ye.current.classList.remove(du),Ce.current=!1,G(!1),Se.current=new Date)}function fs(ge){if(!K||!ye.current)return;ye.current.classList.remove(du),Ce.current=!1,G(!1),Se.current=new Date;const Re=Pi(ye.current,D);if(!ge||!jn(ge.target,!1)||!Re||Number.isNaN(Re)||we.current===null)return;const Te=Se.current.getTime()-we.current.getTime(),ke=Oe.current-(Xe(D)?ge.pageY:ge.pageX),Me=Math.abs(ke)/Te;if(Me>.05&&(W(!0),setTimeout(()=>{W(!1)},200)),c){so({draggedDistance:ke*(D==="bottom"||D==="right"?1:-1),closeDrawer:lr,velocity:Me,dismissible:y}),u==null||u(ge,!0);return}if(D==="bottom"||D==="right"?ke>0:ke<0){co(),u==null||u(ge,!0);return}if(Me>Gm){lr(),u==null||u(ge,!1);return}var ot;const Je=Math.min((ot=ye.current.getBoundingClientRect().height)!=null?ot:0,window.innerHeight);var $t;const mt=Math.min(($t=ye.current.getBoundingClientRect().width)!=null?$t:0,window.innerWidth),Ft=D==="left"||D==="right";if(Math.abs(Re)>=(Ft?mt:Je)*h){lr(),u==null||u(ge,!1);return}u==null||u(ge,!0),co()}ee.useEffect(()=>(ce&&(qe(document.documentElement,{scrollBehavior:"auto"}),de.current=new Date),()=>{Aw(document.documentElement,"scrollBehavior")}),[ce]);function fo(ge){const Re=ge?(window.innerWidth-ji)/window.innerWidth:1,Te=ge?-16:0;Ne.current&&window.clearTimeout(Ne.current),qe(ye.current,{transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,transform:Xe(D)?`scale(${Re}) translate3d(0, ${Te}px, 0)`:`scale(${Re}) translate3d(${Te}px, 0, 0)`}),!ge&&ye.current&&(Ne.current=setTimeout(()=>{const ke=Pi(ye.current,D);qe(ye.current,{transition:"none",transform:Xe(D)?`translate3d(0, ${ke}px, 0)`:`translate3d(${ke}px, 0, 0)`})},500))}function po(ge,Re){if(Re<0)return;const Te=(window.innerWidth-ji)/window.innerWidth,ke=Te+Re*(1-Te),Me=-16+Re*ji;qe(ye.current,{transform:Xe(D)?`scale(${ke}) translate3d(0, ${Me}px, 0)`:`scale(${ke}) translate3d(${Me}px, 0, 0)`,transition:"none"})}function mo(ge,Re){const Te=Xe(D)?window.innerHeight:window.innerWidth,ke=Re?(Te-ji)/Te:1,Me=Re?-16:0;Re&&qe(ye.current,{transition:`transform ${Fe.DURATION}s cubic-bezier(${Fe.EASE.join(",")})`,transform:Xe(D)?`scale(${ke}) translate3d(0, ${Me}px, 0)`:`scale(${ke}) translate3d(${Me}px, 0, 0)`})}return ee.useEffect(()=>{j||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[j]),ee.createElement(pw,{defaultOpen:F,onOpenChange:ge=>{!y&&!ge||(ge?A(!0):lr(!0),se(ge))},open:ce},ee.createElement(Vm.Provider,{value:{activeSnapPoint:Jt,snapPoints:c,setActiveSnapPoint:gn,drawerRef:ye,overlayRef:ne,onOpenChange:l,onPress:cl,onRelease:fs,onDrag:or,dismissible:y,shouldAnimate:Ct,handleOnly:x,isOpen:ce,isDragging:K,shouldFade:ao,closeDrawer:lr,onNestedDrag:po,onNestedOpenChange:fo,onNestedRelease:mo,keyboardIsOpen:Ze,modal:j,snapPointsOffset:Pn,activeSnapPointIndex:_t,direction:D,shouldScaleBackground:f,setBackgroundColorOnScale:m,noBodyStyles:z,container:ue,autoFocus:ve}},o))}const Jm=ee.forwardRef(function({...n},l){const{overlayRef:o,snapPoints:s,onRelease:u,shouldFade:c,isOpen:f,modal:m,shouldAnimate:h}=ll(),v=Xm(l,o),y=s&&s.length>0;if(!m)return null;const x=ee.useCallback(S=>u(S),[u]);return ee.createElement(gw,{onMouseUp:x,ref:v,"data-vaul-overlay":"","data-vaul-snap-points":f&&y?"true":"false","data-vaul-snap-points-overlay":f&&c?"true":"false","data-vaul-animate":h!=null&&h.current?"true":"false",...n})});Jm.displayName="Drawer.Overlay";const eh=ee.forwardRef(function({onPointerDownOutside:n,style:l,onOpenAutoFocus:o,...s},u){const{drawerRef:c,onPress:f,onRelease:m,onDrag:h,keyboardIsOpen:v,snapPointsOffset:y,activeSnapPointIndex:x,modal:S,isOpen:b,direction:E,snapPoints:C,container:j,handleOnly:_,shouldAnimate:R,autoFocus:z}=ll(),[D,F]=ee.useState(!1),U=Xm(u,c),I=ee.useRef(null),$=ee.useRef(null),B=ee.useRef(!1),J=C&&C.length>0;Fw();const ue=(X,pe,ce=0)=>{if(B.current)return!0;const se=Math.abs(X.y),q=Math.abs(X.x),A=q>se,K=["bottom","right"].includes(pe)?1:-1;if(pe==="left"||pe==="right"){if(!(X.x*K<0)&&q>=0&&q<=ce)return A}else if(!(X.y*K<0)&&se>=0&&se<=ce)return!A;return B.current=!0,!0};ee.useEffect(()=>{J&&window.requestAnimationFrame(()=>{F(!0)})},[]);function ve(X){I.current=null,B.current=!1,m(X)}return ee.createElement(vw,{"data-vaul-drawer-direction":E,"data-vaul-drawer":"","data-vaul-delayed-snap-points":D?"true":"false","data-vaul-snap-points":b&&J?"true":"false","data-vaul-custom-container":j?"true":"false","data-vaul-animate":R!=null&&R.current?"true":"false",...s,ref:U,style:y&&y.length>0?{"--snap-point-height":`${y[x??0]}px`,...l}:l,onPointerDown:X=>{_||(s.onPointerDown==null||s.onPointerDown.call(s,X),I.current={x:X.pageX,y:X.pageY},f(X))},onOpenAutoFocus:X=>{o==null||o(X),z||X.preventDefault()},onPointerDownOutside:X=>{if(n==null||n(X),!S||X.defaultPrevented){X.preventDefault();return}v.current&&(v.current=!1)},onFocusOutside:X=>{if(!S){X.preventDefault();return}},onPointerMove:X=>{if($.current=X,_||(s.onPointerMove==null||s.onPointerMove.call(s,X),!I.current))return;const pe=X.pageY-I.current.y,ce=X.pageX-I.current.x,se=X.pointerType==="touch"?10:2;ue({x:ce,y:pe},E,se)?h(X):(Math.abs(ce)>se||Math.abs(pe)>se)&&(I.current=null)},onPointerUp:X=>{s.onPointerUp==null||s.onPointerUp.call(s,X),I.current=null,B.current=!1,m(X)},onPointerOut:X=>{s.onPointerOut==null||s.onPointerOut.call(s,X),ve($.current)},onContextMenu:X=>{s.onContextMenu==null||s.onContextMenu.call(s,X),$.current&&ve($.current)}})});eh.displayName="Drawer.Content";const Hw=250,Vw=120,Uw=ee.forwardRef(function({preventCycle:n=!1,children:l,...o},s){const{closeDrawer:u,isDragging:c,snapPoints:f,activeSnapPoint:m,setActiveSnapPoint:h,dismissible:v,handleOnly:y,isOpen:x,onPress:S,onDrag:b}=ll(),E=ee.useRef(null),C=ee.useRef(!1);function j(){if(C.current){z();return}window.setTimeout(()=>{_()},Vw)}function _(){if(c||n||C.current){z();return}if(z(),!f||f.length===0){v||u();return}if(m===f[f.length-1]&&v){u();return}const F=f.findIndex(I=>I===m);if(F===-1)return;const U=f[F+1];h(U)}function R(){E.current=window.setTimeout(()=>{C.current=!0},Hw)}function z(){E.current&&window.clearTimeout(E.current),C.current=!1}return ee.createElement("div",{onClick:j,onPointerCancel:z,onPointerDown:D=>{y&&S(D),R()},onPointerMove:D=>{y&&b(D)},ref:s,"data-vaul-drawer-visible":x?"true":"false","data-vaul-handle":"","aria-hidden":"true",...o},ee.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},l))});Uw.displayName="Drawer.Handle";function Yw(n){const l=ll(),{container:o=l.container,...s}=n;return ee.createElement(hw,{container:o,...s})}const oo={Root:Bw,Content:eh,Overlay:Jm,Trigger:mw,Portal:Yw,Title:yw};function Ii({...n}){return p.jsx(oo.Root,{"data-slot":"drawer",...n})}function $i({...n}){return p.jsx(oo.Trigger,{"data-slot":"drawer-trigger",...n})}function Xw({...n}){return p.jsx(oo.Portal,{"data-slot":"drawer-portal",...n})}function Qw({className:n,...l}){return p.jsx(oo.Overlay,{"data-slot":"drawer-overlay",className:fn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...l})}function Fi({className:n,children:l,...o}){return p.jsxs(Xw,{"data-slot":"drawer-portal",children:[p.jsx(Qw,{}),p.jsxs(oo.Content,{"data-slot":"drawer-content",className:fn("group/drawer-content bg-background fixed z-50 flex h-auto flex-col","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:border-l","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",n),...o,children:[p.jsx("div",{className:"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),l]})]})}function Wi({className:n,...l}){return p.jsx("div",{"data-slot":"drawer-header",className:fn("flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",n),...l})}function Bi({className:n,...l}){return p.jsx(oo.Title,{"data-slot":"drawer-title",className:fn("text-foreground font-semibold",n),...l})}const Gw=["top","right","bottom","left"],er=Math.min,Tt=Math.max,qi=Math.round,_i=Math.floor,an=n=>({x:n,y:n}),Kw={left:"right",right:"left",bottom:"top",top:"bottom"},qw={start:"end",end:"start"};function xu(n,l,o){return Tt(n,er(l,o))}function Rn(n,l){return typeof n=="function"?n(l):n}function Tn(n){return n.split("-")[0]}function lo(n){return n.split("-")[1]}function Bu(n){return n==="x"?"y":"x"}function Hu(n){return n==="y"?"height":"width"}const Zw=new Set(["top","bottom"]);function sn(n){return Zw.has(Tn(n))?"y":"x"}function Vu(n){return Bu(sn(n))}function Jw(n,l,o){o===void 0&&(o=!1);const s=lo(n),u=Vu(n),c=Hu(u);let f=u==="x"?s===(o?"end":"start")?"right":"left":s==="start"?"bottom":"top";return l.reference[c]>l.floating[c]&&(f=Zi(f)),[f,Zi(f)]}function e1(n){const l=Zi(n);return[wu(n),l,wu(l)]}function wu(n){return n.replace(/start|end/g,l=>qw[l])}const hp=["left","right"],gp=["right","left"],t1=["top","bottom"],n1=["bottom","top"];function r1(n,l,o){switch(n){case"top":case"bottom":return o?l?gp:hp:l?hp:gp;case"left":case"right":return l?t1:n1;default:return[]}}function o1(n,l,o,s){const u=lo(n);let c=r1(Tn(n),o==="start",s);return u&&(c=c.map(f=>f+"-"+u),l&&(c=c.concat(c.map(wu)))),c}function Zi(n){return n.replace(/left|right|bottom|top/g,l=>Kw[l])}function l1(n){return{top:0,right:0,bottom:0,left:0,...n}}function th(n){return typeof n!="number"?l1(n):{top:n,right:n,bottom:n,left:n}}function Ji(n){const{x:l,y:o,width:s,height:u}=n;return{width:s,height:u,top:o,left:l,right:l+s,bottom:o+u,x:l,y:o}}function vp(n,l,o){let{reference:s,floating:u}=n;const c=sn(l),f=Vu(l),m=Hu(f),h=Tn(l),v=c==="y",y=s.x+s.width/2-u.width/2,x=s.y+s.height/2-u.height/2,S=s[m]/2-u[m]/2;let b;switch(h){case"top":b={x:y,y:s.y-u.height};break;case"bottom":b={x:y,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:x};break;case"left":b={x:s.x-u.width,y:x};break;default:b={x:s.x,y:s.y}}switch(lo(l)){case"start":b[f]-=S*(o&&v?-1:1);break;case"end":b[f]+=S*(o&&v?-1:1);break}return b}const i1=async(n,l,o)=>{const{placement:s="bottom",strategy:u="absolute",middleware:c=[],platform:f}=o,m=c.filter(Boolean),h=await(f.isRTL==null?void 0:f.isRTL(l));let v=await f.getElementRects({reference:n,floating:l,strategy:u}),{x:y,y:x}=vp(v,s,h),S=s,b={},E=0;for(let C=0;C<m.length;C++){const{name:j,fn:_}=m[C],{x:R,y:z,data:D,reset:F}=await _({x:y,y:x,initialPlacement:s,placement:S,strategy:u,middlewareData:b,rects:v,platform:f,elements:{reference:n,floating:l}});y=R??y,x=z??x,b={...b,[j]:{...b[j],...D}},F&&E<=50&&(E++,typeof F=="object"&&(F.placement&&(S=F.placement),F.rects&&(v=F.rects===!0?await f.getElementRects({reference:n,floating:l,strategy:u}):F.rects),{x:y,y:x}=vp(v,S,h)),C=-1)}return{x:y,y:x,placement:S,strategy:u,middlewareData:b}};async function tl(n,l){var o;l===void 0&&(l={});const{x:s,y:u,platform:c,rects:f,elements:m,strategy:h}=n,{boundary:v="clippingAncestors",rootBoundary:y="viewport",elementContext:x="floating",altBoundary:S=!1,padding:b=0}=Rn(l,n),E=th(b),j=m[S?x==="floating"?"reference":"floating":x],_=Ji(await c.getClippingRect({element:(o=await(c.isElement==null?void 0:c.isElement(j)))==null||o?j:j.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(m.floating)),boundary:v,rootBoundary:y,strategy:h})),R=x==="floating"?{x:s,y:u,width:f.floating.width,height:f.floating.height}:f.reference,z=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m.floating)),D=await(c.isElement==null?void 0:c.isElement(z))?await(c.getScale==null?void 0:c.getScale(z))||{x:1,y:1}:{x:1,y:1},F=Ji(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:m,rect:R,offsetParent:z,strategy:h}):R);return{top:(_.top-F.top+E.top)/D.y,bottom:(F.bottom-_.bottom+E.bottom)/D.y,left:(_.left-F.left+E.left)/D.x,right:(F.right-_.right+E.right)/D.x}}const s1=n=>({name:"arrow",options:n,async fn(l){const{x:o,y:s,placement:u,rects:c,platform:f,elements:m,middlewareData:h}=l,{element:v,padding:y=0}=Rn(n,l)||{};if(v==null)return{};const x=th(y),S={x:o,y:s},b=Vu(u),E=Hu(b),C=await f.getDimensions(v),j=b==="y",_=j?"top":"left",R=j?"bottom":"right",z=j?"clientHeight":"clientWidth",D=c.reference[E]+c.reference[b]-S[b]-c.floating[E],F=S[b]-c.reference[b],U=await(f.getOffsetParent==null?void 0:f.getOffsetParent(v));let I=U?U[z]:0;(!I||!await(f.isElement==null?void 0:f.isElement(U)))&&(I=m.floating[z]||c.floating[E]);const $=D/2-F/2,B=I/2-C[E]/2-1,J=er(x[_],B),ue=er(x[R],B),ve=J,X=I-C[E]-ue,pe=I/2-C[E]/2+$,ce=xu(ve,pe,X),se=!h.arrow&&lo(u)!=null&&pe!==ce&&c.reference[E]/2-(pe<ve?J:ue)-C[E]/2<0,q=se?pe<ve?pe-ve:pe-X:0;return{[b]:S[b]+q,data:{[b]:ce,centerOffset:pe-ce-q,...se&&{alignmentOffset:q}},reset:se}}}),a1=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(l){var o,s;const{placement:u,middlewareData:c,rects:f,initialPlacement:m,platform:h,elements:v}=l,{mainAxis:y=!0,crossAxis:x=!0,fallbackPlacements:S,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:C=!0,...j}=Rn(n,l);if((o=c.arrow)!=null&&o.alignmentOffset)return{};const _=Tn(u),R=sn(m),z=Tn(m)===m,D=await(h.isRTL==null?void 0:h.isRTL(v.floating)),F=S||(z||!C?[Zi(m)]:e1(m)),U=E!=="none";!S&&U&&F.push(...o1(m,C,E,D));const I=[m,...F],$=await tl(l,j),B=[];let J=((s=c.flip)==null?void 0:s.overflows)||[];if(y&&B.push($[_]),x){const pe=Jw(u,f,D);B.push($[pe[0]],$[pe[1]])}if(J=[...J,{placement:u,overflows:B}],!B.every(pe=>pe<=0)){var ue,ve;const pe=(((ue=c.flip)==null?void 0:ue.index)||0)+1,ce=I[pe];if(ce&&(!(x==="alignment"?R!==sn(ce):!1)||J.every(A=>sn(A.placement)===R?A.overflows[0]>0:!0)))return{data:{index:pe,overflows:J},reset:{placement:ce}};let se=(ve=J.filter(q=>q.overflows[0]<=0).sort((q,A)=>q.overflows[1]-A.overflows[1])[0])==null?void 0:ve.placement;if(!se)switch(b){case"bestFit":{var X;const q=(X=J.filter(A=>{if(U){const K=sn(A.placement);return K===R||K==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(K=>K>0).reduce((K,G)=>K+G,0)]).sort((A,K)=>A[1]-K[1])[0])==null?void 0:X[0];q&&(se=q);break}case"initialPlacement":se=m;break}if(u!==se)return{reset:{placement:se}}}return{}}}};function yp(n,l){return{top:n.top-l.height,right:n.right-l.width,bottom:n.bottom-l.height,left:n.left-l.width}}function xp(n){return Gw.some(l=>n[l]>=0)}const u1=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(l){const{rects:o}=l,{strategy:s="referenceHidden",...u}=Rn(n,l);switch(s){case"referenceHidden":{const c=await tl(l,{...u,elementContext:"reference"}),f=yp(c,o.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:xp(f)}}}case"escaped":{const c=await tl(l,{...u,altBoundary:!0}),f=yp(c,o.floating);return{data:{escapedOffsets:f,escaped:xp(f)}}}default:return{}}}}},nh=new Set(["left","top"]);async function c1(n,l){const{placement:o,platform:s,elements:u}=n,c=await(s.isRTL==null?void 0:s.isRTL(u.floating)),f=Tn(o),m=lo(o),h=sn(o)==="y",v=nh.has(f)?-1:1,y=c&&h?-1:1,x=Rn(l,n);let{mainAxis:S,crossAxis:b,alignmentAxis:E}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return m&&typeof E=="number"&&(b=m==="end"?E*-1:E),h?{x:b*y,y:S*v}:{x:S*v,y:b*y}}const d1=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(l){var o,s;const{x:u,y:c,placement:f,middlewareData:m}=l,h=await c1(l,n);return f===((o=m.offset)==null?void 0:o.placement)&&(s=m.arrow)!=null&&s.alignmentOffset?{}:{x:u+h.x,y:c+h.y,data:{...h,placement:f}}}}},f1=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(l){const{x:o,y:s,placement:u}=l,{mainAxis:c=!0,crossAxis:f=!1,limiter:m={fn:j=>{let{x:_,y:R}=j;return{x:_,y:R}}},...h}=Rn(n,l),v={x:o,y:s},y=await tl(l,h),x=sn(Tn(u)),S=Bu(x);let b=v[S],E=v[x];if(c){const j=S==="y"?"top":"left",_=S==="y"?"bottom":"right",R=b+y[j],z=b-y[_];b=xu(R,b,z)}if(f){const j=x==="y"?"top":"left",_=x==="y"?"bottom":"right",R=E+y[j],z=E-y[_];E=xu(R,E,z)}const C=m.fn({...l,[S]:b,[x]:E});return{...C,data:{x:C.x-o,y:C.y-s,enabled:{[S]:c,[x]:f}}}}}},p1=function(n){return n===void 0&&(n={}),{options:n,fn(l){const{x:o,y:s,placement:u,rects:c,middlewareData:f}=l,{offset:m=0,mainAxis:h=!0,crossAxis:v=!0}=Rn(n,l),y={x:o,y:s},x=sn(u),S=Bu(x);let b=y[S],E=y[x];const C=Rn(m,l),j=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(h){const z=S==="y"?"height":"width",D=c.reference[S]-c.floating[z]+j.mainAxis,F=c.reference[S]+c.reference[z]-j.mainAxis;b<D?b=D:b>F&&(b=F)}if(v){var _,R;const z=S==="y"?"width":"height",D=nh.has(Tn(u)),F=c.reference[x]-c.floating[z]+(D&&((_=f.offset)==null?void 0:_[x])||0)+(D?0:j.crossAxis),U=c.reference[x]+c.reference[z]+(D?0:((R=f.offset)==null?void 0:R[x])||0)-(D?j.crossAxis:0);E<F?E=F:E>U&&(E=U)}return{[S]:b,[x]:E}}}},m1=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(l){var o,s;const{placement:u,rects:c,platform:f,elements:m}=l,{apply:h=()=>{},...v}=Rn(n,l),y=await tl(l,v),x=Tn(u),S=lo(u),b=sn(u)==="y",{width:E,height:C}=c.floating;let j,_;x==="top"||x==="bottom"?(j=x,_=S===(await(f.isRTL==null?void 0:f.isRTL(m.floating))?"start":"end")?"left":"right"):(_=x,j=S==="end"?"top":"bottom");const R=C-y.top-y.bottom,z=E-y.left-y.right,D=er(C-y[j],R),F=er(E-y[_],z),U=!l.middlewareData.shift;let I=D,$=F;if((o=l.middlewareData.shift)!=null&&o.enabled.x&&($=z),(s=l.middlewareData.shift)!=null&&s.enabled.y&&(I=R),U&&!S){const J=Tt(y.left,0),ue=Tt(y.right,0),ve=Tt(y.top,0),X=Tt(y.bottom,0);b?$=E-2*(J!==0||ue!==0?J+ue:Tt(y.left,y.right)):I=C-2*(ve!==0||X!==0?ve+X:Tt(y.top,y.bottom))}await h({...l,availableWidth:$,availableHeight:I});const B=await f.getDimensions(m.floating);return E!==B.width||C!==B.height?{reset:{rects:!0}}:{}}}};function is(){return typeof window<"u"}function io(n){return rh(n)?(n.nodeName||"").toLowerCase():"#document"}function jt(n){var l;return(n==null||(l=n.ownerDocument)==null?void 0:l.defaultView)||window}function mn(n){var l;return(l=(rh(n)?n.ownerDocument:n.document)||window.document)==null?void 0:l.documentElement}function rh(n){return is()?n instanceof Node||n instanceof jt(n).Node:!1}function Gt(n){return is()?n instanceof Element||n instanceof jt(n).Element:!1}function cn(n){return is()?n instanceof HTMLElement||n instanceof jt(n).HTMLElement:!1}function wp(n){return!is()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof jt(n).ShadowRoot}const h1=new Set(["inline","contents"]);function il(n){const{overflow:l,overflowX:o,overflowY:s,display:u}=Kt(n);return/auto|scroll|overlay|hidden|clip/.test(l+s+o)&&!h1.has(u)}const g1=new Set(["table","td","th"]);function v1(n){return g1.has(io(n))}const y1=[":popover-open",":modal"];function ss(n){return y1.some(l=>{try{return n.matches(l)}catch{return!1}})}const x1=["transform","translate","scale","rotate","perspective"],w1=["transform","translate","scale","rotate","perspective","filter"],S1=["paint","layout","strict","content"];function Uu(n){const l=Yu(),o=Gt(n)?Kt(n):n;return x1.some(s=>o[s]?o[s]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!l&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!l&&(o.filter?o.filter!=="none":!1)||w1.some(s=>(o.willChange||"").includes(s))||S1.some(s=>(o.contain||"").includes(s))}function C1(n){let l=tr(n);for(;cn(l)&&!Jr(l);){if(Uu(l))return l;if(ss(l))return null;l=tr(l)}return null}function Yu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const k1=new Set(["html","body","#document"]);function Jr(n){return k1.has(io(n))}function Kt(n){return jt(n).getComputedStyle(n)}function as(n){return Gt(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function tr(n){if(io(n)==="html")return n;const l=n.assignedSlot||n.parentNode||wp(n)&&n.host||mn(n);return wp(l)?l.host:l}function oh(n){const l=tr(n);return Jr(l)?n.ownerDocument?n.ownerDocument.body:n.body:cn(l)&&il(l)?l:oh(l)}function nl(n,l,o){var s;l===void 0&&(l=[]),o===void 0&&(o=!0);const u=oh(n),c=u===((s=n.ownerDocument)==null?void 0:s.body),f=jt(u);if(c){const m=Su(f);return l.concat(f,f.visualViewport||[],il(u)?u:[],m&&o?nl(m):[])}return l.concat(u,nl(u,[],o))}function Su(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function lh(n){const l=Kt(n);let o=parseFloat(l.width)||0,s=parseFloat(l.height)||0;const u=cn(n),c=u?n.offsetWidth:o,f=u?n.offsetHeight:s,m=qi(o)!==c||qi(s)!==f;return m&&(o=c,s=f),{width:o,height:s,$:m}}function Xu(n){return Gt(n)?n:n.contextElement}function qr(n){const l=Xu(n);if(!cn(l))return an(1);const o=l.getBoundingClientRect(),{width:s,height:u,$:c}=lh(l);let f=(c?qi(o.width):o.width)/s,m=(c?qi(o.height):o.height)/u;return(!f||!Number.isFinite(f))&&(f=1),(!m||!Number.isFinite(m))&&(m=1),{x:f,y:m}}const b1=an(0);function ih(n){const l=jt(n);return!Yu()||!l.visualViewport?b1:{x:l.visualViewport.offsetLeft,y:l.visualViewport.offsetTop}}function E1(n,l,o){return l===void 0&&(l=!1),!o||l&&o!==jt(n)?!1:l}function Sr(n,l,o,s){l===void 0&&(l=!1),o===void 0&&(o=!1);const u=n.getBoundingClientRect(),c=Xu(n);let f=an(1);l&&(s?Gt(s)&&(f=qr(s)):f=qr(n));const m=E1(c,o,s)?ih(c):an(0);let h=(u.left+m.x)/f.x,v=(u.top+m.y)/f.y,y=u.width/f.x,x=u.height/f.y;if(c){const S=jt(c),b=s&&Gt(s)?jt(s):s;let E=S,C=Su(E);for(;C&&s&&b!==E;){const j=qr(C),_=C.getBoundingClientRect(),R=Kt(C),z=_.left+(C.clientLeft+parseFloat(R.paddingLeft))*j.x,D=_.top+(C.clientTop+parseFloat(R.paddingTop))*j.y;h*=j.x,v*=j.y,y*=j.x,x*=j.y,h+=z,v+=D,E=jt(C),C=Su(E)}}return Ji({width:y,height:x,x:h,y:v})}function us(n,l){const o=as(n).scrollLeft;return l?l.left+o:Sr(mn(n)).left+o}function sh(n,l){const o=n.getBoundingClientRect(),s=o.left+l.scrollLeft-us(n,o),u=o.top+l.scrollTop;return{x:s,y:u}}function N1(n){let{elements:l,rect:o,offsetParent:s,strategy:u}=n;const c=u==="fixed",f=mn(s),m=l?ss(l.floating):!1;if(s===f||m&&c)return o;let h={scrollLeft:0,scrollTop:0},v=an(1);const y=an(0),x=cn(s);if((x||!x&&!c)&&((io(s)!=="body"||il(f))&&(h=as(s)),cn(s))){const b=Sr(s);v=qr(s),y.x=b.x+s.clientLeft,y.y=b.y+s.clientTop}const S=f&&!x&&!c?sh(f,h):an(0);return{width:o.width*v.x,height:o.height*v.y,x:o.x*v.x-h.scrollLeft*v.x+y.x+S.x,y:o.y*v.y-h.scrollTop*v.y+y.y+S.y}}function R1(n){return Array.from(n.getClientRects())}function T1(n){const l=mn(n),o=as(n),s=n.ownerDocument.body,u=Tt(l.scrollWidth,l.clientWidth,s.scrollWidth,s.clientWidth),c=Tt(l.scrollHeight,l.clientHeight,s.scrollHeight,s.clientHeight);let f=-o.scrollLeft+us(n);const m=-o.scrollTop;return Kt(s).direction==="rtl"&&(f+=Tt(l.clientWidth,s.clientWidth)-u),{width:u,height:c,x:f,y:m}}const Sp=25;function P1(n,l){const o=jt(n),s=mn(n),u=o.visualViewport;let c=s.clientWidth,f=s.clientHeight,m=0,h=0;if(u){c=u.width,f=u.height;const y=Yu();(!y||y&&l==="fixed")&&(m=u.offsetLeft,h=u.offsetTop)}const v=us(s);if(v<=0){const y=s.ownerDocument,x=y.body,S=getComputedStyle(x),b=y.compatMode==="CSS1Compat"&&parseFloat(S.marginLeft)+parseFloat(S.marginRight)||0,E=Math.abs(s.clientWidth-x.clientWidth-b);E<=Sp&&(c-=E)}else v<=Sp&&(c+=v);return{width:c,height:f,x:m,y:h}}const j1=new Set(["absolute","fixed"]);function _1(n,l){const o=Sr(n,!0,l==="fixed"),s=o.top+n.clientTop,u=o.left+n.clientLeft,c=cn(n)?qr(n):an(1),f=n.clientWidth*c.x,m=n.clientHeight*c.y,h=u*c.x,v=s*c.y;return{width:f,height:m,x:h,y:v}}function Cp(n,l,o){let s;if(l==="viewport")s=P1(n,o);else if(l==="document")s=T1(mn(n));else if(Gt(l))s=_1(l,o);else{const u=ih(n);s={x:l.x-u.x,y:l.y-u.y,width:l.width,height:l.height}}return Ji(s)}function ah(n,l){const o=tr(n);return o===l||!Gt(o)||Jr(o)?!1:Kt(o).position==="fixed"||ah(o,l)}function A1(n,l){const o=l.get(n);if(o)return o;let s=nl(n,[],!1).filter(m=>Gt(m)&&io(m)!=="body"),u=null;const c=Kt(n).position==="fixed";let f=c?tr(n):n;for(;Gt(f)&&!Jr(f);){const m=Kt(f),h=Uu(f);!h&&m.position==="fixed"&&(u=null),(c?!h&&!u:!h&&m.position==="static"&&!!u&&j1.has(u.position)||il(f)&&!h&&ah(n,f))?s=s.filter(y=>y!==f):u=m,f=tr(f)}return l.set(n,s),s}function O1(n){let{element:l,boundary:o,rootBoundary:s,strategy:u}=n;const f=[...o==="clippingAncestors"?ss(l)?[]:A1(l,this._c):[].concat(o),s],m=f[0],h=f.reduce((v,y)=>{const x=Cp(l,y,u);return v.top=Tt(x.top,v.top),v.right=er(x.right,v.right),v.bottom=er(x.bottom,v.bottom),v.left=Tt(x.left,v.left),v},Cp(l,m,u));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function D1(n){const{width:l,height:o}=lh(n);return{width:l,height:o}}function L1(n,l,o){const s=cn(l),u=mn(l),c=o==="fixed",f=Sr(n,!0,c,l);let m={scrollLeft:0,scrollTop:0};const h=an(0);function v(){h.x=us(u)}if(s||!s&&!c)if((io(l)!=="body"||il(u))&&(m=as(l)),s){const b=Sr(l,!0,c,l);h.x=b.x+l.clientLeft,h.y=b.y+l.clientTop}else u&&v();c&&!s&&u&&v();const y=u&&!s&&!c?sh(u,m):an(0),x=f.left+m.scrollLeft-h.x-y.x,S=f.top+m.scrollTop-h.y-y.y;return{x,y:S,width:f.width,height:f.height}}function fu(n){return Kt(n).position==="static"}function kp(n,l){if(!cn(n)||Kt(n).position==="fixed")return null;if(l)return l(n);let o=n.offsetParent;return mn(n)===o&&(o=o.ownerDocument.body),o}function uh(n,l){const o=jt(n);if(ss(n))return o;if(!cn(n)){let u=tr(n);for(;u&&!Jr(u);){if(Gt(u)&&!fu(u))return u;u=tr(u)}return o}let s=kp(n,l);for(;s&&v1(s)&&fu(s);)s=kp(s,l);return s&&Jr(s)&&fu(s)&&!Uu(s)?o:s||C1(n)||o}const M1=async function(n){const l=this.getOffsetParent||uh,o=this.getDimensions,s=await o(n.floating);return{reference:L1(n.reference,await l(n.floating),n.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function z1(n){return Kt(n).direction==="rtl"}const I1={convertOffsetParentRelativeRectToViewportRelativeRect:N1,getDocumentElement:mn,getClippingRect:O1,getOffsetParent:uh,getElementRects:M1,getClientRects:R1,getDimensions:D1,getScale:qr,isElement:Gt,isRTL:z1};function ch(n,l){return n.x===l.x&&n.y===l.y&&n.width===l.width&&n.height===l.height}function $1(n,l){let o=null,s;const u=mn(n);function c(){var m;clearTimeout(s),(m=o)==null||m.disconnect(),o=null}function f(m,h){m===void 0&&(m=!1),h===void 0&&(h=1),c();const v=n.getBoundingClientRect(),{left:y,top:x,width:S,height:b}=v;if(m||l(),!S||!b)return;const E=_i(x),C=_i(u.clientWidth-(y+S)),j=_i(u.clientHeight-(x+b)),_=_i(y),z={rootMargin:-E+"px "+-C+"px "+-j+"px "+-_+"px",threshold:Tt(0,er(1,h))||1};let D=!0;function F(U){const I=U[0].intersectionRatio;if(I!==h){if(!D)return f();I?f(!1,I):s=setTimeout(()=>{f(!1,1e-7)},1e3)}I===1&&!ch(v,n.getBoundingClientRect())&&f(),D=!1}try{o=new IntersectionObserver(F,{...z,root:u.ownerDocument})}catch{o=new IntersectionObserver(F,z)}o.observe(n)}return f(!0),c}function F1(n,l,o,s){s===void 0&&(s={});const{ancestorScroll:u=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:m=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,v=Xu(n),y=u||c?[...v?nl(v):[],...nl(l)]:[];y.forEach(_=>{u&&_.addEventListener("scroll",o,{passive:!0}),c&&_.addEventListener("resize",o)});const x=v&&m?$1(v,o):null;let S=-1,b=null;f&&(b=new ResizeObserver(_=>{let[R]=_;R&&R.target===v&&b&&(b.unobserve(l),cancelAnimationFrame(S),S=requestAnimationFrame(()=>{var z;(z=b)==null||z.observe(l)})),o()}),v&&!h&&b.observe(v),b.observe(l));let E,C=h?Sr(n):null;h&&j();function j(){const _=Sr(n);C&&!ch(C,_)&&o(),C=_,E=requestAnimationFrame(j)}return o(),()=>{var _;y.forEach(R=>{u&&R.removeEventListener("scroll",o),c&&R.removeEventListener("resize",o)}),x==null||x(),(_=b)==null||_.disconnect(),b=null,h&&cancelAnimationFrame(E)}}const W1=d1,B1=f1,H1=a1,V1=m1,U1=u1,bp=s1,Y1=p1,X1=(n,l,o)=>{const s=new Map,u={platform:I1,...o},c={...u.platform,_c:s};return i1(n,l,{...u,platform:c})};var Q1=typeof document<"u",G1=function(){},Hi=Q1?w.useLayoutEffect:G1;function es(n,l){if(n===l)return!0;if(typeof n!=typeof l)return!1;if(typeof n=="function"&&n.toString()===l.toString())return!0;let o,s,u;if(n&&l&&typeof n=="object"){if(Array.isArray(n)){if(o=n.length,o!==l.length)return!1;for(s=o;s--!==0;)if(!es(n[s],l[s]))return!1;return!0}if(u=Object.keys(n),o=u.length,o!==Object.keys(l).length)return!1;for(s=o;s--!==0;)if(!{}.hasOwnProperty.call(l,u[s]))return!1;for(s=o;s--!==0;){const c=u[s];if(!(c==="_owner"&&n.$$typeof)&&!es(n[c],l[c]))return!1}return!0}return n!==n&&l!==l}function dh(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Ep(n,l){const o=dh(n);return Math.round(l*o)/o}function pu(n){const l=w.useRef(n);return Hi(()=>{l.current=n}),l}function K1(n){n===void 0&&(n={});const{placement:l="bottom",strategy:o="absolute",middleware:s=[],platform:u,elements:{reference:c,floating:f}={},transform:m=!0,whileElementsMounted:h,open:v}=n,[y,x]=w.useState({x:0,y:0,strategy:o,placement:l,middlewareData:{},isPositioned:!1}),[S,b]=w.useState(s);es(S,s)||b(s);const[E,C]=w.useState(null),[j,_]=w.useState(null),R=w.useCallback(A=>{A!==U.current&&(U.current=A,C(A))},[]),z=w.useCallback(A=>{A!==I.current&&(I.current=A,_(A))},[]),D=c||E,F=f||j,U=w.useRef(null),I=w.useRef(null),$=w.useRef(y),B=h!=null,J=pu(h),ue=pu(u),ve=pu(v),X=w.useCallback(()=>{if(!U.current||!I.current)return;const A={placement:l,strategy:o,middleware:S};ue.current&&(A.platform=ue.current),X1(U.current,I.current,A).then(K=>{const G={...K,isPositioned:ve.current!==!1};pe.current&&!es($.current,G)&&($.current=G,Tu.flushSync(()=>{x(G)}))})},[S,l,o,ue,ve]);Hi(()=>{v===!1&&$.current.isPositioned&&($.current.isPositioned=!1,x(A=>({...A,isPositioned:!1})))},[v]);const pe=w.useRef(!1);Hi(()=>(pe.current=!0,()=>{pe.current=!1}),[]),Hi(()=>{if(D&&(U.current=D),F&&(I.current=F),D&&F){if(J.current)return J.current(D,F,X);X()}},[D,F,X,J,B]);const ce=w.useMemo(()=>({reference:U,floating:I,setReference:R,setFloating:z}),[R,z]),se=w.useMemo(()=>({reference:D,floating:F}),[D,F]),q=w.useMemo(()=>{const A={position:o,left:0,top:0};if(!se.floating)return A;const K=Ep(se.floating,y.x),G=Ep(se.floating,y.y);return m?{...A,transform:"translate("+K+"px, "+G+"px)",...dh(se.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:K,top:G}},[o,m,se.floating,y.x,y.y]);return w.useMemo(()=>({...y,update:X,refs:ce,elements:se,floatingStyles:q}),[y,X,ce,se,q])}const q1=n=>{function l(o){return{}.hasOwnProperty.call(o,"current")}return{name:"arrow",options:n,fn(o){const{element:s,padding:u}=typeof n=="function"?n(o):n;return s&&l(s)?s.current!=null?bp({element:s.current,padding:u}).fn(o):{}:s?bp({element:s,padding:u}).fn(o):{}}}},Z1=(n,l)=>({...W1(n),options:[n,l]}),J1=(n,l)=>({...B1(n),options:[n,l]}),eS=(n,l)=>({...Y1(n),options:[n,l]}),tS=(n,l)=>({...H1(n),options:[n,l]}),nS=(n,l)=>({...V1(n),options:[n,l]}),rS=(n,l)=>({...U1(n),options:[n,l]}),oS=(n,l)=>({...q1(n),options:[n,l]});var lS="Arrow",fh=w.forwardRef((n,l)=>{const{children:o,width:s=10,height:u=5,...c}=n;return p.jsx(He.svg,{...c,ref:l,width:s,height:u,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?o:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});fh.displayName=lS;var iS=fh;function sS(n){const[l,o]=w.useState(void 0);return un(()=>{if(n){o({width:n.offsetWidth,height:n.offsetHeight});const s=new ResizeObserver(u=>{if(!Array.isArray(u)||!u.length)return;const c=u[0];let f,m;if("borderBoxSize"in c){const h=c.borderBoxSize,v=Array.isArray(h)?h[0]:h;f=v.inlineSize,m=v.blockSize}else f=n.offsetWidth,m=n.offsetHeight;o({width:f,height:m})});return s.observe(n,{box:"border-box"}),()=>s.unobserve(n)}else o(void 0)},[n]),l}var Qu="Popper",[ph,mh]=ol(Qu),[aS,hh]=ph(Qu),gh=n=>{const{__scopePopper:l,children:o}=n,[s,u]=w.useState(null);return p.jsx(aS,{scope:l,anchor:s,onAnchorChange:u,children:o})};gh.displayName=Qu;var vh="PopperAnchor",yh=w.forwardRef((n,l)=>{const{__scopePopper:o,virtualRef:s,...u}=n,c=hh(vh,o),f=w.useRef(null),m=rt(l,f),h=w.useRef(null);return w.useEffect(()=>{const v=h.current;h.current=(s==null?void 0:s.current)||f.current,v!==h.current&&c.onAnchorChange(h.current)}),s?null:p.jsx(He.div,{...u,ref:m})});yh.displayName=vh;var Gu="PopperContent",[uS,cS]=ph(Gu),xh=w.forwardRef((n,l)=>{var fe,Ce,Ne,Oe,Ze,Ct;const{__scopePopper:o,side:s="bottom",sideOffset:u=0,align:c="center",alignOffset:f=0,arrowPadding:m=0,avoidCollisions:h=!0,collisionBoundary:v=[],collisionPadding:y=0,sticky:x="partial",hideWhenDetached:S=!1,updatePositionStrategy:b="optimized",onPlaced:E,...C}=n,j=hh(Gu,o),[_,R]=w.useState(null),z=rt(l,kt=>R(kt)),[D,F]=w.useState(null),U=sS(D),I=(U==null?void 0:U.width)??0,$=(U==null?void 0:U.height)??0,B=s+(c!=="center"?"-"+c:""),J=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},ue=Array.isArray(v)?v:[v],ve=ue.length>0,X={padding:J,boundary:ue.filter(fS),altBoundary:ve},{refs:pe,floatingStyles:ce,placement:se,isPositioned:q,middlewareData:A}=K1({strategy:"fixed",placement:B,whileElementsMounted:(...kt)=>F1(...kt,{animationFrame:b==="always"}),elements:{reference:j.anchor},middleware:[Z1({mainAxis:u+$,alignmentAxis:f}),h&&J1({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?eS():void 0,...X}),h&&tS({...X}),nS({...X,apply:({elements:kt,rects:ye,availableWidth:nr,availableHeight:rr})=>{const{width:hn,height:kr}=ye.reference,Jt=kt.floating.style;Jt.setProperty("--radix-popper-available-width",`${nr}px`),Jt.setProperty("--radix-popper-available-height",`${rr}px`),Jt.setProperty("--radix-popper-anchor-width",`${hn}px`),Jt.setProperty("--radix-popper-anchor-height",`${kr}px`)}}),D&&oS({element:D,padding:m}),pS({arrowWidth:I,arrowHeight:$}),S&&rS({strategy:"referenceHidden",...X})]}),[K,G]=Ch(se),P=Pt(E);un(()=>{q&&(P==null||P())},[q,P]);const W=(fe=A.arrow)==null?void 0:fe.x,ne=(Ce=A.arrow)==null?void 0:Ce.y,de=((Ne=A.arrow)==null?void 0:Ne.centerOffset)!==0,[we,Se]=w.useState();return un(()=>{_&&Se(window.getComputedStyle(_).zIndex)},[_]),p.jsx("div",{ref:pe.setFloating,"data-radix-popper-content-wrapper":"",style:{...ce,transform:q?ce.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[(Oe=A.transformOrigin)==null?void 0:Oe.x,(Ze=A.transformOrigin)==null?void 0:Ze.y].join(" "),...((Ct=A.hide)==null?void 0:Ct.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:p.jsx(uS,{scope:o,placedSide:K,onArrowChange:F,arrowX:W,arrowY:ne,shouldHideArrow:de,children:p.jsx(He.div,{"data-side":K,"data-align":G,...C,ref:z,style:{...C.style,animation:q?void 0:"none"}})})})});xh.displayName=Gu;var wh="PopperArrow",dS={top:"bottom",right:"left",bottom:"top",left:"right"},Sh=w.forwardRef(function(l,o){const{__scopePopper:s,...u}=l,c=cS(wh,s),f=dS[c.placedSide];return p.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[f]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:p.jsx(iS,{...u,ref:o,style:{...u.style,display:"block"}})})});Sh.displayName=wh;function fS(n){return n!==null}var pS=n=>({name:"transformOrigin",options:n,fn(l){var j,_,R;const{placement:o,rects:s,middlewareData:u}=l,f=((j=u.arrow)==null?void 0:j.centerOffset)!==0,m=f?0:n.arrowWidth,h=f?0:n.arrowHeight,[v,y]=Ch(o),x={start:"0%",center:"50%",end:"100%"}[y],S=(((_=u.arrow)==null?void 0:_.x)??0)+m/2,b=(((R=u.arrow)==null?void 0:R.y)??0)+h/2;let E="",C="";return v==="bottom"?(E=f?x:`${S}px`,C=`${-h}px`):v==="top"?(E=f?x:`${S}px`,C=`${s.floating.height+h}px`):v==="right"?(E=`${-h}px`,C=f?x:`${b}px`):v==="left"&&(E=`${s.floating.width+h}px`,C=f?x:`${b}px`),{data:{x:E,y:C}}}});function Ch(n){const[l,o="center"]=n.split("-");return[l,o]}var mS=gh,hS=yh,gS=xh,vS=Sh,yS=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"}),xS="VisuallyHidden",kh=w.forwardRef((n,l)=>p.jsx(He.span,{...n,ref:l,style:{...yS,...n.style}}));kh.displayName=xS;var wS=kh,[cs,cC]=ol("Tooltip",[mh]),ds=mh(),bh="TooltipProvider",SS=700,Cu="tooltip.open",[CS,Ku]=cs(bh),Eh=n=>{const{__scopeTooltip:l,delayDuration:o=SS,skipDelayDuration:s=300,disableHoverableContent:u=!1,children:c}=n,f=w.useRef(!0),m=w.useRef(!1),h=w.useRef(0);return w.useEffect(()=>{const v=h.current;return()=>window.clearTimeout(v)},[]),p.jsx(CS,{scope:l,isOpenDelayedRef:f,delayDuration:o,onOpen:w.useCallback(()=>{window.clearTimeout(h.current),f.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>f.current=!0,s)},[s]),isPointerInTransitRef:m,onPointerInTransitChange:w.useCallback(v=>{m.current=v},[]),disableHoverableContent:u,children:c})};Eh.displayName=bh;var rl="Tooltip",[kS,sl]=cs(rl),Nh=n=>{const{__scopeTooltip:l,children:o,open:s,defaultOpen:u,onOpenChange:c,disableHoverableContent:f,delayDuration:m}=n,h=Ku(rl,n.__scopeTooltip),v=ds(l),[y,x]=w.useState(null),S=Jo(),b=w.useRef(0),E=f??h.disableHoverableContent,C=m??h.delayDuration,j=w.useRef(!1),[_,R]=Au({prop:s,defaultProp:u??!1,onChange:I=>{I?(h.onOpen(),document.dispatchEvent(new CustomEvent(Cu))):h.onClose(),c==null||c(I)},caller:rl}),z=w.useMemo(()=>_?j.current?"delayed-open":"instant-open":"closed",[_]),D=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,j.current=!1,R(!0)},[R]),F=w.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),U=w.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{j.current=!0,R(!0),b.current=0},C)},[C,R]);return w.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),p.jsx(mS,{...v,children:p.jsx(kS,{scope:l,contentId:S,open:_,stateAttribute:z,trigger:y,onTriggerChange:x,onTriggerEnter:w.useCallback(()=>{h.isOpenDelayedRef.current?U():D()},[h.isOpenDelayedRef,U,D]),onTriggerLeave:w.useCallback(()=>{E?F():(window.clearTimeout(b.current),b.current=0)},[F,E]),onOpen:D,onClose:F,disableHoverableContent:E,children:o})})};Nh.displayName=rl;var ku="TooltipTrigger",Rh=w.forwardRef((n,l)=>{const{__scopeTooltip:o,...s}=n,u=sl(ku,o),c=Ku(ku,o),f=ds(o),m=w.useRef(null),h=rt(l,m,u.onTriggerChange),v=w.useRef(!1),y=w.useRef(!1),x=w.useCallback(()=>v.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),p.jsx(hS,{asChild:!0,...f,children:p.jsx(He.button,{"aria-describedby":u.open?u.contentId:void 0,"data-state":u.stateAttribute,...s,ref:h,onPointerMove:Be(n.onPointerMove,S=>{S.pointerType!=="touch"&&!y.current&&!c.isPointerInTransitRef.current&&(u.onTriggerEnter(),y.current=!0)}),onPointerLeave:Be(n.onPointerLeave,()=>{u.onTriggerLeave(),y.current=!1}),onPointerDown:Be(n.onPointerDown,()=>{u.open&&u.onClose(),v.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:Be(n.onFocus,()=>{v.current||u.onOpen()}),onBlur:Be(n.onBlur,u.onClose),onClick:Be(n.onClick,u.onClose)})})});Rh.displayName=ku;var qu="TooltipPortal",[bS,ES]=cs(qu,{forceMount:void 0}),Th=n=>{const{__scopeTooltip:l,forceMount:o,children:s,container:u}=n,c=sl(qu,l);return p.jsx(bS,{scope:l,forceMount:o,children:p.jsx(qt,{present:o||c.open,children:p.jsx(zu,{asChild:!0,container:u,children:s})})})};Th.displayName=qu;var eo="TooltipContent",Ph=w.forwardRef((n,l)=>{const o=ES(eo,n.__scopeTooltip),{forceMount:s=o.forceMount,side:u="top",...c}=n,f=sl(eo,n.__scopeTooltip);return p.jsx(qt,{present:s||f.open,children:f.disableHoverableContent?p.jsx(jh,{side:u,...c,ref:l}):p.jsx(NS,{side:u,...c,ref:l})})}),NS=w.forwardRef((n,l)=>{const o=sl(eo,n.__scopeTooltip),s=Ku(eo,n.__scopeTooltip),u=w.useRef(null),c=rt(l,u),[f,m]=w.useState(null),{trigger:h,onClose:v}=o,y=u.current,{onPointerInTransitChange:x}=s,S=w.useCallback(()=>{m(null),x(!1)},[x]),b=w.useCallback((E,C)=>{const j=E.currentTarget,_={x:E.clientX,y:E.clientY},R=_S(_,j.getBoundingClientRect()),z=AS(_,R),D=OS(C.getBoundingClientRect()),F=LS([...z,...D]);m(F),x(!0)},[x]);return w.useEffect(()=>()=>S(),[S]),w.useEffect(()=>{if(h&&y){const E=j=>b(j,y),C=j=>b(j,h);return h.addEventListener("pointerleave",E),y.addEventListener("pointerleave",C),()=>{h.removeEventListener("pointerleave",E),y.removeEventListener("pointerleave",C)}}},[h,y,b,S]),w.useEffect(()=>{if(f){const E=C=>{const j=C.target,_={x:C.clientX,y:C.clientY},R=(h==null?void 0:h.contains(j))||(y==null?void 0:y.contains(j)),z=!DS(_,f);R?S():z&&(S(),v())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[h,y,f,v,S]),p.jsx(jh,{...n,ref:c})}),[RS,TS]=cs(rl,{isInside:!1}),PS=fy("TooltipContent"),jh=w.forwardRef((n,l)=>{const{__scopeTooltip:o,children:s,"aria-label":u,onEscapeKeyDown:c,onPointerDownOutside:f,...m}=n,h=sl(eo,o),v=ds(o),{onClose:y}=h;return w.useEffect(()=>(document.addEventListener(Cu,y),()=>document.removeEventListener(Cu,y)),[y]),w.useEffect(()=>{if(h.trigger){const x=S=>{const b=S.target;b!=null&&b.contains(h.trigger)&&y()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[h.trigger,y]),p.jsx(Mu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:x=>x.preventDefault(),onDismiss:y,children:p.jsxs(gS,{"data-state":h.stateAttribute,...v,...m,ref:l,style:{...m.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(PS,{children:s}),p.jsx(RS,{scope:o,isInside:!0,children:p.jsx(wS,{id:h.contentId,role:"tooltip",children:u||s})})]})})});Ph.displayName=eo;var _h="TooltipArrow",jS=w.forwardRef((n,l)=>{const{__scopeTooltip:o,...s}=n,u=ds(o);return TS(_h,o).isInside?null:p.jsx(vS,{...u,...s,ref:l})});jS.displayName=_h;function _S(n,l){const o=Math.abs(l.top-n.y),s=Math.abs(l.bottom-n.y),u=Math.abs(l.right-n.x),c=Math.abs(l.left-n.x);switch(Math.min(o,s,u,c)){case c:return"left";case u:return"right";case o:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function AS(n,l,o=5){const s=[];switch(l){case"top":s.push({x:n.x-o,y:n.y+o},{x:n.x+o,y:n.y+o});break;case"bottom":s.push({x:n.x-o,y:n.y-o},{x:n.x+o,y:n.y-o});break;case"left":s.push({x:n.x+o,y:n.y-o},{x:n.x+o,y:n.y+o});break;case"right":s.push({x:n.x-o,y:n.y-o},{x:n.x-o,y:n.y+o});break}return s}function OS(n){const{top:l,right:o,bottom:s,left:u}=n;return[{x:u,y:l},{x:o,y:l},{x:o,y:s},{x:u,y:s}]}function DS(n,l){const{x:o,y:s}=n;let u=!1;for(let c=0,f=l.length-1;c<l.length;f=c++){const m=l[c],h=l[f],v=m.x,y=m.y,x=h.x,S=h.y;y>s!=S>s&&o<(x-v)*(s-y)/(S-y)+v&&(u=!u)}return u}function LS(n){const l=n.slice();return l.sort((o,s)=>o.x<s.x?-1:o.x>s.x?1:o.y<s.y?-1:o.y>s.y?1:0),MS(l)}function MS(n){if(n.length<=1)return n.slice();const l=[];for(let s=0;s<n.length;s++){const u=n[s];for(;l.length>=2;){const c=l[l.length-1],f=l[l.length-2];if((c.x-f.x)*(u.y-f.y)>=(c.y-f.y)*(u.x-f.x))l.pop();else break}l.push(u)}l.pop();const o=[];for(let s=n.length-1;s>=0;s--){const u=n[s];for(;o.length>=2;){const c=o[o.length-1],f=o[o.length-2];if((c.x-f.x)*(u.y-f.y)>=(c.y-f.y)*(u.x-f.x))o.pop();else break}o.push(u)}return o.pop(),l.length===1&&o.length===1&&l[0].x===o[0].x&&l[0].y===o[0].y?l:l.concat(o)}var zS=Eh,IS=Nh,$S=Rh,FS=Th,WS=Ph;function BS({delayDuration:n=0,...l}){return p.jsx(zS,{"data-slot":"tooltip-provider",delayDuration:n,...l})}function Ai({...n}){return p.jsx(BS,{children:p.jsx(IS,{"data-slot":"tooltip",...n})})}function Oi({...n}){return p.jsx($S,{"data-slot":"tooltip-trigger",...n})}function Di({className:n,sideOffset:l=4,children:o,...s}){return p.jsx(FS,{children:p.jsx(WS,{"data-slot":"tooltip-content",sideOffset:l,className:fn("bg-background text-foreground border border-border animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",n),...s,children:o})})}function HS(n){const l=n.reduce((c,f)=>(c[f.toolName]=(c[f.toolName]||0)+1,c),{}),o=Object.keys(l),s=c=>{const f=l[c]??0;return f>1?`${c} (x${f})`:c},u=o.map(s);return o.length===1&&o[0]?{label:s(o[0]),details:""}:o.length===2?{label:`${s(o[0])}, ${s(o[1])}`,details:u.join(", ")}:{label:`${s(o[0])}, ${s(o[1])}, ...`,details:u.join(", ")}}function VS(n,l){const o=n==null?void 0:n.prompt;if(!Array.isArray(o))return null;if(l){const h=o.filter(y=>y.role==="user"),v=h[h.length-1];if(v){const y=v.content;let x=null;if(typeof y=="string")x=y;else if(Array.isArray(y)){const S=y.find(b=>b.type==="text");S!=null&&S.text&&(x=S.text)}if(x)return{type:"user",label:`"${Np(x)}"`,fullText:x}}return null}const s=o.filter(h=>h.role==="tool");if(s.length>0){const h=s[s.length-1],v={},y=h.content;if(Array.isArray(y))for(const E of y)E.type==="tool-result"&&E.toolName&&(v[E.toolName]=(v[E.toolName]||0)+1);const x=Object.keys(v);if(x.length===0)return{type:"tool",label:"tool result"};const S=E=>{const C=v[E];return C>1?`${E} (x${C})`:E},b=x.map(S);return x.length===1?{type:"tool",label:S(x[0])}:x.length===2?{type:"tool",label:`${S(x[0])}, ${S(x[1])}`,toolDetails:b.join(", ")}:{type:"tool",label:`${S(x[0])}, ${S(x[1])}, ...`,toolDetails:b.join(", ")}}const u=o.filter(h=>h.role==="user"),c=u[u.length-1];if(!c)return null;const f=c.content;let m=null;if(typeof f=="string")m=f;else if(Array.isArray(f)){const h=f.find(v=>v.type==="text");h!=null&&h.text&&(m=h.text)}return m?{type:"user",label:`"${Np(m)}"`,fullText:m}:null}function Np(n,l=30){return n.length<=l?n:n.slice(0,l).trim()+"…"}function US(n,l){var s,u;if(l)return{type:"error",icon:"alert",label:"Error"};if((typeof(n==null?void 0:n.finishReason)=="string"?n.finishReason:(s=n==null?void 0:n.finishReason)==null?void 0:s.unified)==="tool-calls"){const c=(n==null?void 0:n.toolCalls)||((u=n==null?void 0:n.content)==null?void 0:u.filter(h=>h.type==="tool-call"))||[],{label:f,details:m}=HS(c);return{type:"tool-calls",icon:"wrench",label:f,toolDetails:m||void 0}}return{type:"response",icon:"message",label:"Response"}}function YS(){const[n,l]=w.useState([]),[o,s]=w.useState(null),[u,c]=w.useState(new Set),[f,m]=w.useState(!0),h=async()=>{try{const z=await(await fetch("/api/runs")).json();l(z)}catch(R){console.error("Failed to fetch runs:",R)}finally{m(!1)}},v=async()=>{await fetch("/api/clear",{method:"POST"}),l([]),s(null)};w.useEffect(()=>{h()},[]),w.useEffect(()=>{let R=null,z=null;const D=()=>{R=new EventSource("/api/events"),R.addEventListener("connected",()=>{console.log("[DevTools] Connected to real-time updates")}),R.addEventListener("update",()=>{h(),o&&fetch(`/api/runs/${o.run.id}`).then(F=>F.json()).then(F=>{F&&!F.error&&s(F)}).catch(()=>{})}),R.addEventListener("heartbeat",()=>{}),R.onerror=()=>{console.log("[DevTools] SSE connection lost, reconnecting..."),R==null||R.close(),z=setTimeout(D,2e3)}};return D(),()=>{R==null||R.close(),z&&clearTimeout(z)}},[o==null?void 0:o.run.id]);const y=async R=>{const D=await(await fetch(`/api/runs/${R}`)).json();s(D),c(new Set)},x=R=>{c(z=>{const D=new Set(z);return D.has(R)?D.delete(R):D.add(R),D})},S=R=>R===null?"-":R<1e3?`${R}ms`:`${(R/1e3).toFixed(2)}s`,b=R=>{if(!R)return null;try{return JSON.parse(R)}catch{return R}},E=R=>{var U,I,$;const z=R[0];if(!z)return"Empty run";const D=b(z.input),F=(U=D==null?void 0:D.prompt)==null?void 0:U.find(B=>B.role==="user");if(F){const B=typeof F.content=="string"?F.content:(($=(I=F.content)==null?void 0:I[0])==null?void 0:$.text)||"";return B.slice(0,50)+(B.length>50?"...":"")}return"No user message"},C=R=>R.some(z=>z.error),j=R=>R.reduce((z,D)=>z+(D.duration_ms||0),0),_=R=>R.reduce((z,D)=>{const F=b(D.usage),U=Vi(F==null?void 0:F.inputTokens),I=Ui(F==null?void 0:F.outputTokens),$={total:z.input.total+U.total};(z.input.noCache!==void 0||U.noCache!==void 0)&&($.noCache=(z.input.noCache??0)+(U.noCache??0)),(z.input.cacheRead!==void 0||U.cacheRead!==void 0)&&($.cacheRead=(z.input.cacheRead??0)+(U.cacheRead??0)),(z.input.cacheWrite!==void 0||U.cacheWrite!==void 0)&&($.cacheWrite=(z.input.cacheWrite??0)+(U.cacheWrite??0));const B={total:z.output.total+I.total};return(z.output.text!==void 0||I.text!==void 0)&&(B.text=(z.output.text??0)+(I.text??0)),(z.output.reasoning!==void 0||I.reasoning!==void 0)&&(B.reasoning=(z.output.reasoning??0)+(I.reasoning??0)),{input:$,output:B}},{input:{total:0},output:{total:0}});return p.jsxs("div",{className:"flex flex-col h-screen bg-background",children:[p.jsxs("header",{className:"flex justify-between items-center px-5 py-3 border-b border-border bg-card",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(c0,{}),p.jsx("span",{className:"text-base font-medium text-muted-foreground",children:"DevTools"})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsxs(Gf,{variant:"ghost",size:"sm",onClick:h,className:"h-8 px-3 text-xs",children:[p.jsx(n0,{className:"size-3.5"}),"Refresh"]}),p.jsxs(Gf,{variant:"ghost",size:"sm",onClick:v,className:"h-8 px-3 text-xs text-destructive-foreground hover:bg-destructive/20",children:[p.jsx(i0,{className:"size-3.5"}),"Clear"]})]})]}),p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsxs("aside",{className:"w-[300px] border-r border-border bg-sidebar flex flex-col",children:[p.jsx("div",{className:"px-4 py-3 border-b border-border",children:p.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:"Runs"})}),p.jsx(Zf,{className:"flex-1 overflow-hidden",children:f?p.jsx("p",{className:"p-4 text-muted-foreground text-sm",children:"Loading..."}):n.length===0?p.jsx("p",{className:"p-4 text-muted-foreground text-sm",children:"No runs yet"}):p.jsx("div",{children:n.map(R=>{const z=(o==null?void 0:o.run.id)===R.id;return p.jsxs("button",{className:`w-full text-left px-4 py-3 border-b border-border/50 transition-colors ${z?"bg-accent":"hover:bg-accent/50"}`,onClick:()=>y(R.id),children:[p.jsxs("div",{className:"flex items-start gap-2 mb-1.5 min-w-0",children:[R.isInProgress?p.jsx(wi,{className:"size-3.5 text-blue-400 mt-0.5 shrink-0 animate-spin"}):R.hasError?p.jsx(Ff,{className:"size-3.5 text-destructive-foreground mt-0.5 shrink-0"}):p.jsx(Li,{className:"size-3.5 text-muted-foreground mt-0.5 shrink-0"}),p.jsx("span",{className:"text-[13px] text-foreground leading-tight line-clamp-1 break-all",children:R.firstMessage||"Loading..."})]}),p.jsxs("div",{className:"flex items-center gap-2 ml-5.5 text-[11px] text-muted-foreground",children:[R.type&&p.jsxs("span",{className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${R.type==="stream"?"bg-blue-500/15 text-blue-400":"bg-emerald-500/15 text-emerald-400"}`,children:[R.type==="stream"&&p.jsx(u0,{className:"size-2.5"}),R.type]}),p.jsxs("span",{children:[R.stepCount," ",R.stepCount===1?"step":"steps"]}),p.jsx("span",{children:"·"}),p.jsx("span",{className:"font-mono",children:new Date(R.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]},R.id)})})})]}),p.jsx("main",{className:"flex-1 overflow-hidden",children:p.jsx(Zf,{className:"h-full",children:o?p.jsxs("div",{className:"p-5",children:[p.jsxs("div",{className:"flex items-center justify-between mb-5",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("h2",{className:"text-sm font-medium text-foreground",children:E(o.steps)}),o.run.isInProgress&&p.jsxs(Kf,{variant:"secondary",className:"text-[10px] h-5 gap-1.5 bg-blue-500/15 text-blue-400 border-blue-500/30",children:[p.jsx(wi,{className:"size-3 animate-spin"}),"In Progress"]}),C(o.steps)&&p.jsx(Kf,{variant:"destructive",className:"text-[10px] h-5",children:"Error"})]}),p.jsxs("div",{className:"flex items-center text-xs text-muted-foreground",children:[p.jsxs("span",{children:[o.steps.length," steps"]}),p.jsx("span",{className:"px-3 text-muted-foreground/30",children:"·"}),p.jsx("span",{className:"font-mono",children:S(j(o.steps))}),p.jsx("span",{className:"px-3 text-muted-foreground/30",children:"·"}),p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsxs("span",{className:"font-mono cursor-help",children:["input:"," ",Tp(_(o.steps).input)," ",p.jsx("span",{className:"text-muted-foreground/50",children:"→"})," ","output:"," ",Pp(_(o.steps).output)]})}),p.jsx(Di,{children:p.jsx(Rp,{input:_(o.steps).input,output:_(o.steps).output})})]}),p.jsx("span",{className:"px-3 text-muted-foreground/30",children:"·"}),p.jsx("span",{children:new Date(o.run.started_at).toLocaleString()})]})]}),p.jsx("div",{className:"flex flex-col gap-3",children:o.steps.map((R,z)=>{var se,q;const D=u.has(R.id),U=z===o.steps.length-1&&o.run.isInProgress,I=b(R.input),$=b(R.output),B=b(R.usage),J=o.steps[z+1],ue=J?b(J.input):null,ve=((q=(se=ue==null?void 0:ue.prompt)==null?void 0:se.filter(A=>A.role==="tool"))==null?void 0:q.flatMap(A=>A.content))??[],X=US($,R.error),ce=VS(I,z===0);return p.jsx(Ky,{open:D,onOpenChange:()=>x(R.id),children:p.jsxs(uy,{className:`overflow-hidden py-0 gap-0 ${U?"ring-2 ring-blue-500/50 ring-offset-1 ring-offset-background":""}`,children:[p.jsx(qy,{asChild:!0,children:p.jsxs("button",{className:`w-full flex items-center justify-between px-4 py-3 text-left transition-colors hover:bg-accent/50 ${D?"border-b border-border":""}`,children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-mono w-4",children:R.step_number}),p.jsxs("div",{className:"flex items-center gap-2",children:[ce&&p.jsxs(p.Fragment,{children:[ce.type==="user"?p.jsx(Li,{className:"size-3.5 text-muted-foreground"}):p.jsx(el,{className:"size-3.5 text-muted-foreground"}),ce.fullText||ce.toolDetails?p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsx("span",{className:`text-sm text-muted-foreground ${ce.type==="tool"?"font-mono":""}`,children:ce.label})}),p.jsx(Di,{side:"bottom",className:"max-w-sm max-h-40 overflow-hidden",children:p.jsx("span",{className:"line-clamp-6",children:ce.fullText||ce.toolDetails})})]}):p.jsx("span",{className:`text-sm text-muted-foreground ${ce.type==="tool"?"font-mono":""}`,children:ce.label}),p.jsx("span",{className:"text-muted-foreground/50 mx-1",children:"→"})]}),X.icon==="wrench"&&p.jsx(el,{className:"size-3.5 text-muted-foreground"}),X.icon==="message"&&p.jsx(Li,{className:"size-3.5 text-muted-foreground"}),X.icon==="alert"&&p.jsx(Ff,{className:"size-3.5 text-destructive"}),X.toolDetails?p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsx("span",{className:"text-sm font-medium font-mono",children:X.label})}),p.jsx(Di,{children:X.toolDetails})]}):p.jsx("span",{className:`text-sm font-medium ${X.icon==="wrench"?"font-mono":""}`,children:X.label})]})]}),p.jsxs("div",{className:"flex items-center gap-4",children:[U?p.jsxs("span",{className:"text-[11px] text-blue-400 font-medium flex items-center gap-1.5",children:[p.jsx(wi,{className:"size-3 animate-spin"}),"streaming"]}):p.jsx("span",{className:"text-[11px] text-muted-foreground font-mono",children:S(R.duration_ms)}),B&&p.jsxs(Ai,{children:[p.jsx(Oi,{asChild:!0,children:p.jsxs("span",{className:"text-[11px] font-mono text-muted-foreground cursor-help",children:[Tp(Vi(B.inputTokens))," ",p.jsx("span",{className:"text-muted-foreground/50",children:"→"})," ",Pp(Ui(B.outputTokens))]})}),p.jsx(Di,{children:p.jsx(Rp,{input:Vi(B.inputTokens),output:Ui(B.outputTokens),raw:B.raw})})]}),p.jsx(Gv,{className:`size-4 text-muted-foreground transition-transform ${D?"rotate-180":""}`})]})]})}),p.jsxs(Zy,{children:[p.jsx(XS,{modelId:R.model_id,provider:R.provider,input:I,providerOptions:b(R.provider_options),usage:B}),p.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border",children:[p.jsx("div",{className:"bg-card/50",children:p.jsx(QS,{input:I})}),p.jsxs("div",{className:"p-4 bg-background min-h-full",children:[p.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Output"}),R.error?p.jsx("div",{className:"p-3 rounded-md bg-destructive/10 border border-destructive/30 text-sm text-destructive-foreground font-mono",children:R.error}):$?p.jsx(eC,{output:$,toolResults:ve}):U?p.jsxs("div",{className:"flex items-center gap-2 text-sm text-blue-400",children:[p.jsx(wi,{className:"size-4 animate-spin"}),p.jsx("span",{children:"Waiting for response..."})]}):p.jsx("p",{className:"text-sm text-muted-foreground",children:"No output"})]})]}),p.jsx(nC,{rawRequest:R.raw_request,rawResponse:R.raw_response,rawChunks:R.raw_chunks,isStream:R.type==="stream"})]})]})},R.id)})})]}):p.jsx("div",{className:"flex items-center justify-center min-h-[calc(100vh-57px)] text-muted-foreground",children:p.jsx("p",{className:"text-sm",children:"Select a run to view details"})})})})]})]})}function XS({modelId:n,provider:l,input:o,providerOptions:s,usage:u}){var m,h;const c=((m=o==null?void 0:o.tools)==null?void 0:m.length)??0,f=[];if((o==null?void 0:o.temperature)!=null&&f.push({label:"temp",value:String(o.temperature)}),(o==null?void 0:o.maxOutputTokens)!=null&&f.push({label:"max tokens",value:String(o.maxOutputTokens)}),(o==null?void 0:o.topP)!=null&&f.push({label:"topP",value:String(o.topP)}),(o==null?void 0:o.topK)!=null&&f.push({label:"topK",value:String(o.topK)}),(o==null?void 0:o.toolChoice)!=null){const v=typeof o.toolChoice=="string"?o.toolChoice:o.toolChoice.type;f.push({label:"tool choice",value:v})}return p.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted/20 border-b border-border text-[11px] text-muted-foreground",children:[l&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-sidebar-primary/10 text-sidebar-primary text-[10px] font-medium",children:l}),p.jsx("span",{className:"font-mono",children:n}),f.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),f.map((v,y)=>p.jsxs("span",{children:[v.label,": ",p.jsx("span",{className:"text-foreground",children:v.value}),y<f.length-1&&p.jsx("span",{className:"text-muted-foreground/30 mx-1",children:"·"})]},y))]}),c>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 hover:text-foreground transition-colors cursor-pointer",children:[p.jsx(el,{className:"size-3"}),c," available ",c===1?"tool":"tools"]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsxs(Bi,{children:["Available Tools (",c,")"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx("div",{className:"space-y-3",children:(h=o==null?void 0:o.tools)==null?void 0:h.map((v,y)=>p.jsx(KS,{tool:v},y))})})]})]})]}),s&&Object.keys(s).length>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 hover:text-foreground transition-colors cursor-pointer",children:[p.jsx(o0,{className:"size-3"}),"Provider options"]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsx(Bi,{children:"Provider Options"})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx(dn,{data:s,size:"lg"})})]})]})]}),u&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/30",children:"·"}),p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 hover:text-foreground transition-colors cursor-pointer",children:[p.jsx(Yv,{className:"size-3"}),"Usage"]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsx(Bi,{children:"Token Usage"})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx(rC,{usage:u})})]})]})]})]})}function QS({input:n}){const l=(n==null?void 0:n.prompt)??[],o=l.length,s=l.slice(-2),u=Math.max(0,o-2);return p.jsxs(Ii,{direction:"right",children:[p.jsx($i,{asChild:!0,children:p.jsxs("button",{className:"w-full h-full text-left p-4 hover:bg-accent/30 transition-colors cursor-pointer flex flex-col justify-start",children:[p.jsx("h3",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-3",children:"Input"}),p.jsxs("div",{className:"space-y-3",children:[u>0&&p.jsxs("div",{className:"text-[11px] text-muted-foreground/60 text-center py-1.5 rounded-md bg-muted/30",children:["+ ",u," previous"," ",u===1?"message":"messages"]}),s.map((c,f)=>p.jsx(GS,{message:c,index:u+f+1},f)),o===0&&p.jsx("p",{className:"text-sm text-muted-foreground",children:"No messages"})]})]})}),p.jsxs(Fi,{className:"h-full w-[800px] sm:max-w-[800px] overflow-hidden",children:[p.jsx(Wi,{className:"border-b border-border shrink-0",children:p.jsxs(Bi,{children:["All Messages (",o,")"]})}),p.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:p.jsx("div",{className:"space-y-3",children:l.map((c,f)=>p.jsx(JS,{message:c,index:f+1},f))})})]})]})}function GS({message:n,index:l}){const o=n.role,s=n.content,u={user:"User",assistant:"Assistant",system:"System",tool:"Tool"},c=E=>typeof E=="string"?E:Array.isArray(E)?E.filter(C=>C.type==="text").map(C=>C.text).join(""):"",f=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-call"):[],m=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-result"):[],h=E=>Array.isArray(E)?E.filter(C=>C.type==="thinking"||C.type==="reasoning").map(C=>C.thinking||C.text||C.reasoning).join(""):"",v=c(s),y=f(s),x=m(s),S=h(s),b=(v?1:0)+(S?1:0)+y.length+x.length;return p.jsxs("div",{className:"rounded-md border border-border/50 bg-background/50 p-2.5 space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/50",children:l}),p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:u[o]||o}),b>1&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:[b," parts"]})]}),S&&p.jsx("div",{className:"text-xs text-amber-500/60",children:"[thinking]"}),v&&p.jsx("div",{className:"text-xs text-foreground/90 line-clamp-3",children:v}),y.length>0&&p.jsxs("div",{className:"space-y-1",children:[y.slice(0,3).map((E,C)=>{const j=E.args??E.input,_=typeof j=="string"?to(j):j;return p.jsxs("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[E.toolName,"(",oC(_),")"]},C)}),y.length>3&&p.jsxs("div",{className:"text-[11px] text-muted-foreground/60",children:["+",y.length-3," more tool"," ",y.length-3===1?"call":"calls"]})]}),x.length>0&&p.jsxs("div",{className:"space-y-1",children:[x.slice(0,3).map((E,C)=>{const j=E.result??E.output??E,_=lC(j);return p.jsxs("div",{className:"text-[11px] font-mono text-muted-foreground truncate",children:[E.toolName||"tool","(…) => ",_]},C)}),x.length>3&&p.jsxs("div",{className:"text-[11px] text-muted-foreground/60",children:["+",x.length-3," more tool"," ",x.length-3===1?"result":"results"]})]}),!v&&!S&&y.length===0&&x.length===0&&p.jsx("div",{className:"text-[11px] text-muted-foreground italic",children:"Empty message"})]})}function KS({tool:n}){const[l,o]=w.useState(!1);return p.jsxs("div",{className:"rounded-md border border-border bg-background overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center justify-between p-2.5 hover:bg-accent/50 transition-colors",onClick:()=>o(!l),children:[p.jsx("span",{className:"text-sm font-mono text-purple",children:n.name}),n.parameters&&p.jsx(Cr,{className:`size-3 text-muted-foreground transition-transform ${l?"rotate-90":""}`})]}),l&&n.parameters&&p.jsxs("div",{className:"px-2.5 pb-2.5 border-t border-border",children:[n.description&&p.jsx("p",{className:"text-xs text-muted-foreground mb-2 pt-2",children:n.description}),p.jsx(dn,{data:n.parameters,compact:!0})]}),!l&&n.description&&p.jsx("div",{className:"px-2.5 pb-2 -mt-1",children:p.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:n.description})})]})}function qS({toolName:n,toolCallId:l,data:o}){const[s,u]=w.useState(!1),c=typeof o=="string"?to(o):o;return p.jsxs("div",{className:"rounded-md border border-purple/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-purple/10 hover:bg-purple/20 transition-colors",onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 text-purple transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx(el,{className:"size-3 text-purple shrink-0"}),p.jsx("span",{className:"text-xs font-mono font-medium text-purple",children:n}),!s&&c&&p.jsx("span",{className:"text-[11px] font-mono text-purple/70 truncate",children:Dh(c)}),l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 ml-auto shrink-0",children:l})]}),s&&p.jsx("div",{className:"p-3 bg-card/50 border-t border-purple/30",children:p.jsx(dn,{data:c})})]})}function ZS({toolName:n,toolCallId:l,data:o}){const[s,u]=w.useState(!1);return p.jsxs("div",{className:"rounded-md border border-success/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-success/10 hover:bg-success/20 transition-colors",onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 text-success transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx("span",{className:"text-xs font-medium text-success",children:"Result"}),n&&p.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:n}),l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 ml-auto shrink-0",children:l})]}),s&&p.jsx("div",{className:"p-3 bg-card/50 border-t border-success/30",children:p.jsx(dn,{data:o})})]})}function JS({message:n,index:l}){const o=n.role,s=n.content,u={user:"User",assistant:"Assistant",system:"System",tool:"Tool"},c=E=>typeof E=="string"?E:Array.isArray(E)?E.filter(C=>C.type==="text").map(C=>C.text).join(""):"",f=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-call"):[],m=E=>Array.isArray(E)?E.filter(C=>C.type==="tool-result"):[],h=E=>Array.isArray(E)?E.filter(C=>C.type==="thinking"||C.type==="reasoning").map(C=>C.thinking||C.text||C.reasoning).join(""):"",v=c(s),y=f(s),x=m(s),S=h(s),b=(v?1:0)+(S?1:0)+y.length+x.length;return p.jsxs("div",{className:"rounded-md border border-border/50 bg-background/50 p-3 space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[l&&p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/50",children:l}),p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:u[o]||o}),b>1&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:[b," parts"]})]}),S&&p.jsx(Ah,{content:S}),v&&p.jsx(Oh,{content:v,defaultExpanded:!S&&y.length===0&&x.length===0,isSystem:o==="system"}),y.length>0&&p.jsx("div",{className:"space-y-2",children:y.map((E,C)=>p.jsx(qS,{toolName:E.toolName,toolCallId:E.toolCallId,data:E.args??E.input},C))}),x.length>0&&p.jsx("div",{className:"space-y-2",children:x.map((E,C)=>p.jsx(ZS,{toolName:E.toolName,toolCallId:E.toolCallId,data:E.result??E.output??E},C))}),!v&&!S&&y.length===0&&x.length===0&&p.jsx("div",{className:"text-[11px] text-muted-foreground italic",children:"Empty message"})]})}function eC({output:n,toolResults:l=[]}){var v,y,x;const o=S=>l.find(b=>b.toolCallId===S),s=(n==null?void 0:n.toolCalls)||((v=n==null?void 0:n.content)==null?void 0:v.filter(S=>S.type==="tool-call"))||[],u=(n==null?void 0:n.textParts)||((y=n==null?void 0:n.content)==null?void 0:y.filter(S=>S.type==="text"))||[],c=(n==null?void 0:n.reasoningParts)||((x=n==null?void 0:n.content)==null?void 0:x.filter(S=>S.type==="thinking"||S.type==="reasoning"))||[],f=u.map(S=>S.text).join(""),m=c.map(S=>S.text).join(""),h=f&&!m&&s.length===0;return p.jsxs("div",{className:"space-y-3",children:[m&&p.jsx(Ah,{content:m}),f&&p.jsx(Oh,{content:f,defaultExpanded:h}),s.map((S,b)=>{const E=o(S.toolCallId);return p.jsx(tC,{toolName:S.toolName,args:S.args??S.input,result:(E==null?void 0:E.output)??(E==null?void 0:E.result)},b)})]})}function tC({toolName:n,args:l,result:o}){const[s,u]=w.useState(!1),c=typeof l=="string"?to(l):l,f=typeof o=="string"?to(o):o;return p.jsxs("div",{className:"rounded-md border border-purple/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-purple/10 hover:bg-purple/20 transition-colors",onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 text-purple transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx(el,{className:"size-3 text-purple shrink-0"}),p.jsx("span",{className:"text-xs font-mono font-medium text-purple",children:n}),!s&&c&&p.jsx("span",{className:"text-[11px] font-mono text-purple/70 truncate",children:Dh(c)})]}),s&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"p-3 bg-card/50 border-t border-purple/30",children:[p.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Input"}),p.jsx(dn,{data:c})]}),f&&p.jsxs("div",{className:"p-3 border-t border-border bg-success/5",children:[p.jsx("div",{className:"text-[10px] font-medium uppercase tracking-wider text-success mb-2",children:"Output"}),p.jsx(dn,{data:f})]})]})]})}function Ah({content:n}){const[l,o]=w.useState(!1),s=n.length>200?n.slice(0,200)+"…":n;return p.jsxs("div",{className:"rounded-md border border-amber-500/30 overflow-hidden",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 bg-amber-500/10 hover:bg-amber-500/20 transition-colors",onClick:()=>o(!l),children:[p.jsx(Cr,{className:`size-3 text-amber-500 transition-transform shrink-0 ${l?"rotate-90":""}`}),p.jsx(Vv,{className:"size-3 text-amber-500 shrink-0"}),p.jsx("span",{className:"text-xs font-medium text-amber-500",children:"Thinking"}),!l&&p.jsx("span",{className:"text-[11px] text-amber-500/70 truncate ml-1",children:s})]}),l&&p.jsx("div",{className:"p-3 bg-card/50 border-t border-amber-500/30",children:p.jsx("div",{className:"text-xs text-foreground/80 leading-relaxed whitespace-pre-wrap",children:n})})]})}function Oh({content:n,defaultExpanded:l=!1,isSystem:o=!1}){const[s,u]=w.useState(l),[c,f]=w.useState(!1),m=n.length>200?n.slice(0,200)+"…":n,h=o?"border-blue-500/30":"border-border",v=o?"bg-blue-500/10":"bg-muted/30",y=o?"hover:bg-blue-500/20":"hover:bg-muted/50",x=o?"text-blue-400":"text-muted-foreground",S=o?"text-blue-400":"text-foreground",b=async E=>{E.stopPropagation(),await navigator.clipboard.writeText(n),f(!0),setTimeout(()=>f(!1),2e3)};return p.jsxs("div",{className:`rounded-md border ${h} overflow-hidden`,children:[p.jsxs("button",{className:`w-full flex items-center gap-2 px-3 py-2 ${v} ${y} transition-colors`,onClick:()=>u(!s),children:[p.jsx(Cr,{className:`size-3 ${x} transition-transform shrink-0 ${s?"rotate-90":""}`}),p.jsx(Li,{className:`size-3 ${x} shrink-0`}),p.jsx("span",{className:`text-xs font-medium ${S}`,children:"Text"}),!s&&p.jsx("span",{className:`text-[11px] ${o?"text-blue-400/70":"text-muted-foreground"} truncate ml-1`,children:m})]}),s&&p.jsxs("div",{className:`p-3 bg-card/50 border-t ${h} group relative`,children:[p.jsx("button",{onClick:b,className:"absolute top-1.5 right-1.5 p-1.5 rounded-md border border-border bg-background opacity-0 group-hover:opacity-100 transition-opacity z-10",title:"Copy to clipboard",children:c?p.jsx(Op,{className:"size-3 text-success"}):p.jsx(Dp,{className:"size-3 text-muted-foreground"})}),p.jsx("div",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap max-h-60 overflow-y-auto",children:n})]})]})}function dn({data:n,compact:l=!1,size:o="sm"}){const[s,u]=w.useState(!1),c=JSON.stringify(n,null,2),f=l&&c.length>200?JSON.stringify(n):c,m={sm:"text-xs",base:"text-sm",lg:"text-base"},h=async()=>{await navigator.clipboard.writeText(c),u(!0),setTimeout(()=>u(!1),2e3)};return p.jsxs("div",{className:"relative group",children:[p.jsx("button",{onClick:h,className:"absolute top-1.5 right-1.5 p-1.5 rounded-md border border-border bg-background opacity-0 group-hover:opacity-100 transition-opacity z-10",title:"Copy to clipboard",children:s?p.jsx(Op,{className:"size-3 text-success"}):p.jsx(Dp,{className:"size-3 text-muted-foreground"})}),p.jsx("pre",{className:`font-mono ${m[o]} text-muted-foreground whitespace-pre-wrap wrap-break-words bg-background rounded p-2 ${l?"max-h-20 overflow-hidden":""}`,children:f})]})}function nC({rawRequest:n,rawResponse:l,rawChunks:o,isStream:s}){const[u,c]=w.useState(!1),[f,m]=w.useState("parsed");if(!n&&!l)return null;const h=s&&o;return p.jsxs("div",{className:"border-t border-border",children:[p.jsxs("button",{className:"w-full flex items-center gap-2 px-4 py-2.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors",onClick:()=>c(!u),children:[p.jsx(Cr,{className:`size-3 transition-transform ${u?"rotate-90":""}`}),p.jsx("span",{className:"font-medium uppercase tracking-wider",children:"Request / Response"})]}),u&&p.jsxs("div",{className:"px-4 pb-4 grid grid-cols-2 gap-4",children:[n&&p.jsxs("div",{className:"flex flex-col",children:[p.jsx("div",{className:"h-7 flex items-end mb-2",children:p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:"Request"})}),p.jsx("div",{className:"max-h-[400px] overflow-auto rounded-md border border-border",children:p.jsx(dn,{data:to(n)})})]}),(l||o)&&p.jsxs("div",{className:"flex flex-col",children:[p.jsxs("div",{className:"h-7 flex items-end justify-between mb-2",children:[p.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:s?"Stream":"Response"}),h&&p.jsxs("div",{className:"inline-flex rounded-md border border-border bg-muted/30 p-0.5",children:[p.jsx("button",{onClick:()=>m("parsed"),className:`px-2 py-0.5 text-[10px] font-medium rounded transition-colors ${f==="parsed"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"AI SDK"}),p.jsx("button",{onClick:()=>m("raw"),className:`px-2 py-0.5 text-[10px] font-medium rounded transition-colors ${f==="raw"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Provider"})]})]}),p.jsx("div",{className:"max-h-[400px] overflow-auto rounded-md border border-border",children:p.jsx(dn,{data:to(h&&f==="raw"?o:l)})})]})]})]})}function rC({usage:n}){const l=Vi(n==null?void 0:n.inputTokens),o=Ui(n==null?void 0:n.outputTokens);return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Input Tokens"}),p.jsx("div",{className:"text-2xl font-semibold",children:l.total}),(l.cacheRead!==void 0||l.cacheWrite!==void 0)&&p.jsxs("div",{className:"mt-3 space-y-1 text-sm text-muted-foreground",children:[l.cacheRead!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Cache read"}),p.jsx("span",{className:"font-mono",children:l.cacheRead})]}),l.cacheWrite!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Cache write"}),p.jsx("span",{className:"font-mono",children:l.cacheWrite})]}),l.noCache!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"No cache"}),p.jsx("span",{className:"font-mono",children:l.noCache})]})]})]}),p.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Output Tokens"}),p.jsx("div",{className:"text-2xl font-semibold",children:o.total}),(o.text!==void 0||o.reasoning!==void 0)&&p.jsxs("div",{className:"mt-3 space-y-1 text-sm text-muted-foreground",children:[o.text!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Text"}),p.jsx("span",{className:"font-mono",children:o.text})]}),o.reasoning!==void 0&&p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{children:"Reasoning"}),p.jsx("span",{className:"font-mono",children:o.reasoning})]})]})]})]}),(n==null?void 0:n.raw)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Raw Provider Usage"}),p.jsx(dn,{data:n.raw,size:"sm"})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground mb-2",children:"Full Usage Object"}),p.jsx(dn,{data:n,size:"sm"})]})]})}function Rp({input:n,output:l,raw:o}){const s=n.noCache!==void 0||n.cacheRead!==void 0||n.cacheWrite!==void 0,u=l.text!==void 0||l.reasoning!==void 0;return s||u?p.jsxs("div",{className:"text-xs space-y-2",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"font-medium mb-1",children:["Input: ",n.total]}),n.cacheRead!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Cache read: ",n.cacheRead]}),n.cacheWrite!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Cache write: ",n.cacheWrite]})]}),p.jsxs("div",{children:[p.jsxs("div",{className:"font-medium mb-1",children:["Output: ",l.total]}),l.text!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Text: ",l.text]}),l.reasoning!==void 0&&p.jsxs("div",{className:"text-muted-foreground ml-2",children:["Reasoning: ",l.reasoning]})]}),o!==void 0&&p.jsx("div",{className:"pt-1 border-t border-border mt-1",children:p.jsxs("div",{className:"text-muted-foreground/70 font-mono text-[10px] max-w-[200px] truncate",children:["Raw: ",JSON.stringify(o)]})})]}):p.jsxs("div",{className:"text-xs",children:[p.jsxs("div",{children:["Input: ",n.total]}),p.jsxs("div",{children:["Output: ",l.total]})]})}function to(n){if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n}function Vi(n){return n==null?{total:0}:typeof n=="number"?{total:n}:typeof n=="object"?{total:"total"in n&&typeof n.total=="number"?n.total:0,...typeof n.noCache=="number"&&{noCache:n.noCache},...typeof n.cacheRead=="number"&&{cacheRead:n.cacheRead},...typeof n.cacheWrite=="number"&&{cacheWrite:n.cacheWrite}}:{total:0}}function Ui(n){return n==null?{total:0}:typeof n=="number"?{total:n}:typeof n=="object"?{total:"total"in n&&typeof n.total=="number"?n.total:0,...typeof n.text=="number"&&{text:n.text},...typeof n.reasoning=="number"&&{reasoning:n.reasoning}}:{total:0}}function Tp(n){const{total:l,cacheRead:o}=n;return o&&o>0?`${l} (${o} cached)`:String(l)}function Pp(n){const{total:l,reasoning:o}=n;return o&&o>0?`${l} (${o} reasoning)`:String(l)}function Dh(n,l=40){if(!n||typeof n!="object")return"";const o=Object.entries(n);if(o.length===0)return"";const s=(h,v=20)=>h===null?"null":h===void 0?"undefined":typeof h=="object"?Array.isArray(h)?`[${h.length}]`:"{…}":typeof h=="string"?h.length>v?`"${h.slice(0,v)}…"`:`"${h}"`:String(h),u=o[0];if(!u)return"";const[c,f]=u,m=`${c}: ${s(f)}`;return o.length===1?`{ ${m} }`:`{ ${m}, … }`}function oC(n){if(!n||typeof n!="object")return"";const l=Object.entries(n);if(l.length===0)return"";const o=(m,h=20)=>m===null?"null":m===void 0?"undefined":typeof m=="object"?Array.isArray(m)?`[${m.length}]`:"{…}":typeof m=="string"?m.length>h?`"${m.slice(0,h)}…"`:`"${m}"`:String(m),s=l[0];if(!s)return"";const[u,c]=s,f=`${u}: ${o(c)}`;return l.length===1?`{ ${f} }`:`{ ${f}, … }`}function lC(n){if(n===null)return"null";if(n===void 0)return"undefined";if(typeof n=="string")return n.length>30?`"${n.slice(0,30)}…"`:`"${n}"`;if(Array.isArray(n))return`[${n.length}]`;if(typeof n=="object"){const l=Object.entries(n);if(l.length===0)return"{}";const o=l[0];if(!o)return"{…}";const[s,u]=o;let c;return typeof u=="string"&&u.length>15?c=`"${u.slice(0,15)}…"`:typeof u=="string"?c=`"${u}"`:typeof u=="object"?c=Array.isArray(u)?`[${u.length}]`:"{…}":c=String(u),l.length===1?`{ ${s}: ${c} }`:`{ ${s}: ${c}, … }`}return String(n)}zv.createRoot(document.getElementById("root")).render(p.jsx(YS,{}));
@@ -10,7 +10,7 @@
10
10
  href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600;700&display=swap"
11
11
  rel="stylesheet"
12
12
  />
13
- <script type="module" crossorigin src="/assets/index-BdahjG0x.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-BkkVu33-.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/assets/index-DtoOzHSk.css">
15
15
  </head>
16
16
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/devtools",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -13,7 +13,7 @@
13
13
  }
14
14
  },
15
15
  "bin": {
16
- "@ai-sdk/devtools": "./bin/cli.js"
16
+ "devtools": "./bin/cli.js"
17
17
  },
18
18
  "files": [
19
19
  "dist",
@@ -50,7 +50,7 @@
50
50
  "vaul": "^1.1.2",
51
51
  "vite": "^6.0.3",
52
52
  "zod": "3.25.76",
53
- "ai": "6.0.0"
53
+ "ai": "6.0.3"
54
54
  },
55
55
  "scripts": {
56
56
  "dev": "concurrently -k \"pnpm dev:api\" \"pnpm dev:client\"",