@mcpc-tech/unplugin-dev-inspector-mcp 0.0.2-beta.21 → 0.0.2-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/dist/inspector.iife.js +1 -1
- package/dist/index.cjs +1391 -1207
- package/dist/index.d.cts +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +1391 -1207
- package/package.json +7 -7
|
@@ -6833,7 +6833,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
|
|
|
6833
6833
|
`)||(e.endsWith("```\n")||e.endsWith("```"))&&t%2==0)return e;let r=e.match(wtn);if(r&&!n){let t=r[2];if(!t||L7.test(t))return e;if(Btn(e)%2==1)return`${e}\``}return e},Htn=e=>{let t=e.match(Ttn);if(t){let n=t[2];if(!n||L7.test(n))return e;if((e.match(/~~/g)||[]).length%2==1)return`${e}~~`}return e},Utn=e=>{if((e.match(/\$\$/g)||[]).length%2==0)return e;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
6834
6834
|
`,t)!==-1&&!e.endsWith(`
|
|
6835
6835
|
`)?`${e}
|
|
6836
|
-
$$`:`${e}$$`},Wtn=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},Gtn=e=>{if(z7(e)||Atn.test(e))return e;let t=e.match(xtn);if(t){let n=t[2];if(!n||L7.test(n))return e;if(Wtn(e)%2==1)return`${e}***`}return e},Ktn=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=jtn(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=Gtn(t),t=Mtn(t),t=Ntn(t),t=Ftn(t),t=Rtn(t),t=Vtn(t),t=Htn(t),t=Utn(t),t)},qtn={harden:[Kme,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:NSe,katex:[By,{errorColor:`var(--color-muted-foreground)`}]},Jtn={gfm:[QTe,{}],math:[uEe,{singleDollarTextMath:!1}],cjkFriendly:[fCe,{}],cjkFriendlyGfmStrikethrough:[mCe,{}]},Ytn=(0,_.createContext)([`github-light`,`github-dark`]),Xtn=(0,_.createContext)(void 0),Ztn=(0,_.createContext)(!0),B7=(0,_.createContext)({isAnimating:!1}),Qtn=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?Ktn(e.trim()):e,[e,t]);return(0,S.jsx)(Vme,{...n,children:r})},(e,t)=>e.content===t.content);Qtn.displayName=`Block`;var $tn=[`github-light`,`github-dark`],enn=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(qtn),remarkPlugins:i=Object.values(Jtn),className:a,shikiTheme:o=$tn,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=Qtn,parseMarkdownIntoBlocksFn:m=_tn,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===By:e===By)&&Promise.resolve().then(()=>p(fen(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(Ytn.Provider,{value:o,children:(0,S.jsx)(Xtn.Provider,{value:s,children:(0,S.jsx)(Ztn.Provider,{value:l,children:(0,S.jsx)(B7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:N7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...ftn,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);enn.displayName=`Streamdown`;let tnn=(0,_.createContext)(null),nnn=()=>{let e=(0,_.useContext)(tnn);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},rnn=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=ht({prop:n,defaultProp:r,onChange:i}),[d,f]=ht({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(tnn.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(Ki,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),inn=(e,t)=>e||t===0?(0,S.jsx)(Fce,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),ann=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=nnn();return(0,S.jsx)(qi,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ii,{className:`size-4`}),inn(r,a),(0,S.jsx)(ai,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),onn=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Ji,{className:nt(`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,S.jsx)(enn,{...n,children:t})}));rnn.displayName=`Reasoning`,ann.displayName=`ReasoningTrigger`,onn.displayName=`ReasoningContent`,(0,_.createContext)(null);let snn=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(enn,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);snn.displayName=`MessageResponse`;let cnn=(0,_.createContext)({code:``}),lnn={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 unn(e,t,n=!1){let r=n?[lnn]:[];return await Promise.all([fXe(e,{lang:t,theme:`one-light`,transformers:r}),fXe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let V7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(unn(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(cnn.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden 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,S.jsx)(`div`,{className:`hidden overflow-hidden 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,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},dnn=({className:e,...t})=>(0,S.jsx)(Ki,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),fnn=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,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(di,{className:`size-4`}),"input-available":(0,S.jsx)(fi,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(fi,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(ci,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(ci,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(ui,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(ui,{className:`size-4 text-orange-600`})}[e],t[e]]})},pnn=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(qi,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Ci,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),fnn(r)]}),(0,S.jsx)(ai,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),mnn=({className:e,...t})=>(0,S.jsx)(Ji,{className:nt(`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}),hnn=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(V7,{code:JSON.stringify(t,null,2),language:`json`})})]}),gnn=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(V7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(V7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function _nn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function vnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@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 ynn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let bnn=(0,_.createContext)(null),xnn=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(bnn.Provider,{value:{isStreaming:t},children:(0,S.jsx)(Ki,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(_nn,{className:nt(`shadow-none`,e),children:n})})}),Snn=({className:e,...t})=>(0,S.jsx)(vnn,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),Cnn=e=>(0,S.jsx)(Ji,{asChild:!0,children:(0,S.jsx)(ynn,{"data-slot":`plan-content`,...e})}),wnn=({className:e,...t})=>(0,S.jsx)(qi,{asChild:!0,children:(0,S.jsxs)(Mi,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(oi,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function Tnn(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function Enn(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(snn,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(rnn,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(ann,{}),(0,S.jsx)(onn,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(xnn,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(Snn,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(wnn,{className:`mb-2`})]})}),(0,S.jsx)(Cnn,{children:(0,S.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,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.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(Tnn(e)){let r=e.type,i=e.state,a=i===`output-available`||i===`output-error`;return(0,S.jsxs)(dnn,{defaultOpen:a,children:[(0,S.jsx)(pnn,{type:r,state:i}),(0,S.jsxs)(mnn,{children:[e.input!==void 0&&(0,S.jsx)(hnn,{input:e.input}),a&&(0,S.jsx)(gnn,{output:e.output?(0,S.jsx)(V7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let H7=[{name:`Claude Code`,command:`npx`,args:[`-y`,`@zed-industries/claude-code-acp`],env:[{key:`ANTHROPIC_API_KEY`,required:!1},{key:`ANTHROPIC_BASE_URL`,required:!1}],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/claude-color.svg`}},{name:`Codex CLI`,command:`npx`,args:[`-y`,`@zed-industries/codex-acp`],env:[{key:`AI_GATEWAY_API_KEY`,required:!1}],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/openai.svg`}},{name:`Gemini CLI`,command:`npx`,args:[`@google/gemini-cli`,`--experimental-acp`],env:[{key:`GEMINI_API_KEY`,required:!1}],authMethodId:`gemini-api-key`,meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/gemini-color.svg`}},{name:`Kimi CLI`,command:`kimi`,args:[`--acp`],env:[],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/moonshot.svg`}},{name:`Goose`,command:`goose`,args:[`acp`],env:[],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/goose.svg`}},{name:`Opencode`,command:`npx`,args:[`-y`,`opencode-ai`,`acp`],env:[],meta:{icon:`https://avatars.githubusercontent.com/u/66570915?s=48&v=4`}},{name:`Cursor Agent`,command:`npx`,args:[`cursor-agent-acp`],env:[],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/cursor.svg`}}],Dnn=`Claude Code`,Onn=({messages:e,status:t,selectedAgent:n})=>{let r=H7.find(e=>e.name===(n||Dnn))||H7[0];return(0,S.jsx)(`div`,{className:`flex flex-col w-full h-full min-h-0 bg-background`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,S.jsxs)(qce,{className:`h-full`,children:[(0,S.jsxs)(Jce,{className:`h-full overflow-y-auto p-4 space-y-4`,children:[e.length===0?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):e.map(e=>(0,S.jsxs)(Ole,{className:`items-start`,from:e.role,children:[(0,S.jsx)(kle,{children:e.parts.map((n,r)=>Enn(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(Ale,{name:r.name,src:r.meta?.icon??``})]},e.id)),t===`submitted`&&(0,S.jsx)(Mle,{})]}),(0,S.jsx)(Yce,{})]})})})};function knn(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function Ann({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.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,_.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,_.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,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let jnn=({isActive:e,onToggleInspector:t,onSubmitAgent:n,isAgentWorking:r,messages:i,status:a,inspectionCount:o=0,inspectionItems:s=[],onRemoveInspection:l=()=>{}})=>{let[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(`none`),[y,b]=(0,_.useState)(!1),[x,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!0),[E,D]=(0,_.useState)(Dnn),[O,k]=(0,_.useState)(!1),{elementRef:A,isDragging:j,handleMouseDown:M}=Ann(),[N,P]=(0,_.useState)(null),[F,I]=(0,_.useState)(``),L=knn(F,r,50),[R,ee]=(0,_.useState)(``),te=(0,_.useRef)(``),z=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=L,t=te.current;if(e.length<t.length||!e.startsWith(t)){ee(e),te.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&ee(n),te.current=e}},[L]);let B=(0,_.useRef)(null),ne=(0,_.useRef)(null),re=(0,_.useRef)(null),ie=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(i.length===0){I(``),h(null),re.current=null,ie.current=!1,ee(``),te.current=``;return}let e=i[i.length-1];if(e.role!==`assistant`)return;let t=Rce(e),{displayText:n,toolCall:r}=Bce(e,t||re.current);I(n||``),t&&(re.current=t),r?(ne.current&&=(clearTimeout(ne.current),null),h(r),ie.current=!0):ie.current=!1},[i]),(0,_.useEffect)(()=>{R!==z.current&&(ie.current||h(null),z.current=R)},[R]),(0,_.useEffect)(()=>{u&&B.current&&B.current.focus()},[u]),(0,_.useEffect)(()=>{if(!r&&x){b(!1),C(!1),T(!1);let e=setTimeout(()=>{T(!0)},2e3);return()=>clearTimeout(e)}},[r,x]),(0,_.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;P({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;P({id:r,status:t,message:n?.message||n}),setTimeout(()=>{P(null)},3e3)}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 ae=e=>{e.preventDefault(),f.trim()&&(ne.current&&=(clearTimeout(ne.current),null),h(null),I(``),re.current=null,b(!0),C(!0),n(f,E),p(``),g===`none`&&(d(!1),B.current?.blur()))},oe=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ae(e)),e.key===`Escape`&&(d(!1),B.current?.blur())},se=a===`error`,ce=i.length>0,le=u&&!y,ue=(!u||y)&&(r||ce||N);return(0,S.jsxs)(`div`,{ref:A,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,u?`w-[450px]`:ue?`w-auto min-w-[200px] max-w-[450px]`:`w-[160px]`,j?`cursor-grabbing`:`cursor-grab`),onMouseDown:M,onMouseEnter:()=>{!x&&w&&!j&&d(!0)},onMouseLeave:()=>{!f.trim()&&!x&&!j&&(d(!1),v(`none`)),T(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,u?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,g===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,se&&!u&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,le?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!ue&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(bi,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3`,children:`Hover to inspect`})]}),ue&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(bi,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):N?N.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(xi,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):N.status===`completed`?(0,S.jsx)(li,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(ui,{className:`w-5 h-5 text-red-500`}):se?(0,S.jsx)(ui,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(li,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:N&&N.status===`in-progress`&&N.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(xi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,N.currentStep.index,`/`,N.currentStep.total,`: `,N.currentStep.title]})]}):N?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:N.message}):m?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(xi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:m})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:r&&!R?(0,S.jsx)(Fce,{duration:2,spread:2,children:`Thinking...`}):R||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,le?`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,S.jsx)(`button`,{onClick:t,className:nt(`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`,children:(0,S.jsx)(pi,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),o>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>v(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,g===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(mi,{className:`w-3.5 h-3.5`}),(0,S.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:o>99?`99+`:o})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:ae,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>k(!O),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:H7.find(e=>e.name===E)?.meta?.icon,alt:E,className:`w-3.5 h-3.5`})}),O&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>k(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-48 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:H7.map(e=>(0,S.jsxs)(`button`,{onClick:()=>{D(e.name),k(!1)},className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-accent transition-colors`,E===e.name&&`bg-accent/50 font-medium`),children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4`}),e.name]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:B,type:`text`,value:f,onChange:e=>p(e.target.value),onKeyDown:oe,placeholder:`Ask ${E}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7`,tabIndex:0}),(i.length>0||r||x)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,g===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:g===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(wee,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,g===`chat`&&`rotate-180`)})}),(0,S.jsx)(`button`,{type:`submit`,disabled:!f.trim()||r,className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,f.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:r?(0,S.jsx)(bi,{className:`w-3.5 h-3.5 animate-spin`}):(0,S.jsx)(ri,{className:`w-3.5 h-3.5`})})]})]})]}),g!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[g===`inspections`&&s.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(ta,{items:s,onRemove:l})}),g===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(Onn,{messages:i,status:a,selectedAgent:E})})]})})]})};var Mnn=`vercel.ai.error`,Nnn=Symbol.for(Mnn),Pnn,Fnn=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Pnn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Mnn)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Pnn=Nnn;var U7=Fnn;function Inn(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var Lnn=`AI_InvalidArgumentError`,Rnn=`vercel.ai.error.${Lnn}`,znn=Symbol.for(Rnn),Bnn,Vnn=class extends U7{constructor({message:e,cause:t,argument:n}){super({name:Lnn,message:e,cause:t}),this[Bnn]=!0,this.argument=n}static isInstance(e){return U7.hasMarker(e,Rnn)}};Bnn=znn;var Hnn=`AI_JSONParseError`,Unn=`vercel.ai.error.${Hnn}`,Wnn=Symbol.for(Unn),Gnn,Knn=class extends U7{constructor({text:e,cause:t}){super({name:Hnn,message:`JSON parsing failed: Text: ${e}.
|
|
6836
|
+
$$`:`${e}$$`},Wtn=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},Gtn=e=>{if(z7(e)||Atn.test(e))return e;let t=e.match(xtn);if(t){let n=t[2];if(!n||L7.test(n))return e;if(Wtn(e)%2==1)return`${e}***`}return e},Ktn=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=jtn(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=Gtn(t),t=Mtn(t),t=Ntn(t),t=Ftn(t),t=Rtn(t),t=Vtn(t),t=Htn(t),t=Utn(t),t)},qtn={harden:[Kme,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:NSe,katex:[By,{errorColor:`var(--color-muted-foreground)`}]},Jtn={gfm:[QTe,{}],math:[uEe,{singleDollarTextMath:!1}],cjkFriendly:[fCe,{}],cjkFriendlyGfmStrikethrough:[mCe,{}]},Ytn=(0,_.createContext)([`github-light`,`github-dark`]),Xtn=(0,_.createContext)(void 0),Ztn=(0,_.createContext)(!0),B7=(0,_.createContext)({isAnimating:!1}),Qtn=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?Ktn(e.trim()):e,[e,t]);return(0,S.jsx)(Vme,{...n,children:r})},(e,t)=>e.content===t.content);Qtn.displayName=`Block`;var $tn=[`github-light`,`github-dark`],enn=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(qtn),remarkPlugins:i=Object.values(Jtn),className:a,shikiTheme:o=$tn,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=Qtn,parseMarkdownIntoBlocksFn:m=_tn,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===By:e===By)&&Promise.resolve().then(()=>p(fen(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(Ytn.Provider,{value:o,children:(0,S.jsx)(Xtn.Provider,{value:s,children:(0,S.jsx)(Ztn.Provider,{value:l,children:(0,S.jsx)(B7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:N7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...ftn,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);enn.displayName=`Streamdown`;let tnn=(0,_.createContext)(null),nnn=()=>{let e=(0,_.useContext)(tnn);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},rnn=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=ht({prop:n,defaultProp:r,onChange:i}),[d,f]=ht({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(tnn.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(Ki,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),inn=(e,t)=>e||t===0?(0,S.jsx)(Fce,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),ann=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=nnn();return(0,S.jsx)(qi,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(ii,{className:`size-4`}),inn(r,a),(0,S.jsx)(ai,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),onn=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Ji,{className:nt(`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,S.jsx)(enn,{...n,children:t})}));rnn.displayName=`Reasoning`,ann.displayName=`ReasoningTrigger`,onn.displayName=`ReasoningContent`,(0,_.createContext)(null);let snn=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(enn,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);snn.displayName=`MessageResponse`;let cnn=(0,_.createContext)({code:``}),lnn={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 unn(e,t,n=!1){let r=n?[lnn]:[];return await Promise.all([fXe(e,{lang:t,theme:`one-light`,transformers:r}),fXe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let V7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(unn(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(cnn.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden 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,S.jsx)(`div`,{className:`hidden overflow-hidden 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,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},dnn=({className:e,...t})=>(0,S.jsx)(Ki,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),fnn=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,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(di,{className:`size-4`}),"input-available":(0,S.jsx)(fi,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(fi,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(ci,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(ci,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(ui,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(ui,{className:`size-4 text-orange-600`})}[e],t[e]]})},pnn=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(qi,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(Ci,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),fnn(r)]}),(0,S.jsx)(ai,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),mnn=({className:e,...t})=>(0,S.jsx)(Ji,{className:nt(`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}),hnn=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(V7,{code:JSON.stringify(t,null,2),language:`json`})})]}),gnn=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(V7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(V7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function _nn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function vnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@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 ynn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let bnn=(0,_.createContext)(null),xnn=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(bnn.Provider,{value:{isStreaming:t},children:(0,S.jsx)(Ki,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(_nn,{className:nt(`shadow-none`,e),children:n})})}),Snn=({className:e,...t})=>(0,S.jsx)(vnn,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),Cnn=e=>(0,S.jsx)(Ji,{asChild:!0,children:(0,S.jsx)(ynn,{"data-slot":`plan-content`,...e})}),wnn=({className:e,...t})=>(0,S.jsx)(qi,{asChild:!0,children:(0,S.jsxs)(Mi,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(oi,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function Tnn(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function Enn(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(snn,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(rnn,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(ann,{}),(0,S.jsx)(onn,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(xnn,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(Snn,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(wnn,{className:`mb-2`})]})}),(0,S.jsx)(Cnn,{children:(0,S.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,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.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(Tnn(e)){let r=e.input,i=r.toolName,a=e.state,o=a===`output-available`||a===`output-error`;return(0,S.jsxs)(dnn,{defaultOpen:o,children:[(0,S.jsx)(pnn,{title:i,type:i,state:a}),(0,S.jsxs)(mnn,{children:[e.input!==void 0&&(0,S.jsx)(hnn,{input:r}),o&&(0,S.jsx)(gnn,{output:e.output?(0,S.jsx)(V7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let H7=[{name:`Claude Code`,command:`npx`,args:[`-y`,`@zed-industries/claude-code-acp`],env:[{key:`ANTHROPIC_API_KEY`,required:!1},{key:`ANTHROPIC_BASE_URL`,required:!1}],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/claude-color.svg`}},{name:`Codex CLI`,command:`npx`,args:[`-y`,`@zed-industries/codex-acp`],env:[{key:`AI_GATEWAY_API_KEY`,required:!1}],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/openai.svg`}},{name:`Gemini CLI`,command:`npx`,args:[`@google/gemini-cli`,`--experimental-acp`],env:[{key:`GEMINI_API_KEY`,required:!1}],authMethodId:`gemini-api-key`,meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/gemini-color.svg`}},{name:`Kimi CLI`,command:`kimi`,args:[`--acp`],env:[],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/moonshot.svg`}},{name:`Goose`,command:`goose`,args:[`acp`],env:[],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/goose.svg`}},{name:`Opencode`,command:`npx`,args:[`-y`,`opencode-ai`,`acp`],env:[],meta:{icon:`https://avatars.githubusercontent.com/u/66570915?s=48&v=4`}},{name:`Cursor Agent`,command:`npx`,args:[`cursor-agent-acp`],env:[],meta:{icon:`https://unpkg.com/@lobehub/icons-static-svg@1.73.0/icons/cursor.svg`}}],Dnn=`Claude Code`,Onn=({messages:e,status:t,selectedAgent:n})=>{let r=H7.find(e=>e.name===(n||Dnn))||H7[0];return(0,S.jsx)(`div`,{className:`flex flex-col w-full h-full min-h-0 bg-background`,children:(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,S.jsxs)(qce,{className:`h-full`,children:[(0,S.jsxs)(Jce,{className:`h-full overflow-y-auto p-4 space-y-4`,children:[e.length===0?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):e.map(e=>(0,S.jsxs)(Ole,{className:`items-start`,from:e.role,children:[(0,S.jsx)(kle,{children:e.parts.map((n,r)=>Enn(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(Ale,{name:r.name,src:r.meta?.icon??``})]},e.id)),t===`submitted`&&(0,S.jsx)(Mle,{})]}),(0,S.jsx)(Yce,{})]})})})};function knn(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function Ann({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.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,_.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,_.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,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let jnn=({isActive:e,onToggleInspector:t,onSubmitAgent:n,isAgentWorking:r,messages:i,status:a,inspectionCount:o=0,inspectionItems:s=[],onRemoveInspection:l=()=>{}})=>{let[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(``),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(`none`),[y,b]=(0,_.useState)(!1),[x,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!0),[E,D]=(0,_.useState)(Dnn),[O,k]=(0,_.useState)(!1),{elementRef:A,isDragging:j,handleMouseDown:M}=Ann(),[N,P]=(0,_.useState)(null),[F,I]=(0,_.useState)(``),L=knn(F,r,50),[R,ee]=(0,_.useState)(``),te=(0,_.useRef)(``),z=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=L,t=te.current;if(e.length<t.length||!e.startsWith(t)){ee(e),te.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&ee(n),te.current=e}},[L]);let B=(0,_.useRef)(null),ne=(0,_.useRef)(null),re=(0,_.useRef)(null),ie=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(i.length===0){I(``),h(null),re.current=null,ie.current=!1,ee(``),te.current=``;return}let e=i[i.length-1];if(e.role!==`assistant`)return;let t=Rce(e),{displayText:n,toolCall:r}=Bce(e,t||re.current);I(n||``),t&&(re.current=t),r?(ne.current&&=(clearTimeout(ne.current),null),h(r),ie.current=!0):ie.current=!1},[i]),(0,_.useEffect)(()=>{R!==z.current&&(ie.current||h(null),z.current=R)},[R]),(0,_.useEffect)(()=>{u&&B.current&&B.current.focus()},[u]),(0,_.useEffect)(()=>{if(!r&&x){b(!1),C(!1),T(!1);let e=setTimeout(()=>{T(!0)},2e3);return()=>clearTimeout(e)}},[r,x]),(0,_.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;P({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;P({id:r,status:t,message:n?.message||n}),setTimeout(()=>{P(null)},3e3)}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 ae=e=>{e.preventDefault(),f.trim()&&(ne.current&&=(clearTimeout(ne.current),null),h(null),I(``),re.current=null,b(!0),C(!0),n(f,E),p(``),g===`none`&&(d(!1),B.current?.blur()))},oe=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ae(e)),e.key===`Escape`&&(d(!1),B.current?.blur())},se=a===`error`,ce=i.length>0,le=u&&!y,ue=(!u||y)&&(r||ce||N);return(0,S.jsxs)(`div`,{ref:A,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,u?`w-[450px]`:ue?`w-auto min-w-[200px] max-w-[450px]`:`w-[160px]`,j?`cursor-grabbing`:`cursor-grab`),onMouseDown:M,onMouseEnter:()=>{!x&&w&&!j&&d(!0)},onMouseLeave:()=>{!f.trim()&&!x&&!j&&(d(!1),v(`none`)),T(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,u?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,g===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,se&&!u&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,le?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!ue&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(bi,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3`,children:`Hover to inspect`})]}),ue&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:r?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(bi,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):N?N.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(xi,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):N.status===`completed`?(0,S.jsx)(li,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(ui,{className:`w-5 h-5 text-red-500`}):se?(0,S.jsx)(ui,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(li,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:N&&N.status===`in-progress`&&N.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(xi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,N.currentStep.index,`/`,N.currentStep.total,`: `,N.currentStep.title]})]}):N?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:N.message}):m?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(xi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:m})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:r&&!R?(0,S.jsx)(Fce,{duration:2,spread:2,children:`Thinking...`}):R||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,le?`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,S.jsx)(`button`,{onClick:t,className:nt(`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`,children:(0,S.jsx)(pi,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),o>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>v(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,g===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(mi,{className:`w-3.5 h-3.5`}),(0,S.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:o>99?`99+`:o})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:ae,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>k(!O),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:H7.find(e=>e.name===E)?.meta?.icon,alt:E,className:`w-3.5 h-3.5`})}),O&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>k(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-48 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:H7.map(e=>(0,S.jsxs)(`button`,{onClick:()=>{D(e.name),k(!1)},className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-accent transition-colors`,E===e.name&&`bg-accent/50 font-medium`),children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4`}),e.name]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:B,type:`text`,value:f,onChange:e=>p(e.target.value),onKeyDown:oe,placeholder:`Ask ${E}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7`,tabIndex:0}),(i.length>0||r||x)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>v(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,g===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:g===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(wee,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,g===`chat`&&`rotate-180`)})}),(0,S.jsx)(`button`,{type:`submit`,disabled:!f.trim()||r,className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,f.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:r?(0,S.jsx)(bi,{className:`w-3.5 h-3.5 animate-spin`}):(0,S.jsx)(ri,{className:`w-3.5 h-3.5`})})]})]})]}),g!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[g===`inspections`&&s.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(ta,{items:s,onRemove:l})}),g===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(Onn,{messages:i,status:a,selectedAgent:E})})]})})]})};var Mnn=`vercel.ai.error`,Nnn=Symbol.for(Mnn),Pnn,Fnn=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Pnn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Mnn)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Pnn=Nnn;var U7=Fnn;function Inn(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var Lnn=`AI_InvalidArgumentError`,Rnn=`vercel.ai.error.${Lnn}`,znn=Symbol.for(Rnn),Bnn,Vnn=class extends U7{constructor({message:e,cause:t,argument:n}){super({name:Lnn,message:e,cause:t}),this[Bnn]=!0,this.argument=n}static isInstance(e){return U7.hasMarker(e,Rnn)}};Bnn=znn;var Hnn=`AI_JSONParseError`,Unn=`vercel.ai.error.${Hnn}`,Wnn=Symbol.for(Unn),Gnn,Knn=class extends U7{constructor({text:e,cause:t}){super({name:Hnn,message:`JSON parsing failed: Text: ${e}.
|
|
6837
6837
|
Error message: ${Inn(t)}`,cause:t}),this[Gnn]=!0,this.text=e}static isInstance(e){return U7.hasMarker(e,Unn)}};Gnn=Wnn;var qnn=`AI_TypeValidationError`,Jnn=`vercel.ai.error.${qnn}`,Ynn=Symbol.for(Jnn),Xnn,Znn=class e extends U7{constructor({value:e,cause:t}){super({name:qnn,message:`Type validation failed: Value: ${JSON.stringify(e)}.
|
|
6838
6838
|
Error message: ${Inn(t)}`,cause:t}),this[Xnn]=!0,this.value=e}static isInstance(e){return U7.hasMarker(e,Jnn)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}};Xnn=Ynn;var W7=Znn,Qnn=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=_l({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 G7(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 K7=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};let $nn={};function q7(e){return e&&Object.assign($nn,e),$nn}function ern(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 trn(e,t){return typeof t==`bigint`?t.toString():t}function nrn(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function rrn(e){return e==null}function irn(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function arn(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 J7(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 Y7(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function X7(e){return JSON.stringify(e)}let orn=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Z7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let srn=nrn(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Q7(e){if(Z7(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Z7(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}let crn=new Set([`string`,`number`,`symbol`]);function $7(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function e9(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function t9(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 lrn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let urn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function drn(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 e9(e,{...e._zod.def,shape:n,checks:[]})}function frn(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 e9(e,{...e._zod.def,shape:n,checks:[]})}function prn(e,t){if(!Q7(t))throw Error(`Invalid input to extend: expected a plain object`);return e9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Y7(this,`shape`,n),n},checks:[]})}function mrn(e,t){return e9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Y7(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function hrn(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 e9(t,{...t._zod.def,shape:i,checks:[]})}function grn(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 e9(t,{...t._zod.def,shape:i,checks:[]})}function n9(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function r9(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function i9(e){return typeof e==`string`?e:e?.message}function a9(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=i9(e.inst?._zod.def?.error?.(e))??i9(t?.error?.(e))??i9(n.customError?.(e))??i9(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function _rn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function o9(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let vrn=(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,trn,2)},enumerable:!0}),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},yrn=G7(`$ZodError`,vrn),brn=G7(`$ZodError`,vrn,{Parent:Error});function xrn(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 Srn(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 Crn=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 K7;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>a9(e,a,q7())));throw orn(t,i?.callee),t}return o.value},wrn=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=>a9(e,a,q7())));throw orn(t,i?.callee),t}return o.value},Trn=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 K7;return a.issues.length?{success:!1,error:new(e??yrn)(a.issues.map(e=>a9(e,i,q7())))}:{success:!0,data:a.value}},Ern=Trn(brn),Drn=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=>a9(e,i,q7())))}:{success:!0,data:a.value}},Orn=Drn(brn),krn=/^[cC][^\s-]{8,}$/,Arn=/^[0-9a-z]+$/,jrn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mrn=/^[0-9a-vA-V]{20}$/,Nrn=/^[A-Za-z0-9]{27}$/,Prn=/^[a-zA-Z0-9_-]{21}$/,Frn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Irn=/^([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})$/,Lrn=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)$/,Rrn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function zrn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Brn=/^(?:(?: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])$/,Vrn=/^(([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})$/,Hrn=/^((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])$/,Urn=/^(([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])$/,Wrn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Grn=/^[A-Za-z0-9_-]*$/,Krn=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,qrn=/^\+(?:[0-9]){6,14}[0-9]$/,Jrn=`(?:(?:\\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])))`,Yrn=RegExp(`^${Jrn}$`);function Xrn(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 Zrn(e){return RegExp(`^${Xrn(e)}$`)}function Qrn(e){let t=Xrn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Jrn}T(?:${r})$`)}let $rn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ein=/^\d+$/,tin=/^-?\d+(?:\.\d+)?/i,nin=/true|false/i,rin=/null/i,iin=/^[^A-Z]*$/,ain=/^[^a-z]*$/,s9=G7(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),oin={number:`number`,bigint:`bigint`,object:`date`},sin=G7(`$ZodCheckLessThan`,(e,t)=>{s9.init(e,t);let n=oin[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})}}),cin=G7(`$ZodCheckGreaterThan`,(e,t)=>{s9.init(e,t);let n=oin[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})}}),lin=G7(`$ZodCheckMultipleOf`,(e,t)=>{s9.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):arn(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})}}),uin=G7(`$ZodCheckNumberFormat`,(e,t)=>{s9.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=urn[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=ein)}),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})}}),din=G7(`$ZodCheckMaxLength`,(e,t)=>{var n;s9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!rrn(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=_rn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fin=G7(`$ZodCheckMinLength`,(e,t)=>{var n;s9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!rrn(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=_rn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pin=G7(`$ZodCheckLengthEquals`,(e,t)=>{var n;s9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!rrn(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=_rn(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})}}),c9=G7(`$ZodCheckStringFormat`,(e,t)=>{var n,r;s9.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=()=>{})}),min=G7(`$ZodCheckRegex`,(e,t)=>{c9.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})}}),hin=G7(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=iin,c9.init(e,t)}),gin=G7(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ain,c9.init(e,t)}),_in=G7(`$ZodCheckIncludes`,(e,t)=>{s9.init(e,t);let n=$7(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})}}),vin=G7(`$ZodCheckStartsWith`,(e,t)=>{s9.init(e,t);let n=RegExp(`^${$7(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})}}),yin=G7(`$ZodCheckEndsWith`,(e,t)=>{s9.init(e,t);let n=RegExp(`.*${$7(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})}}),bin=G7(`$ZodCheckOverwrite`,(e,t)=>{s9.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var xin=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(`
|
|
6839
6839
|
`).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(`
|