'use strict';function f(r){return !!(r&&typeof r=="string")}function u(...r){for(var e in r){let t=r[e];if(typeof t=="string"&&f(t))return t}return ""}function g(r){return typeof r=="number"&&!isNaN(r)}function p(r){return u(r).replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f")}function i(r,e){var t=Object.prototype.toString.call(r);return t==="[object "+e+"]"}function a(r,e){if(["boolean","undefined"].includes(typeof r)||r===null)return String(r);if(g(r))return r.formatNumber();if(r instanceof Date)return r.toFormat();if(r instanceof Error)return r==null?void 0:r.toString();e=Object.assign({},e);let{parenthesis:t}=e,c=t?"(":"",s=t?")":"";return typeof r=="string"?(e==null?void 0:e.escapeString)!==false?"'"+p(r)+"'":r:i(r,"RegExp")||i(r,"Number")||i(r,"Boolean")?r.toString():i(r,"Date")?"new Date("+r.getTime()+")":Array.isArray(r)?"["+r.map(n=>a(n,e)).join(",")+"]":typeof r=="object"?c+"{"+Object.keys(r).map(n=>{var l=r[n];return a(n,e)+":"+a(l,e)}).join(",")+"}"+s:r&&typeof(r==null?void 0:r.toString)=="function"?r==null?void 0:r.toString():String(r)}exports.stringify=a;