import r from"../../_virtual/_node_util.mjs";import{__require as e}from"../is-arrayish/index.mjs";var t,n;function i(){if(n)return t;n=1;var i=r,s=e(),o=function(r,e){r&&r.constructor===String||(e=r||{},r=Error.name);var t=function n(i){if(!this)return new n(i);i=i instanceof Error?i.message:i||this.message,Error.call(this,i),Error.captureStackTrace(this,t),this.name=r,Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,get:function(){var r=i.split(/\r?\n/g);for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];"message"in n&&(r=n.message(this[t],r)||r,s(r)||(r=[r]))}return r.join("\n")},set:function(r){i=r}});var o=null,a=Object.getOwnPropertyDescriptor(this,"stack"),c=a.get,u=a.value;delete a.value,delete a.writable,a.set=function(r){o=r},a.get=function(){var r=(o||(c?c.call(this):u)).split(/\r?\n+/g);o||(r[0]=this.name+": "+this.message);var t=1;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];if("line"in i){var s=i.line(this[n]);s&&r.splice(t++,0,"    "+s)}"stack"in i&&i.stack(this[n],r)}return r.join("\n")},Object.defineProperty(this,"stack",a)};return Object.setPrototypeOf?(Object.setPrototypeOf(t.prototype,Error.prototype),Object.setPrototypeOf(t,Error)):i.inherits(t,Error),t};return o.append=function(r,e){return{message:function(t,n){return(t=t||e)&&(n[0]+=" "+r.replace("%s",t.toString())),n}}},o.line=function(r,e){return{line:function(t){return(t=t||e)?r.replace("%s",t.toString()):null}}},t=o}export{i as __require};