@nathanstephenson/flow 0.1.6 → 0.1.7

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.
@@ -1,5 +1,5 @@
1
- import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{Cr as a,T as o,g as s,m as c,t as l,vr as u,y as d}from"./input-D9fbSfQF.js";import{G as f,a as p,c as m,n as h,r as g,s as _,t as v}from"./switch-DEvHojwW.js";function y(e){if(!e)return;let{used:t,window:n}=e;return n>0?`context ${Math.round(t/n*100)}%`:`${t} tokens`}function b(e){if(!e||e.window<=0)return;let{used:t,window:n,spend:r}=e,i=[{label:`Context`,value:`${Math.round(t/n*100)}% · ${S(t)}/${S(n)} tokens`}];if(!r)return i;if(i.push({label:`Spent`,value:`${S(r.tokens)} tokens · ${x(r.costUSD)}`}),i.push({label:`Cache reads`,value:`${S(r.cached)} of ${S(r.tokens)}`}),r.models.length>1)for(let e of r.models)i.push({label:e.id,value:`${S(e.tokens)} · ${x(e.costUSD)}`,model:!0});return i}function x(e){return e>=.01?`$${e.toFixed(2)}`:e===0?`$0.00`:`$${e.toFixed(4)}`}function S(e){return e>=1e6?`${Math.round(e/1e5)/10}M`:e>=1e3?`${Math.round(e/1e3)}k`:`${e}`}function C(e){return e.lifecycle===`live`?e.awaiting?`awaiting`:e.turnInFlight?`running`:`idle`:e.lifecycle}function w(e){return e===`running`||e===`awaiting`}var T=[`needs-input`,`unread`,`working`,`idle`,`dormant`,`filed-away`];function E(e){return e.status===`settled`||e.status===`ended`?`filed-away`:e.attention?.group===`needs-input`?`needs-input`:e.attention?.group===`unread`?`unread`:e.status===`running`||e.status===`awaiting`||O(e)?`working`:e.status===`idle`?`idle`:`dormant`}function D(e){switch(e){case`needs-input`:return`Needs input`;case`unread`:return`Unread`;case`working`:return`Working`;case`idle`:return`Idle`;case`dormant`:return`Dormant`;case`filed-away`:return`Filed away`}}function O(e){return e.status===`idle`&&e.activeSubagents+e.activeBackgroundCalls+(e.activeWorkflows??0)>0}function k(e){return e!==`settled`&&e!==`ended`}function ee(e){return e===`dormant`||e===`settled`}function te(e){let t={tokens:0,cached:0,costUSD:0,models:[]};for(let n of e){t.tokens+=n.tokens,t.cached+=n.cached,t.costUSD+=n.costUSD;for(let e of n.models){let n=t.models.find(t=>t.id===e.id);n?(n.tokens+=e.tokens,n.cached+=e.cached,n.costUSD+=e.costUSD):t.models.push({...e})}}return t}function A(){return{status:`idle`,lifecycle:`live`,turnInFlight:!1,entries:[],queue:[],activeSubagents:0,activeBackgroundCalls:0,lastSeq:0}}function ne(e){return e===`running`||e===`waiting`}function re(e,t=A()){let n=t;for(let t of e)n=ie(n,t);return n}function ie(e,t){let n=ae(e,t.event,t.at);return n===void 0?{...e,lastSeq:t.seq}:n===e?e:{...n,status:C({lifecycle:n.lifecycle,turnInFlight:n.turnInFlight,awaiting:n.asking!==void 0&&n.asking.producer===void 0||n.authorising!==void 0&&n.authorising.producer===void 0}),lastSeq:t.seq}}function ae(e,t,n){switch(t.type){case`session_started`:return{...e,backend:t.backend,scope:t.scope,capabilities:t.capabilities,...t.permissionMode?{permissionMode:t.permissionMode}:{},...t.worktree===void 0?{}:{worktree:t.worktree}};case`capabilities_changed`:return{...e,capabilities:t.capabilities};case`user_message`:return{...e,spoken:!0,entries:de(e.entries,{kind:`user`,id:t.id,text:t.text,...t.attachments===void 0?{}:{attachments:t.attachments}})};case`turn_started`:return{...e,turnInFlight:!0};case`message`:return{...e,entries:de(e.entries,{kind:`assistant`,id:t.id,text:t.text,final:t.final,...ue(t)})};case`thinking`:return{...e,entries:de(e.entries,{kind:`thinking`,id:t.id,text:t.text,final:t.final,...ue(t)})};case`tool_started`:return{...e,entries:de(e.entries,{kind:`tool`,id:t.callId,name:t.name,input:t.input,status:`running`,...ue(t)})};case`tool_updated`:return{...e,entries:fe(e.entries,t.callId,e=>({...e,update:t.update}))};case`tool_ended`:return{...e,entries:fe(e.entries,t.callId,e=>({...e,result:t.result,status:t.isError?`error`:`complete`}))};case`subagent`:{let r=e.entries.find(e=>e.kind===`subagent`&&e.id===t.subagentId),i=r!==void 0&&ne(r.status),a=ne(t.state),o=a?void 0:r?.endedAt??n;return{...e,activeSubagents:e.activeSubagents+ +!!a-+!!i,entries:de(e.entries,{kind:`subagent`,id:t.subagentId,name:t.name,...t.description===void 0?{}:{description:t.description},status:t.state,...t.state===`waiting`?{waitingOn:t.on}:{},startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`background_call`:{let r=e.entries.find(e=>e.kind===`background_call`&&e.id===t.callId),i=r?.status===`running`,a=t.state===`running`,o=a?void 0:r?.endedAt??n;return{...e,activeBackgroundCalls:e.activeBackgroundCalls+ +!!a-+!!i,entries:de(e.entries,{kind:`background_call`,id:t.callId,tool:t.tool,status:t.state,...ue(t),startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`enquiry`:{let n=t.state===`asked`,r=n&&e.asking?.askId===t.askId?e.asking:n?{askId:t.askId,questions:t.questions,...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}}:e.asking?.askId===t.askId?void 0:e.asking;return{...e,...r===void 0?{asking:void 0}:{asking:r},entries:de(e.entries,{kind:`enquiry`,id:t.askId,questions:t.questions,status:t.state,...t.state===`answered`?{answers:t.answers}:{},...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}})}}case`permission`:{let n=t.state===`asked`?e.authorising??{callId:t.callId,tool:t.tool,...t.context===void 0?{}:{context:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope},...t.producer===void 0?{}:{producer:t.producer}}:e.authorising?.callId===t.callId?le(e.entries,t.callId):e.authorising;return{...e,...n===void 0?{authorising:void 0}:{authorising:n},entries:fe(e.entries,t.callId,e=>({...e,authorisation:ce(t),...t.context===void 0?{}:{permissionContext:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope}}))}}case`turn_ended`:return{...e,turnInFlight:!1,asking:e.asking?.producer===void 0?void 0:e.asking,authorising:e.authorising?.producer===void 0?void 0:e.authorising};case`queue_changed`:return{...e,queue:[...t.pending],queuedMessages:e.queuedMessages?.length===t.pending.length&&e.queuedMessages.every((e,n)=>e.text===t.pending[n]&&e.id===t.ids?.[n]&&(e.attachments?.length??0)===(t.attachments?.[n]?.length??0)&&(e.attachments??[]).every((e,r)=>e===t.attachments?.[n]?.[r]))?e.queuedMessages:t.pending.map((e,n)=>({id:t.ids?.[n],text:e,...t.attachments?.[n]?.length?{attachments:t.attachments[n]}:{}}))};case`workflow_spend`:{let n={...e.workflowSpend,[t.executionId]:t.spend},r=te([...e.parentSpend?[e.parentSpend]:[],...Object.values(n)]);return{...e,workflowSpend:n,spend:r,...e.contextUsage?{contextUsage:{...e.contextUsage,spend:r}}:{}}}case`context_usage`:{let n=t.spend||e.workflowSpend?te([...t.spend?[t.spend]:[],...Object.values(e.workflowSpend??{})]):void 0;return{...e,...t.spend?{parentSpend:t.spend}:{},...n?{spend:n}:{},contextUsage:{used:t.used,window:t.window,...n===void 0?{}:{spend:n}}}}case`model_changed`:return{...e,model:t.model};case`permission_mode_changed`:return{...e,permissionMode:t.mode};case`effort_changed`:return{...e,effort:t.effort};case`branch_changed`:return{...e,branch:t.branch};case`notice`:return{...e,entries:[...e.entries,{kind:`notice`,id:`notice-${e.entries.length}`,level:t.level,text:t.text}]};case`compacting`:return t.active?{...e,compacting:!0}:oe(e);case`compacted`:return{...oe(e),entries:[...e.entries,{kind:`marker`,id:`compacted-${e.entries.length}`,marker:`compacted`,text:se(t.trigger,t.before,t.after)}]};case`session_dormant`:return{...e,lifecycle:`dormant`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`dormant-${e.entries.length}`,marker:`dormant`,text:`Dormant: ${t.reason}`}]};case`session_settled`:return{...e,lifecycle:`settled`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`settled-${e.entries.length}`,marker:`settled`,text:`Settled`}]};case`revived`:return{...e,lifecycle:`live`,turnInFlight:!1,entries:[...e.entries,{kind:`marker`,id:`revived-${t.fromSeq}`,marker:`revived`,text:`Revived from seq ${t.fromSeq}`}]};case`session_ended`:return{...e,lifecycle:`ended`,turnInFlight:!1,endedReason:t.reason,asking:void 0,authorising:void 0}}}function oe(e){if(!e.compacting)return e;let{compacting:t,...n}=e;return n}function se(e,t,n){let r=e===`auto`?`Compacted automatically`:`Compacted`;return n===void 0?`${r}, from ${S(t)} tokens`:`${r}, ${S(t)} → ${S(n)} tokens`}function ce(e){return e.state===`asked`?`asked`:e.state===`aborted`||e.decision===`deny`?`denied`:e.decision===`always`?`always`:`allowed`}function le(e,t){let n=e.find(e=>e.kind===`tool`&&e.id!==t&&e.authorisation===`asked`);return n?.kind===`tool`?{callId:n.id,tool:n.name,...n.permissionContext===void 0?{}:{context:n.permissionContext},...n.allowAlways===void 0?{}:{allowAlways:n.allowAlways},...n.authorizationScope===void 0?{}:{authorizationScope:n.authorizationScope},...n.producer===void 0?{}:{producer:n.producer}}:void 0}function ue(e){return e.producer===void 0?{}:{producer:e.producer}}function de(e,t){let n=e.findIndex(e=>e.kind===t.kind&&e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]=t,r}function fe(e,t,n){let r=e.findIndex(e=>e.kind===`tool`&&e.id===t);if(r<0)return e;let i=e[r];if(!i||i.kind!==`tool`)return e;let a=[...e];return a[r]=n(i),a}var j=e(a(),1);function pe(e){return`${e.kind}:${e.id}`}var me=new Map;function he(e,t){me.set(e,structuredClone(t))}function ge(e){let t=me.get(e);return t&&structuredClone(t)}function _e(e){me.delete(e)}function ve(e){for(let t of me.keys())e.has(t)||me.delete(t)}var M=u(),ye=2e3,be=3e4,xe=(0,j.createContext)(void 0);function Se(){let e=(0,j.useContext)(xe);if(!e)throw Error(`useAgentSessions outside SessionsProvider`);return e}function Ce({children:e}){let{connection:t}=d(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),o=(0,j.useRef)(()=>{});(0,j.useEffect)(()=>{let e=!1,n,i,s=0,c=0,l=0,u=e=>{n&&clearTimeout(n),n=setTimeout(()=>void d(),e)},d=async()=>{if(e||document.hidden)return;i?.abort(),i=new AbortController;let n=++s;try{let i=await t.listSessions();if(e||n<=c)return;c=n,l=0,ve(new Set(i.map(e=>e.id))),r(i),a(!0),u(ye)}catch{if(e)return;a(!0),l+=1,u(Math.min(be,ye*2**l))}},f=()=>{document.hidden||d()};return o.current=()=>void d(),d(),document.addEventListener(`visibilitychange`,f),()=>{e=!0,o.current=()=>{},n&&clearTimeout(n),i?.abort(),document.removeEventListener(`visibilitychange`,f)}},[t]);let s=(0,j.useCallback)(()=>o.current(),[]);return(0,M.jsx)(xe.Provider,{value:{sessions:n,loaded:i,nudge:s},children:e})}function we(){let{connection:e}=d(),{nudge:t}=Se();return(0,j.useCallback)(async n=>{try{let r=await e.command(n);return t(),r}catch(e){o.error(`${n.type} failed`,e instanceof Error?e.message:String(e)),t();return}},[e,t])}var Te=f(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ee=f(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),De=f(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Oe=60,ke=[{key:`command`,shape:`text`},{key:`questions`,shape:`questions`},{key:`file_path`,shape:`path`},{key:`notebook_path`,shape:`path`},{key:`pattern`,shape:`text`},{key:`url`,shape:`text`},{key:`query`,shape:`text`},{key:`path`,shape:`path`},{key:`description`,shape:`text`},{key:`prompt`,shape:`text`}];function Ae(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of ke){let n=t[e.key];if(e.shape===`questions`){let e=je(n);if(e!==void 0)return e;continue}if(typeof n==`string`&&n.trim()!==``)return e.shape===`path`?Ne(n.trim()):Me(n)}let n=Object.values(t).filter(e=>typeof e==`string`),r=n.length===1?n[0]:void 0;return r&&r.trim()!==``?Me(r):void 0}function je(e){if(!Array.isArray(e)||e.length===0)return;let t=e[0];if(!t||typeof t!=`object`)return;let n=t.question;if(typeof n!=`string`||n.trim()===``)return;let r=e.length-1;return Me(r>0?`${n} (+${r} more)`:n)}function Me(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=Oe?t:`${t.slice(0,59)}…`}function Ne(e){return e.length<=Oe?e:`…${e.slice(-59)}`}var Pe=6e4,Fe=60*Pe,Ie=24*Fe;function Le(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,t-n);return r<Pe?`just now`:r<Fe?`${Math.floor(r/Pe)}m`:r<Ie?`${Math.floor(r/Fe)}h`:new Date(n).toISOString().slice(0,10)}function Re(e){let t=Math.max(0,e.activeSubagents),n=Math.max(0,e.activeBackgroundCalls),r=Math.max(0,e.activeWorkflows??0),i=[t>0?`${t} agent${t===1?``:`s`}`:void 0,n>0?`${n} background call${n===1?``:`s`}`:void 0,r>0?`${r} workflow${r===1?``:`s`}`:void 0].filter(e=>e!==void 0);if(i.length!==0)return`${i.length<3?i.join(` and `):`${i.slice(0,-1).join(`, `)} and ${i.at(-1)}`} running`}function ze(e){return e.activeSubagents>0}function Be(e){let t=Re(e);return t===void 0?e.status:`${e.status}, ${t}`}function Ve(e,t){switch(e.status){case`running`:return{label:`started`,at:Le(e.startedAt,t)};case`complete`:return{label:`finished`,at:Le(e.endedAt??e.startedAt,t)};case`aborted`:return{label:`stopped`,at:Le(e.endedAt??e.startedAt,t)};case`error`:return{label:`failed`,at:Le(e.endedAt??e.startedAt,t)}}}function He(e){if(!e.startsWith(`/`))return;let t=/^\/([A-Za-z0-9][\w-]*(?::(?:[A-Za-z0-9][\w-]*)?)?)?/.exec(e)?.[1]??``;return{name:t,to:t.length+1}}function Ue(e){let t=He(e);if(!t||t.name===``||t.name.endsWith(`:`))return;let n=e[t.to];if(n===void 0||n===` `||n===`
2
- `)return{...t,rest:e.slice(t.to)}}var We=[{decision:`allow`,label:`Allow once`,description:`Run it this time, and ask again next time.`},{decision:`deny`,label:`Deny`,description:`Refuse it, and stop asking for the rest of this turn.`},{decision:`always`,label:`Always allow on this machine`,description:`Run it, and never ask again in any Agent Session. Revocable in Settings.`}],Ge=We.slice(0,2);function Ke(e){return e===!1?Ge:We}function qe(e){switch(e){case void 0:return;case`asked`:return`waiting to be authorised`;case`allowed`:return`authorised`;case`always`:return`always authorised on this machine`;case`denied`:return`refused`}}function Je({className:e,...t}){return(0,M.jsx)(`textarea`,{"data-slot":`textarea`,className:s(`flex field-sizing-content min-h-16 w-full resize-none rounded-2xl border border-transparent bg-input/50 px-2.5 py-2 text-base transition-[color,box-shadow] duration-200 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Ye(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Xe=Ye();function Ze(e){Xe=e}var Qe={exec:()=>null};function $e(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function N(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(P.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var et=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),P={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:$e(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:$e(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:$e(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:$e(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:$e(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:$e(e=>RegExp(`^ {0,${e}}>`))},tt=/^(?:[ \t]*(?:\n|$))+/,nt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,it=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,at=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ot=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,st=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ct=N(st).replace(/bull/g,ot).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),lt=N(st).replace(/bull/g,ot).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ut=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,dt=/^[^\n]+/,ft=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pt=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ft).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mt=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ot).getRegex(),ht=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,gt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_t=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,gt).replace(`tag`,ht).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vt=e=>N(ut).replace(`hr`,it).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ht).getRegex(),yt=vt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),bt=vt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),xt={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,bt).getRegex(),code:nt,def:pt,fences:rt,heading:at,hr:it,html:_t,lheading:ct,list:mt,newline:tt,paragraph:yt,table:Qe,text:dt},St=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,it).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ht).getRegex(),Ct={...xt,lheading:lt,table:St,paragraph:N(ut).replace(`hr`,it).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,St).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ht).getRegex()},wt={...xt,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,gt).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Qe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(ut).replace(`hr`,it).replace(`heading`,` *#{1,6} *[^
1
+ import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{E as a,_ as o,b as s,h as c,t as l,wr as u,yr as d}from"./input-BOuBzJVY.js";import{K as f,a as p,c as m,n as h,r as g,s as _,t as v}from"./switch-B0hMd_dH.js";function y(e){if(!e)return;let{used:t,window:n}=e;return n>0?`context ${Math.round(t/n*100)}%`:`${t} tokens`}function b(e){if(!e||e.window<=0)return;let{used:t,window:n,spend:r}=e,i=[{label:`Context`,value:`${Math.round(t/n*100)}% · ${S(t)}/${S(n)} tokens`}];if(!r)return i;if(i.push({label:`Spent`,value:`${S(r.tokens)} tokens · ${x(r.costUSD)}`}),i.push({label:`Cache reads`,value:`${S(r.cached)} of ${S(r.tokens)}`}),r.models.length>1)for(let e of r.models)i.push({label:e.id,value:`${S(e.tokens)} · ${x(e.costUSD)}`,model:!0});return i}function x(e){return e>=.01?`$${e.toFixed(2)}`:e===0?`$0.00`:`$${e.toFixed(4)}`}function S(e){return e>=1e6?`${Math.round(e/1e5)/10}M`:e>=1e3?`${Math.round(e/1e3)}k`:`${e}`}function C(e){return e.lifecycle===`live`?e.awaiting?`awaiting`:e.turnInFlight?`running`:`idle`:e.lifecycle}function w(e){return e===`running`||e===`awaiting`}var T=[`needs-input`,`unread`,`working`,`idle`,`dormant`,`filed-away`];function E(e){return e.status===`settled`||e.status===`ended`?`filed-away`:e.attention?.group===`needs-input`?`needs-input`:e.attention?.group===`unread`?`unread`:e.status===`running`||e.status===`awaiting`||O(e)?`working`:e.status===`idle`?`idle`:`dormant`}function D(e){switch(e){case`needs-input`:return`Needs input`;case`unread`:return`Unread`;case`working`:return`Working`;case`idle`:return`Idle`;case`dormant`:return`Dormant`;case`filed-away`:return`Filed away`}}function O(e){return e.status===`idle`&&e.activeSubagents+e.activeBackgroundCalls+(e.activeWorkflows??0)>0}function k(e){return e!==`settled`&&e!==`ended`}function ee(e){return e===`dormant`||e===`settled`}function te(e){let t={tokens:0,cached:0,costUSD:0,models:[]};for(let n of e){t.tokens+=n.tokens,t.cached+=n.cached,t.costUSD+=n.costUSD;for(let e of n.models){let n=t.models.find(t=>t.id===e.id);n?(n.tokens+=e.tokens,n.cached+=e.cached,n.costUSD+=e.costUSD):t.models.push({...e})}}return t}function A(){return{status:`idle`,lifecycle:`live`,turnInFlight:!1,entries:[],queue:[],activeSubagents:0,activeBackgroundCalls:0,lastSeq:0}}function ne(e){return e===`running`||e===`waiting`}function re(e,t=A()){let n=t;for(let t of e)n=ie(n,t);return n}function ie(e,t){let n=ae(e,t.event,t.at);return n===void 0?{...e,lastSeq:t.seq}:n===e?e:{...n,status:C({lifecycle:n.lifecycle,turnInFlight:n.turnInFlight,awaiting:n.asking!==void 0&&n.asking.producer===void 0||n.authorising!==void 0&&n.authorising.producer===void 0}),lastSeq:t.seq}}function ae(e,t,n){switch(t.type){case`session_started`:return{...e,backend:t.backend,scope:t.scope,capabilities:t.capabilities,...t.permissionMode?{permissionMode:t.permissionMode}:{},...t.worktree===void 0?{}:{worktree:t.worktree}};case`capabilities_changed`:return{...e,capabilities:t.capabilities};case`user_message`:return{...e,spoken:!0,entries:de(e.entries,{kind:`user`,id:t.id,text:t.text,...t.attachments===void 0?{}:{attachments:t.attachments}})};case`turn_started`:return{...e,turnInFlight:!0};case`message`:return{...e,entries:de(e.entries,{kind:`assistant`,id:t.id,text:t.text,final:t.final,...ue(t)})};case`thinking`:return{...e,entries:de(e.entries,{kind:`thinking`,id:t.id,text:t.text,final:t.final,...ue(t)})};case`tool_started`:return{...e,entries:de(e.entries,{kind:`tool`,id:t.callId,name:t.name,input:t.input,status:`running`,...ue(t)})};case`tool_updated`:return{...e,entries:fe(e.entries,t.callId,e=>({...e,update:t.update}))};case`tool_ended`:return{...e,entries:fe(e.entries,t.callId,e=>({...e,result:t.result,status:t.isError?`error`:`complete`}))};case`subagent`:{let r=e.entries.find(e=>e.kind===`subagent`&&e.id===t.subagentId),i=r!==void 0&&ne(r.status),a=ne(t.state),o=a?void 0:r?.endedAt??n;return{...e,activeSubagents:e.activeSubagents+ +!!a-+!!i,entries:de(e.entries,{kind:`subagent`,id:t.subagentId,name:t.name,...t.description===void 0?{}:{description:t.description},status:t.state,...t.state===`waiting`?{waitingOn:t.on}:{},startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`background_call`:{let r=e.entries.find(e=>e.kind===`background_call`&&e.id===t.callId),i=r?.status===`running`,a=t.state===`running`,o=a?void 0:r?.endedAt??n;return{...e,activeBackgroundCalls:e.activeBackgroundCalls+ +!!a-+!!i,entries:de(e.entries,{kind:`background_call`,id:t.callId,tool:t.tool,status:t.state,...ue(t),startedAt:r?.startedAt??n,...o===void 0?{}:{endedAt:o}})}}case`enquiry`:{let n=t.state===`asked`,r=n&&e.asking?.askId===t.askId?e.asking:n?{askId:t.askId,questions:t.questions,...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}}:e.asking?.askId===t.askId?void 0:e.asking;return{...e,...r===void 0?{asking:void 0}:{asking:r},entries:de(e.entries,{kind:`enquiry`,id:t.askId,questions:t.questions,status:t.state,...t.state===`answered`?{answers:t.answers}:{},...t.context===void 0?{}:{context:t.context},...t.producer===void 0?{}:{producer:t.producer}})}}case`permission`:{let n=t.state===`asked`?e.authorising??{callId:t.callId,tool:t.tool,...t.context===void 0?{}:{context:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope},...t.producer===void 0?{}:{producer:t.producer}}:e.authorising?.callId===t.callId?le(e.entries,t.callId):e.authorising;return{...e,...n===void 0?{authorising:void 0}:{authorising:n},entries:fe(e.entries,t.callId,e=>({...e,authorisation:ce(t),...t.context===void 0?{}:{permissionContext:t.context},...t.allowAlways===void 0?{}:{allowAlways:t.allowAlways},...t.authorizationScope===void 0?{}:{authorizationScope:t.authorizationScope}}))}}case`turn_ended`:return{...e,turnInFlight:!1,asking:e.asking?.producer===void 0?void 0:e.asking,authorising:e.authorising?.producer===void 0?void 0:e.authorising};case`queue_changed`:return{...e,queue:[...t.pending],queuedMessages:e.queuedMessages?.length===t.pending.length&&e.queuedMessages.every((e,n)=>e.text===t.pending[n]&&e.id===t.ids?.[n]&&(e.attachments?.length??0)===(t.attachments?.[n]?.length??0)&&(e.attachments??[]).every((e,r)=>e===t.attachments?.[n]?.[r]))?e.queuedMessages:t.pending.map((e,n)=>({id:t.ids?.[n],text:e,...t.attachments?.[n]?.length?{attachments:t.attachments[n]}:{}}))};case`workflow_spend`:{let n={...e.workflowSpend,[t.executionId]:t.spend},r=te([...e.parentSpend?[e.parentSpend]:[],...Object.values(n)]);return{...e,workflowSpend:n,spend:r,...e.contextUsage?{contextUsage:{...e.contextUsage,spend:r}}:{}}}case`context_usage`:{let n=t.spend||e.workflowSpend?te([...t.spend?[t.spend]:[],...Object.values(e.workflowSpend??{})]):void 0;return{...e,...t.spend?{parentSpend:t.spend}:{},...n?{spend:n}:{},contextUsage:{used:t.used,window:t.window,...n===void 0?{}:{spend:n}}}}case`model_changed`:return{...e,model:t.model};case`permission_mode_changed`:return{...e,permissionMode:t.mode};case`effort_changed`:return{...e,effort:t.effort};case`branch_changed`:return{...e,branch:t.branch};case`notice`:return{...e,entries:[...e.entries,{kind:`notice`,id:`notice-${e.entries.length}`,level:t.level,text:t.text}]};case`compacting`:return t.active?{...e,compacting:!0}:oe(e);case`compacted`:return{...oe(e),entries:[...e.entries,{kind:`marker`,id:`compacted-${e.entries.length}`,marker:`compacted`,text:se(t.trigger,t.before,t.after)}]};case`session_dormant`:return{...e,lifecycle:`dormant`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`dormant-${e.entries.length}`,marker:`dormant`,text:`Dormant: ${t.reason}`}]};case`session_settled`:return{...e,lifecycle:`settled`,turnInFlight:!1,queue:[],queuedMessages:[],asking:void 0,authorising:void 0,entries:[...e.entries,{kind:`marker`,id:`settled-${e.entries.length}`,marker:`settled`,text:`Settled`}]};case`revived`:return{...e,lifecycle:`live`,turnInFlight:!1,entries:[...e.entries,{kind:`marker`,id:`revived-${t.fromSeq}`,marker:`revived`,text:`Revived from seq ${t.fromSeq}`}]};case`session_ended`:return{...e,lifecycle:`ended`,turnInFlight:!1,endedReason:t.reason,asking:void 0,authorising:void 0}}}function oe(e){if(!e.compacting)return e;let{compacting:t,...n}=e;return n}function se(e,t,n){let r=e===`auto`?`Compacted automatically`:`Compacted`;return n===void 0?`${r}, from ${S(t)} tokens`:`${r}, ${S(t)} → ${S(n)} tokens`}function ce(e){return e.state===`asked`?`asked`:e.state===`aborted`||e.decision===`deny`?`denied`:e.decision===`always`?`always`:`allowed`}function le(e,t){let n=e.find(e=>e.kind===`tool`&&e.id!==t&&e.authorisation===`asked`);return n?.kind===`tool`?{callId:n.id,tool:n.name,...n.permissionContext===void 0?{}:{context:n.permissionContext},...n.allowAlways===void 0?{}:{allowAlways:n.allowAlways},...n.authorizationScope===void 0?{}:{authorizationScope:n.authorizationScope},...n.producer===void 0?{}:{producer:n.producer}}:void 0}function ue(e){return e.producer===void 0?{}:{producer:e.producer}}function de(e,t){let n=e.findIndex(e=>e.kind===t.kind&&e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]=t,r}function fe(e,t,n){let r=e.findIndex(e=>e.kind===`tool`&&e.id===t);if(r<0)return e;let i=e[r];if(!i||i.kind!==`tool`)return e;let a=[...e];return a[r]=n(i),a}var j=e(u(),1);function pe(e){return`${e.kind}:${e.id}`}var me=new Map;function he(e,t){me.set(e,structuredClone(t))}function ge(e){let t=me.get(e);return t&&structuredClone(t)}function _e(e){me.delete(e)}function ve(e){for(let t of me.keys())e.has(t)||me.delete(t)}var M=d(),ye=2e3,be=3e4,xe=(0,j.createContext)(void 0);function Se(){let e=(0,j.useContext)(xe);if(!e)throw Error(`useAgentSessions outside SessionsProvider`);return e}function Ce({children:e}){let{connection:t}=s(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),o=(0,j.useRef)(()=>{});(0,j.useEffect)(()=>{let e=!1,n,i,s=0,c=0,l=0,u=e=>{n&&clearTimeout(n),n=setTimeout(()=>void d(),e)},d=async()=>{if(e||document.hidden)return;i?.abort(),i=new AbortController;let n=++s;try{let i=await t.listSessions();if(e||n<=c)return;c=n,l=0,ve(new Set(i.map(e=>e.id))),r(i),a(!0),u(ye)}catch{if(e)return;a(!0),l+=1,u(Math.min(be,ye*2**l))}},f=()=>{document.hidden||d()};return o.current=()=>void d(),d(),document.addEventListener(`visibilitychange`,f),()=>{e=!0,o.current=()=>{},n&&clearTimeout(n),i?.abort(),document.removeEventListener(`visibilitychange`,f)}},[t]);let c=(0,j.useCallback)(()=>o.current(),[]);return(0,M.jsx)(xe.Provider,{value:{sessions:n,loaded:i,nudge:c},children:e})}function we(){let{connection:e}=s(),{nudge:t}=Se();return(0,j.useCallback)(async n=>{try{let r=await e.command(n);return t(),r}catch(e){a.error(`${n.type} failed`,e instanceof Error?e.message:String(e)),t();return}},[e,t])}var Te=f(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ee=f(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),De=f(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Oe=60,ke=[{key:`command`,shape:`text`},{key:`questions`,shape:`questions`},{key:`file_path`,shape:`path`},{key:`notebook_path`,shape:`path`},{key:`pattern`,shape:`text`},{key:`url`,shape:`text`},{key:`query`,shape:`text`},{key:`path`,shape:`path`},{key:`description`,shape:`text`},{key:`prompt`,shape:`text`}];function Ae(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of ke){let n=t[e.key];if(e.shape===`questions`){let e=je(n);if(e!==void 0)return e;continue}if(typeof n==`string`&&n.trim()!==``)return e.shape===`path`?Ne(n.trim()):Me(n)}let n=Object.values(t).filter(e=>typeof e==`string`),r=n.length===1?n[0]:void 0;return r&&r.trim()!==``?Me(r):void 0}function je(e){if(!Array.isArray(e)||e.length===0)return;let t=e[0];if(!t||typeof t!=`object`)return;let n=t.question;if(typeof n!=`string`||n.trim()===``)return;let r=e.length-1;return Me(r>0?`${n} (+${r} more)`:n)}function Me(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=Oe?t:`${t.slice(0,59)}…`}function Ne(e){return e.length<=Oe?e:`…${e.slice(-59)}`}var Pe=6e4,Fe=60*Pe,Ie=24*Fe;function Le(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(Number.isNaN(n))return``;let r=Math.max(0,t-n);return r<Pe?`just now`:r<Fe?`${Math.floor(r/Pe)}m`:r<Ie?`${Math.floor(r/Fe)}h`:new Date(n).toISOString().slice(0,10)}function Re(e){let t=Math.max(0,e.activeSubagents),n=Math.max(0,e.activeBackgroundCalls),r=Math.max(0,e.activeWorkflows??0),i=[t>0?`${t} agent${t===1?``:`s`}`:void 0,n>0?`${n} background call${n===1?``:`s`}`:void 0,r>0?`${r} workflow${r===1?``:`s`}`:void 0].filter(e=>e!==void 0);if(i.length!==0)return`${i.length<3?i.join(` and `):`${i.slice(0,-1).join(`, `)} and ${i.at(-1)}`} running`}function ze(e){return e.activeSubagents>0}function Be(e){let t=Re(e);return t===void 0?e.status:`${e.status}, ${t}`}function Ve(e,t){switch(e.status){case`running`:return{label:`started`,at:Le(e.startedAt,t)};case`complete`:return{label:`finished`,at:Le(e.endedAt??e.startedAt,t)};case`aborted`:return{label:`stopped`,at:Le(e.endedAt??e.startedAt,t)};case`error`:return{label:`failed`,at:Le(e.endedAt??e.startedAt,t)}}}function He(e){if(!e.startsWith(`/`))return;let t=/^\/([A-Za-z0-9][\w-]*(?::(?:[A-Za-z0-9][\w-]*)?)?)?/.exec(e)?.[1]??``;return{name:t,to:t.length+1}}function Ue(e){let t=He(e);if(!t||t.name===``||t.name.endsWith(`:`))return;let n=e[t.to];if(n===void 0||n===` `||n===`
2
+ `)return{...t,rest:e.slice(t.to)}}var We=[{decision:`allow`,label:`Allow once`,description:`Run it this time, and ask again next time.`},{decision:`deny`,label:`Deny`,description:`Refuse it, and stop asking for the rest of this turn.`},{decision:`always`,label:`Always allow on this machine`,description:`Run it, and never ask again in any Agent Session. Revocable in Settings.`}],Ge=We.slice(0,2);function Ke(e){return e===!1?Ge:We}function qe(e){switch(e){case void 0:return;case`asked`:return`waiting to be authorised`;case`allowed`:return`authorised`;case`always`:return`always authorised on this machine`;case`denied`:return`refused`}}function Je({className:e,...t}){return(0,M.jsx)(`textarea`,{"data-slot":`textarea`,className:o(`flex field-sizing-content min-h-16 w-full resize-none rounded-2xl border border-transparent bg-input/50 px-2.5 py-2 text-base transition-[color,box-shadow] duration-200 outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Ye(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Xe=Ye();function Ze(e){Xe=e}var Qe={exec:()=>null};function $e(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function N(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(P.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var et=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),P={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:$e(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:$e(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:$e(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:$e(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:$e(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:$e(e=>RegExp(`^ {0,${e}}>`))},tt=/^(?:[ \t]*(?:\n|$))+/,nt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,it=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,at=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ot=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,st=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ct=N(st).replace(/bull/g,ot).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),lt=N(st).replace(/bull/g,ot).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ut=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,dt=/^[^\n]+/,ft=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pt=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ft).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mt=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ot).getRegex(),ht=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,gt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_t=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,gt).replace(`tag`,ht).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vt=e=>N(ut).replace(`hr`,it).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ht).getRegex(),yt=vt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),bt=vt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),xt={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,bt).getRegex(),code:nt,def:pt,fences:rt,heading:at,hr:it,html:_t,lheading:ct,list:mt,newline:tt,paragraph:yt,table:Qe,text:dt},St=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,it).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ht).getRegex(),Ct={...xt,lheading:lt,table:St,paragraph:N(ut).replace(`hr`,it).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,St).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ht).getRegex()},wt={...xt,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,gt).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Qe,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(ut).replace(`hr`,it).replace(`heading`,` *#{1,6} *[^
3
3
  ]`).replace(`lheading`,ct).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Tt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Et=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Dt=/^( {2,}|\\)\n(?!\s*$)/,Ot=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,kt=/[\p{P}\p{S}]/u,At=/[\s\p{P}\p{S}]/u,jt=/[^\s\p{P}\p{S}]/u,Mt=N(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,At).getRegex(),Nt=/[\p{Pi}\p{Ps}"']/u,Pt=/(?!~)[\p{P}\p{S}]/u,Ft=/(?!~)[\s\p{P}\p{S}]/u,It=/(?:[^\s\p{P}\p{S}]|~)/u,Lt=N(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,et?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Rt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,zt=N(Rt,`u`).replace(/punct/g,kt).getRegex(),Bt=N(Rt,`u`).replace(/punct/g,Pt).getRegex(),Vt=N(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Nt).replace(/punct/g,kt).getRegex(),Ht=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ut=N(Ht,`gu`).replace(/notPunctSpace/g,jt).replace(/punctSpace/g,At).replace(/punct/g,kt).getRegex(),Wt=N(Ht,`gu`).replace(/notPunctSpace/g,It).replace(/punctSpace/g,Ft).replace(/punct/g,Pt).getRegex(),Gt=N(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,jt).replace(/punctSpace/g,At).replace(/punct/g,kt).getRegex(),Kt=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,jt).replace(/punctSpace/g,At).replace(/punct/g,kt).getRegex(),qt=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,jt).replace(/punctSpace/g,At).replace(/punct/g,kt).getRegex(),Jt=N(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,kt).getRegex(),Yt=N(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,jt).replace(/punctSpace/g,At).replace(/punct/g,kt).getRegex(),Xt=N(/\\(punct)/,`gu`).replace(/punct/g,kt).getRegex(),Zt=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Qt=N(gt).replace(`(?:-->|$)`,`-->`).getRegex(),$t=N(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Qt).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),en=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,tn=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,en).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nn=N(/^!?\[(label)\]\[(ref)\]/).replace(`label`,en).replace(`ref`,ft).getRegex(),rn=N(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ft).getRegex(),an=N(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,nn).replace(`nolink`,rn).getRegex(),on=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,sn={_backpedal:Qe,anyPunctuation:Xt,autolink:Zt,blockSkip:Lt,br:Dt,code:Et,del:Qe,delLDelim:Qe,delRDelim:Qe,emStrongLDelim:zt,emStrongRDelimAst:Ut,emStrongRDelimUnd:Kt,escape:Tt,link:tn,nolink:rn,punctuation:Mt,reflink:nn,reflinkSearch:an,tag:$t,text:Ot,url:Qe},cn={...sn,emStrongLDelim:Vt,emStrongRDelimAst:Gt,emStrongRDelimUnd:qt,link:N(/^!?\[(label)\]\((.*?)\)/).replace(`label`,en).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,en).getRegex()},ln={...sn,emStrongRDelimAst:Wt,emStrongLDelim:Bt,delLDelim:Jt,delRDelim:Yt,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,on).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:N(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,on).getRegex()},un={...ln,br:N(Dt).replace(`{2,}`,`*`).getRegex(),text:N(ln.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},dn={normal:xt,gfm:Ct,pedantic:wt},fn={normal:sn,gfm:ln,breaks:un,pedantic:cn},pn={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},mn=e=>pn[e];function hn(e,t){if(t){if(P.escapeTest.test(e))return e.replace(P.escapeReplace,mn)}else if(P.escapeTestNoEncode.test(e))return e.replace(P.escapeReplaceNoEncode,mn);return e}function gn(e){try{e=encodeURI(e).replace(P.percentDecode,`%`)}catch{return null}return e}function _n(e,t){let n=e.replace(P.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(P.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(P.slashPipe,`|`);return n}function vn(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function yn(e){let t=e.split(`
4
4
  `),n=t.length-1;for(;n>=0&&P.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
5
5
  `)}function bn(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function xn(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Sn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function Cn(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
@@ -71,7 +71,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
71
71
  `)?`\r
72
72
  `:e.text.endsWith(`
73
73
  `)?`
74
- `:``,o=t===i.length-1?r:void 0;return(0,M.jsxs)(j.Fragment,{children:[(0,M.jsxs)(`span`,{className:s(`inline-block min-w-full min-h-[1lh] align-top`,rr(e.kind)),children:[(0,M.jsx)(nr,{text:a?e.text.slice(0,-a.length):e.text,query:n}),a?void 0:o]}),a||void 0,a?o:void 0]},t)}),i.length===0?r:void 0]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(nr,{text:e,query:n}),r]})}function ar({blocks:e,query:t,trailing:n}){return(0,M.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,M.jsx)(or,{blocks:e,query:t,trailing:n})})}function or({blocks:e,query:t,trailing:n}){return(0,M.jsx)(M.Fragment,{children:e.map((r,i)=>(0,M.jsx)(cr,{block:r,query:t,trailing:i===e.length-1?n:void 0},i))})}var sr={1:`text-lg`,2:`text-base`};function cr({block:e,query:t,trailing:n}){switch(e.kind){case`paragraph`:return(0,M.jsxs)(`p`,{className:`m-0 [overflow-wrap:anywhere]`,children:[(0,M.jsx)(fr,{inlines:e.inlines,query:t}),n]});case`heading`:{let r=`h${e.level}`;return(0,M.jsxs)(r,{className:s(sr[e.level]??`text-sm`,`m-0 pt-1 font-heading font-semibold tracking-tight [overflow-wrap:anywhere]`),children:[(0,M.jsx)(fr,{inlines:e.inlines,query:t}),n]})}case`code`:return(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-lg border bg-muted`,children:[e.lang===void 0?null:(0,M.jsx)(`div`,{className:`border-b px-3 py-1 font-mono text-xs text-muted-foreground`,children:e.lang}),(0,M.jsx)(`pre`,{className:`overflow-x-auto p-3`,children:(0,M.jsx)(`code`,{className:`font-mono text-sm`,children:(0,M.jsx)(ir,{text:e.text,lang:e.lang,query:t,trailing:n})})})]});case`list`:{let r=e.ordered?`ol`:`ul`;return(0,M.jsx)(r,{className:s(`m-0 space-y-1 pl-5 marker:text-muted-foreground`,e.ordered?`list-decimal`:`list-disc`),...e.start===void 0?{}:{start:e.start},children:e.items.map((r,i)=>(0,M.jsx)(`li`,{className:`space-y-2 [overflow-wrap:anywhere]`,children:(0,M.jsx)(or,{blocks:r,query:t,trailing:i===e.items.length-1?n:void 0})},i))})}case`quote`:return(0,M.jsx)(`blockquote`,{className:`space-y-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,M.jsx)(or,{blocks:e.blocks,query:t,trailing:n})});case`table`:return(0,M.jsx)(dr,{block:e,query:t,trailing:n});case`rule`:return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`hr`,{className:`border-border`}),n]})}}var lr={left:`text-left`,center:`text-center`,right:`text-right`},ur=e=>e===void 0?`text-left`:lr[e]??`text-left`;function dr({block:e,query:t,trailing:n}){return(0,M.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,M.jsxs)(`table`,{className:`border-collapse text-sm tabular-nums`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:e.header.map((n,r)=>(0,M.jsx)(`th`,{className:s(`border-b px-2 py-1 font-semibold`,ur(e.align[r])),children:(0,M.jsx)(fr,{inlines:n,query:t})},r))})}),(0,M.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,M.jsx)(`tr`,{children:n.map((n,r)=>(0,M.jsx)(`td`,{className:s(`border-b border-border/50 px-2 py-1`,ur(e.align[r])),children:(0,M.jsx)(fr,{inlines:n,query:t})},r))},r))})]}),n]})}function fr({inlines:e,query:t}){return(0,M.jsx)(M.Fragment,{children:e.map((e,n)=>(0,M.jsx)(pr,{inline:e,query:t},n))})}function pr({inline:e,query:t}){switch(e.kind){case`text`:return(0,M.jsx)(nr,{text:e.text,query:t});case`strong`:return(0,M.jsx)(`strong`,{className:`font-semibold`,children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`em`:return(0,M.jsx)(`em`,{children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`del`:return(0,M.jsx)(`del`,{className:`text-muted-foreground`,children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`code`:return(0,M.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em] [overflow-wrap:anywhere]`,children:(0,M.jsx)(nr,{text:e.text,query:t})});case`link`:return(0,M.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground`,children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`image`:return(0,M.jsx)(mr,{src:e.src,alt:e.alt},e.src);case`break`:return(0,M.jsx)(`br`,{})}}function mr({src:e,alt:t}){let[n,r]=(0,j.useState)(!1);return n?(0,M.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Image unavailable`,t?`: ${t}`:``,`. Open the pull request on GitHub to view it.`]}):(0,M.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(!0),className:`my-2 max-h-[36rem] max-w-full rounded border object-contain`})}var hr=(0,j.createContext)(void 0),gr=hr.Provider;function _r(){return(0,j.useContext)(hr)}function vr(e=3e4){let[t,n]=(0,j.useState)(()=>Date.now());return(0,j.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function yr({input:e,query:t}){let n=Yn(e);return n?(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-md border bg-muted`,children:[n.path===void 0?null:(0,M.jsx)(br,{path:n.path}),(0,M.jsxs)(`div`,{className:`overflow-x-auto`,children:[n.removed.map((e,n)=>(0,M.jsx)(xr,{sign:`-`,line:e,query:t,kind:`removed`},`-${n}`)),n.added.map((e,n)=>(0,M.jsx)(xr,{sign:`+`,line:e,query:t,kind:`added`},`+${n}`))]})]}):null}function br({path:e}){let t=e.lastIndexOf(`/`);return(0,M.jsxs)(`p`,{className:`m-0 truncate border-b px-2 py-1 font-mono text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground/70`,children:t<0?``:`${e.slice(0,t)}/`}),(0,M.jsx)(`span`,{className:`text-foreground`,children:t<0?e:e.slice(t+1)})]})}function xr({sign:e,line:t,query:n,kind:r}){return(0,M.jsxs)(`div`,{className:s(`grid grid-cols-[1.25rem_minmax(0,1fr)] font-mono text-xs whitespace-pre`,rr(r)),children:[(0,M.jsx)(`span`,{className:`pl-2 select-none`,"aria-hidden":!0,children:e}),(0,M.jsx)(`span`,{children:(0,M.jsx)(nr,{text:t,query:n})})]})}function Sr({entry:e,query:t}){let n=Yn(e.input)!==void 0;return(0,M.jsxs)(M.Fragment,{children:[n?null:(0,M.jsx)(wr,{label:`input`,value:e.input,query:t}),(0,M.jsx)(wr,{label:`update`,value:e.update,query:t}),(0,M.jsx)(wr,{label:`result`,value:e.result,query:t})]})}var Cr=2e4;function wr({label:e,value:t,query:n}){if(t==null||t===``)return null;let r=typeof t==`string`?t:Er(t);if(r===``)return null;let i=e!==`input`&&r.length<=Cr?Tr(t):void 0;return(0,M.jsxs)(`div`,{className:`mt-1.5 first:mt-0`,children:[(0,M.jsx)(`p`,{className:`m-0 mb-1 text-xs text-muted-foreground`,children:e}),i?i.map(e=>(0,M.jsx)(wr,{label:e.label,value:e.text,query:n},e.label)):(0,M.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r.length>Cr?r:(0,M.jsx)(ir,{text:r,query:n})})]})}function Tr(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.content;if(!Array.isArray(n))return;let r=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`text`&&typeof t.text==`string`&&Xn(t.text)?t.text:void 0};if(!n.some(e=>r(e)!==void 0))return;let i=n.flatMap((e,t)=>{let n=r(e),i=`content ${t+1}`;if(n===void 0)return[{label:i,text:Er(e)}];let{type:a,text:o,...s}=e,c=[{label:`${i} (text)`,text:n}];return Object.keys(s).length>0&&c.push({label:`${i} metadata`,text:Er(s)}),c}),{content:a,...o}=t;return Object.keys(o).length>0&&i.push({label:`metadata`,text:Er(o)}),i}function Er(e){try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}var Dr=(0,j.memo)(function({entry:e,query:t,sessionId:n}){switch(e.kind){case`user`:return(0,M.jsx)(Or,{entry:e,query:t,sessionId:n});case`assistant`:return(0,M.jsx)(Ar,{entry:e,query:t});case`thinking`:return(0,M.jsx)(Mr,{entry:e,query:t});case`tool`:return(0,M.jsx)(Nr,{entry:e,query:t});case`subagent`:return(0,M.jsx)(Fr,{entry:e,query:t});case`background_call`:return(0,M.jsx)(Lr,{entry:e});case`enquiry`:return(0,M.jsx)(Pr,{entry:e,query:t});case`notice`:return(0,M.jsx)(Hr,{entry:e,query:t});case`marker`:return(0,M.jsx)(Wr,{entry:e});default:return null}});function Or({entry:e,query:t,sessionId:n}){let r=(0,j.useMemo)(()=>Mn(e.text),[e.text]);return(0,M.jsx)(`div`,{className:`flex justify-end py-3`,children:(0,M.jsxs)(`div`,{className:`min-w-0 max-w-[90%] rounded-2xl rounded-br-sm bg-muted px-4 py-3 sm:max-w-[80%]`,children:[e.attachments?.length?(0,M.jsx)(kr,{ids:e.attachments,sessionId:n}):null,(0,M.jsx)(ar,{blocks:r,query:t})]})})}function kr({ids:e,sessionId:t}){return(0,M.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,M.jsx)(`img`,{src:`/api/sessions/${encodeURIComponent(t)}/attachments/${encodeURIComponent(e)}`,alt:``,className:`max-h-64 max-w-full rounded-md border border-border`},e))})}function Ar({entry:e,query:t}){let n=(0,j.useMemo)(()=>Mn(e.text),[e.text]);return(0,M.jsx)(Gr,{children:(0,M.jsx)(ar,{blocks:n,query:t,trailing:e.final?void 0:(0,M.jsx)(jr,{})})})}function jr(){return(0,M.jsx)(`span`,{className:`animate-caret-blink ml-px inline-block w-[1ch] text-primary`,"aria-hidden":!0,children:`▍`})}function Mr({entry:e,query:t}){let[n,r]=(0,j.useState)(!1),i=(0,j.useMemo)(()=>Mn(e.text),[e.text]),a=e.final&&!n;return(0,M.jsx)(Gr,{gutter:`·`,gutterClassName:`text-muted-foreground`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:s(`text-muted-foreground italic`,a&&`max-h-[4.5rem] overflow-hidden`),children:(0,M.jsx)(ar,{blocks:i,query:t,trailing:e.final?void 0:(0,M.jsx)(jr,{})})}),e.final?(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`mt-0.5 text-xs text-muted-foreground hover:text-foreground`,children:n?`less`:`more`}):null]})})}function Nr({entry:e,query:t}){let[n,r]=(0,j.useState)(void 0),i=n??e.status===`error`,a=Ae(e.input),o=qe(e.authorisation);return(0,M.jsx)(`div`,{className:`py-0.5`,children:(0,M.jsxs)(`details`,{open:i,onToggle:e=>r(e.currentTarget.open),className:`rounded-lg border text-foreground`,children:[(0,M.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 px-3 py-2 select-none`,children:[(0,M.jsx)(Br,{status:e.status}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm text-foreground [overflow-wrap:anywhere]`,children:e.name}),a===void 0?null:(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:a}),o?(0,M.jsx)(`span`,{className:s(`ml-auto shrink-0 text-xs`,e.authorisation===`denied`?`text-destructive`:e.authorisation===`asked`?`text-status-awaiting`:`text-muted-foreground`),children:o}):e.status===`running`?(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:`running…`}):null]}),(0,M.jsxs)(`div`,{className:`border-t p-3`,children:[(0,M.jsx)(yr,{input:e.input,query:t}),(0,M.jsx)(Sr,{entry:e,query:t})]})]})})}function Pr({entry:e,query:t}){return(0,M.jsx)(`div`,{className:`py-0.5`,children:(0,M.jsxs)(`div`,{className:`w-full rounded-lg border px-3 py-2 text-foreground [overflow-wrap:anywhere]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Br,{status:e.status===`asked`?`running`:e.status===`answered`?`complete`:`error`}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`?`}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm`,children:e.questions.length===1?`Asked a question`:`Asked ${e.questions.length} questions`}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.status===`asked`?`waiting…`:e.status})]}),(0,M.jsx)(`dl`,{className:`mt-1 space-y-1`,children:e.questions.map((n,r)=>{let i=e.answers?.[r]??[];return(0,M.jsxs)(`div`,{className:`text-sm`,children:[(0,M.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:(0,M.jsx)(nr,{text:n.question,query:t})}),(0,M.jsx)(`dd`,{className:s(`font-medium`,i.length===0&&`text-muted-foreground italic`),children:i.length===0?e.status===`asked`?`unanswered`:`no answer`:(0,M.jsx)(nr,{text:i.join(`, `),query:t})})]},n.question)})})]})})}function Fr({entry:e,query:t}){let n=e.waitingOn?`waiting on ${e.waitingOn}`:e.status,r=e.status===`running`||e.status===`waiting`,i=_r(),a=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Br,{status:e.status===`waiting`?`running`:Ir(e.status)}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`⤷`}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm text-foreground [overflow-wrap:anywhere] max-sm:col-start-3 max-sm:row-start-1 max-sm:truncate`,children:e.name}),e.description===void 0?null:(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground max-sm:col-start-3 max-sm:col-end-5 max-sm:row-start-2`,children:(0,M.jsx)(nr,{text:e.description,query:t})}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground max-sm:col-start-4 max-sm:row-start-1`,children:r?`${n}…`:n})]}),o=`flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-foreground max-sm:grid max-sm:grid-cols-[8px_12px_minmax(0,1fr)_auto] max-sm:gap-y-1`;return(0,M.jsx)(`div`,{className:`py-0.5`,children:i===void 0?(0,M.jsx)(`div`,{className:o,children:a}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(pe(e)),className:s(o,`cursor-gloss text-left hover:bg-accent`),children:a})})}function Ir(e){return e===`error`?`error`:e===`running`?`running`:`complete`}function Lr({entry:e}){let t=Ve(e,vr());return(0,M.jsx)(`div`,{className:`py-0.5`,children:(0,M.jsxs)(`div`,{className:`flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-foreground`,children:[(0,M.jsx)(Br,{status:Rr(e.status)}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`⟳`}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm text-foreground [overflow-wrap:anywhere]`,children:e.tool}),(0,M.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[t.label,` `,t.at]})]})})}function Rr(e){return e===`error`?`error`:e===`running`?`running`:`complete`}var zr={running:`text-foreground`,complete:`text-muted-foreground`,error:`text-destructive`};function Br({status:e}){return(0,M.jsx)(`span`,{"aria-hidden":!0,className:s(`inline-block size-1.5 shrink-0 rounded-full`,zr[e],e===`complete`?`border-[1.5px] border-current`:`bg-current`)})}var Vr={info:`text-muted-foreground`,warn:`text-foreground`,error:`text-destructive`};function Hr({entry:e,query:t}){let n=Vr[e.level];return(0,M.jsx)(Gr,{gutter:`!`,gutterClassName:n,children:(0,M.jsx)(`p`,{className:s(`m-0 font-mono text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,n),children:(0,M.jsx)(nr,{text:e.text,query:t})})})}var Ur={revived:`text-primary`,settled:`text-muted-foreground`,dormant:`text-muted-foreground`,compacted:`text-muted-foreground`};function Wr({entry:e}){let t=Ur[e.marker];return(0,M.jsxs)(`div`,{className:s(`flex items-center gap-2 py-2`,t),role:`separator`,"aria-label":e.text,children:[(0,M.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`text-xs`,children:e.text}),(0,M.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0})]})}function Gr({gutter:e,gutterClassName:t,children:n}){return(0,M.jsxs)(`div`,{className:s(`py-1`,e&&`grid grid-cols-[2ch_minmax(0,1fr)] gap-0`),children:[e?(0,M.jsx)(`span`,{"aria-hidden":!0,className:s(`font-mono text-sm select-none`,t),children:e}):null,n]})}function Kr(e,t=40){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function qr(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 Jr(e,t=`|`){return e.map(e=>bi(e)).join(t)}function Yr(e,t){return typeof t==`bigint`?t.toString():t}var Xr=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Zr(e){return new Xr(e)}function Qr(e){return e==null}function $r(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ei(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var ti=Symbol(`evaluating`);function ni(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ti)return r===void 0&&(r=ti,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ri(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ii(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ai(e){return ii(e._zod.def)??e._zod.def.shape}function oi(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ri(this,t,e),e},enumerable:!0,configurable:!0})}function si(e,t,n){t in e?ri(e,t,n):e[t]=n}function ci(e,t,n,r){let i=ai(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?oi(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):si(e,a,r?r(n.value,a):n.value))}}function li(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?oi(e,n,()=>t[n]):si(e,n,r.value))}}function I(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ui(e){return JSON.stringify(e)}function di(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var fi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function pi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mi=Zr(()=>{if(ca.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function hi(e){if(pi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return pi(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function gi(e){return hi(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _i=new Set([`string`,`number`,`symbol`]);function vi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(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 bi(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Si={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ci={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wi(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return ci(i,e,Ti(e,t)),yi(e,I(n,{shape:i,checks:[]}))}function Ti(e,t){let n=ai(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Ei(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ti(e,t)),a={};return ci(a,e,Reflect.ownKeys(ai(e)).filter(e=>!i.has(e))),yi(e,I(n,{shape:a,checks:[]}))}function Di(e,t){if(!hi(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ai(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yi(e,I(e._zod.def,{shape:Oi(e,t)}))}function Oi(e,t){let n={};return ci(n,e,Reflect.ownKeys(ai(e))),li(n,t),n}function ki(e,t){if(!hi(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yi(e,I(e._zod.def,{shape:Oi(e,t)}))}function Ai(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return ci(n,e,Reflect.ownKeys(ai(e))),ci(n,t,Reflect.ownKeys(ai(t))),yi(e,I(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ji(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ti(t,n)):void 0,o={};return ci(o,t,Reflect.ownKeys(ai(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),yi(t,I(t._zod.def,{shape:o,checks:[]}))}function Mi(e,t,n){let r=n?new Set(Ti(t,n)):void 0,i={};return ci(i,t,Reflect.ownKeys(ai(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),yi(t,I(t._zod.def,{shape:i}))}function Ni(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Pi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Fi(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ii(e){return typeof e==`string`?e:e?.message}function Li(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ri(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ii(e.inst?._zod.def?.error?.(e))??Ii(a?.(e))??Ii(t?.error?.(e))??Ii(n.customError?.(e))??Ii(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var zi=/[\uD800-\uDBFF]/;function Bi(e){let t=e.length;if(!zi.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Vi(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Hi(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ui(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Wi(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ji(e,n,r.value)}}function Gi(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ki(e,t,n){return Gi(e,t,n,!1)}function qi(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Gi(this,n,r(this))},set(e){Gi(this,n,e)}})}return t}function Ji(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Gi(this,t,n.bind(this))},set(e){Gi(this,t,e)}})}function Yi(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Xi,Zi=!1,Qi={configurable:!0,get(){Zi=!0}};function R(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Xi!==e._zod){Xi=void 0;return}Xi=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Qi);let e=Zi;Zi=!1;try{let r=n(this);return Zi?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Zi||=e,r}catch(n){throw delete this[t],Zi||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function $i(e,t,n,r){let i=Yi(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ea=`~constantCatch`;function ta(e){let t=()=>e;return t[ea]=!0,t}var na,ra={value:void 0,enumerable:!1},ia=`captureStackTrace`in Error?Error:null;function aa(e){let t=ia;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ia=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function z(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ra.value=new a(r);try{Object.defineProperty(n,"_zod",ra)}finally{ra.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Wi(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?aa(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var oa=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sa=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(na=globalThis).__zod_globalConfig??(na.__zod_globalConfig={});var ca=globalThis.__zod_globalConfig;function la(e){return e&&Object.assign(ca,e),ca}function ua(){let e=this._zod;return e.message??=JSON.stringify(e.def,Yr,2),e.message}function da(e){this._zod.message=e}var fa={get:ua,set:da,enumerable:!0,configurable:!0},pa={value:void 0,enumerable:!1},ma=new WeakSet([Object.prototype,Error.prototype]),ha=(e,t)=>{e.name=`$ZodError`,pa.value=t,Object.defineProperty(e,"issues",pa),pa.value=void 0,Object.defineProperty(e,"message",fa);let n=Object.getPrototypeOf(e);ma.has(n)||(ma.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},ga=z(`$ZodError`,ha);z(`$ZodError`,ha,void 0,{Parent:Error});function _a(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function va(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?_a(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ya(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ba(e,t){return{callee:t?.callee??e,Err:t?.Err}}var xa=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new oa;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ri(e,o,la())));throw fi(n,a?.callee??t),n}return s.value};return t},Sa=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ri(e,o,la())));throw fi(n,a?.callee??t),n}return s.value};return t},Ca=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 oa;return a.issues.length?wa(e,a.issues,i):{success:!0,data:a.value}};function wa(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ri(e,n,la()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Ta=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?wa(e,a.issues,i):{success:!0,data:a.value}},Ea=Symbol.for(`zod.compile.invalid`),Da=Symbol.for(`zod.compile.fallback`),Oa=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ea)return!0;if(r.definite===!0&&n===void 0)return!1}return ka(e,t,n)});function ka(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Da]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new oa;return a.issues.length===0}var Aa=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ja=e=>{let t=xa(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ba(n,a))};return n},Ma=e=>{let t=xa(e),n=(e,r,i,a)=>t(e,r,i,ba(n,a));return n},Na=e=>{let t=Sa(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ba(n,a))};return n},Pa=e=>{let t=Sa(e),n=async(e,r,i,a)=>await t(e,r,i,ba(n,a));return n},Fa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ca(e)(t,n,i)},Ia=e=>(t,n,r)=>Ca(e)(t,n,r),La=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ta(e)(t,n,i)},Ra=e=>async(t,n,r)=>Ta(e)(t,n,r),za=/^[cC][0-9a-z]{6,}$/,Ba=/^[0-9a-z]+$/,Va=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ha=/^[0-9a-vA-V]{20}$/,Ua=/^[A-Za-z0-9]{27}$/,Wa=/^[a-zA-Z0-9_-]{21}$/;function Ga(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ka=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qa=/^([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})$/,Ja=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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ya=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xa=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Za(){return new RegExp(Xa,`u`)}var Qa=/^(?:(?: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])$/,$a=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eo=/^((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])$/,to=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,no=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ro=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,io=/^https?$/,ao=/^\+[1-9]\d{6,14}$/,oo=`(?:(?:\\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])))`;function so(e){return RegExp(`^${e}$`)}var co=so(oo);function lo(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function uo(e){return RegExp(`^${lo(e)}$`)}function fo(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${lo({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${lo({precision:e.precision})}`:n;return RegExp(`^${oo}T(?:${r})$`)}var po=/^[\s\S]{0,}$/,mo=/^-?\d+$/,ho=/^-?\d+(?:\.\d+)?$/,go=/^(?:true|false)$/i,_o=/^null$/i,vo=/^[^A-Z]*$/,yo=/^[^a-z]*$/,B=z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bo=e=>{let t=e.value;return!Qr(t)&&t.length!==void 0},xo={number:`number`,bigint:`bigint`,object:`date`},So=z(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=xo[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:xo[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Co=z(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=xo[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:xo[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wo=z(`$ZodCheckMultipleOf`,(e,t)=>{B.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ei(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})}}),To=z(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Si[t.format];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`,continue:!1,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,inclusive:!0,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,inclusive:!0,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,inclusive:!0,inst:e,continue:!t.abort})}}),Eo=z(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=bo),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Bi(r):i)<=t.maximum)return;let a=Vi(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Do=z(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=bo),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Bi(r):i)>=t.minimum)return;let a=Vi(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Oo=z(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=bo),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Bi(r):i;if(a===t.length)return;let o=Vi(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ko=z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),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=()=>{})}),Ao=z(`$ZodCheckRegex`,(e,t)=>{ko.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})}}),jo=z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=vo,ko.init(e,t)}),Mo=z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=yo,ko.init(e,t)}),No=z(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=vi(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Po=z(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${vi(t.prefix)}.*`);t.pattern??=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})}}),Fo=z(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${vi(t.suffix)}$`);t.pattern??=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})}}),Io=z(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Lo=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
74
+ `:``,s=t===i.length-1?r:void 0;return(0,M.jsxs)(j.Fragment,{children:[(0,M.jsxs)(`span`,{className:o(`inline-block min-w-full min-h-[1lh] align-top`,rr(e.kind)),children:[(0,M.jsx)(nr,{text:a?e.text.slice(0,-a.length):e.text,query:n}),a?void 0:s]}),a||void 0,a?s:void 0]},t)}),i.length===0?r:void 0]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(nr,{text:e,query:n}),r]})}function ar({blocks:e,query:t,trailing:n}){return(0,M.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,M.jsx)(or,{blocks:e,query:t,trailing:n})})}function or({blocks:e,query:t,trailing:n}){return(0,M.jsx)(M.Fragment,{children:e.map((r,i)=>(0,M.jsx)(cr,{block:r,query:t,trailing:i===e.length-1?n:void 0},i))})}var sr={1:`text-lg`,2:`text-base`};function cr({block:e,query:t,trailing:n}){switch(e.kind){case`paragraph`:return(0,M.jsxs)(`p`,{className:`m-0 [overflow-wrap:anywhere]`,children:[(0,M.jsx)(fr,{inlines:e.inlines,query:t}),n]});case`heading`:{let r=`h${e.level}`;return(0,M.jsxs)(r,{className:o(sr[e.level]??`text-sm`,`m-0 pt-1 font-heading font-semibold tracking-tight [overflow-wrap:anywhere]`),children:[(0,M.jsx)(fr,{inlines:e.inlines,query:t}),n]})}case`code`:return(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-lg border bg-muted`,children:[e.lang===void 0?null:(0,M.jsx)(`div`,{className:`border-b px-3 py-1 font-mono text-xs text-muted-foreground`,children:e.lang}),(0,M.jsx)(`pre`,{className:`overflow-x-auto p-3`,children:(0,M.jsx)(`code`,{className:`font-mono text-sm`,children:(0,M.jsx)(ir,{text:e.text,lang:e.lang,query:t,trailing:n})})})]});case`list`:{let r=e.ordered?`ol`:`ul`;return(0,M.jsx)(r,{className:o(`m-0 space-y-1 pl-5 marker:text-muted-foreground`,e.ordered?`list-decimal`:`list-disc`),...e.start===void 0?{}:{start:e.start},children:e.items.map((r,i)=>(0,M.jsx)(`li`,{className:`space-y-2 [overflow-wrap:anywhere]`,children:(0,M.jsx)(or,{blocks:r,query:t,trailing:i===e.items.length-1?n:void 0})},i))})}case`quote`:return(0,M.jsx)(`blockquote`,{className:`space-y-2 border-l-2 border-border pl-3 text-muted-foreground`,children:(0,M.jsx)(or,{blocks:e.blocks,query:t,trailing:n})});case`table`:return(0,M.jsx)(dr,{block:e,query:t,trailing:n});case`rule`:return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`hr`,{className:`border-border`}),n]})}}var lr={left:`text-left`,center:`text-center`,right:`text-right`},ur=e=>e===void 0?`text-left`:lr[e]??`text-left`;function dr({block:e,query:t,trailing:n}){return(0,M.jsxs)(`div`,{className:`overflow-x-auto`,children:[(0,M.jsxs)(`table`,{className:`border-collapse text-sm tabular-nums`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsx)(`tr`,{children:e.header.map((n,r)=>(0,M.jsx)(`th`,{className:o(`border-b px-2 py-1 font-semibold`,ur(e.align[r])),children:(0,M.jsx)(fr,{inlines:n,query:t})},r))})}),(0,M.jsx)(`tbody`,{children:e.rows.map((n,r)=>(0,M.jsx)(`tr`,{children:n.map((n,r)=>(0,M.jsx)(`td`,{className:o(`border-b border-border/50 px-2 py-1`,ur(e.align[r])),children:(0,M.jsx)(fr,{inlines:n,query:t})},r))},r))})]}),n]})}function fr({inlines:e,query:t}){return(0,M.jsx)(M.Fragment,{children:e.map((e,n)=>(0,M.jsx)(pr,{inline:e,query:t},n))})}function pr({inline:e,query:t}){switch(e.kind){case`text`:return(0,M.jsx)(nr,{text:e.text,query:t});case`strong`:return(0,M.jsx)(`strong`,{className:`font-semibold`,children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`em`:return(0,M.jsx)(`em`,{children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`del`:return(0,M.jsx)(`del`,{className:`text-muted-foreground`,children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`code`:return(0,M.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em] [overflow-wrap:anywhere]`,children:(0,M.jsx)(nr,{text:e.text,query:t})});case`link`:return(0,M.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`underline decoration-muted-foreground underline-offset-2 hover:decoration-foreground`,children:(0,M.jsx)(fr,{inlines:e.inlines,query:t})});case`image`:return(0,M.jsx)(mr,{src:e.src,alt:e.alt},e.src);case`break`:return(0,M.jsx)(`br`,{})}}function mr({src:e,alt:t}){let[n,r]=(0,j.useState)(!1);return n?(0,M.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Image unavailable`,t?`: ${t}`:``,`. Open the pull request on GitHub to view it.`]}):(0,M.jsx)(`img`,{src:e,alt:t,loading:`lazy`,decoding:`async`,referrerPolicy:`no-referrer`,onError:()=>r(!0),className:`my-2 max-h-[36rem] max-w-full rounded border object-contain`})}var hr=(0,j.createContext)(void 0),gr=hr.Provider;function _r(){return(0,j.useContext)(hr)}function vr(e=3e4){let[t,n]=(0,j.useState)(()=>Date.now());return(0,j.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function yr({input:e,query:t}){let n=Yn(e);return n?(0,M.jsxs)(`div`,{className:`overflow-hidden rounded-md border bg-muted`,children:[n.path===void 0?null:(0,M.jsx)(br,{path:n.path}),(0,M.jsxs)(`div`,{className:`overflow-x-auto`,children:[n.removed.map((e,n)=>(0,M.jsx)(xr,{sign:`-`,line:e,query:t,kind:`removed`},`-${n}`)),n.added.map((e,n)=>(0,M.jsx)(xr,{sign:`+`,line:e,query:t,kind:`added`},`+${n}`))]})]}):null}function br({path:e}){let t=e.lastIndexOf(`/`);return(0,M.jsxs)(`p`,{className:`m-0 truncate border-b px-2 py-1 font-mono text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground/70`,children:t<0?``:`${e.slice(0,t)}/`}),(0,M.jsx)(`span`,{className:`text-foreground`,children:t<0?e:e.slice(t+1)})]})}function xr({sign:e,line:t,query:n,kind:r}){return(0,M.jsxs)(`div`,{className:o(`grid grid-cols-[1.25rem_minmax(0,1fr)] font-mono text-xs whitespace-pre`,rr(r)),children:[(0,M.jsx)(`span`,{className:`pl-2 select-none`,"aria-hidden":!0,children:e}),(0,M.jsx)(`span`,{children:(0,M.jsx)(nr,{text:t,query:n})})]})}function Sr({entry:e,query:t}){let n=Yn(e.input)!==void 0;return(0,M.jsxs)(M.Fragment,{children:[n?null:(0,M.jsx)(wr,{label:`input`,value:e.input,query:t}),(0,M.jsx)(wr,{label:`update`,value:e.update,query:t}),(0,M.jsx)(wr,{label:`result`,value:e.result,query:t})]})}var Cr=2e4;function wr({label:e,value:t,query:n}){if(t==null||t===``)return null;let r=typeof t==`string`?t:Er(t);if(r===``)return null;let i=e!==`input`&&r.length<=Cr?Tr(t):void 0;return(0,M.jsxs)(`div`,{className:`mt-1.5 first:mt-0`,children:[(0,M.jsx)(`p`,{className:`m-0 mb-1 text-xs text-muted-foreground`,children:e}),i?i.map(e=>(0,M.jsx)(wr,{label:e.label,value:e.text,query:n},e.label)):(0,M.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md border bg-muted p-2 font-mono text-xs whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]`,children:r.length>Cr?r:(0,M.jsx)(ir,{text:r,query:n})})]})}function Tr(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.content;if(!Array.isArray(n))return;let r=e=>{if(!e||typeof e!=`object`)return;let t=e;return t.type===`text`&&typeof t.text==`string`&&Xn(t.text)?t.text:void 0};if(!n.some(e=>r(e)!==void 0))return;let i=n.flatMap((e,t)=>{let n=r(e),i=`content ${t+1}`;if(n===void 0)return[{label:i,text:Er(e)}];let{type:a,text:o,...s}=e,c=[{label:`${i} (text)`,text:n}];return Object.keys(s).length>0&&c.push({label:`${i} metadata`,text:Er(s)}),c}),{content:a,...o}=t;return Object.keys(o).length>0&&i.push({label:`metadata`,text:Er(o)}),i}function Er(e){try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}var Dr=(0,j.memo)(function({entry:e,query:t,sessionId:n}){switch(e.kind){case`user`:return(0,M.jsx)(Or,{entry:e,query:t,sessionId:n});case`assistant`:return(0,M.jsx)(Ar,{entry:e,query:t});case`thinking`:return(0,M.jsx)(Mr,{entry:e,query:t});case`tool`:return(0,M.jsx)(Nr,{entry:e,query:t});case`subagent`:return(0,M.jsx)(Fr,{entry:e,query:t});case`background_call`:return(0,M.jsx)(Lr,{entry:e});case`enquiry`:return(0,M.jsx)(Pr,{entry:e,query:t});case`notice`:return(0,M.jsx)(Hr,{entry:e,query:t});case`marker`:return(0,M.jsx)(Wr,{entry:e});default:return null}});function Or({entry:e,query:t,sessionId:n}){let r=(0,j.useMemo)(()=>Mn(e.text),[e.text]);return(0,M.jsx)(`div`,{className:`flex justify-end py-3`,children:(0,M.jsxs)(`div`,{className:`min-w-0 max-w-[90%] rounded-2xl rounded-br-sm bg-muted px-4 py-3 sm:max-w-[80%]`,children:[e.attachments?.length?(0,M.jsx)(kr,{ids:e.attachments,sessionId:n}):null,(0,M.jsx)(ar,{blocks:r,query:t})]})})}function kr({ids:e,sessionId:t}){return(0,M.jsx)(`div`,{className:`mb-2 flex flex-wrap gap-2`,children:e.map(e=>(0,M.jsx)(`img`,{src:`/api/sessions/${encodeURIComponent(t)}/attachments/${encodeURIComponent(e)}`,alt:``,className:`max-h-64 max-w-full rounded-md border border-border`},e))})}function Ar({entry:e,query:t}){let n=(0,j.useMemo)(()=>Mn(e.text),[e.text]);return(0,M.jsx)(Gr,{children:(0,M.jsx)(ar,{blocks:n,query:t,trailing:e.final?void 0:(0,M.jsx)(jr,{})})})}function jr(){return(0,M.jsx)(`span`,{className:`animate-caret-blink ml-px inline-block w-[1ch] text-primary`,"aria-hidden":!0,children:`▍`})}function Mr({entry:e,query:t}){let[n,r]=(0,j.useState)(!1),i=(0,j.useMemo)(()=>Mn(e.text),[e.text]),a=e.final&&!n;return(0,M.jsx)(Gr,{gutter:`·`,gutterClassName:`text-muted-foreground`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:o(`text-muted-foreground italic`,a&&`max-h-[4.5rem] overflow-hidden`),children:(0,M.jsx)(ar,{blocks:i,query:t,trailing:e.final?void 0:(0,M.jsx)(jr,{})})}),e.final?(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(!n),className:`mt-0.5 text-xs text-muted-foreground hover:text-foreground`,children:n?`less`:`more`}):null]})})}function Nr({entry:e,query:t}){let[n,r]=(0,j.useState)(void 0),i=n??e.status===`error`,a=Ae(e.input),s=qe(e.authorisation);return(0,M.jsx)(`div`,{className:`py-0.5`,children:(0,M.jsxs)(`details`,{open:i,onToggle:e=>r(e.currentTarget.open),className:`rounded-lg border text-foreground`,children:[(0,M.jsxs)(`summary`,{className:`flex cursor-default items-center gap-2 px-3 py-2 select-none`,children:[(0,M.jsx)(Br,{status:e.status}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm text-foreground [overflow-wrap:anywhere]`,children:e.name}),a===void 0?null:(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:a}),s?(0,M.jsx)(`span`,{className:o(`ml-auto shrink-0 text-xs`,e.authorisation===`denied`?`text-destructive`:e.authorisation===`asked`?`text-status-awaiting`:`text-muted-foreground`),children:s}):e.status===`running`?(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:`running…`}):null]}),(0,M.jsxs)(`div`,{className:`border-t p-3`,children:[(0,M.jsx)(yr,{input:e.input,query:t}),(0,M.jsx)(Sr,{entry:e,query:t})]})]})})}function Pr({entry:e,query:t}){return(0,M.jsx)(`div`,{className:`py-0.5`,children:(0,M.jsxs)(`div`,{className:`w-full rounded-lg border px-3 py-2 text-foreground [overflow-wrap:anywhere]`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Br,{status:e.status===`asked`?`running`:e.status===`answered`?`complete`:`error`}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`?`}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm`,children:e.questions.length===1?`Asked a question`:`Asked ${e.questions.length} questions`}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:e.status===`asked`?`waiting…`:e.status})]}),(0,M.jsx)(`dl`,{className:`mt-1 space-y-1`,children:e.questions.map((n,r)=>{let i=e.answers?.[r]??[];return(0,M.jsxs)(`div`,{className:`text-sm`,children:[(0,M.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:(0,M.jsx)(nr,{text:n.question,query:t})}),(0,M.jsx)(`dd`,{className:o(`font-medium`,i.length===0&&`text-muted-foreground italic`),children:i.length===0?e.status===`asked`?`unanswered`:`no answer`:(0,M.jsx)(nr,{text:i.join(`, `),query:t})})]},n.question)})})]})})}function Fr({entry:e,query:t}){let n=e.waitingOn?`waiting on ${e.waitingOn}`:e.status,r=e.status===`running`||e.status===`waiting`,i=_r(),a=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Br,{status:e.status===`waiting`?`running`:Ir(e.status)}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`⤷`}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm text-foreground [overflow-wrap:anywhere] max-sm:col-start-3 max-sm:row-start-1 max-sm:truncate`,children:e.name}),e.description===void 0?null:(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground max-sm:col-start-3 max-sm:col-end-5 max-sm:row-start-2`,children:(0,M.jsx)(nr,{text:e.description,query:t})}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground max-sm:col-start-4 max-sm:row-start-1`,children:r?`${n}…`:n})]}),s=`flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-foreground max-sm:grid max-sm:grid-cols-[8px_12px_minmax(0,1fr)_auto] max-sm:gap-y-1`;return(0,M.jsx)(`div`,{className:`py-0.5`,children:i===void 0?(0,M.jsx)(`div`,{className:s,children:a}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(pe(e)),className:o(s,`cursor-gloss text-left hover:bg-accent`),children:a})})}function Ir(e){return e===`error`?`error`:e===`running`?`running`:`complete`}function Lr({entry:e}){let t=Ve(e,vr());return(0,M.jsx)(`div`,{className:`py-0.5`,children:(0,M.jsxs)(`div`,{className:`flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-foreground`,children:[(0,M.jsx)(Br,{status:Rr(e.status)}),(0,M.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`⟳`}),(0,M.jsx)(`span`,{className:`min-w-0 font-mono text-sm text-foreground [overflow-wrap:anywhere]`,children:e.tool}),(0,M.jsxs)(`span`,{className:`ml-auto shrink-0 text-xs text-muted-foreground`,children:[t.label,` `,t.at]})]})})}function Rr(e){return e===`error`?`error`:e===`running`?`running`:`complete`}var zr={running:`text-foreground`,complete:`text-muted-foreground`,error:`text-destructive`};function Br({status:e}){return(0,M.jsx)(`span`,{"aria-hidden":!0,className:o(`inline-block size-1.5 shrink-0 rounded-full`,zr[e],e===`complete`?`border-[1.5px] border-current`:`bg-current`)})}var Vr={info:`text-muted-foreground`,warn:`text-foreground`,error:`text-destructive`};function Hr({entry:e,query:t}){let n=Vr[e.level];return(0,M.jsx)(Gr,{gutter:`!`,gutterClassName:n,children:(0,M.jsx)(`p`,{className:o(`m-0 font-mono text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,n),children:(0,M.jsx)(nr,{text:e.text,query:t})})})}var Ur={revived:`text-primary`,settled:`text-muted-foreground`,dormant:`text-muted-foreground`,compacted:`text-muted-foreground`};function Wr({entry:e}){let t=Ur[e.marker];return(0,M.jsxs)(`div`,{className:o(`flex items-center gap-2 py-2`,t),role:`separator`,"aria-label":e.text,children:[(0,M.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`text-xs`,children:e.text}),(0,M.jsx)(`span`,{className:`h-px flex-1 bg-current opacity-50`,"aria-hidden":!0})]})}function Gr({gutter:e,gutterClassName:t,children:n}){return(0,M.jsxs)(`div`,{className:o(`py-1`,e&&`grid grid-cols-[2ch_minmax(0,1fr)] gap-0`),children:[e?(0,M.jsx)(`span`,{"aria-hidden":!0,className:o(`font-mono text-sm select-none`,t),children:e}):null,n]})}function Kr(e,t=40){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function qr(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 Jr(e,t=`|`){return e.map(e=>bi(e)).join(t)}function Yr(e,t){return typeof t==`bigint`?t.toString():t}var Xr=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Zr(e){return new Xr(e)}function Qr(e){return e==null}function $r(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ei(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var ti=Symbol(`evaluating`);function ni(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ti)return r===void 0&&(r=ti,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ri(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ii(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ai(e){return ii(e._zod.def)??e._zod.def.shape}function oi(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ri(this,t,e),e},enumerable:!0,configurable:!0})}function si(e,t,n){t in e?ri(e,t,n):e[t]=n}function ci(e,t,n,r){let i=ai(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?oi(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):si(e,a,r?r(n.value,a):n.value))}}function li(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?oi(e,n,()=>t[n]):si(e,n,r.value))}}function I(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ui(e){return JSON.stringify(e)}function di(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var fi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function pi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mi=Zr(()=>{if(ca.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function hi(e){if(pi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return pi(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function gi(e){return hi(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _i=new Set([`string`,`number`,`symbol`]);function vi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(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 bi(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function xi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Si={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ci={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function wi(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return ci(i,e,Ti(e,t)),yi(e,I(n,{shape:i,checks:[]}))}function Ti(e,t){let n=ai(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Ei(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ti(e,t)),a={};return ci(a,e,Reflect.ownKeys(ai(e)).filter(e=>!i.has(e))),yi(e,I(n,{shape:a,checks:[]}))}function Di(e,t){if(!hi(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ai(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yi(e,I(e._zod.def,{shape:Oi(e,t)}))}function Oi(e,t){let n={};return ci(n,e,Reflect.ownKeys(ai(e))),li(n,t),n}function ki(e,t){if(!hi(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yi(e,I(e._zod.def,{shape:Oi(e,t)}))}function Ai(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return ci(n,e,Reflect.ownKeys(ai(e))),ci(n,t,Reflect.ownKeys(ai(t))),yi(e,I(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ji(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ti(t,n)):void 0,o={};return ci(o,t,Reflect.ownKeys(ai(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),yi(t,I(t._zod.def,{shape:o,checks:[]}))}function Mi(e,t,n){let r=n?new Set(Ti(t,n)):void 0,i={};return ci(i,t,Reflect.ownKeys(ai(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),yi(t,I(t._zod.def,{shape:i}))}function Ni(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Pi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Fi(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ii(e){return typeof e==`string`?e:e?.message}function Li(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Ri(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ii(e.inst?._zod.def?.error?.(e))??Ii(a?.(e))??Ii(t?.error?.(e))??Ii(n.customError?.(e))??Ii(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var zi=/[\uD800-\uDBFF]/;function Bi(e){let t=e.length;if(!zi.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Vi(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Hi(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ui(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Wi(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ji(e,n,r.value)}}function Gi(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Ki(e,t,n){return Gi(e,t,n,!1)}function qi(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Gi(this,n,r(this))},set(e){Gi(this,n,e)}})}return t}function Ji(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Gi(this,t,n.bind(this))},set(e){Gi(this,t,e)}})}function Yi(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Xi,Zi=!1,Qi={configurable:!0,get(){Zi=!0}};function R(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Xi!==e._zod){Xi=void 0;return}Xi=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Qi);let e=Zi;Zi=!1;try{let r=n(this);return Zi?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Zi||=e,r}catch(n){throw delete this[t],Zi||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function $i(e,t,n,r){let i=Yi(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ea=`~constantCatch`;function ta(e){let t=()=>e;return t[ea]=!0,t}var na,ra={value:void 0,enumerable:!1},ia=`captureStackTrace`in Error?Error:null;function aa(e){let t=ia;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ia=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function z(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ra.value=new a(r);try{Object.defineProperty(n,"_zod",ra)}finally{ra.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Wi(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?aa(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var oa=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},sa=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(na=globalThis).__zod_globalConfig??(na.__zod_globalConfig={});var ca=globalThis.__zod_globalConfig;function la(e){return e&&Object.assign(ca,e),ca}function ua(){let e=this._zod;return e.message??=JSON.stringify(e.def,Yr,2),e.message}function da(e){this._zod.message=e}var fa={get:ua,set:da,enumerable:!0,configurable:!0},pa={value:void 0,enumerable:!1},ma=new WeakSet([Object.prototype,Error.prototype]),ha=(e,t)=>{e.name=`$ZodError`,pa.value=t,Object.defineProperty(e,"issues",pa),pa.value=void 0,Object.defineProperty(e,"message",fa);let n=Object.getPrototypeOf(e);ma.has(n)||(ma.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},ga=z(`$ZodError`,ha);z(`$ZodError`,ha,void 0,{Parent:Error});function _a(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function va(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?_a(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ya(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ba(e,t){return{callee:t?.callee??e,Err:t?.Err}}var xa=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new oa;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ri(e,o,la())));throw fi(n,a?.callee??t),n}return s.value};return t},Sa=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Ri(e,o,la())));throw fi(n,a?.callee??t),n}return s.value};return t},Ca=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 oa;return a.issues.length?wa(e,a.issues,i):{success:!0,data:a.value}};function wa(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Ri(e,n,la()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Ta=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?wa(e,a.issues,i):{success:!0,data:a.value}},Ea=Symbol.for(`zod.compile.invalid`),Da=Symbol.for(`zod.compile.fallback`),Oa=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ea)return!0;if(r.definite===!0&&n===void 0)return!1}return ka(e,t,n)});function ka(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Da]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new oa;return a.issues.length===0}var Aa=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},ja=e=>{let t=xa(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ba(n,a))};return n},Ma=e=>{let t=xa(e),n=(e,r,i,a)=>t(e,r,i,ba(n,a));return n},Na=e=>{let t=Sa(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ba(n,a))};return n},Pa=e=>{let t=Sa(e),n=async(e,r,i,a)=>await t(e,r,i,ba(n,a));return n},Fa=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ca(e)(t,n,i)},Ia=e=>(t,n,r)=>Ca(e)(t,n,r),La=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ta(e)(t,n,i)},Ra=e=>async(t,n,r)=>Ta(e)(t,n,r),za=/^[cC][0-9a-z]{6,}$/,Ba=/^[0-9a-z]+$/,Va=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ha=/^[0-9a-vA-V]{20}$/,Ua=/^[A-Za-z0-9]{27}$/,Wa=/^[a-zA-Z0-9_-]{21}$/;function Ga(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ka=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qa=/^([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})$/,Ja=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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ya=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xa=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Za(){return new RegExp(Xa,`u`)}var Qa=/^(?:(?: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])$/,$a=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,eo=/^((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])$/,to=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,no=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ro=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,io=/^https?$/,ao=/^\+[1-9]\d{6,14}$/,oo=`(?:(?:\\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])))`;function so(e){return RegExp(`^${e}$`)}var co=so(oo);function lo(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function uo(e){return RegExp(`^${lo(e)}$`)}function fo(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${lo({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${lo({precision:e.precision})}`:n;return RegExp(`^${oo}T(?:${r})$`)}var po=/^[\s\S]{0,}$/,mo=/^-?\d+$/,ho=/^-?\d+(?:\.\d+)?$/,go=/^(?:true|false)$/i,_o=/^null$/i,vo=/^[^A-Z]*$/,yo=/^[^a-z]*$/,B=z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bo=e=>{let t=e.value;return!Qr(t)&&t.length!==void 0},xo={number:`number`,bigint:`bigint`,object:`date`},So=z(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=xo[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:xo[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Co=z(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=xo[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:xo[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wo=z(`$ZodCheckMultipleOf`,(e,t)=>{B.init(e,t),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`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):ei(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})}}),To=z(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Si[t.format];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`,continue:!1,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,inclusive:!0,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,inclusive:!0,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,inclusive:!0,inst:e,continue:!t.abort})}}),Eo=z(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=bo),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Bi(r):i)<=t.maximum)return;let a=Vi(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Do=z(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=bo),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Bi(r):i)>=t.minimum)return;let a=Vi(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Oo=z(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=bo),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Bi(r):i;if(a===t.length)return;let o=Vi(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ko=z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),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=()=>{})}),Ao=z(`$ZodCheckRegex`,(e,t)=>{ko.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})}}),jo=z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=vo,ko.init(e,t)}),Mo=z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=yo,ko.init(e,t)}),No=z(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=vi(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),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})}}),Po=z(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${vi(t.prefix)}.*`);t.pattern??=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})}}),Fo=z(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${vi(t.suffix)}$`);t.pattern??=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})}}),Io=z(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Lo=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
75
75
  `).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?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
76
76
  `)}\n};`)(...Object.values(this.closed))}},Ro={major:4,minor:6,patch:5},V=z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ro;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Ni(t),a;for(let o of n){if(o._zod.def.when){if(Pi(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new oa;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Li(t.issues,n,e),i||=Ni(t,n))});else{if(t.issues.length===n)continue;Li(t.issues,n,e),i||=Ni(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ni(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new oa;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new oa;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Ki(this,`~standard`,Vo(this))},set"~standard"(e){Gi(this,`~standard`,e)}}),zo=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Ri(e,t,la()))}:{value:e.value};async function Bo(e,t){let n={async:!0};return zo(await e._zod.run({value:t,issues:[]},n),n)}function Vo(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return zo(r,n)}catch{}return Bo(e,t)},vendor:`zod`,version:1}}var Ho=z(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=t.pattern??po,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),H=z(`$ZodStringFormat`,(e,t)=>{ko.init(e,t),Ho.init(e,t)}),Uo=z(`$ZodGUID`,(e,t)=>{t.pattern??=qa,H.init(e,t)}),Wo=z(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ja(e)}else t.pattern??=Ja();H.init(e,t)}),Go=z(`$ZodEmail`,(e,t)=>{t.pattern??=Ya,H.init(e,t)});function Ko(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function qo(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ko(e)||2:Jo(e,t)}function Jo(e,t){if(!t.normalize&&t.protocol?.source===io.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Yo=/[\t\n\r]/g;function Xo(e){return e.replace(Yo,``)}function Zo(e,t){return t.lastIndex=0,t.test(e.hostname)}function Qo(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var $o=z(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=qo(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Xo(r);return}t.hostname&&!Zo(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Qo(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Xo(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),es=z(`$ZodEmoji`,(e,t)=>{t.pattern??=Za(),H.init(e,t)}),ts=z(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Wa:Ga(t.length),H.init(e,t)}),ns=z(`$ZodCUID`,(e,t)=>{t.pattern??=za,H.init(e,t)}),rs=z(`$ZodCUID2`,(e,t)=>{t.pattern??=Ba,H.init(e,t)}),is=z(`$ZodULID`,(e,t)=>{t.pattern??=Va,H.init(e,t)}),as=z(`$ZodXID`,(e,t)=>{t.pattern??=Ha,H.init(e,t)}),os=z(`$ZodKSUID`,(e,t)=>{t.pattern??=Ua,H.init(e,t)}),ss=z(`$ZodISODateTime`,(e,t)=>{t.pattern??=fo(t),H.init(e,t)}),cs=z(`$ZodISODate`,(e,t)=>{t.pattern??=co,H.init(e,t)}),ls=z(`$ZodISOTime`,(e,t)=>{t.pattern??=uo(t),H.init(e,t)}),us=z(`$ZodISODuration`,(e,t)=>{t.pattern??=Ka,H.init(e,t)}),ds=z(`$ZodIPv4`,(e,t)=>{t.pattern??=Qa,H.init(e,t)}),fs=/^[0-9a-fA-F:.]+$/;function ps(e){return fs.test(e)?Ko(`http://[${e}]`):!1}var ms=z(`$ZodIPv6`,(e,t)=>{t.pattern??=$a,H.init(e,t),e._zod.check=n=>{ps(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),hs=z(`$ZodCIDRv4`,(e,t)=>{t.pattern??=eo,H.init(e,t)});function gs(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ps(n)}var _s=z(`$ZodCIDRv6`,(e,t)=>{t.pattern??=to,H.init(e,t),e._zod.check=n=>{gs(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function vs(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ys=/^[0-9a-zA-Z+/]*={0,2}$/,bs=z(`$ZodBase64`,(e,t)=>{t.pattern??=ys,H.init(e,t),e._zod.check=n=>{vs(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),xs=/^[A-Za-z0-9_-]*$/;function Ss(e){if(!xs.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return vs(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Cs=z(`$ZodBase64URL`,(e,t)=>{t.pattern??=xs,H.init(e,t),e._zod.check=n=>{Ss(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ws=z(`$ZodE164`,(e,t)=>{t.pattern??=ao,H.init(e,t)});function Ts(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Es=z(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{Ts(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ds=z(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=ho,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Os=z(`$ZodNumberFormat`,(e,t)=>{To.init(e,t),Ds.init(e,t)}),ks=z(`$ZodBoolean`,(e,t)=>{V.init(e,t),e._zod.pattern=go,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),As=z(`$ZodNull`,(e,t)=>{V.init(e,t),e._zod.pattern=_o,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),js=z(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),Ms=z(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ns(e,t,n){e.issues.length&&t.issues.push(...Fi(n,e.issues)),t.value[n]=e.value}var Ps=z(`$ZodArray`,(e,t)=>{V.init(e,t);let n=ca.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Ns(t,r,e)));else if(Ns(c,r,e),s&&c.issues.length!==0&&Ni(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Fs(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Fi(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Is=[];function Ls(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Is,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=xi(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Rs(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Ni(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Fs(e,n,i,t,d,f))):Fs(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var zs=z(`$ZodObject`,(e,t)=>{V.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Zr(()=>Ls(t));R(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||ri(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=pi,o=t.catchall,s,c=ca.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Ni(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Fs(n,t,e,r,a,o))):Fs(s,t,e,r,a,o)}return o?Rs(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Bs=z(`$ZodObjectJIT`,(e,t)=>{zs.init(e,t);let n=e._zod.parse,r=Zr(()=>Ls(t)),i=ca.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Lo([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
77
77
  let ${e}_ab = false;