function r(t){if(!t||typeof t!="object"||Array.isArray(t))return t;if(t.runtimeException)return t.cause&&(t.cause=r(t.cause)),t;{const e={message:t.message,stack:t.stack};return t.cause&&(e.cause=r(t.cause)),e}}function c(t){if(!t)return"";let e=r(t),s;if(!e||typeof e!="object"||t.runtimeException)try{s=typeof e=="string"?e:`${JSON.stringify(e,null,"  ")}
`}catch(i){s=`<report-error>${i.message}</report-error>
`}else if(s=`
Error message: ${e.message}
`,e.stack&&(s+=`Error stack: ${e.stack}
`),e.cause)try{let i=typeof e.cause=="string"?e.cause:JSON.stringify(e.cause,null,"  ");s+=`Caused by: ${i}
`}catch(i){s+=`Caused by:
<report-error>${i.message}</report-error>
`}return s.split("\\n").join(`
`).split("\\\\").join("\\")}function u(t,e,s,i){e?it(t,o(()=>e().finally(()=>{var n,a;(a=(n=w3n.testStand).focusThisWindow)==null||a.call(n)})),s):it(t)}function o(t,e){return async()=>{try{await t()}catch(s){if(typeof s=="string")fail(s);else if(s.runtimeException)fail(c(s));else throw s}}}export{u as i};
