@mcpc-tech/unplugin-dev-inspector-mcp 0.0.45 → 0.0.46

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.
@@ -686,6 +686,10 @@ After clicking, use \`list_inspections\` to view the captured element with full
686
686
  inset: calc(var(--spacing) * 0);
687
687
  }
688
688
 
689
+ .inset-1 {
690
+ inset: calc(var(--spacing) * 1);
691
+ }
692
+
689
693
  .-top-0\\.5 {
690
694
  top: calc(var(--spacing) * -.5);
691
695
  }
@@ -7064,7 +7068,7 @@ let F7t=(0,y.createContext)(null),I7t=typeof window<`u`?y.useLayoutEffect:y.useE
7064
7068
  * This source code is licensed under the MIT license found in the
7065
7069
  * LICENSE file in the root directory of this source tree.
7066
7070
  */
7067
- var W7t=l((e=>{var t=g();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),l=r[0].inst,d=r[1];return o(function(){l.value=n,l.getSnapshot=t,u(l)&&d({inst:l})},[e,n,t]),a(function(){return u(l)&&d({inst:l}),e(function(){u(l)&&d({inst:l})})},[e]),s(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),G7t=l(((e,t)=>{t.exports=W7t()}))();function K7t(){return(0,G7t.useSyncExternalStore)(q7t,()=>!0,()=>!1)}function q7t(){return()=>{}}var J7t=`Avatar`,[Y7t,X7t]=H7t(J7t),[Z7t,Q7t]=Y7t(J7t),$7t=y.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=y.useState(`idle`);return(0,b.jsx)(Z7t,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,b.jsx)(Bp.span,{...r,ref:t})})});$7t.displayName=J7t;var e9t=`AvatarImage`,t9t=y.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Q7t(e9t,n),s=a9t(r,a),l=Joe(e=>{i(e),o.onImageLoadingStatusChange(e)});return Wt(()=>{s!==`idle`&&l(s)},[s,l]),s===`loaded`?(0,b.jsx)(Bp.img,{...a,ref:t,src:r}):null});t9t.displayName=e9t;var n9t=`AvatarFallback`,r9t=y.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Q7t(n9t,n),[o,s]=y.useState(r===void 0);return y.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,b.jsx)(Bp.span,{...i,ref:t}):null});r9t.displayName=n9t;function i9t(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function a9t(e,{referrerPolicy:t,crossOrigin:n}){let r=K7t(),i=y.useRef(null),a=(()=>r?(i.current||=new window.Image,i.current):null)(),[o,s]=y.useState(()=>i9t(a,e));return Wt(()=>{s(i9t(a,e))},[a,e]),Wt(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var o9t=$7t,s9t=t9t,c9t=r9t;let l9t=y.forwardRef(({className:e,...t},n)=>(0,b.jsx)(o9t,{ref:n,className:Ct(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));l9t.displayName=o9t.displayName;let u9t=y.forwardRef(({className:e,...t},n)=>(0,b.jsx)(s9t,{ref:n,className:Ct(`aspect-square h-full w-full`,e),...t}));u9t.displayName=s9t.displayName;let d9t=y.forwardRef(({className:e,...t},n)=>(0,b.jsx)(c9t,{ref:n,className:Ct(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));d9t.displayName=c9t.displayName;let f9t=({className:e,from:t,...n})=>(0,b.jsx)(`div`,{className:Ct(`group flex w-full items-end justify-end gap-2 py-4`,t===`user`?`is-user`:`is-assistant flex-row-reverse justify-end`,`[&>div]:max-w-[80%]`,e),...n}),p9t=({children:e,className:t,...n})=>(0,b.jsx)(`div`,{className:Ct(`flex flex-col gap-2 overflow-hidden rounded-lg px-4 py-3 text-foreground text-sm`,`group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground`,`group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground`,`is-user:dark`,t),...n,children:e}),m9t=({src:e,name:t,className:n,...r})=>(0,b.jsxs)(l9t,{className:Ct(`size-8 ring-1 ring-border`,n),...r,children:[(0,b.jsx)(u9t,{alt:``,className:`mt-0 mb-0`,src:e}),(0,b.jsx)(d9t,{children:t?.slice(0,2)||`ME`})]}),h9t=({size:e=16})=>(0,b.jsxs)(`svg`,{height:e,strokeLinejoin:`round`,style:{color:`currentcolor`},viewBox:`0 0 16 16`,width:e,children:[(0,b.jsx)(`title`,{children:`Loader`}),(0,b.jsxs)(`g`,{clipPath:`url(#clip0_2393_1490)`,children:[(0,b.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),(0,b.jsx)(`defs`,{children:(0,b.jsx)(`clipPath`,{id:`clip0_2393_1490`,children:(0,b.jsx)(`rect`,{fill:`white`,height:`16`,width:`16`})})})]}),g9t=({className:e,size:t=16,...n})=>(0,b.jsx)(`div`,{className:Ct(`inline-flex animate-spin items-center justify-center`,e),...n,children:(0,b.jsx)(h9t,{size:t})}),_9t=(0,y.createContext)(null),v9t=()=>{let e=(0,y.useContext)(_9t);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},y9t=(0,y.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=Kt({prop:n,defaultProp:r,onChange:i}),[d,f]=Kt({prop:a,defaultProp:void 0}),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(null);return(0,y.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,y.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,b.jsx)(_9t.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,b.jsx)(bn,{className:Ct(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),b9t=(e,t)=>e||t===0?(0,b.jsx)(Foe,{duration:1,children:`Thinking...`}):t===void 0?(0,b.jsx)(`p`,{children:`Thought for a few seconds`}):(0,b.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),x9t=(0,y.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=v9t();return(0,b.jsx)(xn,{className:Ct(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(M,{className:`size-4`}),b9t(r,a),(0,b.jsx)(N,{className:Ct(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),S9t=(0,y.memo)(({className:e,children:t,...n})=>(0,b.jsx)(Sn,{className:Ct(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,b.jsx)(E7t,{...n,children:t})}));y9t.displayName=`Reasoning`,x9t.displayName=`ReasoningTrigger`,S9t.displayName=`ReasoningContent`;let C9t=Bt(`inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function w9t({className:e,variant:t,asChild:n=!1,...r}){return(0,b.jsx)(n?Pt:`span`,{"data-slot":`badge`,className:Ct(C9t({variant:t}),e),...r})}let T9t=(0,y.createContext)({code:``}),E9t={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function D9t(e,t,n=!1){let r=n?[E9t]:[];return await Promise.all([uqe(e,{lang:t,theme:`one-light`,transformers:r}),uqe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),d=(0,y.useRef)(!1);return(0,y.useEffect)(()=>(D9t(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,b.jsx)(T9t.Provider,{value:{code:e},children:(0,b.jsx)(`div`,{className:Ct(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`div`,{className:`overflow-x-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,b.jsx)(`div`,{className:`hidden overflow-x-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,b.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},O9t=({className:e,...t})=>(0,b.jsx)(bn,{className:Ct(`not-prose mb-4 w-full rounded-md border`,e),...t}),k9t=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,b.jsxs)(w9t,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,b.jsx)(z,{className:`size-4`}),"input-available":(0,b.jsx)(B,{className:`size-4 animate-pulse`}),"approval-requested":(0,b.jsx)(B,{className:`size-4 text-yellow-600`}),"approval-responded":(0,b.jsx)(R,{className:`size-4 text-blue-600`}),"output-available":(0,b.jsx)(R,{className:`size-4 text-green-600`}),"output-error":(0,b.jsx)(te,{className:`size-4 text-red-600`}),"output-denied":(0,b.jsx)(te,{className:`size-4 text-orange-600`})}[e],t[e]]})},A9t=({className:e,title:t,type:n,state:r,...i})=>(0,b.jsxs)(xn,{className:Ct(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(pe,{className:`size-4 text-muted-foreground`}),(0,b.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),k9t(r)]}),(0,b.jsx)(N,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),j9t=({className:e,...t})=>(0,b.jsx)(Sn,{className:Ct(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),M9t=({className:e,input:t,...n})=>(0,b.jsxs)(`div`,{className:Ct(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,b.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,b.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,b.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),N9t=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,b.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,y.isValidElement)(t)?i=(0,b.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,b.jsx)(U7,{code:t,language:`json`})),(0,b.jsxs)(`div`,{className:Ct(`space-y-2 p-4`,e),...r,children:[(0,b.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,b.jsxs)(`div`,{className:Ct(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,b.jsx)(`div`,{children:n}),i]})]})};function P9t({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`card`,className:Ct(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function F9t({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`card-header`,className:Ct(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function I9t({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`card-content`,className:Ct(`px-6`,e),...t})}let L9t=(0,y.createContext)(null),R9t=({className:e,isStreaming:t=!1,children:n,...r})=>(0,b.jsx)(L9t.Provider,{value:{isStreaming:t},children:(0,b.jsx)(bn,{asChild:!0,"data-slot":`plan`,...r,children:(0,b.jsx)(P9t,{className:Ct(`shadow-none`,e),children:n})})}),z9t=({className:e,...t})=>(0,b.jsx)(F9t,{className:Ct(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),B9t=e=>(0,b.jsx)(Sn,{asChild:!0,children:(0,b.jsx)(I9t,{"data-slot":`plan-content`,...e})}),V9t=({className:e,...t})=>(0,b.jsx)(xn,{asChild:!0,children:(0,b.jsxs)(Ht,{className:Ct(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,b.jsx)(I,{className:`size-4`}),(0,b.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function H9t(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function U9t(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,b.jsx)(D7t,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,b.jsxs)(y9t,{className:`w-full`,isStreaming:r,children:[(0,b.jsx)(x9t,{}),(0,b.jsx)(S9t,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsxs)(R9t,{defaultOpen:!0,isStreaming:r,children:[(0,b.jsx)(z9t,{className:`flex flex-row items-center`,children:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,b.jsx)(V9t,{className:`mb-2`})]})}),(0,b.jsx)(B9t,{children:(0,b.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,b.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex-1`,children:[(0,b.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,b.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,b.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,b.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(H9t(e)){let r=e=>{let t=e;return t=t.replace(/^tool-/,``),t=t.replace(/^mcp__/,``),t=t.replace(/(^|__|\/)(acp[-_]?ai[-_]?sdk[-_]?tools)(?=__|\/|$)/g,`$1`),t=t.replace(/^__+/,``).replace(/__+$/,``),t=t.replace(/__{3,}/g,`__`),t||e},i=e.input;if(!i||!i.toolName)return null;let a=r(i.toolName),o=`tool-${a}`,s=e.state,l=s===`output-available`||s===`output-error`;return(0,b.jsxs)(O9t,{defaultOpen:l,children:[(0,b.jsx)(A9t,{title:a.length>20?`${a.slice(0,20)}...`:a,type:o,state:s}),(0,b.jsxs)(j9t,{children:[e.input!==void 0&&(0,b.jsx)(M9t,{input:i.args}),l&&(0,b.jsx)(N9t,{output:e.output?(0,b.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let W9t=({messages:e,status:t,selectedAgent:n})=>{let r=Mc.find(e=>e.name===(n||Nc))||Mc[0],i=t===`submitted`||t===`streaming`,a=e[e.length-1],o=i&&(!a||a.role===`user`);return(0,b.jsxs)(z7t,{className:`w-full h-full`,children:[(0,b.jsx)(B7t,{className:`p-3 space-y-3`,children:e.length===0&&!i?(0,b.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,b.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):(0,b.jsxs)(b.Fragment,{children:[e.map(e=>(0,b.jsxs)(f9t,{className:`items-start`,from:e.role,children:[(0,b.jsx)(p9t,{children:e.parts.map((n,r)=>U9t(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,b.jsx)(m9t,{name:r.name,src:r.meta?.icon??``})]},e.id)),o&&(0,b.jsxs)(f9t,{className:`items-start`,from:`assistant`,children:[(0,b.jsx)(p9t,{children:(0,b.jsx)(g9t,{size:16})}),(0,b.jsx)(m9t,{name:r.name,src:r.meta?.icon??``})]})]})}),(0,b.jsx)(V7t,{})]})};function G9t(e){let t=``;if(`parts`in e&&Array.isArray(e.parts))for(let n of e.parts)n.type===`text`&&`text`in n&&typeof n.text==`string`&&(t+=n.text);else `content`in e&&typeof e.content==`string`?t=e.content:`text`in e&&typeof e.text==`string`&&(t=e.text);return t}function K9t(e){if(!(`parts`in e)||!Array.isArray(e.parts))return null;let t=null,n=!1;for(let r of e.parts){if(t&&r.type===`text`&&`text`in r&&typeof r.text==`string`&&r.text.trim()){n=!0,t=null;break}if(r.type===`tool-result`&&`result`in r){let e=r.result;if(typeof e==`string`){t=e;continue}if(e&&typeof e==`object`){if(`text`in e&&typeof e.text==`string`){t=e.text;continue}if(Array.isArray(e)&&e.length>0){let n=e[0];if(n&&typeof n==`object`&&`content`in n){let e=n.content;if(e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`){t=e.text;continue}}}}}if(r.type===`tool-acp.acp_provider_agent_dynamic_tool`&&`output`in r&&Array.isArray(r.output)){let e=r.output;if(e.length>0){let n=e[0];if(n&&typeof n==`object`&&`content`in n){let e=n.content;if(e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`){t=e.text;continue}}}}}return n?null:t}function q9t(e){if(!(`parts`in e)||!Array.isArray(e.parts))return null;for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.type===`tool-call`&&`toolName`in n&&typeof n.toolName==`string`)return n.toolName;if(n.type===`tool-acp.acp_provider_agent_dynamic_tool`&&`input`in n&&typeof n.input==`object`&&n.input!==null&&`toolName`in n.input)return n.input.toolName}return null}function J9t(e,t){if(`parts`in e&&Array.isArray(e.parts)){let t=null,n=-1;for(let r=e.parts.length-1;r>=0;r--){let i=e.parts[r];if(i.type===`tool-acp.acp_provider_agent_dynamic_tool`){(`state`in i?i.state:null)===`input-available`&&`input`in i&&typeof i.input==`object`&&i.input!==null&&`toolName`in i.input&&(t=i.input.toolName,n=r);break}if(i.type===`tool-call`&&`toolName`in i&&typeof i.toolName==`string`){t=i.toolName,n=r;break}}if(t&&n!==-1){for(let t=n+1;t<e.parts.length;t++){let n=e.parts[t];if(n.type===`text`&&`text`in n&&typeof n.text==`string`&&n.text.trim()||n.type===`tool-result`)return null}return t}return null}if(t)return t;if(`toolInvocations`in e&&Array.isArray(e.toolInvocations)&&e.toolInvocations.length>0){let t=e.toolInvocations[e.toolInvocations.length-1];if(typeof t==`object`&&t&&`toolName`in t&&typeof t.toolName==`string`)return t.toolName}return null}function Y9t(e,t){return{displayText:G9t(e),toolOutput:K9t(e),toolCall:J9t(e,t)}}function X9t(e,t,n){return(0,y.useMemo)(()=>{let r=e[e.length-1],i=t===`streaming`,a=null,o=``;if(r&&r.role===`assistant`){let e=Y9t(r);o=e.displayText,a=e.toolCall||q9t(r)}return{uiState:n?`expanded`:`collapsed`,chatStatus:t,toolName:a,displayText:o,isStreaming:i,lastMessage:r}},[e,t,n])}function Z9t({initialOffset:e={x:0,y:0}}={}){let t=(0,y.useRef)(null),[n,r]=(0,y.useState)(!1),i=(0,y.useRef)(e),a=(0,y.useRef)({x:0,y:0}),o=(0,y.useRef)({x:0,y:0}),s=(0,y.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,y.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,y.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,y.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let Q9t=`AI_SELECTED_AGENT`,$9t=e=>{let[t,n]=(0,y.useState)(()=>{if(typeof window<`u`){let e=localStorage.getItem(Q9t);if(e)return e}return e}),[r,i]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{typeof window<`u`?zc().then(e=>{e&&e!==Nc&&n(e)}).finally(()=>{i(!0)}):i(!0)},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(Q9t,e):localStorage.removeItem(Q9t))},isReady:r}},een=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{},toolsReady:d=!0,mcpClient:f=null})=>{let[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(`none`),[x,S]=(0,y.useState)(!0),{agent:C,setAgent:w,isReady:T}=$9t(Nc),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(null),[A,M]=(0,y.useState)(!1),{uiState:N,chatStatus:P,toolName:I,displayText:L}=X9t(a,o,p),R=P===`submitted`||P===`streaming`,z=N===`expanded`&&!R,B=a.length>0&&P!==`error`||R,[ae,oe]=(0,y.useState)(null),se=(0,y.useRef)(null),ce=(0,y.useRef)(!1),le=e=>{let t=`${Ic()}/api/acp/cleanup-session`,n=JSON.stringify({sessionId:e});try{if(navigator.sendBeacon){let e=new Blob([n],{type:`application/json`});navigator.sendBeacon(t,e);return}}catch{}fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:n,keepalive:!0}).catch(()=>{})};(0,y.useEffect)(()=>{if(!T||!d)return;let e=!0,t=Mc.find(e=>e.name===C)||Mc[0];return(async()=>{if(se.current){try{await fetch(`${Ic()}/api/acp/cleanup-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:se.current})})}catch(e){console.warn(`[InspectorBar] Failed to cleanup previous session:`,e)}se.current=null,e&&oe(null)}console.log(`[InspectorBar] Initializing session for ${t.name}...`);try{let n=await fetch(`${Ic()}/api/acp/init-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agent:t,envVars:{}})});if(!n.ok)throw Error(`Failed to init session`);let r=await n.json();e&&r.sessionId&&(console.log(`[InspectorBar] Session initialized: ${r.sessionId}`),oe(r.sessionId),se.current=r.sessionId,ce.current=!1)}catch(e){console.error(`[InspectorBar] Failed to initialize session:`,e)}})(),()=>{e=!1}},[C,T,d]),(0,y.useEffect)(()=>{let e=()=>{let e=se.current;!e||ce.current||(ce.current=!0,le(e))};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e)}},[]),(0,y.useEffect)(()=>()=>{let e=se.current;!e||ce.current||(ce.current=!0,console.log(`[InspectorBar] Cleaning up session on unmount: ${e}`),le(e))},[]);let fe=Mc.find(e=>e.name===C)||Mc[0],{elementRef:pe,isDragging:me,handleMouseDown:he}=Z9t(),[ge,_e]=(0,y.useState)(null),ve=(0,y.useRef)(null);(0,y.useEffect)(()=>{p&&ve.current&&ve.current.focus()},[p]),(0,y.useEffect)(()=>{if(!R&&!x){let e=setTimeout(()=>{S(!0)},2e3);return()=>clearTimeout(e)}},[R,x]),(0,y.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;_e({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;_e({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let ye=e=>{e.preventDefault(),h.trim()&&(_e(null),n(h,C,ae||void 0),g(``),v(`chat`))},be=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye(e)),e.key===`Escape`&&(m(!1),ve.current?.blur())},xe=o===`error`;return(0,b.jsxs)(b.Fragment,{children:[(p||_!==`none`)&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-[999998] bg-transparent`,onClick:()=>{R||(m(!1),v(`none`))}}),(0,b.jsxs)(`div`,{ref:pe,className:Ct(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,p?`w-[480px]`:B?`w-auto min-w-[200px] max-w-[480px]`:`w-[190px]`,me?`cursor-grabbing`:`cursor-grab`),onMouseDown:he,onMouseEnter:()=>{!me&&x&&m(!0)},onMouseLeave:()=>{!h.trim()&&!me&&(m(!1),v(`none`)),S(!0)},children:[(0,b.jsxs)(`div`,{className:Ct(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,p?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,_===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,xe&&!p&&`bg-destructive/10 border-destructive/20`),children:[(0,b.jsxs)(`div`,{className:Ct(`flex items-center transition-opacity duration-300 w-full relative`,z?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[a.length===0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,b.jsx)(`img`,{src:fe?.meta?.icon,alt:C,className:`w-3.5 h-3.5`})}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3 whitespace-nowrap`,children:`⌥I or hover to inspect`})]}),B&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,b.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:R?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,b.jsx)(`img`,{src:fe?.meta?.icon,alt:C,className:`w-3.5 h-3.5 animate-pulse`})]}):ge?ge.status===`in-progress`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,b.jsx)(de,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):ge.status===`completed`?(0,b.jsx)(ee,{className:`w-5 h-5 text-green-500`}):(0,b.jsx)(te,{className:`w-5 h-5 text-red-500`}):xe?(0,b.jsx)(te,{className:`w-5 h-5 text-red-500`}):(0,b.jsx)(ee,{className:`w-5 h-5 text-green-500`})}),(0,b.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,b.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,b.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:ge&&ge.status===`in-progress`&&ge.currentStep?(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,b.jsx)(de,{className:`w-4 h-4 flex-shrink-0`}),(0,b.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,ge.currentStep.index,`/`,ge.currentStep.total,`: `,ge.currentStep.title]})]}):ge?.message?(0,b.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:ge.message}):I?(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,b.jsx)(de,{className:`w-4 h-4 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`truncate min-w-0`,children:I})]}):(0,b.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:R&&!L?(0,b.jsx)(Foe,{duration:2,spread:2,children:o===`submitted`&&fe?.command===`npx`?`Starting ${fe.name}... This may take a moment.`:`Thinking...`}):L||`Processing...`})})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e===`chat`?`none`:`chat`),className:Ct(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,_===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:_===`chat`?`Collapse`:`Expand messages`,children:(0,b.jsx)(F,{className:Ct(`w-3.5 h-3.5 transition-transform duration-300`,_===`chat`&&`rotate-180`)})}),R&&(0,b.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,b.jsx)(ue,{className:`w-3 h-3`})})]})]})]}),(0,b.jsxs)(`div`,{className:Ct(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,z?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,b.jsx)(`button`,{onClick:t,className:Ct(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector (⌥I)`,children:(0,b.jsx)(ne,{className:`w-3.5 h-3.5`})}),(0,b.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>M(!0),className:Ct(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,A&&`bg-accent/50 text-foreground`),title:`Context`,children:[(0,b.jsx)(re,{className:`w-3.5 h-3.5`}),s>0&&(0,b.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,b.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,b.jsxs)(`form`,{onSubmit:ye,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>D(!E),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,b.jsx)(`img`,{src:Mc.find(e=>e.name===C)?.meta?.icon,alt:C,className:`w-3.5 h-3.5`})}),E&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>D(!1)}),(0,b.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-64 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:Mc.map(e=>(0,b.jsxs)(`div`,{className:Ct(`w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-accent transition-colors group`,C===e.name&&`bg-accent/50 font-medium`),children:[(0,b.jsxs)(`button`,{onClick:()=>{w(e.name),D(!1)},className:`flex items-center gap-2 flex-1 text-left`,children:[e.meta?.icon&&(0,b.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1`,children:e.name})]}),(e.configHint||e.configLink)&&(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),k(e.name)},className:`p-1 rounded hover:bg-accent-foreground/10 transition-colors`,title:`Configuration info`,children:(0,b.jsx)(ie,{className:`w-3.5 h-3.5 text-muted-foreground`})})]},e.name))})]})]}),(0,b.jsx)(`input`,{ref:ve,type:`text`,value:h,onChange:e=>g(e.target.value),onKeyDown:be,placeholder:`Ask ${C}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:R}),(a.length>0||R)&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e===`chat`?`none`:`chat`),className:Ct(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,_===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:_===`chat`?`Collapse`:`Expand messages`,children:(0,b.jsx)(F,{className:Ct(`w-3.5 h-3.5 transition-transform duration-300`,_===`chat`&&`rotate-180`)})}),R?(0,b.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,b.jsx)(ue,{className:`w-3 h-3`})}):(0,b.jsx)(`button`,{type:`submit`,disabled:!h.trim(),className:Ct(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,h.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,b.jsx)(j,{className:`w-3.5 h-3.5`})})]})]})]}),_!==`none`&&(0,b.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[480px] mx-auto animate-panel-in`,children:(0,b.jsx)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:_===`chat`&&(0,b.jsx)(`div`,{className:`h-[500px]`,children:(0,b.jsx)(W9t,{messages:a,status:o,selectedAgent:C})})})})]}),(0,b.jsx)(k7t,{open:A,onOpenChange:M,inspectionItems:l,onRemoveInspection:u,client:f,isClientReady:d}),O&&(()=>{let e=Mc.find(e=>e.name===O);return e?(0,b.jsx)(wt,{open:!!O,onOpenChange:()=>k(null),children:(0,b.jsxs)(Tt,{onClose:()=>k(null),className:`w-80`,children:[(0,b.jsxs)(Et,{children:[(0,b.jsxs)(Ot,{className:`flex items-center gap-3`,children:[e.meta?.icon&&(0,b.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-6 h-6`}),e.name]}),e.configHint&&(0,b.jsx)(kt,{children:e.configHint})]}),e.configLink&&(0,b.jsx)(`a`,{href:e.configLink,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-blue-500 hover:text-blue-600 underline`,children:`View ACP Documentation →`})]})}):null})()]})};var ten=`vercel.ai.error`,nen=Symbol.for(ten),ren,ien=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[ren]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,ten)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};ren=nen;var W7=ien;function aen(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var oen=`AI_InvalidArgumentError`,sen=`vercel.ai.error.${oen}`,cen=Symbol.for(sen),len,uen=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:oen,message:e,cause:t}),this[len]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,sen)}};len=cen;var den=`AI_JSONParseError`,fen=`vercel.ai.error.${den}`,pen=Symbol.for(fen),men,hen=class extends W7{constructor({text:e,cause:t}){super({name:den,message:`JSON parsing failed: Text: ${e}.
7071
+ var W7t=l((e=>{var t=g();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),l=r[0].inst,d=r[1];return o(function(){l.value=n,l.getSnapshot=t,u(l)&&d({inst:l})},[e,n,t]),a(function(){return u(l)&&d({inst:l}),e(function(){u(l)&&d({inst:l})})},[e]),s(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),G7t=l(((e,t)=>{t.exports=W7t()}))();function K7t(){return(0,G7t.useSyncExternalStore)(q7t,()=>!0,()=>!1)}function q7t(){return()=>{}}var J7t=`Avatar`,[Y7t,X7t]=H7t(J7t),[Z7t,Q7t]=Y7t(J7t),$7t=y.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=y.useState(`idle`);return(0,b.jsx)(Z7t,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,b.jsx)(Bp.span,{...r,ref:t})})});$7t.displayName=J7t;var e9t=`AvatarImage`,t9t=y.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=Q7t(e9t,n),s=a9t(r,a),l=Joe(e=>{i(e),o.onImageLoadingStatusChange(e)});return Wt(()=>{s!==`idle`&&l(s)},[s,l]),s===`loaded`?(0,b.jsx)(Bp.img,{...a,ref:t,src:r}):null});t9t.displayName=e9t;var n9t=`AvatarFallback`,r9t=y.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=Q7t(n9t,n),[o,s]=y.useState(r===void 0);return y.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,b.jsx)(Bp.span,{...i,ref:t}):null});r9t.displayName=n9t;function i9t(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function a9t(e,{referrerPolicy:t,crossOrigin:n}){let r=K7t(),i=y.useRef(null),a=(()=>r?(i.current||=new window.Image,i.current):null)(),[o,s]=y.useState(()=>i9t(a,e));return Wt(()=>{s(i9t(a,e))},[a,e]),Wt(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var o9t=$7t,s9t=t9t,c9t=r9t;let l9t=y.forwardRef(({className:e,...t},n)=>(0,b.jsx)(o9t,{ref:n,className:Ct(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));l9t.displayName=o9t.displayName;let u9t=y.forwardRef(({className:e,...t},n)=>(0,b.jsx)(s9t,{ref:n,className:Ct(`aspect-square h-full w-full`,e),...t}));u9t.displayName=s9t.displayName;let d9t=y.forwardRef(({className:e,...t},n)=>(0,b.jsx)(c9t,{ref:n,className:Ct(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));d9t.displayName=c9t.displayName;let f9t=({className:e,from:t,...n})=>(0,b.jsx)(`div`,{className:Ct(`group flex w-full items-end justify-end gap-2 py-4`,t===`user`?`is-user`:`is-assistant flex-row-reverse justify-end`,`[&>div]:max-w-[80%]`,e),...n}),p9t=({children:e,className:t,...n})=>(0,b.jsx)(`div`,{className:Ct(`flex flex-col gap-2 overflow-hidden rounded-lg px-4 py-3 text-foreground text-sm`,`group-[.is-user]:bg-primary group-[.is-user]:text-primary-foreground`,`group-[.is-assistant]:bg-secondary group-[.is-assistant]:text-foreground`,`is-user:dark`,t),...n,children:e}),m9t=({src:e,name:t,className:n,...r})=>(0,b.jsxs)(l9t,{className:Ct(`size-8 ring-1 ring-border`,n),...r,children:[(0,b.jsx)(u9t,{alt:``,className:`mt-0 mb-0`,src:e}),(0,b.jsx)(d9t,{children:t?.slice(0,2)||`ME`})]}),h9t=({size:e=16})=>(0,b.jsxs)(`svg`,{height:e,strokeLinejoin:`round`,style:{color:`currentcolor`},viewBox:`0 0 16 16`,width:e,children:[(0,b.jsx)(`title`,{children:`Loader`}),(0,b.jsxs)(`g`,{clipPath:`url(#clip0_2393_1490)`,children:[(0,b.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,b.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),(0,b.jsx)(`defs`,{children:(0,b.jsx)(`clipPath`,{id:`clip0_2393_1490`,children:(0,b.jsx)(`rect`,{fill:`white`,height:`16`,width:`16`})})})]}),g9t=({className:e,size:t=16,...n})=>(0,b.jsx)(`div`,{className:Ct(`inline-flex animate-spin items-center justify-center`,e),...n,children:(0,b.jsx)(h9t,{size:t})}),_9t=(0,y.createContext)(null),v9t=()=>{let e=(0,y.useContext)(_9t);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},y9t=(0,y.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=Kt({prop:n,defaultProp:r,onChange:i}),[d,f]=Kt({prop:a,defaultProp:void 0}),[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(null);return(0,y.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,y.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,b.jsx)(_9t.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,b.jsx)(bn,{className:Ct(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),b9t=(e,t)=>e||t===0?(0,b.jsx)(Foe,{duration:1,children:`Thinking...`}):t===void 0?(0,b.jsx)(`p`,{children:`Thought for a few seconds`}):(0,b.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),x9t=(0,y.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=v9t();return(0,b.jsx)(xn,{className:Ct(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(M,{className:`size-4`}),b9t(r,a),(0,b.jsx)(N,{className:Ct(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),S9t=(0,y.memo)(({className:e,children:t,...n})=>(0,b.jsx)(Sn,{className:Ct(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,b.jsx)(E7t,{...n,children:t})}));y9t.displayName=`Reasoning`,x9t.displayName=`ReasoningTrigger`,S9t.displayName=`ReasoningContent`;let C9t=Bt(`inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function w9t({className:e,variant:t,asChild:n=!1,...r}){return(0,b.jsx)(n?Pt:`span`,{"data-slot":`badge`,className:Ct(C9t({variant:t}),e),...r})}let T9t=(0,y.createContext)({code:``}),E9t={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function D9t(e,t,n=!1){let r=n?[E9t]:[];return await Promise.all([uqe(e,{lang:t,theme:`one-light`,transformers:r}),uqe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,y.useState)(``),[l,u]=(0,y.useState)(``),d=(0,y.useRef)(!1);return(0,y.useEffect)(()=>(D9t(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,b.jsx)(T9t.Provider,{value:{code:e},children:(0,b.jsx)(`div`,{className:Ct(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,b.jsxs)(`div`,{className:`relative`,children:[(0,b.jsx)(`div`,{className:`overflow-x-auto dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,b.jsx)(`div`,{className:`hidden overflow-x-auto dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,b.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},O9t=({className:e,...t})=>(0,b.jsx)(bn,{className:Ct(`not-prose mb-4 w-full rounded-md border`,e),...t}),k9t=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,b.jsxs)(w9t,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,b.jsx)(z,{className:`size-4`}),"input-available":(0,b.jsx)(B,{className:`size-4 animate-pulse`}),"approval-requested":(0,b.jsx)(B,{className:`size-4 text-yellow-600`}),"approval-responded":(0,b.jsx)(R,{className:`size-4 text-blue-600`}),"output-available":(0,b.jsx)(R,{className:`size-4 text-green-600`}),"output-error":(0,b.jsx)(te,{className:`size-4 text-red-600`}),"output-denied":(0,b.jsx)(te,{className:`size-4 text-orange-600`})}[e],t[e]]})},A9t=({className:e,title:t,type:n,state:r,...i})=>(0,b.jsxs)(xn,{className:Ct(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(pe,{className:`size-4 text-muted-foreground`}),(0,b.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),k9t(r)]}),(0,b.jsx)(N,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),j9t=({className:e,...t})=>(0,b.jsx)(Sn,{className:Ct(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),M9t=({className:e,input:t,...n})=>(0,b.jsxs)(`div`,{className:Ct(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,b.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,b.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,b.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),N9t=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,b.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,y.isValidElement)(t)?i=(0,b.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,b.jsx)(U7,{code:t,language:`json`})),(0,b.jsxs)(`div`,{className:Ct(`space-y-2 p-4`,e),...r,children:[(0,b.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,b.jsxs)(`div`,{className:Ct(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,b.jsx)(`div`,{children:n}),i]})]})};function P9t({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`card`,className:Ct(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function F9t({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`card-header`,className:Ct(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function I9t({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`card-content`,className:Ct(`px-6`,e),...t})}let L9t=(0,y.createContext)(null),R9t=({className:e,isStreaming:t=!1,children:n,...r})=>(0,b.jsx)(L9t.Provider,{value:{isStreaming:t},children:(0,b.jsx)(bn,{asChild:!0,"data-slot":`plan`,...r,children:(0,b.jsx)(P9t,{className:Ct(`shadow-none`,e),children:n})})}),z9t=({className:e,...t})=>(0,b.jsx)(F9t,{className:Ct(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),B9t=e=>(0,b.jsx)(Sn,{asChild:!0,children:(0,b.jsx)(I9t,{"data-slot":`plan-content`,...e})}),V9t=({className:e,...t})=>(0,b.jsx)(xn,{asChild:!0,children:(0,b.jsxs)(Ht,{className:Ct(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,b.jsx)(I,{className:`size-4`}),(0,b.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function H9t(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function U9t(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,b.jsx)(D7t,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,b.jsxs)(y9t,{className:`w-full`,isStreaming:r,children:[(0,b.jsx)(x9t,{}),(0,b.jsx)(S9t,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsxs)(R9t,{defaultOpen:!0,isStreaming:r,children:[(0,b.jsx)(z9t,{className:`flex flex-row items-center`,children:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,b.jsx)(V9t,{className:`mb-2`})]})}),(0,b.jsx)(B9t,{children:(0,b.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,b.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,b.jsxs)(`div`,{className:`flex-1`,children:[(0,b.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,b.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,b.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,b.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(H9t(e)){let r=e=>{let t=e;return t=t.replace(/^tool-/,``),t=t.replace(/^mcp__/,``),t=t.replace(/(^|__|\/)(acp[-_]?ai[-_]?sdk[-_]?tools)(?=__|\/|$)/g,`$1`),t=t.replace(/^__+/,``).replace(/__+$/,``),t=t.replace(/__{3,}/g,`__`),t||e},i=e.input;if(!i||!i.toolName)return null;let a=r(i.toolName),o=`tool-${a}`,s=e.state,l=s===`output-available`||s===`output-error`;return(0,b.jsxs)(O9t,{defaultOpen:l,children:[(0,b.jsx)(A9t,{title:a.length>20?`${a.slice(0,20)}...`:a,type:o,state:s}),(0,b.jsxs)(j9t,{children:[e.input!==void 0&&(0,b.jsx)(M9t,{input:i.args}),l&&(0,b.jsx)(N9t,{output:e.output?(0,b.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let W9t=({messages:e,status:t,selectedAgent:n})=>{let r=Mc.find(e=>e.name===(n||Nc))||Mc[0],i=t===`submitted`||t===`streaming`,a=e[e.length-1],o=i&&(!a||a.role===`user`);return(0,b.jsxs)(z7t,{className:`w-full h-full`,children:[(0,b.jsx)(B7t,{className:`p-3 space-y-3`,children:e.length===0&&!i?(0,b.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,b.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):(0,b.jsxs)(b.Fragment,{children:[e.map(e=>(0,b.jsxs)(f9t,{className:`items-start`,from:e.role,children:[(0,b.jsx)(p9t,{children:e.parts.map((n,r)=>U9t(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,b.jsx)(m9t,{name:r.name,src:r.meta?.icon??``})]},e.id)),o&&(0,b.jsxs)(f9t,{className:`items-start`,from:`assistant`,children:[(0,b.jsx)(p9t,{children:(0,b.jsx)(g9t,{size:16})}),(0,b.jsx)(m9t,{name:r.name,src:r.meta?.icon??``})]})]})}),(0,b.jsx)(V7t,{})]})};function G9t(e){let t=``;if(`parts`in e&&Array.isArray(e.parts))for(let n of e.parts)n.type===`text`&&`text`in n&&typeof n.text==`string`&&(t+=n.text);else `content`in e&&typeof e.content==`string`?t=e.content:`text`in e&&typeof e.text==`string`&&(t=e.text);return t}function K9t(e){if(!(`parts`in e)||!Array.isArray(e.parts))return null;let t=null,n=!1;for(let r of e.parts){if(t&&r.type===`text`&&`text`in r&&typeof r.text==`string`&&r.text.trim()){n=!0,t=null;break}if(r.type===`tool-result`&&`result`in r){let e=r.result;if(typeof e==`string`){t=e;continue}if(e&&typeof e==`object`){if(`text`in e&&typeof e.text==`string`){t=e.text;continue}if(Array.isArray(e)&&e.length>0){let n=e[0];if(n&&typeof n==`object`&&`content`in n){let e=n.content;if(e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`){t=e.text;continue}}}}}if(r.type===`tool-acp.acp_provider_agent_dynamic_tool`&&`output`in r&&Array.isArray(r.output)){let e=r.output;if(e.length>0){let n=e[0];if(n&&typeof n==`object`&&`content`in n){let e=n.content;if(e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`){t=e.text;continue}}}}}return n?null:t}function q9t(e,t){if(`parts`in e&&Array.isArray(e.parts)){let t=null,n=-1;for(let r=e.parts.length-1;r>=0;r--){let i=e.parts[r];if(i.type===`tool-acp.acp_provider_agent_dynamic_tool`){(`state`in i?i.state:null)===`input-available`&&`input`in i&&typeof i.input==`object`&&i.input!==null&&`toolName`in i.input&&(t=i.input.toolName,n=r);break}if(i.type===`tool-call`&&`toolName`in i&&typeof i.toolName==`string`){t=i.toolName,n=r;break}}if(t&&n!==-1){for(let t=n+1;t<e.parts.length;t++){let n=e.parts[t];if(n.type===`text`&&`text`in n&&typeof n.text==`string`&&n.text.trim()||n.type===`tool-result`)return null}return t}return null}if(t)return t;if(`toolInvocations`in e&&Array.isArray(e.toolInvocations)&&e.toolInvocations.length>0){let t=e.toolInvocations[e.toolInvocations.length-1];if(typeof t==`object`&&t&&`toolName`in t&&typeof t.toolName==`string`)return t.toolName}return null}function J9t(e){if(!(`parts`in e)||!Array.isArray(e.parts))return null;for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.type===`tool-call`&&`toolName`in n&&typeof n.toolName==`string`)return n.toolName;if(typeof n.type==`string`&&n.type.startsWith(`tool-`)){if(`input`in n&&typeof n.input==`object`&&n.input!==null&&`toolName`in n.input&&typeof n.input.toolName==`string`)return n.input.toolName;if(`toolName`in n&&typeof n.toolName==`string`)return n.toolName}if(n.type===`text`&&`text`in n&&typeof n.text==`string`){if(n.text.trim().length>0)return null;continue}if(n.type===`tool-result`)return null}return null}function Y9t(e,t){return{displayText:G9t(e),toolOutput:K9t(e),toolCall:q9t(e,t)}}function X9t(e,t,n){return(0,y.useMemo)(()=>{let r=e[e.length-1],i=t===`streaming`,a=null,o=``;return r&&r.role===`assistant`&&(o=Y9t(r).displayText,a=J9t(r)),{uiState:n?`expanded`:`collapsed`,chatStatus:t,toolName:a,displayText:o,isStreaming:i,lastMessage:r}},[e,t,n])}function Z9t({initialOffset:e={x:0,y:0}}={}){let t=(0,y.useRef)(null),[n,r]=(0,y.useState)(!1),i=(0,y.useRef)(e),a=(0,y.useRef)({x:0,y:0}),o=(0,y.useRef)({x:0,y:0}),s=(0,y.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,y.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,y.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,y.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let Q9t=`AI_SELECTED_AGENT`,$9t=e=>{let[t,n]=(0,y.useState)(()=>{if(typeof window<`u`){let e=localStorage.getItem(Q9t);if(e)return e}return e}),[r,i]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{typeof window<`u`?zc().then(e=>{e&&e!==Nc&&n(e)}).finally(()=>{i(!0)}):i(!0)},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(Q9t,e):localStorage.removeItem(Q9t))},isReady:r}},een=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{},toolsReady:d=!0,mcpClient:f=null})=>{let[p,m]=(0,y.useState)(!1),[h,g]=(0,y.useState)(``),[_,v]=(0,y.useState)(`none`),[x,S]=(0,y.useState)(!0),{agent:C,setAgent:w,isReady:T}=$9t(Nc),[E,D]=(0,y.useState)(!1),[O,k]=(0,y.useState)(null),[A,M]=(0,y.useState)(!1),{uiState:N,chatStatus:P,toolName:I,displayText:L}=X9t(a,o,p),R=P===`submitted`||P===`streaming`,z=N===`expanded`&&!R,B=a.length>0&&P!==`error`||R,[ae,oe]=(0,y.useState)(null),se=(0,y.useRef)(null),ce=(0,y.useRef)(!1),le=e=>{let t=`${Ic()}/api/acp/cleanup-session`,n=JSON.stringify({sessionId:e});try{if(navigator.sendBeacon){let e=new Blob([n],{type:`application/json`});navigator.sendBeacon(t,e);return}}catch{}fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:n,keepalive:!0}).catch(()=>{})};(0,y.useEffect)(()=>{if(!T||!d)return;let e=!0,t=Mc.find(e=>e.name===C)||Mc[0];return(async()=>{if(se.current){try{await fetch(`${Ic()}/api/acp/cleanup-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:se.current})})}catch(e){console.warn(`[InspectorBar] Failed to cleanup previous session:`,e)}se.current=null,e&&oe(null)}console.log(`[InspectorBar] Initializing session for ${t.name}...`);try{let n=await fetch(`${Ic()}/api/acp/init-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({agent:t,envVars:{}})});if(!n.ok)throw Error(`Failed to init session`);let r=await n.json();e&&r.sessionId&&(console.log(`[InspectorBar] Session initialized: ${r.sessionId}`),oe(r.sessionId),se.current=r.sessionId,ce.current=!1)}catch(e){console.error(`[InspectorBar] Failed to initialize session:`,e)}})(),()=>{e=!1}},[C,T,d]),(0,y.useEffect)(()=>{let e=()=>{let e=se.current;!e||ce.current||(ce.current=!0,le(e))};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e)}},[]),(0,y.useEffect)(()=>()=>{let e=se.current;!e||ce.current||(ce.current=!0,console.log(`[InspectorBar] Cleaning up session on unmount: ${e}`),le(e))},[]);let fe=Mc.find(e=>e.name===C)||Mc[0],{elementRef:pe,isDragging:me,handleMouseDown:he}=Z9t(),[ge,_e]=(0,y.useState)(null),ve=(0,y.useRef)(null);(0,y.useEffect)(()=>{p&&ve.current&&ve.current.focus()},[p]),(0,y.useEffect)(()=>{if(!R&&!x){let e=setTimeout(()=>{S(!0)},2e3);return()=>clearTimeout(e)}},[R,x]),(0,y.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;_e({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;_e({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let ye=e=>{e.preventDefault(),h.trim()&&(_e(null),n(h,C,ae||void 0),g(``),v(`chat`))},be=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye(e)),e.key===`Escape`&&(m(!1),ve.current?.blur())},xe=o===`error`;return(0,b.jsxs)(b.Fragment,{children:[(p||_!==`none`)&&(0,b.jsx)(`div`,{className:`fixed inset-0 z-[999998] bg-transparent`,onClick:()=>{R||(m(!1),v(`none`))}}),(0,b.jsxs)(`div`,{ref:pe,className:Ct(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,p?`w-[480px]`:B?`w-auto min-w-[200px] max-w-[480px]`:`w-[190px]`,me?`cursor-grabbing`:`cursor-grab`),onMouseDown:he,onMouseEnter:()=>{!me&&x&&m(!0)},onMouseLeave:()=>{!h.trim()&&!me&&(m(!1),v(`none`)),S(!0)},children:[(0,b.jsxs)(`div`,{className:Ct(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,p?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,_===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,xe&&!p&&`bg-destructive/10 border-destructive/20`),children:[(0,b.jsxs)(`div`,{className:Ct(`flex items-center transition-opacity duration-300 w-full relative`,z?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[a.length===0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,b.jsx)(`img`,{src:fe?.meta?.icon,alt:C,className:`w-3.5 h-3.5`})}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3 whitespace-nowrap`,children:`⌥I or hover to inspect`})]}),B&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,b.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:R?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`absolute inset-1 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,b.jsx)(`img`,{src:fe?.meta?.icon,alt:C,className:`w-3.5 h-3.5 animate-pulse`})]}):ge?ge.status===`in-progress`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`absolute inset-1 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,b.jsx)(de,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):ge.status===`completed`?(0,b.jsx)(ee,{className:`w-5 h-5 text-green-500`}):(0,b.jsx)(te,{className:`w-5 h-5 text-red-500`}):xe?(0,b.jsx)(te,{className:`w-5 h-5 text-red-500`}):(0,b.jsx)(ee,{className:`w-5 h-5 text-green-500`})}),(0,b.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,b.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,b.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:ge&&ge.status===`in-progress`&&ge.currentStep?(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,b.jsx)(de,{className:`w-4 h-4 flex-shrink-0`}),(0,b.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,ge.currentStep.index,`/`,ge.currentStep.total,`: `,ge.currentStep.title]})]}):ge?.message?(0,b.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:ge.message}):I?(0,b.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,b.jsx)(de,{className:`w-4 h-4 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`truncate min-w-0`,children:I})]}):(0,b.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:R&&!L?(0,b.jsx)(Foe,{duration:2,spread:2,children:o===`submitted`&&fe?.command===`npx`?`Starting ${fe.name}... This may take a moment.`:`Thinking...`}):L||`Processing...`})})}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e===`chat`?`none`:`chat`),className:Ct(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,_===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:_===`chat`?`Collapse`:`Expand messages`,children:(0,b.jsx)(F,{className:Ct(`w-3.5 h-3.5 transition-transform duration-300`,_===`chat`&&`rotate-180`)})}),R&&(0,b.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,b.jsx)(ue,{className:`w-3 h-3`})})]})]})]}),(0,b.jsxs)(`div`,{className:Ct(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,z?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,b.jsx)(`button`,{onClick:t,className:Ct(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector (⌥I)`,children:(0,b.jsx)(ne,{className:`w-3.5 h-3.5`})}),(0,b.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`button`,{type:`button`,onClick:()=>M(!0),className:Ct(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,A&&`bg-accent/50 text-foreground`),title:`Context`,children:[(0,b.jsx)(re,{className:`w-3.5 h-3.5`}),s>0&&(0,b.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,b.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,b.jsxs)(`form`,{onSubmit:ye,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,b.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,b.jsx)(`button`,{type:`button`,onClick:()=>D(!E),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,b.jsx)(`img`,{src:Mc.find(e=>e.name===C)?.meta?.icon,alt:C,className:`w-3.5 h-3.5`})}),E&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>D(!1)}),(0,b.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-64 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:Mc.map(e=>(0,b.jsxs)(`div`,{className:Ct(`w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-accent transition-colors group`,C===e.name&&`bg-accent/50 font-medium`),children:[(0,b.jsxs)(`button`,{onClick:()=>{w(e.name),D(!1)},className:`flex items-center gap-2 flex-1 text-left`,children:[e.meta?.icon&&(0,b.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4 flex-shrink-0`}),(0,b.jsx)(`span`,{className:`flex-1`,children:e.name})]}),(e.configHint||e.configLink)&&(0,b.jsx)(`button`,{onClick:t=>{t.stopPropagation(),k(e.name)},className:`p-1 rounded hover:bg-accent-foreground/10 transition-colors`,title:`Configuration info`,children:(0,b.jsx)(ie,{className:`w-3.5 h-3.5 text-muted-foreground`})})]},e.name))})]})]}),(0,b.jsx)(`input`,{ref:ve,type:`text`,value:h,onChange:e=>g(e.target.value),onKeyDown:be,placeholder:`Ask ${C}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:R}),(a.length>0||R)&&(0,b.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e===`chat`?`none`:`chat`),className:Ct(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,_===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:_===`chat`?`Collapse`:`Expand messages`,children:(0,b.jsx)(F,{className:Ct(`w-3.5 h-3.5 transition-transform duration-300`,_===`chat`&&`rotate-180`)})}),R?(0,b.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,b.jsx)(ue,{className:`w-3 h-3`})}):(0,b.jsx)(`button`,{type:`submit`,disabled:!h.trim(),className:Ct(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,h.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,b.jsx)(j,{className:`w-3.5 h-3.5`})})]})]})]}),_!==`none`&&(0,b.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[480px] mx-auto animate-panel-in`,children:(0,b.jsx)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:_===`chat`&&(0,b.jsx)(`div`,{className:`h-[500px]`,children:(0,b.jsx)(W9t,{messages:a,status:o,selectedAgent:C})})})})]}),(0,b.jsx)(k7t,{open:A,onOpenChange:M,inspectionItems:l,onRemoveInspection:u,client:f,isClientReady:d}),O&&(()=>{let e=Mc.find(e=>e.name===O);return e?(0,b.jsx)(wt,{open:!!O,onOpenChange:()=>k(null),children:(0,b.jsxs)(Tt,{onClose:()=>k(null),className:`w-80`,children:[(0,b.jsxs)(Et,{children:[(0,b.jsxs)(Ot,{className:`flex items-center gap-3`,children:[e.meta?.icon&&(0,b.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-6 h-6`}),e.name]}),e.configHint&&(0,b.jsx)(kt,{children:e.configHint})]}),e.configLink&&(0,b.jsx)(`a`,{href:e.configLink,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-blue-500 hover:text-blue-600 underline`,children:`View ACP Documentation →`})]})}):null})()]})};var ten=`vercel.ai.error`,nen=Symbol.for(ten),ren,ien=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[ren]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,ten)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};ren=nen;var W7=ien;function aen(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var oen=`AI_InvalidArgumentError`,sen=`vercel.ai.error.${oen}`,cen=Symbol.for(sen),len,uen=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:oen,message:e,cause:t}),this[len]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,sen)}};len=cen;var den=`AI_JSONParseError`,fen=`vercel.ai.error.${den}`,pen=Symbol.for(fen),men,hen=class extends W7{constructor({text:e,cause:t}){super({name:den,message:`JSON parsing failed: Text: ${e}.
7068
7072
  Error message: ${aen(t)}`,cause:t}),this[men]=!0,this.text=e}static isInstance(e){return W7.hasMarker(e,fen)}};men=pen;var gen=`AI_TypeValidationError`,_en=`vercel.ai.error.${gen}`,ven=Symbol.for(_en),yen,ben=class e extends W7{constructor({value:e,cause:t}){super({name:gen,message:`Type validation failed: Value: ${JSON.stringify(e)}.
7069
7073
  Error message: ${aen(t)}`,cause:t}),this[yen]=!0,this.value=e}static isInstance(e){return W7.hasMarker(e,_en)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}};yen=ven;var G7=ben,xen=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Bo({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};Object.freeze({status:`aborted`});function K7(e,t,n){function r(n,r){var i;for(let a in Object.defineProperty(n,`_zod`,{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r),o.prototype)a in n||Object.defineProperty(n,a,{value:o.prototype[a].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var q7=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};let Sen={};function J7(e){return e&&Object.assign(Sen,e),Sen}function Cen(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function wen(e,t){return typeof t==`bigint`?t.toString():t}function Ten(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function Een(e){return e==null}function Den(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Oen(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function Y7(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function X7(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Z7(e){return JSON.stringify(e)}let ken=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Q7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let Aen=Ten(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function $7(e){if(Q7(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Q7(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}let jen=new Set([`string`,`number`,`symbol`]);function e9(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function t9(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function n9(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Men(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let Nen={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Pen(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return t9(e,{...e._zod.def,shape:n,checks:[]})}function Fen(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return t9(e,{...e._zod.def,shape:n,checks:[]})}function Ien(e,t){if(!$7(t))throw Error(`Invalid input to extend: expected a plain object`);return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return X7(this,`shape`,n),n},checks:[]})}function Len(e,t){return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return X7(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function Ren(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return t9(t,{...t._zod.def,shape:i,checks:[]})}function zen(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return t9(t,{...t._zod.def,shape:i,checks:[]})}function r9(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function i9(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function a9(e){return typeof e==`string`?e:e?.message}function o9(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=a9(e.inst?._zod.def?.error?.(e))??a9(t?.error?.(e))??a9(n.customError?.(e))??a9(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ben(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function s9(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let Ven=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),Object.defineProperty(e,`message`,{get(){return JSON.stringify(t,wen,2)},enumerable:!0}),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Hen=K7(`$ZodError`,Ven),Uen=K7(`$ZodError`,Ven,{Parent:Error});function Wen(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Gen(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}let Ken=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new q7;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw ken(t,i?.callee),t}return o.value},qen=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw ken(t,i?.callee),t}return o.value},Jen=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new q7;return a.issues.length?{success:!1,error:new(e??Hen)(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Yen=Jen(Uen),Xen=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Zen=Xen(Uen),Qen=/^[cC][^\s-]{8,}$/,$en=/^[0-9a-z]+$/,etn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ttn=/^[0-9a-vA-V]{20}$/,ntn=/^[A-Za-z0-9]{27}$/,rtn=/^[a-zA-Z0-9_-]{21}$/,itn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,atn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,otn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,stn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function ctn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let ltn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,utn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,dtn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ftn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ptn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mtn=/^[A-Za-z0-9_-]*$/,htn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,gtn=/^\+(?:[0-9]){6,14}[0-9]$/,_tn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,vtn=RegExp(`^${_tn}$`);function ytn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function btn(e){return RegExp(`^${ytn(e)}$`)}function xtn(e){let t=ytn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${_tn}T(?:${r})$`)}let Stn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ctn=/^\d+$/,wtn=/^-?\d+(?:\.\d+)?/i,Ttn=/true|false/i,Etn=/null/i,Dtn=/^[^A-Z]*$/,Otn=/^[^a-z]*$/,c9=K7(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ktn={number:`number`,bigint:`bigint`,object:`date`},Atn=K7(`$ZodCheckLessThan`,(e,t)=>{c9.init(e,t);let n=ktn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jtn=K7(`$ZodCheckGreaterThan`,(e,t)=>{c9.init(e,t);let n=ktn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mtn=K7(`$ZodCheckMultipleOf`,(e,t)=>{c9.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Oen(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ntn=K7(`$ZodCheckNumberFormat`,(e,t)=>{c9.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Nen[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ctn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),Ptn=K7(`$ZodCheckMaxLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Een(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ben(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ftn=K7(`$ZodCheckMinLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Een(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ben(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Itn=K7(`$ZodCheckLengthEquals`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Een(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ben(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),l9=K7(`$ZodCheckStringFormat`,(e,t)=>{var n,r;c9.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ltn=K7(`$ZodCheckRegex`,(e,t)=>{l9.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Rtn=K7(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Dtn,l9.init(e,t)}),ztn=K7(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Otn,l9.init(e,t)}),Btn=K7(`$ZodCheckIncludes`,(e,t)=>{c9.init(e,t);let n=e9(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Vtn=K7(`$ZodCheckStartsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`^${e9(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Htn=K7(`$ZodCheckEndsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`.*${e9(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Utn=K7(`$ZodCheckOverwrite`,(e,t)=>{c9.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Wtn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
7070
7074
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
5
5
  "type": "module",
6
6
  "license": "MIT",