import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";function r(e){return async(t,n,r)=>{let o=e.parseArgs(r??``);if(i(o))return t(`Invalid args: ${o.reason}`,{display:`system`}),e.errorView(o.reason);try{let r=await e.dispatch(o,t,n);return r===null?null:a.createElement(e.View,r)}catch(n){let r=n instanceof Error?n.message:String(n);return e.onDispatchError?.(n),t(`${e.commandName} failed: ${r}`,{display:`system`}),e.errorView(r)}}}function i(e){return typeof e==`object`&&!!e&&`action`in e&&e.action===`invalid`}var a,o=e((()=>{a=t(n(),1)}));export{r as n,o as t};