function n(){const n=[],t={run:function(...t){let e=-1;const o=t.pop();if("function"!=typeof o)throw new TypeError("Expected function as last argument, not "+o);!function r(u,...c){const f=n[++e];let i=-1;if(u)o(u);else{for(;++i<t.length;)null!==c[i]&&void 0!==c[i]||(c[i]=t[i]);t=c,f?function(n,t){let e;return o;function o(...t){const o=n.length>t.length;let f;o&&t.push(r);try{f=n.apply(this,t)}catch(u){if(o&&e)throw u;return r(u)}o||(f&&f.then&&"function"==typeof f.then?f.then(c,r):f instanceof Error?r(f):c(f))}function r(n,...o){e||(e=!0,t(n,...o))}function c(n){r(null,n)}}(f,r)(...c):o(null,...c)}}(null,...t)},use:function(e){if("function"!=typeof e)throw new TypeError("Expected `middelware` to be a function, not "+e);return n.push(e),t}};return t}export{n as t};
